text: !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.AFRAME=e()}}(function(){var t;return function r(e,t,n){function i(a,s){if(!t[a]){if(!e[a]){var h="function"==typeof require&&require;if(!s&&h)return h(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=t[a]={exports:{}};e[a][0].call(l.exports,function(t){var r=e[a][1][t];return i(r?r:t)},l,l.exports,r,e,t,n)}return t[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-click","click")},{"../lib/utils":13}],2:[function(e,t){function r(e,t){e.addState(t),n(e,t)}function n(e,t){t in y?y[t].push(e):y[t]=[e]}function i(e,t){if(t in y){var r=y[t].indexOf(e);-1!==r&&y[t].splice(r,1)}}function o(e,t){e.removeState(t),i(e,t)}function a(e,t){if(!(t in y))return!1;var r=y[t].indexOf(e);return-1!==r}function s(e,t){t in b?b[t].push(e):b[t]=[e]}function h(e,t){if(!(t in b))return!1;var r=b[t].indexOf(e);return-1!==r}function c(e,t,r,n){h(e,t)||(s(e,t),e.addEventListener(t,r,n))}function l(e,t,r,n){var i=e,o={sourceEl:t,targetSel:r,attributes:n};i in x?x[i].push(o):x[i]=[o]}function u(e){var t=e;return x[t]}function d(e){function t(e){var t=e.sourceEl;if(t===r){var n=e.attributes,i=e.targetSel,o="string"==typeof i?v.$(i):i;o&&p(o,n)}}var r=f(e.target),n=e.type,i=u(n,r);i&&i.forEach(t)}function p(e,t){v.$$(t).forEach(function(t){if(!(t.name in w))if("state"===t.name){var n=v.splitString(t.value);n.forEach(function(t){r(e,t),y[t].forEach(function(r){r!==e&&o(r,t)})})}else e.setAttribute(t.name,t.value)})}function f(e){return"a-root"===e.tagName.toLowerCase()?e.parentNode:e.previousElementSibling||e.nextElementSibling||!e.closest("a-root")?e:e.closest("a-root").parentNode}var m=e("aframe-core"),v=e("../lib/utils"),g=m.registerElement.registerElement,y={},b={},x={},w={target:!0};window.addEventListener("stateadded",function(e){var t=e.detail,r=t.state,i=e.target;n(i,r),"hovering"===r&&i.emit("mouseenter"),"hovered"===r&&a(i,"selected")&&o(i,"hovered")}),window.addEventListener("stateremoved",function(e){var t=e.detail,r=t.state,n=e.target;i(n,r),"hovering"===r&&n.emit("mouseleave")});var M=g("a-event",{prototype:Object.create(HTMLElement.prototype,{attachedCallback:{value:function(){function e(){t.isAEvent=!0,t.type=t.type||t.getAttribute("type"),t.target=t.target||t.getAttribute("target"),t.sceneEl=v.$("a-scene"),t.attachEventListener()}var t=this,r=t.parentNode;r.isNode?e():r.addEventListener("nodeready",e)},writable:window.debug},detachedCallback:{value:function(){},writable:window.debug},attributeChangedCallback:{value:function(e,t,r){t!==r&&("type"===e?this.type=r:"target"===e&&(this.target=r))},writable:window.debug},attachEventListener:{value:function(){var e,t,r,n=this;return this.sceneEl=this.sceneEl||v.$("a-scene"),"load"===n.type?(e=f(n.parentNode),t=n.target?v.$(n.target):e,r=function(r){r.target===e&&p(t,n.attributes)},e&&e.hasLoaded?void r(e):void this.sceneEl.addEventListener("load",r)):(r=d,c(this.sceneEl,n.type,r),e=f(n.parentNode),t=n.target||e,void l(n.type,e,t,n.attributes))},writable:window.debug}})});t.exports=M},{"../lib/utils":13,"aframe-core":69}],3:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-hover","mouseenter")},{"../lib/utils":13}],4:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-load","load")},{"../lib/utils":13}],5:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-mousedown","mousedown")},{"../lib/utils":13}],6:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-mouseenter","mouseenter")},{"../lib/utils":13}],7:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-mouseleave","mouseleave")},{"../lib/utils":13}],8:[function(e,t){var r=e("../lib/utils");t.exports=r.wrapAEventElement("a-mouseup","mouseup")},{"../lib/utils":13}],9:[function(e,t){t.exports={"a-click":e("./a-click"),"a-event":e("./a-event"),"a-hover":e("./a-hover"),"a-load":e("./a-load"),"a-mousedown":e("./a-mousedown"),"a-mouseenter":e("./a-mouseenter"),"a-mouseleave":e("./a-mouseleave"),"a-mouseup":e("./a-mouseup")}},{"./a-click":1,"./a-event":2,"./a-hover":3,"./a-load":4,"./a-mousedown":5,"./a-mouseenter":6,"./a-mouseleave":7,"./a-mouseup":8}],10:[function(e,t){function r(){HTMLImports&&!HTMLImports.useNative&&Object.keys(HTMLImports.importer.documents).forEach(function(e){var t=HTMLImports.importer.documents[e];n(t)})}function n(e){var t=a.$("a-scene"),r=a.$("a-assets");r||(r=document.createElement("a-assets"),t.parentNode.insertBefore(r,t)),a.$$("a-mixin",e).forEach(function(e){var t=document.importNode(e,!0);r.appendChild(t)}),a.$$('template[is="a-template"]',e).forEach(function(e){var t=document.importNode(e,!0);document.body.appendChild(t)})}window.addEventListener("HTMLImportsLoaded",r),"import"in document.createElement("link")||e("../lib/vendor/HTMLImports");var i=e("aframe-core"),o=e("./lib/register-template"),a=e("./lib/utils"),s=i.registerElement.registerElement;t.exports=s("a-template",{"extends":"template",prototype:Object.create(HTMLTemplateElement.prototype,{createdCallback:{value:function(){var e=this;e.placeholders=[],window.addEventListener("load",function(){function t(){var t=e.ownerDocument===document;t||document.body.appendChild(e)}t()})},writable:window.debug},attachedCallback:{value:function(){this.load(),this.inject()},writable:window.debug},detachedCallback:{value:function(){},writable:window.debug},load:{value:function(){this.hasLoaded||(a.fireEvent(this,"loaded"),this.hasLoaded=!0)},writable:window.debug},register:{value:function(e){return this.registered?void 0:(this.registered=!0,o(e))},writable:window.debug},removeTemplateListener:{value:function(){this.mixinObserver&&(this.mixinObserver.disconnect(),this.mixinObserver=null)},writable:window.debug},attachTemplateListener:{value:function(){var e=this;e.mixinObserver&&e.mixinObserver.disconnect(),e.mixinObserver=new MutationObserver(function(){e.placeholders.forEach(function(e){e.rerender(!0)})}),e.mixinObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})},writable:window.debug},inject:{value:function(){var e=this;if(!e.injected){e.injected=!0;var t=e.getAttribute("element");t&&(e.attachTemplateListener(t),e.register(t))}},writable:window.debug}})})},{"../lib/vendor/HTMLImports":29,"./lib/register-template":12,"./lib/utils":13,"aframe-core":69}],11:[function(e,t){var r={"a-event":e("./a-event"),"a-template":e("./a-template")};e("./templates/index.html"),t.exports=r},{"./a-event":9,"./a-template":10,"./templates/index.html":27}],12:[function(e,t){var r=e("aframe-core"),n=e("./utils"),i=r.registerElement.registerElement,o=r.AEntity,a=r.AComponents,s=n.extend({id:!0,name:!0,"class":!0,target:!0}),h=n.extend({},a);i("a-root",{prototype:Object.create(o.prototype)}),t.exports=function(e){var t=e.toLowerCase();return i(t,{prototype:Object.create(o.prototype,{attachedCallback:{value:function(){this.emit("loaded"),this.emit("nodeready"),this.rerender(!1,!0)}},attributeChangedCallback:{value:function(e,t,r){t!==r&&this.rerender()},writable:window.debug},attributeBlacklist:{value:s,writable:window.debug},componentBlacklist:{value:h,writable:window.debug},detachedCallback:{value:function(){this.sceneEl||(this.sceneEl=n.$("a-scene")),this.sceneEl.remove(this)},writable:window.debug},rerender:{value:function(r,i){var o=this;if(r||this.lastOuterHTML!==this.outerHTML){var a=n.$('template[is="a-template"][element="'+e+'"]');if(a){var s=n.mergeAttrs(a,this);n.forEach(a.attributes,function(e){e.name in o.componentBlacklist&&(i&&n.warn('Cannot use attribute name "%s" for template definition of <%s> because it is a core component',e.name,t),delete s[e.name])}),Object.keys(s).filter(function(e){e in this.attributeBlacklist&&delete s[e];var t=s[e],r=this.components[e];r&&"object"==typeof t&&(s[e]=r.stringify(t))},this),this.root=n.$$(this.children).filter(function(e){return"a-root"===e.tagName.toLowerCase()})[0],this.root||(this.root=document.createElement("a-root"),this.appendChild(this.root));var h=n.format(a.innerHTML,s);h!==this.root.innerHTML&&(this.root.innerHTML=h),this.lastOuterHTML=this.outerHTML}}},writable:window.debug}})})}},{"./utils":13,"aframe-core":69}],13:[function(e,t){var r=e("aframe-core"),n=e("../a-event/a-event"),i=r.utils,o=r.registerElement.registerElement;t.exports.$=function(e,t){var r=e;return e&&"string"==typeof e&&(r=(t||document).querySelector(e)),r},t.exports.$$=function(e,t){if(Array.isArray(e))return e;var r=e;return e&&"string"==typeof e&&(r=(t||document).querySelectorAll(e)),a(r)};var a=t.exports.toArray=function(e){return Array.isArray(e)?e:"object"==typeof e&&"number"==typeof e.length?Array.prototype.slice.call(e):[e]},s=t.exports.forEach=function(e,t){return Array.prototype.forEach.call(e,t)};t.exports.mergeAttrs=function(){var e={};return s(arguments,function(t){s(t.attributes,function(r){e[r.name]=t.getComputedAttribute?t.getComputedAttribute(r.name):t.getAttribute(r.name)})}),e},t.exports.format=function(){var e=[/\$?\{\s*([^}= ]+)(\s*=\s*(.+))?\s*\}/g,/\$?%7B\s*([^}= ]+)(\s*=\s*(.+))?\s*%7D/g];return function(t,r){if(!t)throw new Error("Format string is empty!");if(r)return r instanceof Array||r instanceof Object||(r=Array.prototype.slice.call(arguments,1)),Object.keys(r).forEach(function(e){r[String(e).toLowerCase()]=r[e]}),e.forEach(function(e){t=t.replace(e,function(e,t,n,i){var o=r[t.toLowerCase()];return"undefined"==typeof o?(i||"").trim().replace(/^["']|["']$/g,""):(o||"").trim().replace(/^["']|["']$/g,"")})}),t}}();var h=t.exports.wrapElement=function(e,t,r){return r=r||{},o(e,{prototype:Object.create(t.prototype,r)})};t.exports.wrapAEventElement=function(e,t,r){return r=r||{},r.type={value:t,writable:window.debug},h(e,n,r)},t.exports.error=i.error,t.exports.extend=i.extend,t.exports.fireEvent=i.fireEvent,t.exports.log=i.log,t.exports.splitString=i.splitString,t.exports.warn=i.warn},{"../a-event/a-event":2,"aframe-core":69}],14:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-camera" fov="80" near="0.5" far="10000" look-controls-enabled="true" wasd-controls-enabled="true" cursor-visible="true" cursor-offset="1" cursor-color="#FFF" cursor-maxdistance="1000" cursor-scale="1" cursor-opacity="1">\n  <a-entity camera="fov: ${fov}; near: ${near}; far: ${far}" look-controls="enabled: ${look-controls-enabled}" wasd-controls="enabled: ${wasd-controls-enabled}">\n    <a-entity visible="${cursor-visible}" position="0 0 -${cursor-offset}" geometry="primitive: ring; radiusOuter: 0.016; radiusInner: 0.01" material="color: ${cursor-color}; shader: flat; transparent: true; opacity: ${cursor-opacity}" scale="${cursor-scale} ${cursor-scale} ${cursor-scale}" cursor="maxDistance: ${cursor-maxdistance};">\n    </a-entity>\n  </a-entity>\n</template>')})},{}],15:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-cube" width="1.5" height="1.5" depth="1.5" translate="0 0 0" color="gray" opacity="1.0" shader="standard" transparent="true" metalness="0.0" roughness="0.5" src="">\n  <a-entity geometry="primitive: box;\n                      width: ${width};\n                      height: ${height};\n                      depth: ${depth};\n                      translate: ${translate}" material="color: ${color};\n                      opacity: ${opacity};\n                      shader: ${shader};\n                      transparent: ${transparent};\n                      metalness: ${metalness};\n                      roughness: ${roughness};\n                      src: url(${src})"></a-entity>\n</template>')})},{}],16:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-curvedimage" radius="1" height="1" segments-radius="48" theta-start="0" theta-length="360" opacity="1.0" transparent="true" src="">\n  <a-entity geometry="primitive: cylinder;\n                      radius: ${radius};\n                      height: ${height};\n                      segmentsRadius: ${segments-radius};\n                      segmentsHeight: 1;\n                      thetaStart: ${theta-start};\n                      thetaLength: ${theta-length};\n                      openEnded: true" scale="1 1 -1" material="opacity: ${opacity};\n                      shader: flat;\n                      side: double;\n                      transparent: ${transparent};\n                      src: url(${src})"></a-entity>\n</template>')})},{}],17:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-cylinder" radius="0.75" radius-top="0.75" radius-bottom="0.75" height="1.5" segments-radial="36" segments-height="1" theta-start="0" theta-length="360" open-ended="false" translate="0 0 0" color="gray" opacity="1.0" shader="standard" transparent="true" metalness="0.0" roughness="0.5" side="front" src="">\n  <a-entity geometry="primitive: cylinder;\n                      radius: ${radius};\n                      radiusTop: ${radius-top};\n                      radiusBottom: ${radius-bottom};\n                      height: ${height};\n                      segmentsRadial: ${segments-radial};\n                      segmentsHeight: ${segments-height};\n                      thetaStart: ${theta-start};\n                      thetaLength: ${theta-length};\n                      openEnded: ${open-ended};\n                      translate: ${translate}" material="color: ${color};\n                      opacity: ${opacity};\n                      shader: ${shader};\n                      metalness: ${metalness};\n                      roughness: ${roughness};\n                      side: ${side};\n                      transparent: ${transparent};\n                      src: url(${src})"></a-entity>\n</template>')})},{}],18:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-frame" size="10" thickness="0.1" color="#404040">\n  <a-cube position="5 5 0" rotation="0 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="5 -5 0" rotation="0 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="-5 5 0" rotation="0 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="-5 -5 0" rotation="0 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n\n  <a-cube position="0 5 5" rotation="0 90 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="0 5 -5" rotation="0 90 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="0 -5 5" rotation="0 90 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="0 -5 -5" rotation="0 90 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n\n  <a-cube position="5 0 5" rotation="90 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="5 0 -5" rotation="90 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="-5 0 5" rotation="90 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n  <a-cube position="-5 0 -5" rotation="90 0 0" width="${thickness}" height="${thickness}" depth="${size}" color="${color}"></a-cube>\n</template>')})},{}],19:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-image" width="1.75" height="1.75" opacity="1.0" src="">\n  <a-entity geometry="primitive: plane;\n                      width: ${width};\n                      height: ${height}" material="shader: flat;\n                      src: url(${src});\n                      opacity: ${opacity};\n                      side: double;\n                      transparent: true">\n  </a-entity>\n</template>')})},{}],20:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-light" angle="60" color="#fff" ground-color="#fff" decay="1" distance="0.0" exponent="10.0" intensity="1.0" type="directional">\n  <a-entity light="angle: ${angle};\n                   color: ${color};\n                   groundColor: ${ground-color};\n                   decay: ${decay};\n                   distance: ${distance};\n                   exponent: ${exponent};\n                   intensity: ${intensity};\n                   type: ${type}">\n  </a-entity>\n</template>')})},{}],21:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-model" opacity="1.0" src="" format="collada">\n  <a-entity material="opacity: ${opacity}" loader="src: url(${src}); format: ${format}">\n  </a-entity>\n</template>')})},{}],22:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-plane" width="1.75" height="1.75" translate="0 0 0" color="gray" opacity="1.0" shader="standard" transparent="true" metalness="0.0" roughness="0.5" src="">\n  <a-entity geometry="primitive: plane;\n                      height: ${height};\n                      width: ${width};\n                      translate: ${translate}" material="color: ${color};\n                      opacity: ${opacity};\n                      shader: ${shader};\n                      transparent: ${transparent};\n                      metalness: ${metalness};\n                      roughness: ${roughness};\n                      side: double;\n                      src: url(${src})"></a-entity>\n</template>')})},{}],23:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-sky" src="" color="#FFF" radius="5000" segments-width="64" segments-height="64">\n  <a-entity geometry="primitive: sphere;\n                      radius: ${radius};\n                      segmentsWidth: ${segments-width};\n                      segmentsHeight: ${segments-height}" material="shader: flat; \n                      src: url(${src});\n                      color: ${color};\n                      fog: false" scale="-1 1 1">\n  </a-entity>\n</template>')})},{}],24:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-sphere" radius="0.85" segments-width="36" segments-height="18" translate="0 0 0" color="gray" opacity="1.0" shader="standard" transparent="true" metalness="0.0" roughness="0.5" src="">\n  <a-entity geometry="primitive: sphere;\n                      radius: ${radius};\n                      segmentsWidth: ${segments-width};\n                      segmentsHeight: ${segments-height};\n                      translate: ${translate}" material="color: ${color};\n                      opacity: ${opacity};\n                      shader: ${shader};\n                      transparent: ${transparent};\n                      metalness: ${metalness};\n                      roughness: ${roughness};\n                      src: url(${src})"></a-entity>\n</template>')})},{}],25:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-video" src="" width="3" height="1.75" translate="0 0 0" autoplay="true" loop="true" crossorigin="anonymous">\n  <video id="video" src="${src}" width="${width}" height="${height}" autoplay="${autoplay}" loop="${loop}" crossorigin="${crossOrigin}" style="display: none">\n  </video>\n  <a-entity geometry="primitive: plane;\n                      height: ${height};\n                      width: ${width};\n                      translate: ${translate}" material="shader: flat; src: #video">\n  </a-entity>\n</template>')})},{}],26:[function(){document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<template is="a-template" element="a-videosphere" src="" radius="5000" segments-width="64" segments-height="64" autoplay="true" loop="true" crossorigin="anonymous">\n  <video id="video" src="${src}" width="1000" height="500" autoplay="${autoplay}" loop="${loop}" crossorigin="${crossOrigin}" style="display: none">\n  </video>\n  <a-entity geometry="primitive: sphere;\n                      radius: ${radius};\n                      segmentsWidth: ${segments-width};\n                      segmentsHeight: ${segments-height};" material="shader: flat; src: #video;" scale="-1 1 1">\n  </a-entity>\n</template>')})},{}],27:[function(e){e("./a-camera.html"),e("./a-cube.html"),e("./a-curvedimage.html"),e("./a-cylinder.html"),e("./a-frame.html"),e("./a-image.html"),e("./a-light.html"),e("./a-model.html"),e("./a-plane.html"),e("./a-sky/index.html"),e("./a-sphere.html"),e("./a-video.html"),e("./a-videosphere.html"),document.addEventListener("DOMContentLoaded",function(){var e=document.getElementsByTagName("head")[0];e.insertAdjacentHTML("beforeend",'<meta charset="utf-8">')})},{"./a-camera.html":14,"./a-cube.html":15,"./a-curvedimage.html":16,"./a-cylinder.html":17,"./a-frame.html":18,"./a-image.html":19,"./a-light.html":20,"./a-model.html":21,"./a-plane.html":22,"./a-sky/index.html":23,"./a-sphere.html":24,"./a-video.html":25,"./a-videosphere.html":26}],28:[function(e,t){var r=e("aframe-core"),n=e("./elements/"),i=e("./package"),o=e("./elements/lib/register-template");t.exports={aframeCore:r,elements:{core:n},registerTemplate:o,version:i.version}},{"./elements/":11,"./elements/lib/register-template":12,"./package":91,"aframe-core":69}],29:[function(){"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.prototype={set:function(t,r){var n=t[this.name];return n&&n[0]===t?n[1]=r:e(t,this.name,{value:[t,r],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=r}(),function(e){function t(e){x.push(e),b||(b=!0,m(n))}function r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function n(){b=!1;var e=x;x=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var r=e.takeRecords();i(e),r.length&&(e.callback_(r,e),t=!0)}),t&&n()}function i(e){e.nodes_.forEach(function(t){var r=v.get(t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function o(e,t){for(var r=e;r;r=r.parentNode){var n=v.get(r);if(n)for(var i=0;i<n.length;i++){var o=n[i],a=o.options;if(r===e||a.subtree){var s=t(a);s&&o.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++w}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function h(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function c(e,t){return M=new s(e,t)}function l(e){return _?_:(_=h(M),_.oldValue=e,_)}function u(){M=_=void 0}function d(e){return e===_||e===M}function p(e,t){return e===t?e:_&&d(e)?_:null}function f(e,t,r){this.observer=e,this.target=t,this.options=r,this.transientObservedNodes=[]}var m,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))m=setTimeout;else if(window.setImmediate)m=window.setImmediate;else{var g=[],y=String(Math.random());window.addEventListener("message",function(e){if(e.data===y){var t=g;g=[],t.forEach(function(e){e()})}}),m=function(e){g.push(e),window.postMessage(y,"*")}}var b=!1,x=[],w=0;a.prototype={observe:function(e,t){if(e=r(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var n=v.get(e);n||v.set(e,n=[]);for(var i,o=0;o<n.length;o++)if(n[o].observer===this){i=n[o],i.removeListeners(),i.options=t;break}i||(i=new f(this,e,t),n.push(i),this.nodes_.push(e)),i.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),r=0;r<t.length;r++){var n=t[r];if(n.observer===this){n.removeListeners(),t.splice(r,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var M,_;f.prototype={enqueue:function(e){var r=this.observer.records_,n=r.length;if(r.length>0){var i=r[n-1],o=p(i,e);if(o)return void(r[n-1]=o)}else t(this.observer);r[n]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),r=0;r<t.length;r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e.relatedNode.namespaceURI,n=e.target,i=new c("attributes",n);i.attributeName=t,i.attributeNamespace=r;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;o(n,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(r)?void 0:e.attributeOldValue?l(a):i});break;case"DOMCharacterDataModified":var n=e.target,i=c("characterData",n),a=e.prevValue;o(n,function(e){return e.characterData?e.characterDataOldValue?l(a):i:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,h,d=e.target;"DOMNodeInserted"===e.type?(s=[d],h=[]):(s=[],h=[d]);var p=d.previousSibling,f=d.nextSibling,i=c("childList",e.target.parentNode);i.addedNodes=s,i.removedNodes=h,i.previousSibling=p,i.nextSibling=f,o(e.relatedNode,function(e){return e.childList?i:void 0})}u()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a)}(self),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||f,n(function(){o(e,t)},t)}function r(e){return"complete"===e.readyState||e.readyState===g}function n(e,t){if(r(t))e&&e();else{var i=function(){("complete"===t.readyState||t.readyState===g)&&(t.removeEventListener(y,i),n(e,t))};t.addEventListener(y,i)}}function i(e){e.target.__loaded=!0}function o(e,t){function r(){h==c&&e&&e({allImports:s,loadedImports:l,errorImports:u})}function n(e){i(e),l.push(this),h++,r()}function o(){u.push(this),h++,r()}var s=t.querySelectorAll("link[rel=import]"),h=0,c=s.length,l=[],u=[];if(c)for(var d,p=0;c>p&&(d=s[p]);p++)a(d)?(h++,r()):(d.addEventListener("load",n),d.addEventListener("error",o));else r()}function a(e){return u?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)h(t)&&c(t)}function h(e){return"link"===e.localName&&"import"===e.rel}function c(e){var t=e["import"];t?i({target:e}):(e.addEventListener("load",i),e.addEventListener("error",i))}var l="import",u=Boolean(l in document.createElement("link")),d=Boolean(window.ShadowDOMPolyfill),p=function(e){return d?window.ShadowDOMPolyfill.wrapIfNeeded(e):e},f=p(document),m={get:function(){var e=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return p(e)},configurable:!0};Object.defineProperty(document,"_currentScript",m),Object.defineProperty(f,"_currentScript",m);var v=/Trident/.test(navigator.userAgent),g=v?"complete":"interactive",y="readystatechange";u&&(new MutationObserver(function(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),r=0,n=t.length;n>r&&(e=t[r]);r++)c(e)}()),t(function(e){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var t=f.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),f.dispatchEvent(t)}),e.IMPORT_LINK_TYPE=l,e.useNative=u,e.rootDocument=f,e.whenReady=t,e.isIE=v}(window.HTMLImports),function(e){var t=[],r=function(e){t.push(e)},n=function(){t.forEach(function(t){t(e)})};e.addModule=r,e.initializeModules=n}(window.HTMLImports),window.HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,r=/(@import[\s]+(?!url\())([^;]*)(;)/g,n={resolveUrlsInStyle:function(e,t){var r=e.ownerDocument,n=r.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,n),e},resolveUrlsInCssText:function(e,n,i){var o=this.replaceUrls(e,i,n,t);return o=this.replaceUrls(o,i,n,r)},replaceUrls:function(e,t,r,n){return e.replace(n,function(e,n,i,o){var a=i.replace(/["']/g,"");return r&&(a=new URL(a,r).href),t.href=a,a=t.href,n+"'"+a+"'"+o})}};e.path=n}),window.HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(r,n,i){var o=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(r+="?"+Math.random()),o.open("GET",r,t.async),o.addEventListener("readystatechange",function(){if(4===o.readyState){var e=o.getResponseHeader("Location"),r=null;if(e)var r="/"===e.substr(0,1)?location.origin+e:e;n.call(i,!t.ok(o)&&o,o.response||o.responseText,r)}}),o.send(),o},loadDocument:function(e,t,r){this.load(e,t,r).responseType="document"}};e.xhr=t}),window.HTMLImports.addModule(function(e){var t=e.xhr,r=e.flags,n=function(e,t){this.cache={},
  this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};n.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,n){if(r.load&&console.log("fetch",e,n),e)if(e.match(/^data:/)){var i=e.split(","),o=i[0],a=i[1];a=o.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,n,null,a)}.bind(this),0)}else{var s=function(t,r,i){this.receive(e,n,t,r,i)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,n,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,r,n,i){this.cache[e]=n;for(var o,a=this.pending[e],s=0,h=a.length;h>s&&(o=a[s]);s++)this.onload(e,o,n,r,i),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=n}),window.HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,r=0,n=e.length;n>r&&(t=e[r]);r++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===l}function r(e){var t=n(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function n(e){return e.textContent+i(e)}function i(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var r=e.ownerDocument.baseURI,n=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+r+n+".js\n"}function o(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,h=e.flags,c=e.isIE,l=e.IMPORT_LINK_TYPE,u="link[rel="+l+"]",d={documentSelectors:u,importsSelectors:[u,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(h.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){h.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,h.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(e["import"]=e.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=o(e),t.__appliedElement=e,e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var r=this,n=function(i){e.removeEventListener("load",n),e.removeEventListener("error",n),t&&t(i),r.markParsingComplete(e),r.parseNext()};if(e.addEventListener("load",n),e.addEventListener("error",n),c&&"style"===e.localName){var i=!1;if(-1==e.textContent.indexOf("@import"))i=!0;else if(e.sheet){i=!0;for(var o,a=e.sheet.cssRules,s=a?a.length:0,h=0;s>h&&(o=a[h]);h++)o.type===CSSRule.IMPORT_RULE&&(i=i&&Boolean(o.styleSheet))}i&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var n=document.createElement("script");n.__importElement=t,n.src=t.src?t.src:r(t),e.currentScript=t,this.trackElement(n,function(){n.parentNode&&n.parentNode.removeChild(n),e.currentScript=null}),this.addElementToDocument(n)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,r){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var n,i=e.querySelectorAll(this.parseSelectorsForNode(e)),o=0,a=i.length;a>o&&(n=i[o]);o++)if(!this.isParsed(n))return this.hasResource(n)?t(n)?this.nextToParseInDoc(n.__doc,n):n:void 0}return r},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e.__doc?!1:!0}};e.parser=d,e.IMPORT_SELECTOR=u}),window.HTMLImports.addModule(function(e){function t(e){return r(e,a)}function r(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function n(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function i(e,t){var r=document.implementation.createHTMLDocument(a);r._URL=t;var i=r.createElement("base");i.setAttribute("href",t),r.baseURI||n(r)||Object.defineProperty(r,"baseURI",{value:t});var o=r.createElement("meta");return o.setAttribute("charset","utf-8"),r.head.appendChild(o),r.head.appendChild(i),r.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(r),r}var o=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,h=e.rootDocument,c=e.Loader,l=e.Observer,u=e.parser,d={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){p.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);p.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===h?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,r,n,a,s){if(o.load&&console.log("loaded",e,r),r.__resource=n,r.__error=a,t(r)){var h=this.documents[e];void 0===h&&(h=a?null:i(n,s||e),h&&(h.__importLink=r,this.bootDocument(h)),this.documents[e]=h),r.__doc=h}u.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),u.parseNext()},loadedAll:function(){u.parseNext()}},p=new c(d.loaded.bind(d),d.loadedAll.bind(d));if(d.observer=new l,!document.baseURI){var f={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",f),Object.defineProperty(h,"baseURI",f)}e.importer=d,e.importLoader=p}),window.HTMLImports.addModule(function(e){var t=e.parser,r=e.importer,n={added:function(e){for(var n,i,o,a,s=0,h=e.length;h>s&&(a=e[s]);s++)n||(n=a.ownerDocument,i=t.isParsed(n)),o=this.shouldLoadNode(a),o&&r.loadNode(a),this.shouldParseNode(a)&&i&&t.parseDynamic(a,o)},shouldLoadNode:function(e){return 1===e.nodeType&&i.call(e,r.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&i.call(e,t.parseSelectorsForNode(e))}};r.observer.addCallback=n.added.bind(n);var i=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){window.HTMLImports.importer.bootDocument(i)}var r=e.initializeModules,n=e.isIE;if(!e.useNative){(!window.CustomEvent||n&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(e,t){t=t||{};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),r.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})},r},window.CustomEvent.prototype=window.Event.prototype),r();var i=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(window.HTMLImports)},{}],30:[function(e,t){(function(r){var n=r.THREE=e("three-dev");n.TextureLoader&&(n.TextureLoader.prototype.crossOrigin=""),e("../node_modules/three-dev/examples/js/loaders/OBJLoader"),e("../node_modules/three-dev/examples/js/loaders/ColladaLoader"),e("../lib/vendor/Raycaster"),e("../node_modules/three-dev/examples/js/controls/VRControls"),e("../node_modules/three-dev/examples/js/effects/VREffect"),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/vendor/Raycaster":31,"../node_modules/three-dev/examples/js/controls/VRControls":36,"../node_modules/three-dev/examples/js/effects/VREffect":37,"../node_modules/three-dev/examples/js/loaders/ColladaLoader":38,"../node_modules/three-dev/examples/js/loaders/OBJLoader":39,"three-dev":35}],31:[function(){!function(e){function t(e,t){return e.distance-t.distance}function r(e,t,n,i){if(e.visible!==!1&&(e.raycast(t,n),i===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,n,!0)}e.Raycaster=function(t,r,n,i){this.ray=new e.Ray(t,r),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,n){var i=[];return r(e,this,i,n),i.sort(t),i},intersectObjects:function(e,n){var i=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var o=0,a=e.length;a>o;o++)r(e[o],this,i,n);return i.sort(t),i}}}(THREE)},{}],32:[function(e,t){!function(){if("undefined"==typeof window.performance&&(window.performance={}),!window.performance.now){var e=Date.now();performance.timing&&performance.timing.navigationStart&&(e=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-e}}}();var r=function(e){"use strict";function t(e){var t=document.createElement("link");t.href=e,t.rel="stylesheet",t.type="text/css",document.getElementsByTagName("head")[0].appendChild(t)}function r(e,t,r){function n(){o.width=p,o.height=d,o.style.width=o.width+"px",o.style.height=o.height+"px",o.className="rs-canvas",e.appendChild(o),a.fillStyle="#444444",a.fillRect(0,0,o.width,o.height)}function i(e,t){h+=.1*(e-h),s*=.99,h>s&&(s=h),a.drawImage(o,1,0,o.width-1,o.height,0,0,o.width-1,o.height),t?a.drawImage(f,o.width-1,o.height-h*o.height/s-d):a.drawImage(l,o.width-1,o.height-h*o.height/s-d)}var r=r||{},o=document.createElement("canvas"),a=o.getContext("2d"),s=0,h=0,c=r.color?r.color:"#666666",l=(r.warningColor?r.warningColor:"#b70000",document.createElement("canvas")),u=l.getContext("2d");l.width=1,l.height=2*d,u.fillStyle="#444444",u.fillRect(0,0,1,2*d),u.fillStyle=c,u.fillRect(0,d,1,d),u.fillStyle="#ffffff",u.globalAlpha=.5,u.fillRect(0,d,1,1),u.globalAlpha=1;var f=document.createElement("canvas"),m=f.getContext("2d");return f.width=1,f.height=2*d,m.fillStyle="#444444",m.fillRect(0,0,1,2*d),m.fillStyle="#b70000",m.fillRect(0,d,1,d),m.globalAlpha=.5,m.fillStyle="#ffffff",m.fillRect(0,d,1,1),m.globalAlpha=1,n(),{draw:i}}function n(e,t){function r(){i.width=p,i.height=d*t,i.style.width=i.width+"px",i.style.height=i.height+"px",i.className="rs-canvas",e.appendChild(i),o.fillStyle="#444444",o.fillRect(0,0,i.width,i.height)}function n(e){o.drawImage(i,1,0,i.width-1,i.height,0,0,i.width-1,i.height);var t=0;for(var r in e){var n=e[r]*i.height;o.fillStyle=c[r],o.fillRect(i.width-1,t,1,n),t+=n}}var i=document.createElement("canvas"),o=i.getContext("2d");return r(),{draw:n}}function i(e,t){function n(e){if(E&&E.average){g+=e,b++;var t=Date.now();t-y>=(E.avgMs||1e3)&&(v=g/b,g=0,y=t,b=0)}}function i(){d=performance.now()}function o(){f=performance.now()-d,n(f)}function a(){o(),i()}function s(){var e=E&&E.average?v:f;_.nodeValue=Math.round(100*e)/100;var t=E&&(E.below&&f<E.below||E.over&&f>E.over);A.draw(f,t),x.style.color=t?"#b70000":"#ffffff"}function c(){var e=performance.now(),t=e-d;m++,t>1e3&&(f=1e3*m/t,m=0,d=e,n(f))}function l(e){f=e,n(f)}var d,p=e,f=0,m=0,v=0,g=0,y=Date.now(),b=0,x=document.createElement("div"),w=document.createElement("span"),M=document.createElement("div"),_=document.createTextNode(""),E=h?h.values[p.toLowerCase()]:null,A=new r(x,p,E);return x.className="rs-counter-base",w.className="rs-counter-id",w.textContent=E&&E.caption?E.caption:p,M.className="rs-counter-value",M.appendChild(_),x.appendChild(w),x.appendChild(M),t?t.div.appendChild(x):u.appendChild(x),d=performance.now(),{set:l,start:i,tick:a,end:o,frame:c,value:function(){return f},draw:s}}function o(e){if(e=e.toLowerCase(),void 0===e&&(e="default"),f[e])return f[e];var t=null;if(h&&h.groups)for(var r in h.groups){var n=h.groups[parseInt(r,10)];-1==n.values.indexOf(e.toLowerCase())||(t=n)}var o=new i(e,t);return f[e]=o,o}function a(){if(h.plugins){h.values||(h.values={}),h.groups||(h.groups=[]),h.fractions||(h.fractions=[]);for(var e=0;e<h.plugins.length;e++){h.plugins[e].attach(o);for(var t in h.plugins[e].values)h.values[t]=h.plugins[e].values[t];h.groups=h.groups.concat(h.plugins[e].groups),h.fractions=h.fractions.concat(h.plugins[e].fractions)}}else h.plugins={};l=document.createElement("div"),l.className="rs-base",u=document.createElement("div"),u.className="rs-container",u.style.height="auto",l.appendChild(u),document.body.appendChild(l);window.getComputedStyle(l,null).getPropertyValue("font-size");if(h){if(h.groups)for(var e in h.groups){var r=h.groups[parseInt(e,10)],i=document.createElement("div");i.className="rs-group",r.div=i;var a=document.createElement("h1");a.textContent=r.caption,a.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(i)),u.appendChild(a),u.appendChild(i)}if(h.fractions)for(var e in h.fractions){var s=h.fractions[parseInt(e,10)],i=document.createElement("div");i.className="rs-fraction";var p=document.createElement("div");p.className="rs-legend";var f=0;for(var t in h.fractions[e].steps){var m=document.createElement("p");m.textContent=h.fractions[e].steps[t],m.style.color=c[f],p.appendChild(m),f++}i.appendChild(p),i.style.height=f*d+"px",s.div=i;var v=new n(i,f);s.graph=v,u.appendChild(i)}}}function s(){for(var e in h.plugins)h.plugins[e].update();for(var e in f)f[e].draw();if(h&&h.fractions)for(var e in h.fractions){var t=h.fractions[parseInt(e,10)],r=[],n=f[t.base.toLowerCase()];if(n){n=n.value();for(var i in h.fractions[e].steps){var o=h.fractions[e].steps[parseInt(i,10)].toLowerCase(),a=f[o];a&&r.push(a.value()/n)}}t.graph.draw(r)}}var h=e||{},c=["#850700","#c74900","#fcb300","#284280","#4c7c0c"];t("http://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300"),t((h.CSSPath?h.CSSPath:"")+"rStats.css"),h.values||(h.values={});var l,u,d=10,p=200,f={};return a(),function(e){return e?o(e):{update:s}}};"undefined"!=typeof t&&(t.exports=r)},{}],33:[function(e,t){var r={};r.base64=function(e,t){return"data:"+e+";base64,"+t},r.isMobile=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e},r.isIOS=function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},r.isIFrame=function(){try{return window.self!==window.top}catch(e){return!0}},r.appendQueryParameter=function(e,t,r){var n=e.indexOf("?")<0?"?":"&";return e+=n+t+"="+r},r.getQueryParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),r=t.exec(location.search);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))},r.isLandscapeMode=function(){return 90==window.orientation||-90==window.orientation},t.exports=r},{}],34:[function(e,t){function r(){var e=document.createElement("video");e.addEventListener("ended",function(){e.play()}),this.request=function(){e.paused&&(e.src=o.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),e.play())},this.release=function(){e.pause(),e.src=""}}function n(){var e=null;this.request=function(){e||(e=setInterval(function(){window.location=window.location,setTimeout(window.stop,0)},3e4))},this.release=function(){e&&(clearInterval(e),e=null)}}function i(){var e=navigator.userAgent||navigator.vendor||window.opera;return e.match(/iPhone/i)||e.match(/iPod/i)?n:r}var o=e("./util.js");t.exports=i()},{"./util.js":33}],35:[function(e,r,n){var i={REVISION:"74dev"};"function"==typeof t&&t.amd?t("three",i):"undefined"!=typeof n&&"undefined"!=typeof r&&(r.exports=i),(void 0===self.requestAnimationFrame||void 0===self.cancelAnimationFrame)&&!function(){for(var e=0,t=["ms","moz","webkit","o"],r=0;r<t.length&&!self.requestAnimationFrame;++r)self.requestAnimationFrame=self[t[r]+"RequestAnimationFrame"],self.cancelAnimationFrame=self[t[r]+"CancelAnimationFrame"]||self[t[r]+"CancelRequestAnimationFrame"];void 0===self.requestAnimationFrame&&void 0!==self.setTimeout&&(self.requestAnimationFrame=function(t){var r=Date.now(),n=Math.max(0,16-(r-e)),i=self.setTimeout(function(){t(r+n)},n);return e=r+n,i}),void 0===self.cancelAnimationFrame&&void 0!==self.clearTimeout&&(self.cancelAnimationFrame=function(e){self.clearTimeout(e)})}(),void 0===self.performance&&(self.performance={}),void 0===self.performance.now&&!function(){var e=Date.now();self.performance.now=function(){return Date.now()-e}}(),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&Object.defineProperty(Object,"assign",{writable:!0,configurable:!0,value:function(e){"use strict";if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),r=1,n=arguments.length;r!==n;++r){var i=arguments[r];if(void 0!==i&&null!==i){i=Object(i);for(var o=Object.keys(i),a=0,s=o.length;a!==s;++a){var h=o[a],c=Object.getOwnPropertyDescriptor(i,h);void 0!==c&&c.enumerable&&(t[h]=i[h])}}}return t}}),i.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},i.CullFaceNone=0,i.CullFaceBack=1,i.CullFaceFront=2,i.CullFaceFrontBack=3,i.FrontFaceDirectionCW=0,i.FrontFaceDirectionCCW=1,i.BasicShadowMap=0,i.PCFShadowMap=1,i.PCFSoftShadowMap=2,i.FrontSide=0,i.BackSide=1,i.DoubleSide=2,i.FlatShading=1,i.SmoothShading=2,i.NoColors=0,i.FaceColors=1,i.VertexColors=2,i.NoBlending=0,i.NormalBlending=1,i.AdditiveBlending=2,i.SubtractiveBlending=3,i.MultiplyBlending=4,i.CustomBlending=5,i.AddEquation=100,i.SubtractEquation=101,i.ReverseSubtractEquation=102,i.MinEquation=103,i.MaxEquation=104,i.ZeroFactor=200,i.OneFactor=201,i.SrcColorFactor=202,i.OneMinusSrcColorFactor=203,i.SrcAlphaFactor=204,i.OneMinusSrcAlphaFactor=205,i.DstAlphaFactor=206,i.OneMinusDstAlphaFactor=207,i.DstColorFactor=208,i.OneMinusDstColorFactor=209,i.SrcAlphaSaturateFactor=210,i.NeverDepth=0,i.AlwaysDepth=1,i.LessDepth=2,i.LessEqualDepth=3,i.EqualDepth=4,i.GreaterEqualDepth=5,i.GreaterDepth=6,i.NotEqualDepth=7,i.MultiplyOperation=0,i.MixOperation=1,i.AddOperation=2,i.UVMapping=300,i.CubeReflectionMapping=301,i.CubeRefractionMapping=302,i.EquirectangularReflectionMapping=303,i.EquirectangularRefractionMapping=304,i.SphericalReflectionMapping=305,i.RepeatWrapping=1e3,i.ClampToEdgeWrapping=1001,i.MirroredRepeatWrapping=1002,i.NearestFilter=1003,i.NearestMipMapNearestFilter=1004,i.NearestMipMapLinearFilter=1005,i.LinearFilter=1006,i.LinearMipMapNearestFilter=1007,i.LinearMipMapLinearFilter=1008,i.UnsignedByteType=1009,i.ByteType=1010,i.ShortType=1011,i.UnsignedShortType=1012,i.IntType=1013,i.UnsignedIntType=1014,i.FloatType=1015,i.HalfFloatType=1025,i.UnsignedShort4444Type=1016,i.UnsignedShort5551Type=1017,i.UnsignedShort565Type=1018,i.AlphaFormat=1019,i.RGBFormat=1020,i.RGBAFormat=1021,i.LuminanceFormat=1022,i.LuminanceAlphaFormat=1023,i.RGBEFormat=i.RGBAFormat,i.RGB_S3TC_DXT1_Format=2001,i.RGBA_S3TC_DXT1_Format=2002,i.RGBA_S3TC_DXT3_Format=2003,i.RGBA_S3TC_DXT5_Format=2004,i.RGB_PVRTC_4BPPV1_Format=2100,i.RGB_PVRTC_2BPPV1_Format=2101,i.RGBA_PVRTC_4BPPV1_Format=2102,i.RGBA_PVRTC_2BPPV1_Format=2103,i.LoopOnce=2200,i.LoopRepeat=2201,i.LoopPingPong=2202,i.InterpolateDiscrete=2300,i.InterpolateLinear=2301,i.InterpolateSmooth=2302,i.ZeroCurvatureEnding=2400,i.ZeroSlopeEnding=2401,i.WrapAroundEnding=2402,i.TrianglesDrawMode=0,i.TriangleStripDrawMode=1,i.TriangleFanDrawMode=2,i.Color=function(e){return 3===arguments.length?this.fromArray(arguments):this.set(e)},i.Color.prototype={constructor:i.Color,r:1,g:1,b:1,set:function(e){return e instanceof i.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){this.r=e,this.g=e,this.b=e},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e}return function(t,r,n){if(t=i.Math.euclideanModulo(t,1),r=i.Math.clamp(r,0,1),n=i.Math.clamp(n,0,1),0===r)this.r=this.g=this.b=n;else{var o=.5>=n?n*(1+r):n+r-n*r,a=2*n-o;this.r=e(a,o,t+1/3),this.g=e(a,o,t),this.b=e(a,o,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var n,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var s=parseFloat(n[1])/360,h=parseInt(n[2],10)/100,c=parseInt(n[3],10)/100;return t(n[5]),this.setHSL(s,h,c)}}}else if(r=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=r[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(e&&e.length>0){var l=i.ColorKeywords[e];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,n=e||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),h=Math.min(i,o,a),c=(h+s)/2;if(h===s)t=0,r=0;else{var l=s-h;switch(r=.5>=c?l/(s+h):l/(2-s-h),s){case i:t=(o-a)/l+(a>o?6:0);break;case o:t=(a-i)/l+2;break;case a:t=(i-o)/l+4}t/=6}return n.h=t,n.s=r,n.l=c,n},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var n=this.getHSL();return n.h+=e,n.s+=t,n.l+=r,this.setHSL(n.h,n.s,n.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},i.ColorKeywords={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,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},i.Quaternion=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1},i.Quaternion.prototype={constructor:i.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof i.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),n=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),h=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=a*n*o+r*s*h,this._y=r*s*o-a*n*h,this._z=r*n*h+a*s*o,this._w=r*n*o-a*s*h):"YXZ"===c?(this._x=a*n*o+r*s*h,this._y=r*s*o-a*n*h,this._z=r*n*h-a*s*o,this._w=r*n*o+a*s*h):"ZXY"===c?(this._x=a*n*o-r*s*h,this._y=r*s*o+a*n*h,this._z=r*n*h+a*s*o,this._w=r*n*o-a*s*h):"ZYX"===c?(this._x=a*n*o-r*s*h,this._y=r*s*o+a*n*h,this._z=r*n*h-a*s*o,this._w=r*n*o+a*s*h):"YZX"===c?(this._x=a*n*o+r*s*h,this._y=r*s*o+a*n*h,this._z=r*n*h-a*s*o,this._w=r*n*o-a*s*h):"XZY"===c&&(this._x=a*n*o-r*s*h,this._y=r*s*o-a*n*h,this._z=r*n*h+a*s*o,this._w=r*n*o+a*s*h),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,n=r[0],i=r[4],o=r[8],a=r[1],s=r[5],h=r[9],c=r[2],l=r[6],u=r[10],d=n+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(l-h)*t,this._y=(o-c)*t,this._z=(a-i)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),this._w=(l-h)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+c)/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(o-c)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(h+l)/t):(t=2*Math.sqrt(1+u-n-s),this._w=(a-i)/t,this._x=(o+c)/t,this._y=(h+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(n,o){return void 0===e&&(e=new i.Vector3),t=n.dot(o)+1,r>t?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,o),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._w;return this._x=r*c+o*a+n*h-i*s,this._y=n*c+o*s+i*a-r*h,this._z=i*c+o*h+r*s-n*a,this._w=o*c-r*a-n*s-i*h,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,o=this._w,a=o*e._w+r*e._x+n*e._y+i*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=n,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var h=Math.atan2(s,a),c=Math.sin((1-t)*h)/s,l=Math.sin(t*h)/s;return this._w=o*c+this._w*l,this._x=r*c+this._x*l,this._y=n*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},Object.assign(i.Quaternion,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,o,a){var s=r[n+0],h=r[n+1],c=r[n+2],l=r[n+3],u=i[o+0],d=i[o+1],p=i[o+2],f=i[o+3];if(l!==f||s!==u||h!==d||c!==p){var m=1-a,v=s*u+h*d+c*p+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,v*g);m=Math.sin(m*x)/b,a=Math.sin(a*x)/b}var w=a*g;if(s=s*m+u*w,h=h*m+d*w,c=c*m+p*w,l=l*m+f*w,m===1-a){var M=1/Math.sqrt(s*s+h*h+c*c+l*l);s*=M,h*=M,c*=M,l*=M}}e[t]=s,e[t+1]=h,e[t+2]=c,e[t+3]=l}}),i.Vector2=function(e,t){this.x=e||0,this.y=t||0},i.Vector2.prototype={constructor:i.Vector2,get width(){return this.x},set width(e){this.x=e},get height(){return this.y},set height(e){this.y=e},set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e):(this.x=0,this.y=0),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector2,t=new i.Vector2),e.set(r,r),t.set(n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},rotateAround:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*r-o*n+e.x,this.y=i*n+o*r+e.y,this}},i.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},i.Vector3.prototype={constructor:i.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof i.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new i.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6]*n,this.y=i[1]*t+i[4]*r+i[7]*n,this.z=i[2]*t+i[5]*r+i[8]*n,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n+i[12],this.y=i[1]*t+i[5]*r+i[9]*n+i[13],this.z=i[2]*t+i[6]*r+i[10]*n+i[14],this},applyProjection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements,o=1/(i[3]*t+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*o,this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*o,this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z,s=e.w,h=s*t+o*n-a*r,c=s*r+a*t-i*n,l=s*n+i*r-o*t,u=-i*t-o*r-a*n;return this.x=h*s+u*-i+c*-a-l*-o,this.y=c*s+u*-o+l*-i-h*-a,this.z=l*s+u*-a+h*-o-c*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n,this.y=i[1]*t+i[5]*r+i[9]*n,this.z=i[2]*t+i[6]*r+i[10]*n,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector3,t=new i.Vector3),e.set(r,r,r),t.set(n,n,n),this.clamp(e,t)}}(),clampLength:function(e,t){var r=this.length();return this.multiplyScalar(Math.max(e,Math.min(t,r))/r),this},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,n=this.y,i=this.z;return this.x=n*e.z-i*e.y,this.y=i*e.x-r*e.z,this.z=r*e.y-n*e.x,this},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-i*a,this.y=i*o-r*s,this.z=r*a-n*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new i.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(i.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=n,this},setFromMatrixColumn:function(e,t){var r=4*e,n=t.elements;return this.x=n[r],this.y=n[r+1],this.z=n[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},i.Vector4=function(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1},i.Vector4.prototype={constructor:i.Vector4,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this.w*=e):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n+o[12]*i,this.y=o[1]*t+o[5]*r+o[9]*n+o[13]*i,this.z=o[2]*t+o[6]*r+o[10]*n+o[14]*i,this.w=o[3]*t+o[7]*r+o[11]*n+o[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,n,i,o=.01,a=.1,s=e.elements,h=s[0],c=s[4],l=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-u)<o&&Math.abs(l-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+u)<a&&Math.abs(l+f)<a&&Math.abs(p+m)<a&&Math.abs(h+d+v-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var g=(h+1)/2,y=(d+1)/2,b=(v+1)/2,x=(c+u)/4,w=(l+f)/4,M=(p+m)/4;return g>y&&g>b?o>g?(r=0,n=.707106781,i=.707106781):(r=Math.sqrt(g),n=x/r,i=w/r):y>b?o>y?(r=.707106781,n=0,i=.707106781):(n=Math.sqrt(y),r=x/n,i=M/n):o>b?(r=.707106781,n=.707106781,i=0):(i=Math.sqrt(b),r=w/i,n=M/i),this.set(r,n,i,t),this}var _=Math.sqrt((m-p)*(m-p)+(l-f)*(l-f)+(u-c)*(u-c));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(l-f)/_,this.z=(u-c)/_,this.w=Math.acos((h+d+v-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(r,n){return void 0===e&&(e=new i.Vector4,t=new i.Vector4),e.set(r,r,r,r),t.set(n,n,n,n),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.multiplyScalar(e/this.length())},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},i.Euler=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||i.Euler.DefaultOrder},i.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],i.Euler.DefaultOrder="XYZ",i.Euler.prototype={constructor:i.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=i.Math.clamp,o=e.elements,a=o[0],s=o[4],h=o[8],c=o[1],l=o[5],u=o[9],d=o[2],p=o[6],f=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(n(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-n(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(h,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-n(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===t?(this._z=Math.asin(-n(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,n),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new i.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new i.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},i.Line3=function(e,t){this.start=void 0!==e?e:new i.Vector3,this.end=void 0!==t?t:new i.Vector3},i.Line3.prototype={constructor:i.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new i.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new i.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new i.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new i.Vector3,t=new i.Vector3;return function(r,n){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),a=t.dot(e),s=a/o;return n&&(s=i.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,r){var n=this.closestPointToPointParameter(e,t),o=r||new i.Vector3;return this.delta(o).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},i.Box2=function(e,t){this.min=void 0!==e?e:new i.Vector2(1/0,1/0),this.max=void 0!==t?t:new i.Vector2(-(1/0),-(1/0))},i.Box2.prototype={constructor:i.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector2;return function(t,r){var n=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(e){var t=e||new i.Vector2;return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new i.Vector2;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){var r=t||new i.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(e,t){var r=t||new i.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},i.Box3=function(e,t){this.min=void 0!==e?e:new i.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new i.Vector3(-(1/0),-(1/0),-(1/0))},i.Box3.prototype={constructor:i.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new i.Vector3;return function(t,r){var n=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}}(),setFromObject:function(){var e;return function(t){void 0===e&&(e=new i.Box3);var r=this;return this.makeEmpty(),t.updateMatrixWorld(!0),t.traverse(function(t){var n=t.geometry;void 0!==n&&(null===n.boundingBox&&n.computeBoundingBox(),e.copy(n.boundingBox),e.applyMatrix4(t.matrixWorld),r.union(e))}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){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:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(e){var t=e||new i.Vector3;
  
  return t.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(e){var t=e||new i.Vector3;return t.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){var r=t||new i.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},intersectsSphere:function(){var e;return function(t){return void 0===e&&(e=new i.Vector3),this.clampPoint(t.center,e),e.distanceToSquared(t.center)<=t.radius*t.radius}}(),intersectsPlane:function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=e.constant&&r>=e.constant},clampPoint:function(e,t){var r=t||new i.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new i.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new i.Vector3;return function(t){var r=t||new i.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3,new i.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},i.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},i.Matrix3.prototype={constructor:i.Matrix3,set:function(e,t,r,n,i,o,a,s,h){var c=this.elements;return c[0]=e,c[3]=t,c[6]=r,c[1]=n,c[4]=i,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},applyToVector3Array:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,a=r;n>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix3(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length/t.itemSize);for(var o=0,a=r;n>o;o++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],h=e[7],c=e[8];return t*o*c-t*a*h-r*i*c+r*a*s+n*i*h-n*o*s},getInverse:function(e,t){var r=e.elements,n=this.elements;n[0]=r[10]*r[5]-r[6]*r[9],n[1]=-r[10]*r[1]+r[2]*r[9],n[2]=r[6]*r[1]-r[2]*r[5],n[3]=-r[10]*r[4]+r[6]*r[8],n[4]=r[10]*r[0]-r[2]*r[8],n[5]=-r[6]*r[0]+r[2]*r[4],n[6]=r[9]*r[4]-r[5]*r[8],n[7]=-r[9]*r[0]+r[1]*r[8],n[8]=r[5]*r[0]-r[1]*r[4];var i=r[0]*n[0]+r[1]*n[3]+r[2]*n[6];if(0===i){var o="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(o);return console.warn(o),this.identity(),this}return this.multiplyScalar(1/i),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]}},i.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},i.Matrix4.prototype={constructor:i.Matrix4,set:function(e,t,r,n,i,o,a,s,h,c,l,u,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=n,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=h,v[6]=c,v[10]=l,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new i.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){var n=this.elements;return e.set(n[0],n[1],n[2]),t.set(n[4],n[5],n[6]),r.set(n[8],n[9],n[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new i.Vector3);var r=this.elements,n=t.elements,o=1/e.set(n[0],n[1],n[2]).length(),a=1/e.set(n[4],n[5],n[6]).length(),s=1/e.set(n[8],n[9],n[10]).length();return r[0]=n[0]*o,r[1]=n[1]*o,r[2]=n[2]*o,r[4]=n[4]*a,r[5]=n[5]*a,r[6]=n[6]*a,r[8]=n[8]*s,r[9]=n[9]*s,r[10]=n[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof i.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,n=e.y,o=e.z,a=Math.cos(r),s=Math.sin(r),h=Math.cos(n),c=Math.sin(n),l=Math.cos(o),u=Math.sin(o);if("XYZ"===e.order){var d=a*l,p=a*u,f=s*l,m=s*u;t[0]=h*l,t[4]=-h*u,t[8]=c,t[1]=p+f*c,t[5]=d-m*c,t[9]=-s*h,t[2]=m-d*c,t[6]=f+p*c,t[10]=a*h}else if("YXZ"===e.order){var v=h*l,g=h*u,y=c*l,b=c*u;t[0]=v+b*s,t[4]=y*s-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-s,t[2]=g*s-y,t[6]=b+v*s,t[10]=a*h}else if("ZXY"===e.order){var v=h*l,g=h*u,y=c*l,b=c*u;t[0]=v-b*s,t[4]=-a*u,t[8]=y+g*s,t[1]=g+y*s,t[5]=a*l,t[9]=b-v*s,t[2]=-a*c,t[6]=s,t[10]=a*h}else if("ZYX"===e.order){var d=a*l,p=a*u,f=s*l,m=s*u;t[0]=h*l,t[4]=f*c-p,t[8]=d*c+m,t[1]=h*u,t[5]=m*c+d,t[9]=p*c-f,t[2]=-c,t[6]=s*h,t[10]=a*h}else if("YZX"===e.order){var x=a*h,w=a*c,M=s*h,_=s*c;t[0]=h*l,t[4]=_-x*u,t[8]=M*u+w,t[1]=u,t[5]=a*l,t[9]=-s*l,t[2]=-c*l,t[6]=w*u+M,t[10]=x-_*u}else if("XZY"===e.order){var x=a*h,w=a*c,M=s*h,_=s*c;t[0]=h*l,t[4]=-u,t[8]=c*l,t[1]=x*u+_,t[5]=a*l,t[9]=w*u-M,t[2]=M*u-w,t[6]=s*l,t[10]=_*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,n=e.y,i=e.z,o=e.w,a=r+r,s=n+n,h=i+i,c=r*a,l=r*s,u=r*h,d=n*s,p=n*h,f=i*h,m=o*a,v=o*s,g=o*h;return t[0]=1-(d+f),t[4]=l-g,t[8]=u+v,t[1]=l+g,t[5]=1-(c+f),t[9]=p-m,t[2]=u-v,t[6]=p+m,t[10]=1-(c+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(n,o,a){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Vector3),void 0===r&&(r=new i.Vector3);var s=this.elements;return r.subVectors(n,o).normalize(),0===r.lengthSq()&&(r.z=1),e.crossVectors(a,r).normalize(),0===e.lengthSq()&&(r.x+=1e-4,e.crossVectors(a,r).normalize()),t.crossVectors(r,e),s[0]=e.x,s[4]=t.x,s[8]=r.x,s[1]=e.y,s[5]=t.y,s[9]=r.y,s[2]=e.z,s[6]=t.z,s[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,i=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],d=r[13],p=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],b=r[11],x=r[15],w=n[0],M=n[4],_=n[8],E=n[12],A=n[1],S=n[5],C=n[9],T=n[13],L=n[2],k=n[6],R=n[10],P=n[14],D=n[3],O=n[7],N=n[11],I=n[15];return i[0]=o*w+a*A+s*L+h*D,i[4]=o*M+a*S+s*k+h*O,i[8]=o*_+a*C+s*R+h*N,i[12]=o*E+a*T+s*P+h*I,i[1]=c*w+l*A+u*L+d*D,i[5]=c*M+l*S+u*k+d*O,i[9]=c*_+l*C+u*R+d*N,i[13]=c*E+l*T+u*P+d*I,i[2]=p*w+f*A+m*L+v*D,i[6]=p*M+f*S+m*k+v*O,i[10]=p*_+f*C+m*R+v*N,i[14]=p*E+f*T+m*P+v*I,i[3]=g*w+y*A+b*L+x*D,i[7]=g*M+y*S+b*k+x*O,i[11]=g*_+y*C+b*R+x*N,i[15]=g*E+y*T+b*P+x*I,this},multiplyToArray:function(e,t,r){var n=this.elements;return this.multiplyMatrices(e,t),r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7],r[8]=n[8],r[9]=n[9],r[10]=n[10],r[11]=n[11],r[12]=n[12],r[13]=n[13],r[14]=n[14],r[15]=n[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToVector3Array:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length);for(var o=0,a=r;n>o;o+=3,a+=3)e.fromArray(t,a),e.applyMatrix4(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,n){void 0===e&&(e=new i.Vector3),void 0===r&&(r=0),void 0===n&&(n=t.length/t.itemSize);for(var o=0,a=r;n>o;o++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],o=e[1],a=e[5],s=e[9],h=e[13],c=e[2],l=e[6],u=e[10],d=e[14],p=e[3],f=e[7],m=e[11],v=e[15];return p*(+i*s*l-n*h*l-i*a*u+r*h*u+n*a*d-r*s*d)+f*(+t*s*d-t*h*u+i*o*u-n*o*d+n*h*c-i*s*c)+m*(+t*h*l-t*a*d-i*o*l+r*o*d+i*a*c-r*h*c)+v*(-n*a*c-t*s*l+t*a*u+n*o*l-r*o*u+r*s*c)},transpose:function(){var e,t=this.elements;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},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e;return function(){void 0===e&&(e=new i.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,n=e.elements,i=n[0],o=n[4],a=n[8],s=n[12],h=n[1],c=n[5],l=n[9],u=n[13],d=n[2],p=n[6],f=n[10],m=n[14],v=n[3],g=n[7],y=n[11],b=n[15];r[0]=l*m*g-u*f*g+u*p*y-c*m*y-l*p*b+c*f*b,r[4]=s*f*g-a*m*g-s*p*y+o*m*y+a*p*b-o*f*b,r[8]=a*u*g-s*l*g+s*c*y-o*u*y-a*c*b+o*l*b,r[12]=s*l*p-a*u*p-s*c*f+o*u*f+a*c*m-o*l*m,r[1]=u*f*v-l*m*v-u*d*y+h*m*y+l*d*b-h*f*b,r[5]=a*m*v-s*f*v+s*d*y-i*m*y-a*d*b+i*f*b,r[9]=s*l*v-a*u*v-s*h*y+i*u*y+a*h*b-i*l*b,r[13]=a*u*d-s*l*d+s*h*f-i*u*f-a*h*m+i*l*m,r[2]=c*m*v-u*p*v+u*d*g-h*m*g-c*d*b+h*p*b,r[6]=s*p*v-o*m*v-s*d*g+i*m*g+o*d*b-i*p*b,r[10]=o*u*v-s*c*v+s*h*g-i*u*g-o*h*b+i*c*b,r[14]=s*c*d-o*u*d-s*h*p+i*u*p+o*h*m-i*c*m,r[3]=l*p*v-c*f*v-l*d*g+h*f*g+c*d*y-h*p*y,r[7]=o*f*v-a*p*v+a*d*g-i*f*g-o*d*y+i*p*y,r[11]=a*c*v-o*l*v-a*h*g+i*l*g+o*h*y-i*c*y,r[15]=o*l*d-a*c*d+a*h*p-i*l*p-o*h*f+i*c*f;var x=i*r[0]+h*r[4]+d*r[8]+v*r[12];if(0===x){var w="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(w);return console.warn(w),this.identity(),this}return this.multiplyScalar(1/x),this},scale:function(e){var t=this.elements,r=e.x,n=e.y,i=e.z;return t[0]*=r,t[4]*=n,t[8]*=i,t[1]*=r,t[5]*=n,t[9]*=i,t[2]*=r,t[6]*=n,t[10]*=i,t[3]*=r,t[7]*=n,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=1-r,o=e.x,a=e.y,s=e.z,h=i*o,c=i*a;return this.set(h*o+r,h*a-n*s,h*s+n*a,0,h*a+n*s,c*a+r,c*s-n*o,0,h*s-n*a,c*s+n*o,i*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,n,o){void 0===e&&(e=new i.Vector3),void 0===t&&(t=new i.Matrix4);var a=this.elements,s=e.set(a[0],a[1],a[2]).length(),h=e.set(a[4],a[5],a[6]).length(),c=e.set(a[8],a[9],a[10]).length(),l=this.determinant();0>l&&(s=-s),r.x=a[12],r.y=a[13],r.z=a[14],t.elements.set(this.elements);var u=1/s,d=1/h,p=1/c;return t.elements[0]*=u,t.elements[1]*=u,t.elements[2]*=u,t.elements[4]*=d,t.elements[5]*=d,t.elements[6]*=d,t.elements[8]*=p,t.elements[9]*=p,t.elements[10]*=p,n.setFromRotationMatrix(t),o.x=s,o.y=h,o.z=c,this}}(),makeFrustum:function(e,t,r,n,i,o){var a=this.elements,s=2*i/(t-e),h=2*i/(n-r),c=(t+e)/(t-e),l=(n+r)/(n-r),u=-(o+i)/(o-i),d=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=h,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,n){var o=r*Math.tan(i.Math.degToRad(.5*e)),a=-o,s=a*t,h=o*t;return this.makeFrustum(s,h,a,o,r,n)},makeOrthographic:function(e,t,r,n,i,o){var a=this.elements,s=t-e,h=r-n,c=o-i,l=(t+e)/s,u=(r+n)/h,d=(o+i)/c;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;16>n;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}},i.Ray=function(e,t){this.origin=void 0!==e?e:new i.Vector3,this.direction=void 0!==t?t:new i.Vector3},i.Ray.prototype={constructor:i.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new i.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new i.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new i.Vector3;r.subVectors(e,this.origin);var n=r.dot(this.direction);return 0>n?r.copy(this.origin):r.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new i.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(n,i,o,a){e.copy(n).add(i).multiplyScalar(.5),t.copy(i).sub(n).normalize(),r.copy(this.origin).sub(e);var s,h,c,l,u=.5*n.distanceTo(i),d=-this.direction.dot(t),p=r.dot(this.direction),f=-r.dot(t),m=r.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*f-p,h=d*p-f,l=u*v,s>=0)if(h>=-l)if(l>=h){var g=1/v;s*=g,h*=g,c=s*(s+d*h+2*p)+h*(d*s+h+2*f)+m}else h=u,s=Math.max(0,-(d*h+p)),c=-s*s+h*(h+2*f)+m;else h=-u,s=Math.max(0,-(d*h+p)),c=-s*s+h*(h+2*f)+m;else-l>=h?(s=Math.max(0,-(-d*u+p)),h=s>0?-u:Math.min(Math.max(-u,-f),u),c=-s*s+h*(h+2*f)+m):l>=h?(s=0,h=Math.min(Math.max(-u,-f),u),c=h*(h+2*f)+m):(s=Math.max(0,-(d*u+p)),h=s>0?u:Math.min(Math.max(-u,-f),u),c=-s*s+h*(h+2*f)+m);else h=d>0?-u:u,s=Math.max(0,-(d*h+p)),c=-s*s+h*(h+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(h).add(e),c}}(),intersectSphere:function(){var e=new i.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var n=e.dot(this.direction),i=e.dot(e)-n*n,o=t.radius*t.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=n-a,h=n+a;return 0>s&&0>h?null:0>s?this.at(h,r):this.at(s,r)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},intersectBox:function(e,t){var r,n,i,o,a,s,h=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,u=this.origin;return h>=0?(r=(e.min.x-u.x)*h,n=(e.max.x-u.x)*h):(r=(e.max.x-u.x)*h,n=(e.min.x-u.x)*h),c>=0?(i=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(i=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),r>o||i>n?null:((i>r||r!==r)&&(r=i),(n>o||n!==n)&&(n=o),l>=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),r>s||a>n?null:((a>r||r!==r)&&(r=a),(n>s||n!==n)&&(n=s),0>n?null:this.at(r>=0?r:n,t)))},intersectsBox:function(){var e=new i.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectTriangle:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3,n=new i.Vector3;return function(i,o,a,s,h){t.subVectors(o,i),r.subVectors(a,i),n.crossVectors(t,r);var c,l=this.direction.dot(n);if(l>0){if(s)return null;c=1}else{if(!(0>l))return null;c=-1,l=-l}e.subVectors(this.origin,i);var u=c*this.direction.dot(r.crossVectors(e,r));if(0>u)return null;var d=c*this.direction.dot(t.cross(e));if(0>d)return null;if(u+d>l)return null;var p=-c*e.dot(n);return 0>p?null:this.at(p/l,h)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},i.Sphere=function(e,t){this.center=void 0!==e?e:new i.Vector3,this.radius=void 0!==t?t:0},i.Sphere.prototype={constructor:i.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new i.Box3;return function(t,r){var n=this.center;void 0!==r?n.copy(r):e.setFromPoints(t).center(n);for(var i=0,o=0,a=t.length;a>o;o++)i=Math.max(i,n.distanceToSquared(t[o]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(this.center.dot(e.normal)-e.constant)<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),n=t||new i.Vector3;return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(e){var t=e||new i.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},i.Frustum=function(e,t,r,n,o,a){this.planes=[void 0!==e?e:new i.Plane,void 0!==t?t:new i.Plane,void 0!==r?r:new i.Plane,void 0!==n?n:new i.Plane,void 0!==o?o:new i.Plane,void 0!==a?a:new i.Plane]},i.Frustum.prototype={constructor:i.Frustum,set:function(e,t,r,n,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(n),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],h=r[5],c=r[6],l=r[7],u=r[8],d=r[9],p=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(a-n,l-s,f-u,y-m).normalize(),t[1].setComponents(a+n,l+s,f+u,y+m).normalize(),t[2].setComponents(a+i,l+h,f+d,y+v).normalize(),t[3].setComponents(a-i,l-h,f-d,y-v).normalize(),t[4].setComponents(a-o,l-c,f-p,y-g).normalize(),t[5].setComponents(a+o,l+c,f+p,y+g).normalize(),this},intersectsObject:function(){var e=new i.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,n=-e.radius,i=0;6>i;i++){var o=t[i].distanceToPoint(r);if(n>o)return!1}return!0},intersectsBox:function(){var e=new i.Vector3,t=new i.Vector3;return function(r){for(var n=this.planes,i=0;6>i;i++){var o=n[i];e.x=o.normal.x>0?r.min.x:r.max.x,t.x=o.normal.x>0?r.max.x:r.min.x,e.y=o.normal.y>0?r.min.y:r.max.y,t.y=o.normal.y>0?r.max.y:r.min.y,e.z=o.normal.z>0?r.min.z:r.max.z,t.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}},i.Plane=function(e,t){this.normal=void 0!==e?e:new i.Vector3(1,0,0),this.constant=void 0!==t?t:0},i.Plane.prototype={constructor:i.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new i.Vector3,t=new i.Vector3;return function(r,n,i){var o=e.subVectors(i,n).cross(t.subVectors(r,n)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),n=t||new i.Vector3;return n.copy(this.normal).multiplyScalar(r)},intersectLine:function(){var e=new i.Vector3;return function(t,r){var n=r||new i.Vector3,o=t.delta(e),a=this.normal.dot(o);if(0===a)return 0===this.distanceToPoint(t.start)?n.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/a;return 0>s||s>1?void 0:n.copy(o).multiplyScalar(s).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){var t=e||new i.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(n,i){var o=i||r.getNormalMatrix(n),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(n),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},i.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),n=0;return function(){for(var i=0;36>i;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,r[i]=t[19===i?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},i.Spline=function(e){function t(e,t,r,n,i,o,a){var s=.5*(r-e),h=.5*(n-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*i+t}this.points=e;var r,n,o,a,s,h,c,l,u,d=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,n=Math.floor(r),o=r-n,d[0]=0===n?n:n-1,d[1]=n,d[2]=n>this.points.length-2?this.points.length-1:n+1,d[3]=n>this.points.length-3?this.points.length-1:n+2,h=this.points[d[0]],c=this.points[d[1]],l=this.points[d[2]],u=this.points[d[3]],a=o*o,s=o*a,p.x=t(h.x,c.x,l.x,u.x,o,a,s),p.y=t(h.y,c.y,l.y,u.y,o,a,s),p.z=t(h.z,c.z,l.z,u.z,o,a,s),p},this.getControlPointsArray=function(){var e,t,r=this.points.length,n=[];for(e=0;r>e;e++)t=this.points[e],n[e]=[t.x,t.y,t.z];return n},this.getLength=function(e){var t,r,n,o,a=0,s=0,h=0,c=new i.Vector3,l=new i.Vector3,u=[],d=0;for(u[0]=0,e||(e=100),n=this.points.length*e,c.copy(this.points[0]),t=1;n>t;t++)r=t/n,o=this.getPoint(r),l.copy(o),d+=l.distanceTo(c),c.copy(o),a=(this.points.length-1)*r,s=Math.floor(a),s!==h&&(u[s]=d,h=s);return u[u.length]=d,{chunks:u,total:d}},this.reparametrizeByArcLength=function(e){var t,r,n,o,a,s,h,c,l=[],u=new i.Vector3,d=this.getLength();for(l.push(u.copy(this.points[0]).clone()),t=1;t<this.points.length;t++){for(s=d.chunks[t]-d.chunks[t-1],h=Math.ceil(e*s/d.total),o=(t-1)/(this.points.length-1),a=t/(this.points.length-1),r=1;h-1>r;r++)n=o+r*(1/h)*(a-o),c=this.getPoint(n),l.push(u.copy(c).clone());l.push(u.copy(this.points[t]).clone())}this.points=l}},i.Triangle=function(e,t,r){this.a=void 0!==e?e:new i.Vector3,this.b=void 0!==t?t:new i.Vector3,this.c=void 0!==r?r:new i.Vector3},i.Triangle.normal=function(){var e=new i.Vector3;return function(t,r,n,o){var a=o||new i.Vector3;a.subVectors(n,r),e.subVectors(t,r),a.cross(e);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),i.Triangle.barycoordFromPoint=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(n,o,a,s,h){e.subVectors(s,o),t.subVectors(a,o),r.subVectors(n,o);var c=e.dot(e),l=e.dot(t),u=e.dot(r),d=t.dot(t),p=t.dot(r),f=c*d-l*l,m=h||new i.Vector3;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(d*u-l*p)*v,y=(c*p-l*u)*v;return m.set(1-g-y,y,g)}}(),i.Triangle.containsPoint=function(){var e=new i.Vector3;return function(t,r,n,o){var a=i.Triangle.barycoordFromPoint(t,r,n,o,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),i.Triangle.prototype={constructor:i.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new i.Vector3,t=new i.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new i.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return i.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new i.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return i.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return i.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},i.Interpolant=function(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r},i.Interpolant.prototype={constructor:i.Intepolant,evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{var o;r:{n:if(!(n>e)){for(var a=r+2;;){if(void 0===n){if(i>e)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,i)}if(r===a)break;if(i=n,n=t[++r],n>e)break t}o=t.length;break r}{if(e>=i)break e;var s=t[1];s>e&&(r=2,i=s);for(var a=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===a)break;if(n=i,i=t[--r-1],e>=i)break t}o=r,r=0}}for(;o>r;){var h=r+o>>>1;e<t[h]?o=h:r=h+1}if(n=t[r],i=t[r-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,i,e)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n,o=0;o!==n;++o)t[o]=r[i+o];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}},Object.assign(i.Interpolant.prototype,{beforeStart_:i.Interpolant.prototype.copySampleValue_,afterEnd_:i.Interpolant.prototype.copySampleValue_}),i.CubicInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,
  this._weightNext=-0,this._offsetNext=-0},i.CubicInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.CubicInterpolant,DefaultSettings_:{endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},intervalChanged_:function(e,t,r){var n=this.parameterPositions,o=e-2,a=e+1,s=n[o],h=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case i.ZeroSlopeEnding:o=e,s=2*t-r;break;case i.WrapAroundEnding:o=n.length-2,s=t+n[o]-n[o+1];break;default:o=e,s=r}if(void 0===h)switch(this.getSettings_().endingEnd){case i.ZeroSlopeEnding:a=e,h=2*r-t;break;case i.WrapAroundEnding:a=1,h=r+n[1]-n[0];break;default:a=e-1,h=t}var c=.5*(r-t),l=this.valueSize;this._weightPrev=c/(t-s),this._weightNext=c/(h-r),this._offsetPrev=o*l,this._offsetNext=a*l},interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,h=s-a,c=this._offsetPrev,l=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),f=p*p,m=f*p,v=-u*m+2*u*f-u*p,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,b=d*m-d*f,x=0;x!==a;++x)i[x]=v*o[c+x]+g*o[h+x]+y*o[s+x]+b*o[l+x];return i}}),i.DiscreteInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.DiscreteInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.DiscreteInterpolant,interpolate_:function(e){return this.copySampleValue_(e-1)}}),i.LinearInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.LinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.LinearInterpolant,interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,h=s-a,c=(r-t)/(n-t),l=1-c,u=0;u!==a;++u)i[u]=o[h+u]*l+o[s+u]*c;return i}}),i.QuaternionLinearInterpolant=function(e,t,r,n){i.Interpolant.call(this,e,t,r,n)},i.QuaternionLinearInterpolant.prototype=Object.assign(Object.create(i.Interpolant.prototype),{constructor:i.QuaternionLinearInterpolant,interpolate_:function(e,t,r,n){for(var o=this.resultBuffer,a=this.sampleValues,s=this.valueSize,h=e*s,c=(r-t)/(n-t),l=h+s;h!==l;h+=4)i.Quaternion.slerpFlat(o,0,a,h-s,a,h,c);return o}}),i.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},i.Clock.prototype={constructor:i.Clock,start:function(){this.startTime=self.performance.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=self.performance.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},i.EventDispatcher=function(){},i.EventDispatcher.prototype={constructor:i.EventDispatcher,apply:function(e){e.addEventListener=i.EventDispatcher.prototype.addEventListener,e.hasEventListener=i.EventDispatcher.prototype.hasEventListener,e.removeEventListener=i.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=i.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,n=r[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;for(var n=[],i=r.length,o=0;i>o;o++)n[o]=r[o];for(var o=0;i>o;o++)n[o].call(this,e)}}}},i.Layers=function(){this.mask=1},i.Layers.prototype={constructor:i.Layers,set:function(e){this.mask=1<<e},enable:function(e){this.mask|=1<<e},toggle:function(e){this.mask^=1<<e},disable:function(e){this.mask&=~(1<<e)},test:function(e){return 0!==(this.mask&e.mask)}},function(e){function t(e,t){return e.distance-t.distance}function r(e,t,n,i){if(e.visible!==!1&&(e.raycast(t,n),i===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,n,!0)}e.Raycaster=function(t,r,n,i){this.ray=new e.Ray(t,r),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})},e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,n){var i=[];return r(e,this,i,n),i.sort(t),i},intersectObjects:function(e,n){var i=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var o=0,a=e.length;a>o;o++)r(e[o],this,i,n);return i.sort(t),i}}}(i),i.Object3D=function(){function e(){o.setFromEuler(n,!1)}function t(){n.setFromQuaternion(o,void 0,!1)}Object.defineProperty(this,"id",{value:i.Object3DIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.Object3D.DefaultUp.clone();var r=new i.Vector3,n=new i.Euler,o=new i.Quaternion,a=new i.Vector3(1,1,1);n.onChange(e),o.onChange(t),Object.defineProperties(this,{position:{enumerable:!0,value:r},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:o},scale:{enumerable:!0,value:a},modelViewMatrix:{value:new i.Matrix4},normalMatrix:{value:new i.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new i.Matrix4,this.matrixWorld=new i.Matrix4,this.matrixAutoUpdate=i.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new i.Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},i.Object3D.DefaultUp=new i.Vector3(0,1,0),i.Object3D.DefaultMatrixAutoUpdate=!0,i.Object3D.prototype={constructor:i.Object3D,applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new i.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new i.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translateX:function(){var e=new i.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new i.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new i.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new i.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new i.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e instanceof i.Object3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,e.dispatchEvent({type:"added"}),this.children.push(e)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var r=this.children.indexOf(e);-1!==r&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(r,1))},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;n>r;r++){var i=this.children[r],o=i.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(e){var t=e||new i.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new i.Vector3,t=new i.Vector3;return function(r){var n=r||new i.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldRotation:function(){var e=new i.Quaternion;return function(t){var r=t||new i.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new i.Vector3,t=new i.Quaternion;return function(r){var n=r||new i.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(){var e=new i.Quaternion;return function(t){var r=t||new i.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,n=t.length;n>r;r++)t[r].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,r=0,n=t.length;n>r;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}var r=void 0===e,n={};r&&(e={geometries:{},materials:{},textures:{},images:{}},n.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var i={};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),i.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),i.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),i.material=this.material.uuid),this.children.length>0){i.children=[];for(var o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(r){var a=t(e.geometries),s=t(e.materials),h=t(e.textures),c=t(e.images);a.length>0&&(n.geometries=a),s.length>0&&(n.materials=s),h.length>0&&(n.textures=h),c.length>0&&(n.images=c)}return n.object=i,n},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var r=0;r<e.children.length;r++){var n=e.children[r];this.add(n.clone())}return this}},i.EventDispatcher.prototype.apply(i.Object3D.prototype),i.Object3DIdCount=0,i.Face3=function(e,t,r,n,o,a){this.a=e,this.b=t,this.c=r,this.normal=n instanceof i.Vector3?n:new i.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=o instanceof i.Color?o:new i.Color,this.vertexColors=Array.isArray(o)?o:[],this.materialIndex=void 0!==a?a:0},i.Face3.prototype={constructor:i.Face3,clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;r>t;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,r=e.vertexColors.length;r>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},i.Face4=function(e,t,r,n,o,a,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new i.Face3(e,t,r,o,a,s)},i.BufferAttribute=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.BufferAttribute.prototype={constructor:i.BufferAttribute,get count(){return this.array.length/this.itemSize},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var n=0,i=this.itemSize;i>n;n++)this.array[e+n]=t.array[r+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),a=new i.Color),t[r++]=a.r,t[r++]=a.g,t[r++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;i>n;n++){var o=e[n];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),a=new i.Vector2),t[r++]=a.x,t[r++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),a=new i.Vector3),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,o=e.length;o>n;n++){var a=e[n];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),a=new i.Vector4),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=i,this},clone:function(){return(new this.constructor).copy(this)}},i.Int8Attribute=function(e,t){return new i.BufferAttribute(new Int8Array(e),t)},i.Uint8Attribute=function(e,t){return new i.BufferAttribute(new Uint8Array(e),t)},i.Uint8ClampedAttribute=function(e,t){return new i.BufferAttribute(new Uint8ClampedArray(e),t)},i.Int16Attribute=function(e,t){return new i.BufferAttribute(new Int16Array(e),t)},i.Uint16Attribute=function(e,t){return new i.BufferAttribute(new Uint16Array(e),t)},i.Int32Attribute=function(e,t){return new i.BufferAttribute(new Int32Array(e),t)},i.Uint32Attribute=function(e,t){return new i.BufferAttribute(new Uint32Array(e),t)},i.Float32Attribute=function(e,t){return new i.BufferAttribute(new Float32Array(e),t)},i.Float64Attribute=function(e,t){return new i.BufferAttribute(new Float64Array(e),t)},i.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new i.BufferAttribute(e,t).setDynamic(!0)},i.InstancedBufferAttribute=function(e,t,r){i.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},i.InstancedBufferAttribute.prototype=Object.create(i.BufferAttribute.prototype),i.InstancedBufferAttribute.prototype.constructor=i.InstancedBufferAttribute,i.InstancedBufferAttribute.prototype.copy=function(e){return i.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBuffer=function(e,t){this.uuid=i.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},i.InterleavedBuffer.prototype={constructor:i.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var n=0,i=this.stride;i>n;n++)this.array[e+n]=t.array[r+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},i.InstancedInterleavedBuffer=function(e,t,r){i.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},i.InstancedInterleavedBuffer.prototype=Object.create(i.InterleavedBuffer.prototype),i.InstancedInterleavedBuffer.prototype.constructor=i.InstancedInterleavedBuffer,i.InstancedInterleavedBuffer.prototype.copy=function(e){return i.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},i.InterleavedBufferAttribute=function(e,t,r){this.uuid=i.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},i.InterleavedBufferAttribute.prototype={constructor:i.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.count},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=i,this}},i.Geometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},i.Geometry.prototype={constructor:i.Geometry,applyMatrix:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;n>r;r++){var o=this.vertices[r];o.applyMatrix4(e)}for(var r=0,n=this.faces.length;n>r;r++){var a=this.faces[r];a.normal.applyMatrix3(t).normalize();for(var s=0,h=a.vertexNormals.length;h>s;s++)a.vertexNormals[s].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,r,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,r,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){function t(e,t,n){var o=void 0!==s?[u[e].clone(),u[t].clone(),u[n].clone()]:[],a=void 0!==h?[r.colors[e].clone(),r.colors[t].clone(),r.colors[n].clone()]:[],f=new i.Face3(e,t,n,o,a);r.faces.push(f),void 0!==c&&r.faceVertexUvs[0].push([d[e].clone(),d[t].clone(),d[n].clone()]),void 0!==l&&r.faceVertexUvs[1].push([p[e].clone(),p[t].clone(),p[n].clone()])}var r=this,n=null!==e.index?e.index.array:void 0,o=e.attributes,a=o.position.array,s=void 0!==o.normal?o.normal.array:void 0,h=void 0!==o.color?o.color.array:void 0,c=void 0!==o.uv?o.uv.array:void 0,l=void 0!==o.uv2?o.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=[],d=[],p=[],f=0,m=0;f<a.length;f+=3,m+=2)r.vertices.push(new i.Vector3(a[f],a[f+1],a[f+2])),void 0!==s&&u.push(new i.Vector3(s[f],s[f+1],s[f+2])),void 0!==h&&r.colors.push(new i.Color(h[f],h[f+1],h[f+2])),void 0!==c&&d.push(new i.Vector2(c[m],c[m+1])),void 0!==l&&p.push(new i.Vector2(l[m],l[m+1]));if(void 0!==n){var v=e.groups;if(v.length>0)for(var f=0;f<v.length;f++)for(var g=v[f],y=g.start,b=g.count,m=y,x=y+b;x>m;m+=3)t(n[m],n[m+1],n[m+2]);else for(var f=0;f<n.length;f+=3)t(n[f],n[f+1],n[f+2])}else for(var f=0;f<a.length/3;f+=3)t(f,f+1,f+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,n=new i.Matrix4;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix(n),this},computeFaceNormals:function(){for(var e=new i.Vector3,t=new i.Vector3,r=0,n=this.faces.length;n>r;r++){var o=this.faces[r],a=this.vertices[o.a],s=this.vertices[o.b],h=this.vertices[o.c];e.subVectors(h,s),t.subVectors(a,s),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){var t,r,n,o,a,s;for(s=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)s[t]=new i.Vector3;if(e){var h,c,l,u=new i.Vector3,d=new i.Vector3;for(n=0,o=this.faces.length;o>n;n++)a=this.faces[n],h=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),d.subVectors(h,c),u.cross(d),s[a.a].add(u),s[a.b].add(u),s[a.c].add(u)}else for(n=0,o=this.faces.length;o>n;n++)a=this.faces[n],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(t=0,r=this.vertices.length;r>t;t++)s[t].normalize();for(n=0,o=this.faces.length;o>n;n++){a=this.faces[n];var p=a.vertexNormals;3===p.length?(p[0].copy(s[a.a]),p[1].copy(s[a.b]),p[2].copy(s[a.c])):(p[0]=s[a.a].clone(),p[1]=s[a.b].clone(),p[2]=s[a.c].clone())}},computeMorphNormals:function(){var e,t,r,n,o;for(r=0,n=this.faces.length;n>r;r++)for(o=this.faces[r],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var a=new i.Geometry;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s,h,c=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(r=0,n=this.faces.length;n>r;r++)s=new i.Vector3,h={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3},c.push(s),l.push(h)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,h;for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],s=u.faceNormals[r],h=u.vertexNormals[r],s.copy(o.normal),h.a.copy(o.vertexNormals[0]),h.b.copy(o.vertexNormals[1]),h.c.copy(o.vertexNormals[2])}for(r=0,n=this.faces.length;n>r;r++)o=this.faces[r],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,n=t.length;n>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof i.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var n,o=this.vertices.length,a=this.vertices,s=e.vertices,h=this.faces,c=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(n=(new i.Matrix3).getNormalMatrix(t));for(var d=0,p=s.length;p>d;d++){var f=s[d],m=f.clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(d=0,p=c.length;p>d;d++){var v,g,y,b=c[d],x=b.vertexNormals,w=b.vertexColors;v=new i.Face3(b.a+o,b.b+o,b.c+o),v.normal.copy(b.normal),void 0!==n&&v.normal.applyMatrix3(n).normalize();for(var M=0,_=x.length;_>M;M++)g=x[M].clone(),void 0!==n&&g.applyMatrix3(n).normalize(),v.vertexNormals.push(g);v.color.copy(b.color);for(var M=0,_=w.length;_>M;M++)y=w[M],v.vertexColors.push(y.clone());v.materialIndex=b.materialIndex+r,h.push(v)}for(d=0,p=u.length;p>d;d++){var E=u[d],A=[];if(void 0!==E){for(var M=0,_=E.length;_>M;M++)A.push(E[M].clone());l.push(A)}}},mergeMesh:function(e){return e instanceof i.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,n,i,o,a,s,h={},c=[],l=[],u=4,d=Math.pow(10,u);for(r=0,n=this.vertices.length;n>r;r++)e=this.vertices[r],t=Math.round(e.x*d)+"_"+Math.round(e.y*d)+"_"+Math.round(e.z*d),void 0===h[t]?(h[t]=r,c.push(this.vertices[r]),l[r]=c.length-1):l[r]=l[h[t]];var p=[];for(r=0,n=this.faces.length;n>r;r++){i=this.faces[r],i.a=l[i.a],i.b=l[i.b],i.c=l[i.c],o=[i.a,i.b,i.c];for(var f=-1,m=0;3>m;m++)if(o[m]===o[(m+1)%3]){f=m,p.push(r);break}}for(r=p.length-1;r>=0;r--){var v=p[r];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(v,1)}var g=this.vertices.length-c.length;return this.vertices=c,g},sortFacesByMaterialIndex:function(){function e(e,t){return e.materialIndex-t.materialIndex}for(var t=this.faces,r=t.length,n=0;r>n;n++)t[n]._id=n;t.sort(e);var i,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===r&&(i=[]),s&&s.length===r&&(o=[]);for(var n=0;r>n;n++){var h=t[n]._id;i&&i.push(a[h]),o&&o.push(s[h])}i&&(this.faceVertexUvs[0]=i),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==d[t]?d[t]:(d[t]=u.length/3,u.push(e.x,e.y,e.z),d[t])}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==f[t]?f[t]:(f[t]=p.length,p.push(e.getHex()),f[t])}function n(e){var t=e.x.toString()+e.y.toString();return void 0!==v[t]?v[t]:(v[t]=m.length/2,m.push(e.x,e.y),v[t])}var i={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(i[a]=o[a]);return i}for(var s=[],h=0;h<this.vertices.length;h++){var c=this.vertices[h];s.push(c.x,c.y,c.z)}for(var l=[],u=[],d={},p=[],f={},m=[],v={},h=0;h<this.faces.length;h++){var g=this.faces[h],y=!0,b=!1,x=void 0!==this.faceVertexUvs[0][h],w=g.normal.length()>0,M=g.vertexNormals.length>0,_=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,A=0;if(A=e(A,0,0),A=e(A,1,y),A=e(A,2,b),A=e(A,3,x),A=e(A,4,w),A=e(A,5,M),A=e(A,6,_),A=e(A,7,E),l.push(A),l.push(g.a,g.b,g.c),l.push(g.materialIndex),x){var S=this.faceVertexUvs[0][h];l.push(n(S[0]),n(S[1]),n(S[2]))}if(w&&l.push(t(g.normal)),M){var C=g.vertexNormals;l.push(t(C[0]),t(C[1]),t(C[2]))}if(_&&l.push(r(g.color)),E){var T=g.vertexColors;l.push(r(T[0]),r(T[1]),r(T[2]))}}return i.data={},i.data.vertices=s,i.data.normals=u,p.length>0&&(i.data.colors=p),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){return(new i.Geometry).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,n=t.length;n>r;r++)this.vertices.push(t[r].clone());for(var i=e.faces,r=0,n=i.length;n>r;r++)this.faces.push(i[r].clone());for(var r=0,n=e.faceVertexUvs.length;n>r;r++){var o=e.faceVertexUvs[r];void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var a=0,s=o.length;s>a;a++){for(var h=o[a],c=[],l=0,u=h.length;u>l;l++){var d=h[l];c.push(d.clone())}this.faceVertexUvs[r].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Geometry.prototype),i.GeometryIdCount=0,i.DirectGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1},i.DirectGeometry.prototype={constructor:i.DirectGeometry,computeBoundingBox:i.Geometry.prototype.computeBoundingBox,computeBoundingSphere:i.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.");
  
  },computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){for(var t,r,n=[],i=e.faces,o=0;o<i.length;o++){var a=i[o];a.materialIndex!==r&&(r=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,n.push(t)),t={start:3*o,materialIndex:r})}void 0!==t&&(t.count=3*o-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,r=e.faces,n=e.vertices,o=e.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,h=e.morphTargets,c=h.length;if(c>0){t=[];for(var l=0;c>l;l++)t[l]=[];this.morphTargets.position=t}var u,d=e.morphNormals,p=d.length;if(p>0){u=[];for(var l=0;p>l;l++)u[l]=[];this.morphTargets.normal=u}for(var f=e.skinIndices,m=e.skinWeights,v=f.length===n.length,g=m.length===n.length,l=0;l<r.length;l++){var y=r[l];this.vertices.push(n[y.a],n[y.b],n[y.c]);var b=y.vertexNormals;if(3===b.length)this.normals.push(b[0],b[1],b[2]);else{var x=y.normal;this.normals.push(x,x,x)}var w=y.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var M=y.color;this.colors.push(M,M,M)}if(a===!0){var _=o[0][l];void 0!==_?this.uvs.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new i.Vector2,new i.Vector2,new i.Vector2))}if(s===!0){var _=o[1][l];void 0!==_?this.uvs2.push(_[0],_[1],_[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new i.Vector2,new i.Vector2,new i.Vector2))}for(var E=0;c>E;E++){var A=h[E].vertices;t[E].push(A[y.a],A[y.b],A[y.c])}for(var E=0;p>E;E++){var S=d[E].vertexNormals[l];u[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.DirectGeometry.prototype),i.BufferGeometry=function(){Object.defineProperty(this,"id",{value:i.GeometryIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}},i.BufferGeometry.prototype={constructor:i.BufferGeometry,getIndex:function(){return this.index},setIndex:function(e){this.index=e},addAttribute:function(e,t){return t instanceof i.BufferAttribute==!1&&t instanceof i.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new i.BufferAttribute(arguments[1],arguments[2]))):"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):void(this.attributes[e]=t)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){delete this.attributes[e]},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var n=(new i.Matrix3).getNormalMatrix(e);n.applyToVector3Array(r.array),r.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new i.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeTranslation(t,r,n),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,n){return void 0===e&&(e=new i.Matrix4),e.makeScale(t,r,n),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new i.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof i.Points||e instanceof i.Line){var r=new i.Float32Attribute(3*t.vertices.length,3),n=new i.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(t.vertices)),this.addAttribute("color",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var o=new i.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",o.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof i.Mesh&&t instanceof i.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof i.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}if(t.verticesNeedUpdate===!0){var n=this.attributes.position;void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var n=this.attributes.normal;void 0!==n&&(n.copyVector3sArray(t.normals),n.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var n=this.attributes.color;void 0!==n&&(n.copyColorsArray(t.colors),n.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var n=this.attributes.uv;void 0!==n&&(n.copyVector2sArray(t.uvs),n.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var n=this.attributes.lineDistance;void 0!==n&&(n.copyArray(t.lineDistances),n.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new i.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.addAttribute("normal",new i.BufferAttribute(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.addAttribute("color",new i.BufferAttribute(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var o=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new i.BufferAttribute(o,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new i.BufferAttribute(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var s=e.vertices.length>65535?Uint32Array:Uint16Array,h=new s(3*e.indices.length);this.setIndex(new i.BufferAttribute(h,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var c in e.morphTargets){for(var l=[],u=e.morphTargets[c],d=0,p=u.length;p>d;d++){var f=u[d],m=new i.Float32Attribute(3*f.length,3);l.push(m.copyVector3sArray(f))}this.morphAttributes[c]=l}if(e.skinIndices.length>0){var v=new i.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new i.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){var e=new i.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var t=this.attributes.position.array;if(t){var r=this.boundingBox;r.makeEmpty();for(var n=0,o=t.length;o>n;n+=3)e.fromArray(t,n),r.expandByPoint(e)}(void 0===t||0===t.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var e=new i.Box3,t=new i.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere);var r=this.attributes.position.array;if(r){e.makeEmpty();for(var n=this.boundingSphere.center,o=0,a=r.length;a>o;o+=3)t.fromArray(r,o),e.expandByPoint(t);e.center(n);for(var s=0,o=0,a=r.length;a>o;o+=3)t.fromArray(r,o),s=Math.max(s,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new i.BufferAttribute(new Float32Array(n.length),3));else for(var o=t.normal.array,a=0,s=o.length;s>a;a++)o[a]=0;var h,c,l,u=t.normal.array,d=new i.Vector3,p=new i.Vector3,f=new i.Vector3,m=new i.Vector3,v=new i.Vector3;if(e){var g=e.array;0===r.length&&this.addGroup(0,g.length);for(var y=0,b=r.length;b>y;++y)for(var x=r[y],w=x.start,M=x.count,a=w,s=w+M;s>a;a+=3)h=3*g[a+0],c=3*g[a+1],l=3*g[a+2],d.fromArray(n,h),p.fromArray(n,c),f.fromArray(n,l),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[h]+=m.x,u[h+1]+=m.y,u[h+2]+=m.z,u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var a=0,s=n.length;s>a;a+=9)d.fromArray(n,a),p.fromArray(n,a+3),f.fromArray(n,a+6),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[a]=m.x,u[a+1]=m.y,u[a+2]=m.z,u[a+3]=m.x,u[a+4]=m.y,u[a+5]=m.z,u[a+6]=m.x,u[a+7]=m.y,u[a+8]=m.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e instanceof i.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var n in r)if(void 0!==e.attributes[n])for(var o=r[n],a=o.array,s=e.attributes[n],h=s.array,c=s.itemSize,l=0,u=c*t;l<h.length;l++,u++)a[u]=h[l];return this},normalizeNormals:function(){for(var e,t,r,n,i=this.attributes.normal.array,o=0,a=i.length;a>o;o+=3)e=i[o],t=i[o+1],r=i[o+2],n=1/Math.sqrt(e*e+t*t+r*r),i[o]*=n,i[o+1]*=n,i[o+2]*=n},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var n=this.index;if(null!==n){var i=Array.prototype.slice.call(n.array);e.data.index={type:n.array.constructor.name,array:i}}var o=this.attributes;for(var r in o){var a=o[r],i=Array.prototype.slice.call(a.array);e.data.attributes[r]={itemSize:a.itemSize,type:a.array.constructor.name,array:i}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var h=this.boundingSphere;return null!==h&&(e.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),e},clone:function(){return(new i.BufferGeometry).copy(this)},copy:function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var n in r){var i=r[n];this.addAttribute(n,i.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.BufferGeometry.prototype),i.BufferGeometry.MaxIndex=65535,i.InstancedBufferGeometry=function(){i.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},i.InstancedBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.InstancedBufferGeometry.prototype.constructor=i.InstancedBufferGeometry,i.InstancedBufferGeometry.prototype.addGroup=function(e,t,r){this.groups.push({start:e,count:t,instances:r})},i.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.setIndex(t.clone());var r=e.attributes;for(var n in r){var i=r[n];this.addAttribute(n,i.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count,h.instances)}return this},i.EventDispatcher.prototype.apply(i.InstancedBufferGeometry.prototype),i.Uniform=function(e,t){this.type=e,this.value=t,this.dynamic=!1},i.Uniform.prototype={constructor:i.Uniform,onUpdate:function(e){return this.dynamic=!0,this.onUpdateCallback=e,this}},i.AnimationClip=function(e,t,r){this.name=e||i.Math.generateUUID(),this.tracks=r,this.duration=void 0!==t?t:-1,this.duration<0&&this.resetDuration(),this.trim(),this.optimize()},i.AnimationClip.prototype={constructor:i.AnimationClip,resetDuration:function(){for(var e=this.tracks,t=0,r=0,n=e.length;r!==n;++r){var i=this.tracks[r];t=Math.max(t,i.times[i.times.length-1])}this.duration=t},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},Object.assign(i.AnimationClip,{parse:function(e){for(var t=[],r=e.tracks,n=1/(e.fps||1),o=0,a=r.length;o!==a;++o)t.push(i.KeyframeTrack.parse(r[o]).scale(n));return new i.AnimationClip(e.name,e.duration,t)},toJSON:function(e){for(var t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t},o=0,a=r.length;o!==a;++o)t.push(i.KeyframeTrack.toJSON(r[o]));return n},CreateFromMorphTargetSequence:function(e,t,r){for(var n=t.length,o=[],a=0;n>a;a++){var s=[],h=[];s.push((a+n-1)%n,a,(a+1)%n),h.push(0,1,0);var c=i.AnimationUtils.getKeyframeOrder(s);s=i.AnimationUtils.sortedArray(s,1,c),h=i.AnimationUtils.sortedArray(h,1,c),0===s[0]&&(s.push(n),h.push(h[0])),o.push(new i.NumberKeyframeTrack(".morphTargetInfluences["+t[a].name+"]",s,h).scale(1/r))}return new i.AnimationClip(e,-1,o)},findByName:function(e,t){for(var r=0;r<e.length;r++)if(e[r].name===t)return e[r];return null},CreateClipsFromMorphTargetSequences:function(e,t){for(var r={},n=/^([\w-]*?)([\d]+)$/,o=0,a=e.length;a>o;o++){var s=e[o],h=s.name.match(n);if(h&&h.length>1){var c=h[1],l=r[c];l||(r[c]=l=[]),l.push(s)}}var u=[];for(var c in r)u.push(i.AnimationClip.CreateFromMorphTargetSequence(c,r[c],t));return u},parseAnimation:function(e,t){if(!e)return console.error("  no animation in JSONLoader data"),null;for(var r=function(e,t,r,n,o){if(0!==r.length){var a=[],s=[];i.AnimationUtils.flattenJSON(r,a,s,n),0!==a.length&&o.push(new e(t,a,s))}},n=[],o=e.name||"default",a=e.length||-1,s=e.fps||30,h=e.hierarchy||[],c=0;c<h.length;c++){var l=h[c].keys;if(l&&0!=l.length)if(l[0].morphTargets){for(var u={},d=0;d<l.length;d++)if(l[d].morphTargets)for(var p=0;p<l[d].morphTargets.length;p++)u[l[d].morphTargets[p]]=-1;for(var f in u){for(var m=[],v=[],p=0;p!==l[d].morphTargets.length;++p){var g=l[d];m.push(g.time),v.push(g.morphTarget===f?1:0)}n.push(new i.NumberKeyframeTrack(".morphTargetInfluence["+f+"]",m,v))}a=u.length*(s||1)}else{var y=".bones["+t[c].name+"]";r(i.VectorKeyframeTrack,y+".position",l,"pos",n),r(i.QuaternionKeyframeTrack,y+".quaternion",l,"rot",n),r(i.VectorKeyframeTrack,y+".scale",l,"scl",n)}}if(0===n.length)return null;var b=new i.AnimationClip(o,a,n);return b}}),i.AnimationMixer=function(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1},i.AnimationMixer.prototype={constructor:i.AnimationMixer,clipAction:function(e,t){var r,n=t||this._root,o=n.uuid,a="string"==typeof e?e:e.name,s=e!==a?e:null,h=this._actionsByClip[a];if(void 0!==h){var c=h.actionByRoot[o];if(void 0!==c)return c;if(r=h.knownActions[0],s=r._clip,e!==a&&e!==s)throw new Error("Different clips with the same name detected!")}if(null===s)return null;var l=new i.AnimationMixer._Action(this,s,t);return this._bindAction(l,r),this._addInactiveAction(l,a,o),l},existingAction:function(e,t){var r=t||this._root,n=r.uuid,i="string"==typeof e?e:e.name,o=this._actionsByClip[i];return void 0!==o?o.actionByRoot[n]||null:null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,r=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(var i=0;i!==n;++i)r[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,n=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,a=0;a!==r;++a){var s=t[a];s.enabled&&s._update(n,e,i,o)}for(var h=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)h[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,r=e.name,n=this._actionsByClip,i=n[r];if(void 0!==i){for(var o=i.knownActions,a=0,s=o.length;a!==s;++a){var h=o[a];this._deactivateAction(h);var c=h._cacheIndex,l=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,l._cacheIndex=c,t[c]=l,t.pop(),this._removeInactiveBindingsForAction(h)}delete n[r]}},uncacheRoot:function(e){var t=e.uuid,r=this._actionsByClip;for(var n in r){var i=r[n].actionByRoot,o=i[t];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[t];if(void 0!==s)for(var h in s){var c=s[h];c.restoreOriginalState(),this._removeInactiveBinding(c)}},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}},i.EventDispatcher.prototype.apply(i.AnimationMixer.prototype),i.AnimationMixer._Action=function(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null;for(var n=t.tracks,o=n.length,a=new Array(o),s={endingStart:i.ZeroCurvatureEnding,endingEnd:i.ZeroCurvatureEnding},h=0;h!==o;++h){var c=n[h].createInterpolant(null);a[h]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=i.LoopRepeat,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0},i.AnimationMixer._Action.prototype={constructor:i.AnimationMixer._Action,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){this._startTime;return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){this._mixer;if(e.fadeOut(t),this.fadeIn(t),r){var n=this._clip.duration,i=e._clip.duration,o=i/n,a=n/i;e.warp(1,o,t),this.warp(a,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._currentTimeScale,0,e)},warp:function(e,t,r){var n=this._mixer,i=n.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,h=o.sampleValues;return s[0]=i,s[1]=i+r,h[0]=e/a,h[1]=t/a,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,n){var i=this._startTime;if(null!==i){var o=(e-i)*r;if(0>o||0===r)return;this._startTime=null,t=r*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var h=this._interpolants,c=this._propertyBindings,l=0,u=h.length;l!==u;++l)h[l].evaluate(a),c[l].accumulate(n,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.pause=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var r=this._clip.duration,n=this.loop,o=this._loopCount,a=!1;switch(n){case i.LoopOnce:case i.LoopOnceClamp:if(-1===o&&(this.loopCount=0,this._setEndings(!0,!0,!1)),t>=r)t=r;else{if(!(0>t))break;t=0}this.clampWhenFinished?this.pause=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1});break;case i.LoopPingPong:a=!0;case i.LoopRepeat:if(-1===o&&(e>0?(o=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=r||0>t){var s=Math.floor(t/r);t-=r*s,o+=Math.abs(s);var h=this.repetitions-o;if(0>h){this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});break}if(0===h){var c=0>e;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=o,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}if(n===i.LoopPingPong&&1===(1&o))return this.time=t,r-t}return this.time=t,t},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=i.ZeroSlopeEnding,n.endingEnd=i.ZeroSlopeEnding):(n.endingStart=e?this.zeroSlopeAtStart?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding,n.endingEnd=t?this.zeroSlopeAtEnd?i.ZeroSlopeEnding:i.ZeroCurvatureEnding:i.WrapAroundEnding)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,o=this._weightInterpolant;null===o&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=r,this}},Object.assign(i.AnimationMixer.prototype,{_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,o=n.length,a=e._propertyBindings,s=e._interpolants,h=r.uuid,c=this._bindingsByRootAndName,l=c[h];void 0===l&&(l={},c[h]=l);for(var u=0;u!==o;++u){var d=n[u],p=d.name,f=l[p];if(void 0!==f)a[u]=f;else{if(f=a[u],void 0!==f){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,h,p));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;f=new i.PropertyMixer(i.PropertyBinding.create(r,p,m),d.ValueTypeName,d.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,h,p),a[u]=f}s[u].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.name,n=this._actionsByClip[r];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,r,t)}for(var i=e._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,r){var n=this._actions,i=this._actionsByClip,o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;var i=e._clip.name,o=this._actionsByClip,a=o[i],s=a.knownActions,h=s[s.length-1],c=e._byClipCacheIndex;h._byClipCacheIndex=c,s[c]=h,s.pop(),e._byClipCacheIndex=null;var l=a.actionByRoot,u=(t._localRoot||this._root).uuid;delete l[u],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0===--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_addInactiveBinding:function(e,t,r){var n=this._bindingsByRootAndName,i=n[t],o=this._bindings;void 0===i&&(i={},n[t]=i),i[r]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,n=r.rootNode.uuid,i=r.path,o=this._bindingsByRootAndName,a=o[n],s=t[t.length-1],h=e._cacheIndex;s._cacheIndex=h,t[h]=s,t.pop(),delete a[i];e:{for(var c in a)break e;delete o[n]}},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&(r=new i.LinearInterpolant(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,i=t[n];e.__cacheIndex=n,t[n]=e,i.__cacheIndex=r,t[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1)}),i.AnimationObjectGroup=function(){this.uuid=i.Math.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}},i.AnimationObjectGroup.prototype={constructor:i.AnimationObjectGroup,add:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,h=s.length,c=0,l=arguments.length;c!==l;++c){var u=arguments[c],d=u.uuid,p=n[d];if(void 0===p){p=t++,n[d]=p,e.push(u);for(var f=0,m=h;f!==m;++f)s[f].push(new i.PropertyBinding(u,o[f],a[f]))}else if(r>p){var v=e[p],g=--r,y=e[g];n[y.uuid]=p,e[p]=y,n[d]=g,e[g]=u;for(var f=0,m=h;f!==m;++f){var b=s[f],x=b[g],w=b[p];b[p]=x,void 0===w&&(w=new i.PropertyBinding(u,o[f],a[f])),b[g]=w}}else e[p]!==v&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=r},remove:function(){for(var e=this._objects,t=(e.length,this.nCachedObjects_),r=this._indicesByUUID,n=this._bindings,i=n.length,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],h=s.uuid,c=r[h];if(void 0!==c&&c>=t){var l=t++,u=e[l];r[u.uuid]=c,e[c]=u,r[h]=l,e[l]=s;for(var d=0,p=i;d!==p;++d){var f=n[d],m=f[l],v=f[c];f[c]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,o=i.length,a=0,s=arguments.length;a!==s;++a){var h=arguments[a],c=h.uuid,l=n[c];if(void 0!==l)if(delete n[c],r>l){var u=--r,d=e[u],p=--t,f=e[p];n[d.uuid]=l,e[l]=d,n[f.uuid]=u,e[u]=f,e.pop();for(var m=0,v=o;m!==v;++m){var g=i[m],y=g[u],b=g[p];g[l]=y,g[u]=b,g.pop()}}else{var p=--t,f=e[p];n[f.uuid]=l,e[l]=f,e.pop();for(var m=0,v=o;m!==v;++m){var g=i[m];g[l]=g[p],g.pop()}}}this.nCachedObjects_=r},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],o=this._bindings;if(void 0!==n)return o[n];var a=this._paths,s=this._parsedPaths,h=this._objects,c=h.length,l=this.nCachedObjects_,u=new Array(c);n=o.length,r[e]=n,a.push(e),s.push(t),o.push(u);for(var d=l,p=h.length;d!==p;++d){var f=h[d];u[d]=new i.PropertyBinding(f,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var n=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a],h=e[a];t[h]=r,o[r]=s,o.pop(),i[r]=i[a],i.pop(),n[r]=n[a],n.pop()}}},i.AnimationUtils={arraySlice:function(e,t,r){return i.AnimationUtils.isTypedArray(e)?new e.constructor(e.subarray(t,r)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(t,r){return e[t]-e[r]}for(var r=e.length,n=new Array(r),i=0;i!==r;++i)n[i]=i;return n.sort(t),n},sortedArray:function(e,t,r){for(var n=e.length,i=new e.constructor(n),o=0,a=0;a!==n;++o)for(var s=r[o]*t,h=0;h!==t;++h)i[a++]=e[s+h];return i},flattenJSON:function(e,t,r,n){for(var i=1,o=e[0];void 0!==o&&void 0===o[n];)o=e[i++];if(void 0!==o){var a=o[n];if(void 0!==a)if(Array.isArray(a)){do a=o[n],void 0!==a&&(t.push(o.time),r.push.apply(r,a)),o=e[i++];while(void 0!==o)}else if(void 0!==a.toArray){do a=o[n],void 0!==a&&(t.push(o.time),a.toArray(r,r.length)),o=e[i++];while(void 0!==o)}else do a=o[n],void 0!==a&&(t.push(o.time),r.push(a)),o=e[i++];while(void 0!==o)}}},i.KeyframeTrack=function(e,t,r,n){if(void 0===e)throw new Error("track name is undefined");if(void 0===t||0===t.length)throw new Error("no keyframes in track named "+e);this.name=e,this.times=i.AnimationUtils.convertArray(t,this.TimeBufferType),this.values=i.AnimationUtils.convertArray(r,this.ValueBufferType),
  this.setInterpolation(n||this.DefaultInterpolation),this.validate(),this.optimize()},i.KeyframeTrack.prototype={constructor:i.KeyframeTrack,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodDiscrete:function(e){return new i.DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new i.LinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new i.CubicInterpolant(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t=void 0;switch(e){case i.InterpolateDiscrete:t=this.InterpolantFactoryMethodDiscrete;break;case i.InterpolateLinear:t=this.InterpolantFactoryMethodLinear;break;case i.InterpolateSmooth:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(r)}this.createInterpolant=t},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return i.InterpolateDiscrete;case this.InterpolantFactoryMethodLinear:return i.InterpolateLinear;case this.InterpolantFactoryMethodSmooth:return i.InterpolateSmooth}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,o=0,a=1;a!==n;++a)r[a]<=e&&++o;for(var s=0,a=n-2;0!==a&&r[a]>=t;--a)++s;if(o+s!==0){var h=o,c=n-s-o;this.times=i.AnimationUtils.arraySlice(r,h,c);var l=this.values,u=this.getValueSize();this.values=i.AnimationUtils.arraySlice(l,h*u,c*u)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("invalid value size in track",this),e=!1);var r=this.times,n=this.values,o=r.length;0===o&&(console.error("track is empty",this),e=!1);for(var a=null,s=0;s!==o;s++){var h=r[s];if("number"==typeof h&&isNaN(h)){console.error("time is not a valid number",this,s,h),e=!1;break}if(null!==a&&a>h){console.error("out of order keys",this,s,h,a),e=!1;break}a=h}if(void 0!==n&&i.AnimationUtils.isTypedArray(n))for(var s=0,c=n.length;s!==c;++s){var l=n[s];if(isNaN(l)){console.error("value is not a valid number",this,s,l),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,r=this.getValueSize(),n=1,o=1,a=e.length-1;a>=o;++o){var s=!1,h=e[o],c=e[o+1];if(h!==c&&(1!==o||h!==h[0]))for(var l=o*r,u=l-r,d=l+r,p=0;p!==r;++p){var f=t[l+p];if(f!==t[u+p]||f!==t[d+p]){s=!0;break}}if(s){if(o!==n){e[n]=e[o];for(var m=o*r,v=n*r,p=0;p!==r;++p)t[v+p]=t[m+p]}++n}}return n!==e.length&&(this.times=i.AnimationUtils.arraySlice(e,0,n),this.values=i.AnimationUtils.arraySlice(t,0,n*r)),this}},Object.assign(i.KeyframeTrack,{parse:function(e){if(void 0===e.type)throw new Error("track type undefined, can not parse");var t=i.KeyframeTrack._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){console.warn("legacy JSON format detected, converting");var r=[],n=[];i.AnimationUtils.flattenJSON(e.keys,r,n,"value"),e.times=r,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,r=e.constructor;if(void 0!==r.toJSON)t=r.toJSON(e);else{t={name:e.name,times:i.AnimationUtils.convertArray(e.times,Array),values:i.AnimationUtils.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return i.NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return i.VectorKeyframeTrack;case"color":return i.ColorKeyframeTrack;case"quaternion":return i.QuaternionKeyframeTrack;case"bool":case"boolean":return i.BooleanKeyframeTrack;case"string":return i.StringKeyframeTrack}throw new Error("Unsupported typeName: "+e)}}),i.PropertyBinding=function(e,t,r){this.path=t,this.parsedPath=r||i.PropertyBinding.parseTrackName(t),this.node=i.PropertyBinding.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e},i.PropertyBinding.prototype={constructor:i.PropertyBinding,getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,o=t.propertyIndex;if(e||(e=i.PropertyBinding.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("  trying to update node for track: "+this.path+" but it wasn't found.");if(r){var a=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("  can not bind to material as node does not have a material",this);if(!e.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);e=e.skeleton.bones;for(var s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[r])return void console.error("  can not bind to objectName of node, undefined",this);e=e[r]}if(void 0!==a){if(void 0===e[a])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,e);e=e[a]}}var h=e[n];if(!h){var c=t.nodeName;return void console.error("  trying to update property for track: "+c+"."+n+" but it wasn't found.",e)}var l=this.Versioning.None;void 0!==e.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var u=this.BindingType.Direct;if(void 0!==o){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!e.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var s=0;s<this.node.geometry.morphTargets.length;s++)if(e.geometry.morphTargets[s].name===o){o=s;break}}u=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=o}else void 0!==h.fromArray&&void 0!==h.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=h):void 0!==h.length?(u=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=n;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(i.PropertyBinding.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:i.PropertyBinding.prototype.getValue,_setValue_unbound:i.PropertyBinding.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)e[t++]=r[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.node[this.propertyName]=e[t]},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.node[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),i.PropertyBinding.Composite=function(e,t,r){var n=r||i.PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)},i.PropertyBinding.Composite.prototype={constructor:i.PropertyBinding.Composite,getValue:function(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},i.PropertyBinding.create=function(e,t,r){return e instanceof i.AnimationObjectGroup?new i.PropertyBinding.Composite(e,t,r):new i.PropertyBinding(e,t,r)},i.PropertyBinding.parseTrackName=function(e){var t=/^(([\w]+\/)*)([\w-\d]+)?(\.([\w]+)(\[([\w\d\[\]\_. ]+)\])?)?(\.([\w.]+)(\[([\w\d\[\]\_. ]+)\])?)$/,r=t.exec(e);if(!r)throw new Error("cannot parse trackName at all: "+e);r.index===t.lastIndex&&t.lastIndex++;var n={nodeName:r[3],objectName:r[5],objectIndex:r[7],propertyName:r[9],propertyIndex:r[11]};if(null===n.propertyName||0===n.propertyName.length)throw new Error("can not parse propertyName from trackName: "+e);return n},i.PropertyBinding.findNode=function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=function(e){for(var r=0;r<e.bones.length;r++){var n=e.bones[r];if(n.name===t)return n}return null},n=r(e.skeleton);if(n)return n}if(e.children){var i=function(e){for(var r=0;r<e.length;r++){var n=e[r];if(n.name===t||n.uuid===t)return n;var o=i(n.children);if(o)return o}return null},o=i(e.children);if(o)return o}return null},i.PropertyMixer=function(e,t,r){this.binding=e,this.valueSize=r;var n,i=Float64Array;switch(t){case"quaternion":n=this._slerp;break;case"string":case"bool":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(4*r),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0},i.PropertyMixer.prototype={constructor:i.PropertyMixer,accumulate:function(e,t){var r=this.buffer,n=this.valueSize,i=e*n+n,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==n;++a)r[i+a]=r[a];o=t}else{o+=t;var s=t/o;this._mixBufferRegion(r,i,0,s,n)}this.cumulativeWeight=o},apply:function(e){var t=this.valueSize,r=this.buffer,n=e*t+t,i=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,1>i){var a=3*t;this._mixBufferRegion(r,n,a,1-i,t)}for(var s=t,h=t+t;s!==h;++s)if(r[s]!==r[s+t]){o.setValue(r,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,r=this.valueSize,n=3*r;e.getValue(t,n);for(var i=r,o=n;i!==o;++i)t[i]=t[n+i%r];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,r,n,i){if(n>=.5)for(var o=0;o!==i;++o)e[t+o]=e[r+o]},_slerp:function(e,t,r,n){i.Quaternion.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var o=1-n,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[r+a]*n}}},i.BooleanKeyframeTrack=function(e,t,r){i.KeyframeTrack.call(this,e,t,r)},i.BooleanKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.BooleanKeyframeTrack,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:i.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.NumberKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.NumberKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.NumberKeyframeTrack,ValueTypeName:"number"}),i.QuaternionKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.QuaternionKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.QuaternionKeyframeTrack,ValueTypeName:"quaternion",DefaultInterpolation:i.InterpolateLinear,InterpolantFactoryMethodLinear:function(e){return new i.QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),i.StringKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.StringKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.StringKeyframeTrack,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:i.IntepolateDiscrete,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),i.VectorKeyframeTrack=function(e,t,r,n){i.KeyframeTrack.call(this,e,t,r,n)},i.VectorKeyframeTrack.prototype=Object.assign(Object.create(i.KeyframeTrack.prototype),{constructor:i.VectorKeyframeTrack,ValueTypeName:"vector"}),i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filter=null},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.constructor=i.Audio,i.Audio.prototype.getOutput=function(){return this.gain},i.Audio.prototype.load=function(e){var t=new i.AudioBuffer(this.context);return t.load(e),this.setBuffer(t),this},i.Audio.prototype.setNodeSource=function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},i.Audio.prototype.setBuffer=function(e){var t=this;return e.onReady(function(e){t.source.buffer=e,t.sourceType="buffer",t.autoplay&&t.play()}),this},i.Audio.prototype.play=function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()},i.Audio.prototype.pause=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=this.context.currentTime))},i.Audio.prototype.stop=function(){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),void(this.startTime=0))},i.Audio.prototype.connect=function(){null!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.getOutput())):this.source.connect(this.getOutput())},i.Audio.prototype.disconnect=function(){null!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.getOutput())):this.source.disconnect(this.getOutput())},i.Audio.prototype.getFilter=function(){return this.filter},i.Audio.prototype.setFilter=function(e){void 0===e&&(e=null),this.isPlaying===!0?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},i.Audio.prototype.setPlaybackRate=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,void(this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate)))},i.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},i.Audio.prototype.onEnded=function(){this.isPlaying=!1},i.Audio.prototype.setLoop=function(e){return this.hasPlaybackControl===!1?void console.warn("THREE.Audio: this Audio has no playback control."):void(this.source.loop=e)},i.Audio.prototype.getLoop=function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},i.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},i.Audio.prototype.getVolume=function(){return this.gain.gain.value},i.AudioAnalyser=function(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)},i.AudioAnalyser.prototype={constructor:i.AudioAnalyser,getData:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},i.AudioBuffer=function(e){this.context=e,this.ready=!1,this.readyCallbacks=[]},i.AudioBuffer.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){t.context.decodeAudioData(this.response,function(e){t.buffer=e,t.ready=!0;for(var r=0;r<t.readyCallbacks.length;r++)t.readyCallbacks[r](t.buffer);t.readyCallbacks=[]})},r.send(),this},i.AudioBuffer.prototype.onReady=function(e){this.ready?e(this.buffer):this.readyCallbacks.push(e)},i.PositionalAudio=function(e){i.Audio.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)},i.PositionalAudio.prototype=Object.create(i.Audio.prototype),i.PositionalAudio.prototype.constructor=i.PositionalAudio,i.PositionalAudio.prototype.getOutput=function(){return this.panner},i.PositionalAudio.prototype.setRefDistance=function(e){this.panner.refDistance=e},i.PositionalAudio.prototype.getRefDistance=function(){return this.panner.refDistance},i.PositionalAudio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},i.PositionalAudio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},i.PositionalAudio.prototype.setDistanceModel=function(e){this.panner.distanceModel=e},i.PositionalAudio.prototype.getDistanceModel=function(){return this.panner.distanceModel},i.PositionalAudio.prototype.setMaxDistance=function(e){this.panner.maxDistance=e},i.PositionalAudio.prototype.getMaxDistance=function(){return this.panner.maxDistance},i.PositionalAudio.prototype.updateMatrixWorld=function(){var e=new i.Vector3;return function(t){i.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),i.AudioListener=function(){i.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null},i.AudioListener.prototype=Object.create(i.Object3D.prototype),i.AudioListener.prototype.constructor=i.AudioListener,i.AudioListener.prototype.getInput=function(){return this.gain},i.AudioListener.prototype.removeFilter=function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},i.AudioListener.prototype.setFilter=function(e){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},i.AudioListener.prototype.getFilter=function(){return this.filter},i.AudioListener.prototype.setMasterVolume=function(e){this.gain.gain.value=e},i.AudioListener.prototype.getMasterVolume=function(){return this.gain.gain.value},i.AudioListener.prototype.updateMatrixWorld=function(){var e=new i.Vector3,t=new i.Quaternion,r=new i.Vector3,n=new i.Vector3;return function(o){i.Object3D.prototype.updateMatrixWorld.call(this,o);var a=this.context.listener,s=this.up;this.matrixWorld.decompose(e,t,r),n.set(0,0,-1).applyQuaternion(t),a.setPosition(e.x,e.y,e.z),a.setOrientation(n.x,n.y,n.z,s.x,s.y,s.z)}}(),i.Camera=function(){i.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new i.Matrix4,this.projectionMatrix=new i.Matrix4},i.Camera.prototype=Object.create(i.Object3D.prototype),i.Camera.prototype.constructor=i.Camera,i.Camera.prototype.getWorldDirection=function(){var e=new i.Quaternion;return function(t){var r=t||new i.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),i.Camera.prototype.lookAt=function(){var e=new i.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),i.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},i.Camera.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},i.CubeCamera=function(e,t,r){i.Object3D.call(this),this.type="CubeCamera";var n=90,o=1,a=new i.PerspectiveCamera(n,o,e,t);a.up.set(0,-1,0),a.lookAt(new i.Vector3(1,0,0)),this.add(a);var s=new i.PerspectiveCamera(n,o,e,t);s.up.set(0,-1,0),s.lookAt(new i.Vector3(-1,0,0)),this.add(s);var h=new i.PerspectiveCamera(n,o,e,t);h.up.set(0,0,1),h.lookAt(new i.Vector3(0,1,0)),this.add(h);var c=new i.PerspectiveCamera(n,o,e,t);c.up.set(0,0,-1),c.lookAt(new i.Vector3(0,-1,0)),this.add(c);var l=new i.PerspectiveCamera(n,o,e,t);l.up.set(0,-1,0),l.lookAt(new i.Vector3(0,0,1)),this.add(l);var u=new i.PerspectiveCamera(n,o,e,t);u.up.set(0,-1,0),u.lookAt(new i.Vector3(0,0,-1)),this.add(u);var d={format:i.RGBFormat,magFilter:i.LinearFilter,minFilter:i.LinearFilter};this.renderTarget=new i.WebGLRenderTargetCube(r,r,d),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,n=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,a,r),r.activeCubeFace=1,e.render(t,s,r),r.activeCubeFace=2,e.render(t,h,r),r.activeCubeFace=3,e.render(t,c,r),r.activeCubeFace=4,e.render(t,l,r),r.texture.generateMipmaps=n,r.activeCubeFace=5,e.render(t,u,r),e.setRenderTarget(null)}},i.CubeCamera.prototype=Object.create(i.Object3D.prototype),i.CubeCamera.prototype.constructor=i.CubeCamera,i.OrthographicCamera=function(e,t,r,n,o,a){i.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=void 0!==o?o:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},i.OrthographicCamera.prototype=Object.create(i.Camera.prototype),i.OrthographicCamera.prototype.constructor=i.OrthographicCamera,i.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,n+t,n-t,this.near,this.far)},i.OrthographicCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},i.OrthographicCamera.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},i.PerspectiveCamera=function(e,t,r,n){i.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype=Object.create(i.Camera.prototype),i.PerspectiveCamera.prototype.constructor=i.PerspectiveCamera,i.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*i.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,n,i,o){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=n,this.width=i,this.height=o,this.updateProjectionMatrix()},i.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=i.Math.radToDeg(2*Math.atan(Math.tan(.5*i.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,r=Math.tan(i.Math.degToRad(.5*e))*this.near,n=-r,o=t*n,a=t*r,s=Math.abs(a-o),h=Math.abs(r-n);this.projectionMatrix.makeFrustum(o+this.x*s/this.fullWidth,o+(this.x+this.width)*s/this.fullWidth,r-(this.y+this.height)*h/this.fullHeight,r-this.y*h/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},i.PerspectiveCamera.prototype.copy=function(e){return i.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},i.PerspectiveCamera.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},i.StereoCamera=function(e,t,r,n){i.PerspectiveCamera.call(this,e,t,r,n),this.type="StereoCamera",this.focalLength=125,this.cameraL=new i.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new i.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1},i.StereoCamera.prototype=Object.create(i.PerspectiveCamera.prototype),i.StereoCamera.prototype.constructor=i.StereoCamera,i.StereoCamera.prototype.updateMatrixWorld=function(){var e,t,r,n,o,a=new i.Matrix4,s=new i.Matrix4;return function(h){i.Object3D.prototype.updateMatrixWorld.call(this,h);var c=e!==this.focalLength||t!==this.fov||r!==this.aspect||n!==this.near||o!==this.far;if(c){e=this.focalLength,t=this.fov,r=this.aspect,n=this.near,o=this.far;var l,u,d=this.projectionMatrix.clone(),p=e/30*.5,f=p*n/e,m=n*Math.tan(i.Math.degToRad(.5*t));s.elements[12]=-p,a.elements[12]=p,l=-m*r+f,u=m*r+f,d.elements[0]=2*n/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraL.projectionMatrix.copy(d),l=-m*r-f,u=m*r-f,d.elements[0]=2*n/(u-l),d.elements[8]=(u+l)/(u-l),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(this.matrixWorld).multiply(s),this.cameraR.matrixWorld.copy(this.matrixWorld).multiply(a)}}(),i.Light=function(e,t){i.Object3D.call(this),this.type="Light",this.color=new i.Color(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0},i.Light.prototype=Object.create(i.Object3D.prototype),i.Light.prototype.constructor=i.Light,i.Light.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},i.Light.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.exponent&&(t.object.exponent=this.exponent),t},i.LightShadow=function(e){this.camera=e,this.bias=0,this.darkness=1,this.mapSize=new i.Vector2(512,512),this.map=null,this.matrix=null},i.LightShadow.prototype={constructor:i.LightShadow,copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.darkness=e.darkness,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)}},i.AmbientLight=function(e,t){i.Light.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0},i.AmbientLight.prototype=Object.create(i.Light.prototype),i.AmbientLight.prototype.constructor=i.AmbientLight,i.DirectionalLight=function(e,t){i.Light.call(this,e,t),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.shadow=new i.LightShadow(new i.OrthographicCamera(-5,5,5,-5,.5,500))},i.DirectionalLight.prototype=Object.create(i.Light.prototype),i.DirectionalLight.prototype.constructor=i.DirectionalLight,i.DirectionalLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.HemisphereLight=function(e,t,r){i.Light.call(this,e,r),this.type="HemisphereLight",this.castShadow=void 0,this.position.set(0,1,0),this.updateMatrix(),this.groundColor=new i.Color(t)},i.HemisphereLight.prototype=Object.create(i.Light.prototype),i.HemisphereLight.prototype.constructor=i.HemisphereLight,i.HemisphereLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this},i.PointLight=function(e,t,r,n){i.Light.call(this,e,t),this.type="PointLight",this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(90,1,.5,500))},i.PointLight.prototype=Object.create(i.Light.prototype),i.PointLight.prototype.constructor=i.PointLight,i.PointLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},i.SpotLight=function(e,t,r,n,o,a){i.Light.call(this,e,t),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new i.Object3D,this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI/3,this.exponent=void 0!==o?o:10,this.decay=void 0!==a?a:1,this.shadow=new i.LightShadow(new i.PerspectiveCamera(50,1,.5,500))},i.SpotLight.prototype=Object.create(i.Light.prototype),i.SpotLight.prototype.constructor=i.SpotLight,i.SpotLight.prototype.copy=function(e){return i.Light.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.exponent=e.exponent,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},i.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},i.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},i.Loader.prototype={constructor:i.Loader,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,r){for(var n=[],i=0;i<e.length;++i)n[i]=this.createMaterial(e[i],t,r);return n},createMaterial:function(){var e,t,r;return function(n,o,a){function s(e,r,n,s,c){var l,u=o+e,d=i.Loader.Handlers.get(u);null!==d?l=d.load(u):(t.setCrossOrigin(a),l=t.load(u)),void 0!==r&&(l.repeat.fromArray(r),1!==r[0]&&(l.wrapS=i.RepeatWrapping),1!==r[1]&&(l.wrapT=i.RepeatWrapping)),void 0!==n&&l.offset.fromArray(n),void 0!==s&&("repeat"===s[0]&&(l.wrapS=i.RepeatWrapping),"mirror"===s[0]&&(l.wrapS=i.MirroredRepeatWrapping),"repeat"===s[1]&&(l.wrapT=i.RepeatWrapping),"mirror"===s[1]&&(l.wrapT=i.MirroredRepeatWrapping)),void 0!==c&&(l.anisotropy=c);var p=i.Math.generateUUID();return h[p]=l,p}void 0===e&&(e=new i.Color),void 0===t&&(t=new i.TextureLoader),void 0===r&&(r=new i.MaterialLoader);var h={},c={uuid:i.Math.generateUUID(),type:"MeshLambertMaterial"};for(var l in n){var u=n[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=u;break;case"blending":c.blending=i[u];break;case"colorAmbient":console.warn("THREE.Loader.createMaterial: colorAmbient is no longer supported");break;case"colorDiffuse":c.color=e.fromArray(u).getHex();break;case"colorSpecular":c.specular=e.fromArray(u).getHex();break;case"colorEmissive":c.emissive=e.fromArray(u).getHex();break;case"specularCoef":c.shininess=u;break;case"shading":"basic"===u.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===u.toLowerCase()&&(c.type="MeshPhongMaterial");
  
  break;case"mapDiffuse":c.map=s(u,n.mapDiffuseRepeat,n.mapDiffuseOffset,n.mapDiffuseWrap,n.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapLight":c.lightMap=s(u,n.mapLightRepeat,n.mapLightOffset,n.mapLightWrap,n.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=s(u,n.mapAORepeat,n.mapAOOffset,n.mapAOWrap,n.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=s(u,n.mapBumpRepeat,n.mapBumpOffset,n.mapBumpWrap,n.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=u;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=s(u,n.mapNormalRepeat,n.mapNormalOffset,n.mapNormalWrap,n.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[u,u];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=s(u,n.mapSpecularRepeat,n.mapSpecularOffset,n.mapSpecularWrap,n.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapAlpha":c.alphaMap=s(u,n.mapAlphaRepeat,n.mapAlphaOffset,n.mapAlphaWrap,n.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=i.BackSide;break;case"doubleSided":c.side=i.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=u;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[l]=u;break;case"vertexColors":u===!0&&(c.vertexColors=i.VertexColors),"face"===u&&(c.vertexColors=i.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,u)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,c.opacity<1&&(c.transparent=!0),r.setTextures(h),r.parse(c)}}()},i.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,n=t.length;n>r;r+=2){var i=t[r],o=t[r+1];if(i.test(e))return o}return null}},i.XHRLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.XHRLoader.prototype={constructor:i.XHRLoader,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e);var o=this,a=i.Cache.get(e);if(void 0!==a)return t&&setTimeout(function(){t(a)},0),a;var s=new XMLHttpRequest;return s.overrideMimeType("text/plain"),s.open("GET",e,!0),s.addEventListener("load",function(r){var a=r.target.response;i.Cache.add(e,a),200===this.status?(t&&t(a),o.manager.itemEnd(e)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),t&&t(a),o.manager.itemEnd(e)):(n&&n(r),o.manager.itemError(e))},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),o.manager.itemStart(e),s},setPath:function(e){this.path=e},setResponseType:function(e){this.responseType=e},setWithCredentials:function(e){this.withCredentials=e}},i.ImageLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.ImageLoader.prototype={constructor:i.ImageLoader,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e);var o=this,a=i.Cache.get(e);if(void 0!==a)return o.manager.itemStart(e),t?setTimeout(function(){t(a),o.manager.itemEnd(e)},0):o.manager.itemEnd(e),a;var s=document.createElement("img");return s.addEventListener("load",function(){i.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){n&&n(t),o.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),o.manager.itemStart(e),s.src=e,s},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:i.DefaultLoadingManager,this.withCredentials=!1},i.JSONLoader.prototype={constructor:i.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,r,n){var o=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:i.Loader.prototype.extractUrlBase(e),s=new i.XHRLoader(this.manager);s.setWithCredentials(this.withCredentials),s.load(e,function(r){var n=JSON.parse(r),i=n.metadata;if(void 0!==i){var s=i.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}}var h=o.parse(n,a);t(h.geometry,h.materials)},r,n)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function r(t){function r(e,t){return e&1<<t}var n,o,a,h,c,l,u,d,p,f,m,v,g,y,b,x,w,M,_,E,A,S,C,T,L,k,R,P=e.faces,D=e.vertices,O=e.normals,N=e.colors,I=0;if(void 0!==e.uvs){for(n=0;n<e.uvs.length;n++)e.uvs[n].length&&I++;for(n=0;I>n;n++)s.faceVertexUvs[n]=[]}for(h=0,c=D.length;c>h;)M=new i.Vector3,M.x=D[h++]*t,M.y=D[h++]*t,M.z=D[h++]*t,s.vertices.push(M);for(h=0,c=P.length;c>h;)if(f=P[h++],m=r(f,0),v=r(f,1),g=r(f,3),y=r(f,4),b=r(f,5),x=r(f,6),w=r(f,7),m){if(E=new i.Face3,E.a=P[h],E.b=P[h+1],E.c=P[h+3],A=new i.Face3,A.a=P[h+1],A.b=P[h+2],A.c=P[h+3],h+=4,v&&(p=P[h++],E.materialIndex=p,A.materialIndex=p),a=s.faces.length,g)for(n=0;I>n;n++)for(T=e.uvs[n],s.faceVertexUvs[n][a]=[],s.faceVertexUvs[n][a+1]=[],o=0;4>o;o++)d=P[h++],k=T[2*d],R=T[2*d+1],L=new i.Vector2(k,R),2!==o&&s.faceVertexUvs[n][a].push(L),0!==o&&s.faceVertexUvs[n][a+1].push(L);if(y&&(u=3*P[h++],E.normal.set(O[u++],O[u++],O[u]),A.normal.copy(E.normal)),b)for(n=0;4>n;n++)u=3*P[h++],C=new i.Vector3(O[u++],O[u++],O[u]),2!==n&&E.vertexNormals.push(C),0!==n&&A.vertexNormals.push(C);if(x&&(l=P[h++],S=N[l],E.color.setHex(S),A.color.setHex(S)),w)for(n=0;4>n;n++)l=P[h++],S=N[l],2!==n&&E.vertexColors.push(new i.Color(S)),0!==n&&A.vertexColors.push(new i.Color(S));s.faces.push(E),s.faces.push(A)}else{if(_=new i.Face3,_.a=P[h++],_.b=P[h++],_.c=P[h++],v&&(p=P[h++],_.materialIndex=p),a=s.faces.length,g)for(n=0;I>n;n++)for(T=e.uvs[n],s.faceVertexUvs[n][a]=[],o=0;3>o;o++)d=P[h++],k=T[2*d],R=T[2*d+1],L=new i.Vector2(k,R),s.faceVertexUvs[n][a].push(L);if(y&&(u=3*P[h++],_.normal.set(O[u++],O[u++],O[u])),b)for(n=0;3>n;n++)u=3*P[h++],C=new i.Vector3(O[u++],O[u++],O[u]),_.vertexNormals.push(C);if(x&&(l=P[h++],_.color.setHex(N[l])),w)for(n=0;3>n;n++)l=P[h++],_.vertexColors.push(new i.Color(N[l]));s.faces.push(_)}}function n(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,n=e.skinWeights.length;n>r;r+=t){var o=e.skinWeights[r],a=t>1?e.skinWeights[r+1]:0,h=t>2?e.skinWeights[r+2]:0,c=t>3?e.skinWeights[r+3]:0;s.skinWeights.push(new i.Vector4(o,a,h,c))}if(e.skinIndices)for(var r=0,n=e.skinIndices.length;n>r;r+=t){var l=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,d=t>2?e.skinIndices[r+2]:0,p=t>3?e.skinIndices[r+3]:0;s.skinIndices.push(new i.Vector4(l,u,d,p))}s.bones=e.bones,s.bones&&s.bones.length>0&&(s.skinWeights.length!==s.skinIndices.length||s.skinIndices.length!==s.vertices.length)&&console.warn("When skinning, number of vertices ("+s.vertices.length+"), skinIndices ("+s.skinIndices.length+"), and skinWeights ("+s.skinWeights.length+") should match.")}function o(t){if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;n>r;r++){s.morphTargets[r]={},s.morphTargets[r].name=e.morphTargets[r].name,s.morphTargets[r].vertices=[];for(var o=s.morphTargets[r].vertices,a=e.morphTargets[r].vertices,h=0,c=a.length;c>h;h+=3){var l=new i.Vector3;l.x=a[h]*t,l.y=a[h+1]*t,l.z=a[h+2]*t,o.push(l)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=s.faces,d=e.morphColors[0].colors,r=0,n=u.length;n>r;r++)u[r].color.fromArray(d,3*r)}}function a(){var t=[],r=[];void 0!==e.animation&&r.push(e.animation),void 0!==e.animations&&(e.animations.length?r=r.concat(e.animations):r.push(e.animations));for(var n=0;n<r.length;n++){var o=i.AnimationClip.parseAnimation(r[n],s.bones);o&&t.push(o)}if(s.morphTargets){var a=i.AnimationClip.CreateClipsFromMorphTargetSequences(s.morphTargets,10);t=t.concat(a)}t.length>0&&(s.animations=t)}var s=new i.Geometry,h=void 0!==e.scale?1/e.scale:1;if(r(h),n(),o(h),a(),s.computeFaceNormals(),s.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:s};var c=i.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:s,materials:c}}},i.LoadingManager=function(e,t,r){var n=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,i===!1&&void 0!==n.onStart&&n.onStart(e,o,a),i=!0},this.itemEnd=function(e){o++,void 0!==n.onProgress&&n.onProgress(e,o,a),o===a&&(i=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)}},i.DefaultLoadingManager=new i.LoadingManager,i.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.BufferGeometryLoader.prototype={constructor:i.BufferGeometryLoader,load:function(e,t,r,n){var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},parse:function(e){var t=new i.BufferGeometry,r=e.data.index;if(void 0!==r){var n=new self[r.type](r.array);t.setIndex(new i.BufferAttribute(n,1))}var o=e.data.attributes;for(var a in o){var s=o[a],n=new self[s.type](s.array);t.addAttribute(a,new i.BufferAttribute(n,s.itemSize))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var c=0,l=h.length;c!==l;++c){var u=h[c];t.addGroup(u.start,u.count,u.materialIndex)}var d=e.data.boundingSphere;if(void 0!==d){var p=new i.Vector3;void 0!==d.center&&p.fromArray(d.center),t.boundingSphere=new i.Sphere(p,d.radius)}return t}},i.MaterialLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.textures={}},i.MaterialLoader.prototype={constructor:i.MaterialLoader,load:function(e,t,r,n){var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,n)},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new i[e.type];if(void 0!==e.uuid&&(t.uuid=e.uuid),void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.roughness&&(t.roughness=e.roughness),void 0!==e.metalness&&(t.metalness=e.metalness),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(t.colorWrite=e.colorWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),void 0!==e.normalScale){var r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),t.normalScale=(new i.Vector2).fromArray(r)}if(void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(t.roughnessMap=this.getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(t.metalnessMap=this.getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(t.emissiveMap=this.getTexture(e.emissiveMap)),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=i.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var n=0,o=e.materials.length;o>n;n++)t.materials.push(this.parse(e.materials[n]));return t}},i.ObjectLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this.texturePath=""},i.ObjectLoader.prototype={constructor:i.ObjectLoader,load:function(e,t,r,n){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this,a=new i.XHRLoader(o.manager);a.load(e,function(e){o.parse(JSON.parse(e),t)},r,n)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),n=this.parseImages(e.images,function(){void 0!==t&&t(a)}),i=this.parseTextures(e.textures,n),o=this.parseMaterials(e.materials,i),a=this.parseObject(e.object,r,o);return e.animations&&(a.animations=this.parseAnimations(e.animations)),(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new i.JSONLoader,n=new i.BufferGeometryLoader,o=0,a=e.length;a>o;o++){var s,h=e[o];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new i[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new i.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleBufferGeometry":s=new i.CircleBufferGeometry(h.radius,h.segments,h.thetaStart,h.thetaLength);break;case"CircleGeometry":s=new i.CircleGeometry(h.radius,h.segments,h.thetaStart,h.thetaLength);break;case"CylinderGeometry":s=new i.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"SphereGeometry":s=new i.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"SphereBufferGeometry":s=new i.SphereBufferGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"DodecahedronGeometry":s=new i.DodecahedronGeometry(h.radius,h.detail);break;case"IcosahedronGeometry":s=new i.IcosahedronGeometry(h.radius,h.detail);break;case"OctahedronGeometry":s=new i.OctahedronGeometry(h.radius,h.detail);break;case"TetrahedronGeometry":s=new i.TetrahedronGeometry(h.radius,h.detail);break;case"RingGeometry":s=new i.RingGeometry(h.innerRadius,h.outerRadius,h.thetaSegments,h.phiSegments,h.thetaStart,h.thetaLength);break;case"TorusGeometry":s=new i.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":s=new i.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case"BufferGeometry":s=n.parse(h);break;case"Geometry":s=r.parse(h.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+h.type+'"');continue}s.uuid=h.uuid,void 0!==h.name&&(s.name=h.name),t[h.uuid]=s}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var n=new i.MaterialLoader;n.setTextures(t);for(var o=0,a=e.length;a>o;o++){var s=n.parse(e[o]);r[s.uuid]=s}}return r},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=i.AnimationClip.parse(e[r]);t.push(n)}return t},parseImages:function(e,t){function r(e){return n.manager.itemStart(e),s.load(e,function(){n.manager.itemEnd(e)})}var n=this,o={};if(void 0!==e&&e.length>0){var a=new i.LoadingManager(t),s=new i.ImageLoader(a);s.setCrossOrigin(this.crossOrigin);for(var h=0,c=e.length;c>h;h++){var l=e[h],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.texturePath+l.url;o[l.uuid]=r(u)}}return o},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),i[e])}var n={};if(void 0!==e)for(var o=0,a=e.length;a>o;o++){var s=e[o];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var h=new i.Texture(t[s.image]);h.needsUpdate=!0,h.uuid=s.uuid,void 0!==s.name&&(h.name=s.name),void 0!==s.mapping&&(h.mapping=r(s.mapping)),void 0!==s.offset&&(h.offset=new i.Vector2(s.offset[0],s.offset[1])),void 0!==s.repeat&&(h.repeat=new i.Vector2(s.repeat[0],s.repeat[1])),void 0!==s.minFilter&&(h.minFilter=r(s.minFilter)),void 0!==s.magFilter&&(h.magFilter=r(s.magFilter)),void 0!==s.anisotropy&&(h.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(h.wrapS=r(s.wrap[0]),h.wrapT=r(s.wrap[1])),n[s.uuid]=h}return n},parseObject:function(){var e=new i.Matrix4;return function(t,r,n){function o(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]}function a(e){return void 0===e?void 0:(void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e])}var s;switch(t.type){case"Scene":s=new i.Scene;break;case"PerspectiveCamera":s=new i.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":s=new i.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":s=new i.AmbientLight(t.color,t.intensity);break;case"DirectionalLight":s=new i.DirectionalLight(t.color,t.intensity);break;case"PointLight":s=new i.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":s=new i.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":s=new i.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":var h=o(t.geometry),c=a(t.material);s=h.bones&&h.bones.length>0?new i.SkinnedMesh(h,c):new i.Mesh(h,c);break;case"LOD":s=new i.LOD;break;case"Line":s=new i.Line(o(t.geometry),a(t.material),t.mode);break;case"PointCloud":case"Points":s=new i.Points(o(t.geometry),a(t.material));break;case"Sprite":s=new i.Sprite(a(t.material));break;case"Group":s=new i.Group;break;default:s=new i.Object3D}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.children)for(var l in t.children)s.add(this.parseObject(t.children[l],r,n));if("LOD"===t.type)for(var u=t.levels,d=0;d<u.length;d++){var p=u[d],l=s.getObjectByProperty("uuid",p.object);void 0!==l&&s.addLevel(l,p.distance)}return s}}()},i.TextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.TextureLoader.prototype={constructor:i.TextureLoader,load:function(e,t,r,n){var o=new i.Texture,a=new i.ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){o.image=e,o.needsUpdate=!0,void 0!==t&&t(o)},r,n),o},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.CubeTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager},i.CubeTextureLoader.prototype={constructor:i.CubeTextureLoader,load:function(e,t,r,n){function o(r){s.load(e[r],function(e){a.images[r]=e,h++,6===h&&(a.needsUpdate=!0,t&&t(a))},void 0,n)}var a=new i.CubeTexture([]),s=new i.ImageLoader;s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var h=0,c=0;c<e.length;++c)o(c);return a},setCrossOrigin:function(e){this.crossOrigin=e},setPath:function(e){this.path=e}},i.DataTextureLoader=i.BinaryTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.BinaryTextureLoader.prototype={constructor:i.BinaryTextureLoader,load:function(e,t,r,n){var o=this,a=new i.DataTexture,s=new i.XHRLoader(this.manager);return s.setResponseType("arraybuffer"),s.load(e,function(e){var r=o._parser(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:i.ClampToEdgeWrapping,a.wrapT=void 0!==r.wrapT?r.wrapT:i.ClampToEdgeWrapping,a.magFilter=void 0!==r.magFilter?r.magFilter:i.LinearFilter,a.minFilter=void 0!==r.minFilter?r.minFilter:i.LinearMipMapLinearFilter,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps),1===r.mipmapCount&&(a.minFilter=i.LinearFilter),a.needsUpdate=!0,t&&t(a,r))},r,n),a}},i.CompressedTextureLoader=function(e){this.manager=void 0!==e?e:i.DefaultLoadingManager,this._parser=null},i.CompressedTextureLoader.prototype={constructor:i.CompressedTextureLoader,load:function(e,t,r,n){function o(o){c.load(e[o],function(e){var r=a._parser(e,!0);s[o]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},l+=1,6===l&&(1===r.mipmapCount&&(h.minFilter=i.LinearFilter),h.format=r.format,h.needsUpdate=!0,t&&t(h))},r,n)}var a=this,s=[],h=new i.CompressedTexture;h.image=s;var c=new i.XHRLoader(this.manager);if(c.setPath(this.path),c.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,d=e.length;d>u;++u)o(u);else c.load(e,function(e){var r=a._parser(e,!0);if(r.isCubemap)for(var n=r.mipmaps.length/r.mipmapCount,o=0;n>o;o++){s[o]={mipmaps:[]};for(var c=0;c<r.mipmapCount;c++)s[o].mipmaps.push(r.mipmaps[o*r.mipmapCount+c]),s[o].format=r.format,s[o].width=r.width,s[o].height=r.height}else h.image.width=r.width,h.image.height=r.height,h.mipmaps=r.mipmaps;1===r.mipmapCount&&(h.minFilter=i.LinearFilter),h.format=r.format,h.needsUpdate=!0,t&&t(h)},r,n);return h},setPath:function(e){this.path=e}},i.Material=function(){Object.defineProperty(this,"id",{value:i.MaterialIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.type="Material",this.side=i.FrontSide,this.opacity=1,this.transparent=!1,this.blending=i.NormalBlending,this.blendSrc=i.SrcAlphaFactor,this.blendDst=i.OneMinusSrcAlphaFactor,this.blendEquation=i.AddEquation,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=i.LessEqualDepth,this.depthTest=!0,this.depthWrite=!0,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},i.Material.prototype={constructor:i.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r){var n=this[t];void 0!==n?n instanceof i.Color?n.set(r):n instanceof i.Vector3&&r instanceof i.Vector3?n.copy(r):this[t]="overdraw"===t?Number(r):r:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){function t(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}var r=void 0===e;r&&(e={textures:{},images:{}});var n={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color instanceof i.Color&&(n.color=this.color.getHex()),.5!==this.roughness&&(n.roughness=this.roughness),this.metalness>0&&(n.metalness=this.metalness),this.emissive instanceof i.Color&&(n.emissive=this.emissive.getHex()),this.specular instanceof i.Color&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),this.map instanceof i.Texture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap instanceof i.Texture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap instanceof i.Texture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap instanceof i.Texture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap instanceof i.Texture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap instanceof i.Texture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap instanceof i.Texture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap instanceof i.Texture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap instanceof i.Texture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap instanceof i.Texture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap instanceof i.Texture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),void 0!==this.vertexColors&&this.vertexColors!==i.NoColors&&(n.vertexColors=this.vertexColors),void 0!==this.shading&&this.shading!==i.SmoothShading&&(n.shading=this.shading),void 0!==this.blending&&this.blending!==i.NormalBlending&&(n.blending=this.blending),void 0!==this.side&&this.side!==i.FrontSide&&(n.side=this.side),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),r){var o=t(e.textures),a=t(e.images);o.length>0&&(n.textures=o),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.overdraw=e.overdraw,this.visible=e.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.Material.prototype),i.MaterialIdCount=0,i.LineBasicMaterial=function(e){i.Material.call(this),this.type="LineBasicMaterial",this.color=new i.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineBasicMaterial.prototype=Object.create(i.Material.prototype),i.LineBasicMaterial.prototype.constructor=i.LineBasicMaterial,i.LineBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.LineDashedMaterial=function(e){i.Material.call(this),this.type="LineDashedMaterial",this.color=new i.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.LineDashedMaterial.prototype=Object.create(i.Material.prototype),i.LineDashedMaterial.prototype.constructor=i.LineDashedMaterial,i.LineDashedMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.MeshBasicMaterial=function(e){i.Material.call(this),this.type="MeshBasicMaterial",this.color=new i.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},i.MeshBasicMaterial.prototype=Object.create(i.Material.prototype),i.MeshBasicMaterial.prototype.constructor=i.MeshBasicMaterial,i.MeshBasicMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},i.MeshLambertMaterial=function(e){i.Material.call(this),this.type="MeshLambertMaterial",this.color=new i.Color(16777215),this.emissive=new i.Color(0),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshLambertMaterial.prototype=Object.create(i.Material.prototype),i.MeshLambertMaterial.prototype.constructor=i.MeshLambertMaterial,i.MeshLambertMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissiveMap=e.emissiveMap,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,
  this},i.MeshPhongMaterial=function(e){i.Material.call(this),this.type="MeshPhongMaterial",this.color=new i.Color(16777215),this.emissive=new i.Color(0),this.specular=new i.Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=i.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshPhongMaterial.prototype=Object.create(i.Material.prototype),i.MeshPhongMaterial.prototype.constructor=i.MeshPhongMaterial,i.MeshPhongMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissiveMap=e.emissiveMap,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshStandardMaterial=function(e){i.Material.call(this),this.type="MeshStandardMaterial",this.color=new i.Color(16777215),this.roughness=.5,this.metalness=.5,this.emissive=new i.Color(0),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.fog=!0,this.shading=i.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},i.MeshStandardMaterial.prototype=Object.create(i.Material.prototype),i.MeshStandardMaterial.prototype.constructor=i.MeshStandardMaterial,i.MeshStandardMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.emissive.copy(e.emissive),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissiveMap=e.emissiveMap,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},i.MeshDepthMaterial=function(e){i.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},i.MeshDepthMaterial.prototype=Object.create(i.Material.prototype),i.MeshDepthMaterial.prototype.constructor=i.MeshDepthMaterial,i.MeshDepthMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MeshNormalMaterial=function(e){i.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},i.MeshNormalMaterial.prototype=Object.create(i.Material.prototype),i.MeshNormalMaterial.prototype.constructor=i.MeshNormalMaterial,i.MeshNormalMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},i.MultiMaterial=function(e){this.uuid=i.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},i.MultiMaterial.prototype={constructor:i.MultiMaterial,toJSON:function(e){for(var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},r=this.materials,n=0,i=r.length;i>n;n++){var o=r[n].toJSON(e);delete o.metadata,t.materials.push(o)}return t.visible=this.visible,t},clone:function(){for(var e=new this.constructor,t=0;t<this.materials.length;t++)e.materials.push(this.materials[t].clone());return e.visible=this.visible,e}},i.PointsMaterial=function(e){i.Material.call(this),this.type="PointsMaterial",this.color=new i.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=i.NoColors,this.fog=!0,this.setValues(e)},i.PointsMaterial.prototype=Object.create(i.Material.prototype),i.PointsMaterial.prototype.constructor=i.PointsMaterial,i.PointsMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.vertexColors=e.vertexColors,this.fog=e.fog,this},i.ShaderMaterial=function(e){i.Material.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=i.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=i.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))},i.ShaderMaterial.prototype=Object.create(i.Material.prototype),i.ShaderMaterial.prototype.constructor=i.ShaderMaterial,i.ShaderMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=i.UniformsUtils.clone(e.uniforms),this.defines=e.defines,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},i.ShaderMaterial.prototype.toJSON=function(e){var t=i.Material.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},i.RawShaderMaterial=function(e){i.ShaderMaterial.call(this,e),this.type="RawShaderMaterial"},i.RawShaderMaterial.prototype=Object.create(i.ShaderMaterial.prototype),i.RawShaderMaterial.prototype.constructor=i.RawShaderMaterial,i.SpriteMaterial=function(e){i.Material.call(this),this.type="SpriteMaterial",this.color=new i.Color(16777215),this.map=null,this.rotation=0,this.fog=!1,this.setValues(e)},i.SpriteMaterial.prototype=Object.create(i.Material.prototype),i.SpriteMaterial.prototype.constructor=i.SpriteMaterial,i.SpriteMaterial.prototype.copy=function(e){return i.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.fog=e.fog,this},i.Texture=function(e,t,r,n,o,a,s,h,c){Object.defineProperty(this,"id",{value:i.TextureIdCount++}),this.uuid=i.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==e?e:i.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:i.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:i.ClampToEdgeWrapping,this.wrapT=void 0!==n?n:i.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:i.LinearFilter,this.minFilter=void 0!==a?a:i.LinearMipMapLinearFilter,this.anisotropy=void 0!==c?c:1,this.format=void 0!==s?s:i.RGBAFormat,this.type=void 0!==h?h:i.UnsignedByteType,this.offset=new i.Vector2(0,0),this.repeat=new i.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.version=0,this.onUpdate=null},i.Texture.DEFAULT_IMAGE=void 0,i.Texture.DEFAULT_MAPPING=i.UVMapping,i.Texture.prototype={constructor:i.Texture,set needsUpdate(e){e===!0&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this},toJSON:function(e){function t(e){var t;return void 0!==e.toDataURL?t=e:(t=document.createElement("canvas"),t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,e.width,e.height)),t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=i.Math.generateUUID()),void 0===e.images[n.uuid]&&(e.images[n.uuid]={uuid:n.uuid,url:t(n)}),r.image=n.uuid}return e.textures[this.uuid]=r,r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===i.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case i.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case i.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case i.MirroredRepeatWrapping:e.x=1===Math.abs(Math.floor(e.x)%2)?Math.ceil(e.x)-e.x:e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case i.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case i.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case i.MirroredRepeatWrapping:e.y=1===Math.abs(Math.floor(e.y)%2)?Math.ceil(e.y)-e.y:e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},i.EventDispatcher.prototype.apply(i.Texture.prototype),i.TextureIdCount=0,i.CanvasTexture=function(e,t,r,n,o,a,s,h,c){i.Texture.call(this,e,t,r,n,o,a,s,h,c),this.needsUpdate=!0},i.CanvasTexture.prototype=Object.create(i.Texture.prototype),i.CanvasTexture.prototype.constructor=i.CanvasTexture,i.CubeTexture=function(e,t,r,n,o,a,s,h,c){t=void 0!==t?t:i.CubeReflectionMapping,i.Texture.call(this,e,t,r,n,o,a,s,h,c),this.images=e,this.flipY=!1},i.CubeTexture.prototype=Object.create(i.Texture.prototype),i.CubeTexture.prototype.constructor=i.CubeTexture,i.CubeTexture.prototype.copy=function(e){return i.Texture.prototype.copy.call(this,e),this.images=e.images,this},i.CompressedTexture=function(e,t,r,n,o,a,s,h,c,l,u){i.Texture.call(this,null,a,s,h,c,l,n,o,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},i.CompressedTexture.prototype=Object.create(i.Texture.prototype),i.CompressedTexture.prototype.constructor=i.CompressedTexture,i.DataTexture=function(e,t,r,n,o,a,s,h,c,l,u){i.Texture.call(this,null,a,s,h,c,l,n,o,u),this.image={data:e,width:t,height:r},this.magFilter=void 0!==c?c:i.NearestFilter,this.minFilter=void 0!==l?l:i.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},i.DataTexture.prototype=Object.create(i.Texture.prototype),i.DataTexture.prototype.constructor=i.DataTexture,i.VideoTexture=function(e,t,r,n,o,a,s,h,c){function l(){requestAnimationFrame(l),e.readyState===e.HAVE_ENOUGH_DATA&&(u.needsUpdate=!0)}i.Texture.call(this,e,t,r,n,o,a,s,h,c),this.generateMipmaps=!1;var u=this;l()},i.VideoTexture.prototype=Object.create(i.Texture.prototype),i.VideoTexture.prototype.constructor=i.VideoTexture,i.Group=function(){i.Object3D.call(this),this.type="Group"},i.Group.prototype=Object.create(i.Object3D.prototype),i.Group.prototype.constructor=i.Group,i.Points=function(e,t){i.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.PointsMaterial({color:16777215*Math.random()})},i.Points.prototype=Object.create(i.Object3D.prototype),i.Points.prototype.constructor=i.Points,i.Points.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,r=new i.Sphere;return function(n,o){function a(e,r){var i=t.distanceSqToPoint(e);if(d>i){var a=t.closestPointToPoint(e);a.applyMatrix4(c);var h=n.ray.origin.distanceTo(a);if(h<n.near||h>n.far)return;o.push({distance:h,distanceToRay:Math.sqrt(i),point:a.clone(),index:r,face:null,object:s})}}var s=this,h=this.geometry,c=this.matrixWorld,l=n.params.Points.threshold;if(null===h.boundingSphere&&h.computeBoundingSphere(),r.copy(h.boundingSphere),r.applyMatrix4(c),n.ray.intersectsSphere(r)!==!1){e.getInverse(c),t.copy(n.ray).applyMatrix4(e);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new i.Vector3;if(h instanceof i.BufferGeometry){var f=h.index,m=h.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,b=g.length;b>y;y++){var x=g[y];p.fromArray(v,3*x),a(p,x)}else for(var y=0,w=v.length/3;w>y;y++)p.fromArray(v,3*y),a(p,y)}else for(var M=h.vertices,y=0,w=M.length;w>y;y++)a(M[y],y)}}}(),i.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new i.LineSegments(e,t)):(i.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new i.Geometry,void(this.material=void 0!==t?t:new i.LineBasicMaterial({color:16777215*Math.random()})))},i.Line.prototype=Object.create(i.Object3D.prototype),i.Line.prototype.constructor=i.Line,i.Line.prototype.raycast=function(){var e=new i.Matrix4,t=new i.Ray,r=new i.Sphere;return function(n,o){var a=n.linePrecision,s=a*a,h=this.geometry,c=this.matrixWorld;if(null===h.boundingSphere&&h.computeBoundingSphere(),r.copy(h.boundingSphere),r.applyMatrix4(c),n.ray.intersectsSphere(r)!==!1){e.getInverse(c),t.copy(n.ray).applyMatrix4(e);var l=new i.Vector3,u=new i.Vector3,d=new i.Vector3,p=new i.Vector3,f=this instanceof i.LineSegments?2:1;if(h instanceof i.BufferGeometry){var m=h.index,v=h.attributes,g=v.position.array;if(null!==m)for(var y=m.array,b=0,x=y.length-1;x>b;b+=f){var w=y[b],M=y[b+1];l.fromArray(g,3*w),u.fromArray(g,3*M);var _=t.distanceSqToSegment(l,u,p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else for(var b=0,x=g.length/3-1;x>b;b+=f){l.fromArray(g,3*b),u.fromArray(g,3*b+3);var _=t.distanceSqToSegment(l,u,p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else if(h instanceof i.Geometry)for(var A=h.vertices,S=A.length,b=0;S-1>b;b+=f){var _=t.distanceSqToSegment(A[b],A[b+1],p,d);if(!(_>s)){p.applyMatrix4(this.matrixWorld);var E=n.ray.origin.distanceTo(p);E<n.near||E>n.far||o.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}}}(),i.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.LineStrip=0,i.LinePieces=1,i.LineSegments=function(e,t){i.Line.call(this,e,t),this.type="LineSegments"},i.LineSegments.prototype=Object.create(i.Line.prototype),i.LineSegments.prototype.constructor=i.LineSegments,i.Mesh=function(e,t){i.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new i.Geometry,this.material=void 0!==t?t:new i.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=i.TrianglesDrawMode,this.updateMorphTargets()},i.Mesh.prototype=Object.create(i.Object3D.prototype),i.Mesh.prototype.constructor=i.Mesh,i.Mesh.prototype.setDrawMode=function(e){this.drawMode=e},i.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},i.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},i.Mesh.prototype.raycast=function(){function e(e,t,r,n,o,a,s){return i.Triangle.barycoordFromPoint(e,t,r,n,v),o.multiplyScalar(v.x),a.multiplyScalar(v.y),s.multiplyScalar(v.z),o.add(a).add(s),o.clone()}function t(e,t,r,n,o,a,s){var h,c=e.material;if(h=c.side===i.BackSide?r.intersectTriangle(a,o,n,!0,s):r.intersectTriangle(n,o,a,c.side!==i.DoubleSide,s),null===h)return null;y.copy(s),y.applyMatrix4(e.matrixWorld);var l=t.ray.origin.distanceTo(y);return l<t.near||l>t.far?null:{distance:l,point:y.clone(),object:e}}function r(r,n,o,a,l,u,d,v){s.fromArray(a,3*u),h.fromArray(a,3*d),c.fromArray(a,3*v);var y=t(r,n,o,s,h,c,g);return y&&(l&&(p.fromArray(l,2*u),f.fromArray(l,2*d),m.fromArray(l,2*v),y.uv=e(g,s,h,c,p,f,m)),y.face=new i.Face3(u,d,v,i.Triangle.normal(s,h,c)),y.faceIndex=u),y}var n=new i.Matrix4,o=new i.Ray,a=new i.Sphere,s=new i.Vector3,h=new i.Vector3,c=new i.Vector3,l=new i.Vector3,u=new i.Vector3,d=new i.Vector3,p=new i.Vector2,f=new i.Vector2,m=new i.Vector2,v=new i.Vector3,g=new i.Vector3,y=new i.Vector3;return function(v,y){var b=this.geometry,x=this.material,w=this.matrixWorld;if(void 0!==x&&(null===b.boundingSphere&&b.computeBoundingSphere(),a.copy(b.boundingSphere),a.applyMatrix4(w),v.ray.intersectsSphere(a)!==!1&&(n.getInverse(w),o.copy(v.ray).applyMatrix4(n),null===b.boundingBox||o.intersectsBox(b.boundingBox)!==!1))){var M,_;if(b instanceof i.BufferGeometry){var E,A,S,C=b.index,T=b.attributes,L=T.position.array;if(void 0!==T.uv&&(M=T.uv.array),null!==C)for(var k=C.array,R=0,P=k.length;P>R;R+=3)E=k[R],A=k[R+1],S=k[R+2],_=r(this,v,o,L,M,E,A,S),_&&(_.faceIndex=Math.floor(R/3),y.push(_));else for(var R=0,P=L.length;P>R;R+=9)E=R/3,A=E+1,S=E+2,_=r(this,v,o,L,M,E,A,S),_&&(_.index=E,y.push(_))}else if(b instanceof i.Geometry){var D,O,N,I=x instanceof i.MeshFaceMaterial,F=I===!0?x.materials:null,V=b.vertices,B=b.faces,U=b.faceVertexUvs[0];U.length>0&&(M=U);for(var z=0,j=B.length;j>z;z++){var G=B[z],H=I===!0?F[G.materialIndex]:x;if(void 0!==H){if(D=V[G.a],O=V[G.b],N=V[G.c],H.morphTargets===!0){var W=b.morphTargets,q=this.morphTargetInfluences;s.set(0,0,0),h.set(0,0,0),c.set(0,0,0);for(var X=0,Y=W.length;Y>X;X++){var Q=q[X];if(0!==Q){var K=W[X].vertices;s.addScaledVector(l.subVectors(K[G.a],D),Q),h.addScaledVector(u.subVectors(K[G.b],O),Q),c.addScaledVector(d.subVectors(K[G.c],N),Q)}}s.add(D),h.add(O),c.add(N),D=s,O=h,N=c}if(_=t(this,v,o,D,O,N,g)){if(M){var $=M[z];p.copy($[0]),f.copy($[1]),m.copy($[2]),_.uv=e(g,D,O,N,p,f,m)}_.face=G,_.faceIndex=z,y.push(_)}}}}}}}(),i.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},i.Bone=function(e){i.Object3D.call(this),this.type="Bone",this.skin=e},i.Bone.prototype=Object.create(i.Object3D.prototype),i.Bone.prototype.constructor=i.Bone,i.Bone.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},i.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new i.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var n=Math.sqrt(4*this.bones.length);n=i.Math.nextPowerOfTwo(Math.ceil(n)),n=Math.max(n,4),this.boneTextureWidth=n,this.boneTextureHeight=n,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new i.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,i.RGBAFormat,i.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var o=0,a=this.bones.length;a>o;o++)this.boneInverses.push(new i.Matrix4)}},i.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new i.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},i.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},i.Skeleton.prototype.update=function(){var e=new i.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var n=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(n,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),i.Skeleton.prototype.clone=function(){return new i.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},i.SkinnedMesh=function(e,t,r){i.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new i.Matrix4,this.bindMatrixInverse=new i.Matrix4;var n=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,a,s=0,h=this.geometry.bones.length;h>s;++s)a=this.geometry.bones[s],o=new i.Bone(this),n.push(o),o.name=a.name,o.position.fromArray(a.pos),o.quaternion.fromArray(a.rotq),void 0!==a.scl&&o.scale.fromArray(a.scl);for(var s=0,h=this.geometry.bones.length;h>s;++s)a=this.geometry.bones[s],-1!==a.parent&&null!==a.parent?n[a.parent].add(n[s]):this.add(n[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new i.Skeleton(n,void 0,r),this.matrixWorld)},i.SkinnedMesh.prototype=Object.create(i.Mesh.prototype),i.SkinnedMesh.prototype.constructor=i.SkinnedMesh,i.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},i.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},i.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof i.Geometry)for(var e=0;e<this.geometry.skinWeights.length;e++){var t=this.geometry.skinWeights[e],r=1/t.lengthManhattan();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0)}else if(this.geometry instanceof i.BufferGeometry)for(var n=new i.Vector4,o=this.geometry.attributes.skinWeight,e=0;e<o.count;e++){n.x=o.getX(e),n.y=o.getY(e),n.z=o.getZ(e),n.w=o.getW(e);var r=1/n.lengthManhattan();r!==1/0?n.multiplyScalar(r):n.set(1,0,0,0),o.setXYZW(e,n.x,n.y,n.z,n.w)}},i.SkinnedMesh.prototype.updateMatrixWorld=function(){i.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},i.SkinnedMesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material,this.useVertexTexture).copy(this)},i.LOD=function(){i.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},i.LOD.prototype=Object.create(i.Object3D.prototype),i.LOD.prototype.constructor=i.LOD,i.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,n=0;n<r.length&&!(t<r[n].distance);n++);r.splice(n,0,{distance:t,object:e}),this.add(e)},i.LOD.prototype.getObjectForDistance=function(e){for(var t=this.levels,r=1,n=t.length;n>r&&!(e<t[r].distance);r++);return t[r-1].object},i.LOD.prototype.raycast=function(){var e=new i.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(e);this.getObjectForDistance(n).raycast(t,r)}}(),i.LOD.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(r){var n=this.levels;if(n.length>1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);n[0].object.visible=!0;for(var o=1,a=n.length;a>o&&i>=n[o].distance;o++)n[o-1].object.visible=!1,n[o].object.visible=!0;for(;a>o;o++)n[o].object.visible=!1}}}(),i.LOD.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,n=t.length;n>r;r++){var o=t[r];this.addLevel(o.object.clone(),o.distance)}return this},i.LOD.prototype.toJSON=function(e){var t=i.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var r=this.levels,n=0,o=r.length;o>n;n++){var a=r[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t},i.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),n=new i.BufferGeometry;return n.setIndex(new i.BufferAttribute(e,1)),n.addAttribute("position",new i.BufferAttribute(t,3)),n.addAttribute("uv",new i.BufferAttribute(r,2)),function(e){i.Object3D.call(this),this.type="Sprite",this.geometry=n,this.material=void 0!==e?e:new i.SpriteMaterial}}(),i.Sprite.prototype=Object.create(i.Object3D.prototype),i.Sprite.prototype.constructor=i.Sprite,i.Sprite.prototype.raycast=function(){var e=new i.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var n=t.ray.distanceSqToPoint(e),i=this.scale.x*this.scale.y;n>i||r.push({distance:Math.sqrt(n),point:this.position,face:null,object:this})}}(),i.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},i.Particle=i.Sprite,i.LensFlare=function(e,t,r,n,o){i.Object3D.call(this),this.lensFlares=[],this.positionScreen=new i.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,n,o)},i.LensFlare.prototype=Object.create(i.Object3D.prototype),i.LensFlare.prototype.constructor=i.LensFlare,i.LensFlare.prototype.add=function(e,t,r,n,o,a){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===o&&(o=new i.Color(16777215)),void 0===n&&(n=i.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:o,blending:n})},i.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,n=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+n*t.distance,t.y=this.positionScreen.y+i*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},i.LensFlare.prototype.copy=function(e){i.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;r>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},i.Scene=function(){i.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},i.Scene.prototype=Object.create(i.Object3D.prototype),i.Scene.prototype.constructor=i.Scene,i.Scene.prototype.copy=function(e){return i.Object3D.prototype.copy.call(this,e),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},i.Fog=function(e,t,r){this.name="",this.color=new i.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},i.Fog.prototype.clone=function(){return new i.Fog(this.color.getHex(),this.near,this.far)},i.FogExp2=function(e,t){this.name="",this.color=new i.Color(e),this.density=void 0!==t?t:25e-5},i.FogExp2.prototype.clone=function(){return new i.FogExp2(this.color.getHex(),this.density)},i.ShaderChunk={},i.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n	diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",i.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n	uniform sampler2D alphaMap;\n\n#endif\n",i.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n	if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",i.ShaderChunk.ambient_pars="uniform vec3 ambientLightColor;\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n	return PI * ambientLightColor;\n\n}\n",i.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n	reflectedLight.indirectDiffuse *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n",i.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n\n#endif",i.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",i.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",i.ShaderChunk.bsdfs='float calcLightAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n	if ( decayExponent > 0.0 ) {\n\n	  return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n	}\n\n	return 1.0;\n\n}\n\n\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\n	return RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\n\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\n	// Original approximation by Christophe Schlick \'94\n	//;float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n	// Optimized variant (presented by Epic at SIGGRAPH \'13)\n	float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n	return ( 1.0 - specularColor ) * fresnel + specularColor;\n\n} // validated\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n	// geometry term = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\n\n	float a2 = alpha * alpha;\n\n	float gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );\n\n	float gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );\n\n	return 1.0 / ( gl * gv );\n\n} // validated\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n	float a2 = alpha * alpha;\n\n	float denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n	return RECIPROCAL_PI * a2 / ( denom * denom );\n\n}\n\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\n	float alpha = roughness * roughness; // UE4\'s roughness\n\n	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n	float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n	vec3 F = F_Schlick( specularColor, dotLH );\n\n	float G = G_GGX_Smith( alpha, dotNL, dotNV );\n\n	float D = D_GGX( alpha, dotNH );\n\n	return F * ( G * D );\n\n} // validated\n\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\n	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n	vec4 r = roughness * c0 + c1;\n\n	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n	vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n	return specularColor * AB.x + AB.y;\n\n} // validated\n\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n	// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n	return 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\n	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n	//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n	//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n	float dotNH = saturate( dot( geometry.normal, halfDir ) );\n	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n	vec3 F = F_Schlick( specularColor, dotLH );\n\n	float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n	float D = D_BlinnPhong( shininess, dotNH );\n\n	return F * ( G * D );\n\n} // validated\n\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n	return ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );\n}',
  i.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n\n	// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n	// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n	// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n	vec2 dHdxy_fwd() {\n\n		vec2 dSTdx = dFdx( vUv );\n		vec2 dSTdy = dFdy( vUv );\n\n		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n		return vec2( dBx, dBy );\n\n	}\n\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n		vec3 vSigmaX = dFdx( surf_pos );\n		vec3 vSigmaY = dFdy( surf_pos );\n		vec3 vN = surf_norm;		// normalized\n\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n\n		float fDet = dot( vSigmaX, R1 );\n\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n\n	}\n\n#endif\n",i.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n	diffuseColor.rgb *= vColor;\n\n#endif",i.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n	varying vec3 vColor;\n\n#endif\n",i.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n	varying vec3 vColor;\n\n#endif",i.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n	vColor.xyz = color.xyz;\n\n#endif",i.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nfloat square( const in float x ) { return x*x; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n};\n\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n	vec3 position;\n	vec3 normal;\n	vec3 viewDir;\n};\n\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n	float distance = dot( planeNormal, point - pointOnPlane );\n\n	return - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n	return sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nvec3 inputToLinear( in vec3 a ) {\n\n	#ifdef GAMMA_INPUT\n\n		return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\n	#else\n\n		return a;\n\n	#endif\n\n}\n\nvec3 linearToOutput( in vec3 a ) {\n\n	#ifdef GAMMA_OUTPUT\n\n		return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\n	#else\n\n		return a;\n\n	#endif\n\n}\n",i.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n	objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",i.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\n	transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n",i.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n\n#endif\n",i.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\n	vec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n	emissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\n	totalEmissiveLight *= emissiveColor.rgb;\n\n#endif\n",i.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\n	uniform sampler2D emissiveMap;\n\n#endif\n",i.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n		// Transforming Normal Vectors with the Inverse Transformation\n		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n		#ifdef ENVMAP_MODE_REFLECTION\n\n			vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n		#else\n\n			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n		#endif\n\n	#else\n\n		vec3 reflectVec = vReflect;\n\n	#endif\n\n	#ifdef DOUBLE_SIDED\n		float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n	#else\n		float flipNormal = 1.0;\n	#endif\n\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n	#elif defined( ENVMAP_TYPE_EQUIREC )\n		vec2 sampleUV;\n		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n		vec4 envColor = texture2D( envMap, sampleUV );\n\n	#elif defined( ENVMAP_TYPE_SPHERE )\n		vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n	#endif\n\n	envColor.xyz = inputToLinear( envColor.xyz );\n\n	#ifdef ENVMAP_BLENDING_MULTIPLY\n\n		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n	#elif defined( ENVMAP_BLENDING_MIX )\n\n		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n	#elif defined( ENVMAP_BLENDING_ADD )\n\n		outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n	#endif\n\n#endif\n",i.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n	uniform float reflectivity;\n	uniform float envMapIntenstiy;\n#endif\n\n#ifdef USE_ENVMAP\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n	uniform float flipEnvMap;\n\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\n		uniform float refractionRatio;\n\n	#else\n\n		varying vec3 vReflect;\n\n	#endif\n\n#endif\n",i.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n	varying vec3 vReflect;\n\n	uniform float refractionRatio;\n\n#endif\n",i.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n	vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n	vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n	#ifdef ENVMAP_MODE_REFLECTION\n\n		vReflect = reflect( cameraToVertex, worldNormal );\n\n	#else\n\n		vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n	#endif\n\n#endif\n",i.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n	#else\n\n		float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n	#endif\n\n	#ifdef FOG_EXP2\n\n		float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n	#else\n\n		float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n	#endif\n	\n	outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",i.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n	uniform vec3 fogColor;\n\n	#ifdef FOG_EXP2\n\n		uniform float fogDensity;\n\n	#else\n\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n\n#endif",i.ShaderChunk.lights_pars="#if NUM_DIR_LIGHTS > 0\n\n	struct DirectionalLight {\n	  vec3 direction;\n	  vec3 color;\n	  int shadow;\n	};\n\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n	IncidentLight getDirectionalDirectLight( const in DirectionalLight directionalLight, const in GeometricContext geometry ) {\n\n		IncidentLight directLight;\n\n		directLight.color = directionalLight.color;\n		directLight.direction = directionalLight.direction;\n\n		return directLight;\n\n	}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n	struct PointLight {\n	  vec3 position;\n	  vec3 color;\n	  float distance;\n	  float decay;\n	  int shadow;\n	};\n\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n	IncidentLight getPointDirectLight( const in PointLight pointLight, const in GeometricContext geometry ) {\n\n		IncidentLight directLight;\n\n		vec3 lVector = pointLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n\n		directLight.color = pointLight.color;\n		directLight.color *= calcLightAttenuation( length( lVector ), pointLight.distance, pointLight.decay );\n\n		return directLight;\n\n	}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n	struct SpotLight {\n	  vec3 position;\n	  vec3 direction;\n	  vec3 color;\n	  float distance;\n	  float decay;\n	  float angleCos;\n	  float exponent;\n	  int shadow;\n	};\n\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n	IncidentLight getSpotDirectLight( const in SpotLight spotLight, const in GeometricContext geometry ) {\n\n		IncidentLight directLight;\n\n		vec3 lVector = spotLight.position - geometry.position;\n		directLight.direction = normalize( lVector );\n\n		float spotEffect = dot( directLight.direction, spotLight.direction );\n\n		if ( spotEffect > spotLight.angleCos ) {\n\n			float spotEffect = dot( spotLight.direction, directLight.direction );\n			spotEffect = saturate( pow( saturate( spotEffect ), spotLight.exponent ) );\n\n			directLight.color = spotLight.color;\n			directLight.color *= ( spotEffect * calcLightAttenuation( length( lVector ), spotLight.distance, spotLight.decay ) );\n\n		} else {\n\n			directLight.color = vec3( 0.0 );\n\n		}\n\n		return directLight;\n\n	}\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n	struct HemisphereLight {\n	  vec3 direction;\n	  vec3 skyColor;\n	  vec3 groundColor;\n	};\n\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\n		float dotNL = dot( geometry.normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n		return PI * mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n	}\n\n#endif\n\n\n#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n	vec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {\n\n		#ifdef DOUBLE_SIDED\n\n			float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n		#else\n\n			float flipNormal = 1.0;\n\n		#endif\n\n		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n		#ifdef ENVMAP_TYPE_CUBE\n\n			vec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\n			// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\n			// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\n\n			#ifdef TEXTURE_LOD_EXT\n\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\n			#else\n\n				// force the bias high to get the last LOD level as it is the most blurred.\n				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\n			#endif\n\n		#else\n\n			vec3 envMapColor = vec3( 0.0 );\n\n		#endif\n\n		envMapColor.rgb = inputToLinear( envMapColor.rgb );\n\n		return PI * envMapColor.rgb * envMapIntensity;\n\n	}\n\n	// taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html\n	float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\n		//float envMapWidth = pow( 2.0, maxMIPLevelScalar );\n		//float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );\n\n		float maxMIPLevelScalar = float( maxMIPLevel );\n		float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( square( blinnShininessExponent ) + 1.0 );\n\n		// clamp to allowable LOD ranges.\n		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\n	}\n\n	vec3 getLightProbeIndirectRadiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\n		#ifdef ENVMAP_MODE_REFLECTION\n\n			vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\n		#else\n\n			vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\n		#endif\n\n		#ifdef DOUBLE_SIDED\n\n			float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n		#else\n\n			float flipNormal = 1.0;\n\n		#endif\n\n		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n		float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\n		#ifdef ENVMAP_TYPE_CUBE\n\n			vec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\n			#ifdef TEXTURE_LOD_EXT\n\n				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\n			#else\n\n				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\n			#endif\n\n		#elif defined( ENVMAP_TYPE_EQUIREC )\n\n			vec2 sampleUV;\n			sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n			sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\n			#ifdef TEXTURE_LOD_EXT\n\n				vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\n			#else\n\n				vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\n			#endif\n\n		#elif defined( ENVMAP_TYPE_SPHERE )\n\n			vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\n			#ifdef TEXTURE_LOD_EXT\n\n				vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n			#else\n\n				vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n			#endif\n\n		#endif\n\n		envMapColor.rgb = inputToLinear( envMapColor.rgb );\n\n		return envMapColor.rgb * envMapIntensity;\n\n	}\n\n#endif\n",i.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n\n#endif",i.ShaderChunk.lights_lambert_vertex="vec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n	vLightBack = vec3( 0.0 );\n#endif\n\n#if NUM_POINT_LIGHTS > 0\n\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n		IncidentLight directLight = getPointDirectLight( pointLights[ i ], geometry );\n\n		float dotNL = dot( geometry.normal, directLight.direction );\n		vec3 directLightColor_Diffuse = PI * directLight.color;\n\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n		#ifdef DOUBLE_SIDED\n\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n		#endif\n\n	}\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n		IncidentLight directLight = getSpotDirectLight( spotLights[ i ], geometry );\n\n		float dotNL = dot( geometry.normal, directLight.direction );\n		vec3 directLightColor_Diffuse = PI * directLight.color;\n\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n		#ifdef DOUBLE_SIDED\n\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n		#endif\n	}\n\n#endif\n\n#if NUM_DIR_LIGHTS > 0\n\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n		IncidentLight directLight = getDirectionalDirectLight( directionalLights[ i ], geometry );\n\n		float dotNL = dot( geometry.normal, directLight.direction );\n		vec3 directLightColor_Diffuse = PI * directLight.color;\n\n		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n		#ifdef DOUBLE_SIDED\n\n			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n		#endif\n\n	}\n\n#endif\n\n	{\n\n\n		#if NUM_HEMI_LIGHTS > 0\n\n			for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n				vLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n				#ifdef DOUBLE_SIDED\n\n					vLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\n				#endif\n\n			}\n\n		#endif\n\n	}\n",i.ShaderChunk.lights_phong_fragment="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",i.ShaderChunk.lights_phong_pars_fragment="#ifdef USE_ENVMAP\n\n	varying vec3 vWorldPosition;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n	varying vec3 vNormal;\n\n#endif\n\n\nstruct BlinnPhongMaterial {\n\n	vec3	diffuseColor;\n	vec3	specularColor;\n	float	specularShininess;\n	float	specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n	vec3 irradiance = dotNL * PI * directLight.color; // punctual light\n\n	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )	(0)\n",i.ShaderChunk.lights_phong_pars_vertex="#ifdef USE_ENVMAP\n\n	varying vec3 vWorldPosition;\n\n#endif\n",i.ShaderChunk.lights_phong_vertex="#ifdef USE_ENVMAP\n\n	vWorldPosition = worldPosition.xyz;\n\n#endif\n",i.ShaderChunk.lights_standard_fragment="StandardMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\nmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n",i.ShaderChunk.lights_standard_pars_fragment="struct StandardMaterial {\n\n	vec3	diffuseColor;\n	float	specularRoughness;\n	vec3	specularColor;\n\n};\n\nvoid RE_Direct_Standard( const in IncidentLight directLight, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\n	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n	vec3 irradiance = dotNL * PI * directLight.color; // punctual light\n\n	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n	reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\n}\n\nvoid RE_IndirectDiffuse_Standard( const in vec3 irradiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectSpecular_Standard( const in vec3 radiance, const in GeometricContext geometry, const in StandardMaterial material, inout ReflectedLight reflectedLight ) {\n\n	reflectedLight.indirectSpecular += radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\n}\n\n#define RE_Direct				RE_Direct_Standard\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Standard\n#define RE_IndirectSpecular		RE_IndirectSpecular_Standard\n\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n",i.ShaderChunk.lights_template="//\n// This is a template that can be used to light a material, it uses pluggable RenderEquations (RE)\n//   for specific lighting scenarios.\n//\n// Instructions for use:\n//  - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n//  - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n//  - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n//\n// TODO:\n//  - Add area light support.\n//  - Add sphere light support.\n//  - Add diffuse light probe (irradiance cubemap) support.\n//\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n		PointLight pointLight = pointLights[ i ];\n\n		IncidentLight directLight = getPointDirectLight( pointLight, geometry );\n\n		#ifdef USE_SHADOWMAP\n		if ( pointLight.shadow > - 1 ) {\n			for ( int j = 0; j < NUM_SHADOWS; j ++ ) {\n				if ( j == pointLight.shadow ) {\n					directLight.color *= shadows[ j ];\n				}\n			}\n		}\n		#endif\n\n		RE_Direct( directLight, geometry, material, reflectedLight );\n\n	}\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n		SpotLight spotLight = spotLights[ i ];\n\n		IncidentLight directLight = getSpotDirectLight( spotLight, geometry );\n\n		#ifdef USE_SHADOWMAP\n		if ( spotLight.shadow > - 1 ) {\n			for ( int j = 0; j < NUM_SHADOWS; j ++ ) {\n				if ( j == spotLight.shadow ) {\n					directLight.color *= shadows[ j ];\n				}\n			}\n		}\n		#endif\n\n		RE_Direct( directLight, geometry, material, reflectedLight );\n\n	}\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n		DirectionalLight directionalLight = directionalLights[ i ];\n\n		IncidentLight directLight = getDirectionalDirectLight( directionalLight, geometry );\n\n		#ifdef USE_SHADOWMAP\n		if ( directionalLight.shadow > - 1 ) {\n			for ( int j = 0; j < NUM_SHADOWS; j ++ ) {\n				if ( j == directionalLight.shadow ) {\n					directLight.color *= shadows[ j ];\n				}\n			}\n		}\n		#endif\n\n		RE_Direct( directLight, geometry, material, reflectedLight );\n\n	}\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n	{\n\n		vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n		#ifdef USE_LIGHTMAP\n\n			irradiance += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage\n\n		#endif\n\n		#if ( NUM_HEMI_LIGHTS > 0 )\n\n			for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n				irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n			}\n\n		#endif\n\n		// #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n			// TODO, replace 8 with the real maxMIPLevel\n			// irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 ); // comment out until seams are fixed\n\n		// #endif\n\n		RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n	}\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n	{\n\n		// TODO, replace 8 with the real maxMIPLevel\n		vec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 );\n\n		RE_IndirectSpecular( radiance, geometry, material, reflectedLight );\n\n	}\n\n#endif\n",i.ShaderChunk.linear_to_gamma_fragment="\n	outgoingLight = linearToOutput( outgoingLight );\n",i.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n	gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",i.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n	uniform float logDepthBufFC;\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		varying float vFragDepth;\n\n	#endif\n\n#endif\n",i.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		varying float vFragDepth;\n\n	#endif\n\n	uniform float logDepthBufFC;\n\n#endif",i.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n	gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n	#ifdef USE_LOGDEPTHBUF_EXT\n\n		vFragDepth = 1.0 + gl_Position.w;\n\n	#else\n\n		gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n	#endif\n\n#endif\n",i.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n	vec4 texelColor = texture2D( map, vUv );\n\n	texelColor.xyz = inputToLinear( texelColor.xyz );\n\n	diffuseColor *= texelColor;\n\n#endif\n",i.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n	uniform sampler2D map;\n\n#endif",i.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n	diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",i.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n	uniform vec4 offsetRepeat;\n	uniform sampler2D map;\n\n#endif\n",i.ShaderChunk.metalnessmap_fragment="float metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n	vec4 texelMetalness = texture2D( metalnessMap, vUv );\n	metalnessFactor *= texelMetalness.r;\n\n#endif\n",i.ShaderChunk.metalnessmap_pars_fragment="#ifdef USE_METALNESSMAP\n\n	uniform sampler2D metalnessMap;\n\n#endif",i.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n	objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n	objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n	objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n	objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",i.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n	#ifndef USE_MORPHNORMALS\n\n	uniform float morphTargetInfluences[ 8 ];\n\n	#else\n\n	uniform float morphTargetInfluences[ 4 ];\n\n	#endif\n\n#endif",i.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n	transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n	transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n	transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n	transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n	#ifndef USE_MORPHNORMALS\n\n	transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n	transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n	transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n	transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n	#endif\n\n#endif\n",i.ShaderChunk.normal_fragment="#ifdef FLAT_SHADED\n\n	vec3 fdx = dFdx( vViewPosition );\n	vec3 fdy = dFdy( vViewPosition );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n	vec3 normal = normalize( vNormal );\n\n	#ifdef DOUBLE_SIDED\n\n		normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n	#endif\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n	normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n",i.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n\n	// Per-Pixel Tangent Space Normal Mapping\n	// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( vUv.st );\n		vec2 st1 = dFdy( vUv.st );\n\n		vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n		vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n		vec3 N = normalize( surf_norm );\n\n		vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n		mapN.xy = normalScale * mapN.xy;\n		mat3 tsn = mat3( S, T, N );\n		return normalize( tsn * mapN );\n\n	}\n\n#endif\n",i.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n	vec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n	vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",i.ShaderChunk.roughnessmap_fragment="float roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n	vec4 texelRoughness = texture2D( roughnessMap, vUv );\n	roughnessFactor *= texelRoughness.r;\n\n#endif\n",i.ShaderChunk.roughnessmap_pars_fragment="#ifdef USE_ROUGHNESSMAP\n\n	uniform sampler2D roughnessMap;\n\n#endif",i.ShaderChunk.shadowmap_fragment="vec3 shadowMask = vec3( 1.0 );\n\n#ifdef USE_SHADOWMAP\n\n	float shadows[ NUM_SHADOWS ];\n\n	for ( int i = 0; i < NUM_SHADOWS; i ++ ) {\n\n		float texelSizeY =  1.0 / shadowMapSize[ i ].y;\n\n		float shadow = 0.0;\n\n#ifdef POINT_LIGHT_SHADOWS\n\n		// to save on uniform space, we use the sign of @shadowDarkness[ i ] to determine\n		// whether or not this light is a point light ( shadowDarkness[ i ] < 0 == point light)\n		bool isPointLight = shadowDarkness[ i ] < 0.0;\n\n		if ( isPointLight ) {\n\n			// get the real shadow darkness\n			float realShadowDarkness = abs( shadowDarkness[ i ] );\n\n			// for point lights, the uniform @vShadowCoord is re-purposed to hold\n			// the distance from the light to the world-space position of the fragment.\n			vec3 lightToPosition = vShadowCoord[ i ].xyz;\n\n	#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n			// bd3D = base direction 3D\n			vec3 bd3D = normalize( lightToPosition );\n			// dp = distance from light to fragment position\n			float dp = length( lightToPosition );\n\n			// base measurement\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n			// Dr = disk radius\n\n	#if defined( SHADOWMAP_TYPE_PCF )\n			const float Dr = 1.25;\n	#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n			const float Dr = 2.25;\n	#endif\n\n			// os = offset scale\n			float os = Dr *  2.0 * texelSizeY;\n\n			const vec3 Gsd = vec3( - 1, 0, 1 );\n\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );\n\n			shadow *= realShadowDarkness * ( 1.0 / 21.0 );\n\n	#else // no percentage-closer filtering:\n\n			vec3 bd3D = normalize( lightToPosition );\n			float dp = length( lightToPosition );\n\n			adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );\n\n			shadow *= realShadowDarkness;\n\n	#endif\n\n		} else {\n\n#endif // POINT_LIGHT_SHADOWS\n\n			float texelSizeX =  1.0 / shadowMapSize[ i ].x;\n\n			vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n			// if ( something && something ) breaks ATI OpenGL shader compiler\n			// if ( all( something, something ) ) using this instead\n\n			bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n			bool inFrustum = all( inFrustumVec );\n\n			bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n			bool frustumTest = all( frustumTestVec );\n\n			if ( frustumTest ) {\n\n	#if defined( SHADOWMAP_TYPE_PCF )\n\n				// Percentage-close filtering\n				// (9 pixel kernel)\n				// http://fabiensanglard.net/shadowmappingPCF/\n\n				/*\n						// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n						// must enroll loop manually\n					for ( float y = -1.25; y <= 1.25; y += 1.25 )\n						for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n							vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n									// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n									//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n							float fDepth = unpackDepth( rgbaDepth );\n							if ( fDepth < shadowCoord.z )\n								shadow += 1.0;\n					}\n					shadow /= 9.0;\n				*/\n\n				shadowCoord.z += shadowBias[ i ];\n\n				const float ShadowDelta = 1.0 / 9.0;\n\n				float xPixelOffset = texelSizeX;\n				float yPixelOffset = texelSizeY;\n\n				float dx0 = - 1.25 * xPixelOffset;\n				float dy0 = - 1.25 * yPixelOffset;\n				float dx1 = 1.25 * xPixelOffset;\n				float dy1 = 1.25 * yPixelOffset;\n\n				float fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n				if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;\n\n				shadow *= shadowDarkness[ i ];\n\n	#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n				// Percentage-close filtering\n				// (9 pixel kernel)\n				// http://fabiensanglard.net/shadowmappingPCF/\n\n				shadowCoord.z += shadowBias[ i ];\n\n				float xPixelOffset = texelSizeX;\n				float yPixelOffset = texelSizeY;\n\n				float dx0 = - 1.0 * xPixelOffset;\n				float dy0 = - 1.0 * yPixelOffset;\n				float dx1 = 1.0 * xPixelOffset;\n				float dy1 = 1.0 * yPixelOffset;\n\n				mat3 shadowKernel;\n				mat3 depthKernel;\n\n				depthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n				depthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n				depthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n				depthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n				depthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n				depthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n				depthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n				depthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n				depthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n				vec3 shadowZ = vec3( shadowCoord.z );\n				shadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );\n				shadowKernel[ 0 ] *= vec3( 0.25 );\n\n				shadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );\n				shadowKernel[ 1 ] *= vec3( 0.25 );\n\n				shadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );\n				shadowKernel[ 2 ] *= vec3( 0.25 );\n\n				vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );\n\n				shadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );\n				shadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );\n\n				vec4 shadowValues;\n				shadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );\n				shadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );\n				shadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );\n				shadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );\n\n				shadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];\n\n	#else // no percentage-closer filtering:\n\n				shadowCoord.z += shadowBias[ i ];\n\n				vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n				float fDepth = unpackDepth( rgbaDepth );\n\n				if ( fDepth < shadowCoord.z )\n					shadow = shadowDarkness[ i ];\n\n	#endif\n\n			}\n\n#ifdef SHADOWMAP_DEBUG\n\n			if ( inFrustum ) {\n\n				if ( i == 0 ) {\n\n					outgoingLight *= vec3( 1.0, 0.5, 0.0 );\n\n				} else if ( i == 1 ) {\n\n					outgoingLight *= vec3( 0.0, 1.0, 0.8 );\n\n				} else {\n\n					outgoingLight *= vec3( 0.0, 0.5, 1.0 );\n\n				}\n\n			}\n\n#endif\n\n#ifdef POINT_LIGHT_SHADOWS\n\n		}\n\n#endif\n\n		shadowMask = shadowMask * vec3( 1.0 - shadow );\n\n		shadows[ i ] = 1.0 - shadow;\n\n	}\n\n#endif\n",
  i.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n	uniform sampler2D shadowMap[ NUM_SHADOWS ];\n	uniform vec2 shadowMapSize[ NUM_SHADOWS ];\n\n	uniform float shadowDarkness[ NUM_SHADOWS ];\n	uniform float shadowBias[ NUM_SHADOWS ];\n\n	varying vec4 vShadowCoord[ NUM_SHADOWS ];\n\n	float unpackDepth( const in vec4 rgba_depth ) {\n\n		const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n		float depth = dot( rgba_depth, bit_shift );\n		return depth;\n\n	}\n\n	#ifdef POINT_LIGHT_SHADOWS\n\n		// adjustShadowValue1K() upacks the depth value stored in @textureData, adds @bias to it, and then\n		// comapres the result with @testDepth. If @testDepth is larger than or equal to that result, then\n		// @shadowValue is incremented by 1.0.\n\n		void adjustShadowValue1K( const float testDepth, const vec4 textureData, const float bias, inout float shadowValue ) {\n\n			const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n			if ( testDepth >= dot( textureData, bitSh ) * 1000.0 + bias )\n				shadowValue += 1.0;\n\n		}\n\n		// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n		// vector suitable for 2D texture mapping. This code uses the following layout for the\n		// 2D texture:\n		//\n		// xzXZ\n		//  y Y\n		//\n		// Y - Positive y direction\n		// y - Negative y direction\n		// X - Positive x direction\n		// x - Negative x direction\n		// Z - Positive z direction\n		// z - Negative z direction\n		//\n		// Source and test bed:\n		// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n		vec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n			// Number of texels to avoid at the edge of each square\n\n			vec3 absV = abs( v );\n\n			// Intersect unit cube\n\n			float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n			absV *= scaleToCube;\n\n			// Apply scale to avoid seams\n\n			// two texels less per square (one texel will do for NEAREST)\n			v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n			// Unwrap\n\n			// space: -1 ... 1 range for each square\n			//\n			// #X##		dim    := ( 4 , 2 )\n			//  # #		center := ( 1 , 1 )\n\n			vec2 planar = v.xy;\n\n			float almostATexel = 1.5 * texelSizeY;\n			float almostOne = 1.0 - almostATexel;\n\n			if ( absV.z >= almostOne ) {\n\n				if ( v.z > 0.0 )\n					planar.x = 4.0 - v.x;\n\n			} else if ( absV.x >= almostOne ) {\n\n				float signX = sign( v.x );\n				planar.x = v.z * signX + 2.0 * signX;\n\n			} else if ( absV.y >= almostOne ) {\n\n				float signY = sign( v.y );\n				planar.x = v.x + 2.0 * signY + 2.0;\n				planar.y = v.z * signY - 2.0;\n\n			}\n\n			// Transform to UV space\n\n			// scale := 0.5 / dim\n			// translate := ( center + 0.5 ) / dim\n			return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n		}\n\n	#endif\n\n#endif\n",i.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n	uniform mat4 shadowMatrix[ NUM_SHADOWS ];\n	varying vec4 vShadowCoord[ NUM_SHADOWS ];\n\n#endif\n",i.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n	for ( int i = 0; i < NUM_SHADOWS; i ++ ) {\n\n			vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n	}\n\n#endif",i.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",i.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n\n	#ifdef BONE_TEXTURE\n\n		uniform sampler2D boneTexture;\n		uniform int boneTextureWidth;\n		uniform int boneTextureHeight;\n\n		mat4 getBoneMatrix( const in float i ) {\n\n			float j = i * 4.0;\n			float x = mod( j, float( boneTextureWidth ) );\n			float y = floor( j / float( boneTextureWidth ) );\n\n			float dx = 1.0 / float( boneTextureWidth );\n			float dy = 1.0 / float( boneTextureHeight );\n\n			y = dy * ( y + 0.5 );\n\n			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n			mat4 bone = mat4( v1, v2, v3, v4 );\n\n			return bone;\n\n		}\n\n	#else\n\n		uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n		mat4 getBoneMatrix( const in float i ) {\n\n			mat4 bone = boneGlobalMatrices[ int(i) ];\n			return bone;\n\n		}\n\n	#endif\n\n#endif\n",i.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	skinned  = bindMatrixInverse * skinned;\n\n#endif\n",i.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",i.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n	vec4 texelSpecular = texture2D( specularMap, vUv );\n	specularStrength = texelSpecular.r;\n\n#else\n\n	specularStrength = 1.0;\n\n#endif",i.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n	uniform sampler2D specularMap;\n\n#endif",i.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n	varying vec2 vUv2;\n\n#endif",i.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n	attribute vec2 uv2;\n	varying vec2 vUv2;\n\n#endif",i.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n	vUv2 = uv2;\n\n#endif",i.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n	varying vec2 vUv;\n\n#endif",i.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n	varying vec2 vUv;\n	uniform vec4 offsetRepeat;\n\n#endif\n",i.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n	vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",i.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n	#ifdef USE_SKINNING\n\n		vec4 worldPosition = modelMatrix * skinned;\n\n	#else\n\n		vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n	#endif\n\n#endif\n",i.UniformsUtils={merge:function(e){for(var t={},r=0;r<e.length;r++){var n=this.clone(e[r]);for(var i in n)t[i]=n[i]}return t},clone:function(e){var t={};for(var r in e){t[r]={};for(var n in e[r]){var o=e[r][n];t[r][n]=o instanceof i.Color||o instanceof i.Vector2||o instanceof i.Vector3||o instanceof i.Vector4||o instanceof i.Matrix3||o instanceof i.Matrix4||o instanceof i.Texture?o.clone():Array.isArray(o)?o.slice():o}}return t}},i.UniformsLib={common:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98}},aomap:{aoMap:{type:"t",value:null},aoMapIntensity:{type:"f",value:1}},lightmap:{lightMap:{type:"t",value:null},lightMapIntensity:{type:"f",value:1}},emissivemap:{emissiveMap:{type:"t",value:null}},bumpmap:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new i.Vector2(1,1)}},displacementmap:{displacementMap:{type:"t",value:null},displacementScale:{type:"f",value:1},displacementBias:{type:"f",value:0}},roughnessmap:{roughnessMap:{type:"t",value:null}},metalnessmap:{metalnessMap:{type:"t",value:null}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new i.Color(16777215)}},ambient:{ambientLightColor:{type:"fv",value:[]}},lights:{directionalLights:{type:"sa",value:[],properties:{direction:{type:"v3"},color:{type:"c"},shadow:{type:"i"}}},hemisphereLights:{type:"sa",value:[],properties:{direction:{type:"v3"},skyColor:{type:"c"},groundColor:{type:"c"}}},pointLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},decay:{type:"f"},distance:{type:"f"},shadow:{type:"i"}}},spotLights:{type:"sa",value:[],properties:{color:{type:"c"},position:{type:"v3"},direction:{type:"v3"},distance:{type:"f"},angleCos:{type:"f"},exponent:{type:"f"},decay:{type:"f"},shadow:{type:"i"}}}},points:{diffuse:{type:"c",value:new i.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new i.Vector4(0,0,1,1)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}},i.ShaderLib={basic:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.fog,i.UniformsLib.shadowmap]),vertexShader:[i.ShaderChunk.common,i.ShaderChunk.uv_pars_vertex,i.ShaderChunk.uv2_pars_vertex,i.ShaderChunk.envmap_pars_vertex,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,i.ShaderChunk.shadowmap_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.uv_vertex,i.ShaderChunk.uv2_vertex,i.ShaderChunk.color_vertex,i.ShaderChunk.skinbase_vertex,"	#ifdef USE_ENVMAP",i.ShaderChunk.beginnormal_vertex,i.ShaderChunk.morphnormal_vertex,i.ShaderChunk.skinnormal_vertex,i.ShaderChunk.defaultnormal_vertex,"	#endif",i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,i.ShaderChunk.worldpos_vertex,i.ShaderChunk.envmap_vertex,i.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","#ifndef FLAT_SHADED","	varying vec3 vNormal;","#endif",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.uv_pars_fragment,i.ShaderChunk.uv2_pars_fragment,i.ShaderChunk.map_pars_fragment,i.ShaderChunk.alphamap_pars_fragment,i.ShaderChunk.aomap_pars_fragment,i.ShaderChunk.envmap_pars_fragment,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.shadowmap_pars_fragment,i.ShaderChunk.specularmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	vec4 diffuseColor = vec4( diffuse, opacity );",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.map_fragment,i.ShaderChunk.color_fragment,i.ShaderChunk.alphamap_fragment,i.ShaderChunk.alphatest_fragment,i.ShaderChunk.specularmap_fragment,"	ReflectedLight reflectedLight;","	reflectedLight.directDiffuse = vec3( 0.0 );","	reflectedLight.directSpecular = vec3( 0.0 );","	reflectedLight.indirectDiffuse = diffuseColor.rgb;","	reflectedLight.indirectSpecular = vec3( 0.0 );",i.ShaderChunk.aomap_fragment,i.ShaderChunk.shadowmap_fragment,"reflectedLight.indirectDiffuse *= shadowMask;","vec3 outgoingLight = reflectedLight.indirectDiffuse;",i.ShaderChunk.envmap_fragment,i.ShaderChunk.linear_to_gamma_fragment,i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},lambert:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.fog,i.UniformsLib.ambient,i.UniformsLib.lights,i.UniformsLib.shadowmap,{emissive:{type:"c",value:new i.Color(0)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","#endif",i.ShaderChunk.common,i.ShaderChunk.uv_pars_vertex,i.ShaderChunk.uv2_pars_vertex,i.ShaderChunk.envmap_pars_vertex,i.ShaderChunk.bsdfs,i.ShaderChunk.lights_pars,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,i.ShaderChunk.shadowmap_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.uv_vertex,i.ShaderChunk.uv2_vertex,i.ShaderChunk.color_vertex,i.ShaderChunk.beginnormal_vertex,i.ShaderChunk.morphnormal_vertex,i.ShaderChunk.skinbase_vertex,i.ShaderChunk.skinnormal_vertex,i.ShaderChunk.defaultnormal_vertex,i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,i.ShaderChunk.worldpos_vertex,i.ShaderChunk.envmap_vertex,i.ShaderChunk.lights_lambert_vertex,i.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform vec3 emissive;","uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","	varying vec3 vLightBack;","#endif",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.uv_pars_fragment,i.ShaderChunk.uv2_pars_fragment,i.ShaderChunk.map_pars_fragment,i.ShaderChunk.alphamap_pars_fragment,i.ShaderChunk.aomap_pars_fragment,i.ShaderChunk.lightmap_pars_fragment,i.ShaderChunk.emissivemap_pars_fragment,i.ShaderChunk.envmap_pars_fragment,i.ShaderChunk.ambient_pars,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.shadowmap_pars_fragment,i.ShaderChunk.specularmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );","	vec3 totalAmbientLight = getAmbientLightIrradiance( ambientLightColor );","	vec3 totalEmissiveLight = emissive;",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.map_fragment,i.ShaderChunk.color_fragment,i.ShaderChunk.alphamap_fragment,i.ShaderChunk.alphatest_fragment,i.ShaderChunk.specularmap_fragment,i.ShaderChunk.emissivemap_fragment,i.ShaderChunk.shadowmap_fragment,"	#ifdef USE_LIGHTMAP","		totalAmbientLight += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;","	#endif","	#ifdef USE_AOMAP","		totalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;","	#endif","	#ifdef DOUBLE_SIDED","		if ( gl_FrontFacing )","			outgoingLight += RECIPROCAL_PI * diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + totalEmissiveLight;","		else","			outgoingLight += RECIPROCAL_PI * diffuseColor.rgb * ( vLightBack * shadowMask + totalAmbientLight ) + totalEmissiveLight;","	#else","		outgoingLight += RECIPROCAL_PI * diffuseColor.rgb * ( vLightFront * shadowMask + totalAmbientLight ) + totalEmissiveLight;","	#endif",i.ShaderChunk.envmap_fragment,i.ShaderChunk.linear_to_gamma_fragment,i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},phong:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.fog,i.UniformsLib.ambient,i.UniformsLib.lights,i.UniformsLib.shadowmap,{emissive:{type:"c",value:new i.Color(0)},specular:{type:"c",value:new i.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","	varying vec3 vNormal;","#endif",i.ShaderChunk.common,i.ShaderChunk.uv_pars_vertex,i.ShaderChunk.uv2_pars_vertex,i.ShaderChunk.displacementmap_pars_vertex,i.ShaderChunk.envmap_pars_vertex,i.ShaderChunk.lights_phong_pars_vertex,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,i.ShaderChunk.shadowmap_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.uv_vertex,i.ShaderChunk.uv2_vertex,i.ShaderChunk.color_vertex,i.ShaderChunk.beginnormal_vertex,i.ShaderChunk.morphnormal_vertex,i.ShaderChunk.skinbase_vertex,i.ShaderChunk.skinnormal_vertex,i.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED","	vNormal = normalize( transformedNormal );","#endif",i.ShaderChunk.begin_vertex,i.ShaderChunk.displacementmap_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,"	vViewPosition = - mvPosition.xyz;",i.ShaderChunk.worldpos_vertex,i.ShaderChunk.envmap_vertex,i.ShaderChunk.lights_phong_vertex,i.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.uv_pars_fragment,i.ShaderChunk.uv2_pars_fragment,i.ShaderChunk.map_pars_fragment,i.ShaderChunk.alphamap_pars_fragment,i.ShaderChunk.aomap_pars_fragment,i.ShaderChunk.lightmap_pars_fragment,i.ShaderChunk.emissivemap_pars_fragment,i.ShaderChunk.envmap_pars_fragment,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.bsdfs,i.ShaderChunk.ambient_pars,i.ShaderChunk.lights_pars,i.ShaderChunk.lights_phong_pars_fragment,i.ShaderChunk.shadowmap_pars_fragment,i.ShaderChunk.bumpmap_pars_fragment,i.ShaderChunk.normalmap_pars_fragment,i.ShaderChunk.specularmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	vec4 diffuseColor = vec4( diffuse, opacity );","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","	vec3 totalEmissiveLight = emissive;",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.map_fragment,i.ShaderChunk.color_fragment,i.ShaderChunk.alphamap_fragment,i.ShaderChunk.alphatest_fragment,i.ShaderChunk.specularmap_fragment,i.ShaderChunk.normal_fragment,i.ShaderChunk.emissivemap_fragment,i.ShaderChunk.shadowmap_fragment,i.ShaderChunk.lights_phong_fragment,i.ShaderChunk.lights_template,i.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",i.ShaderChunk.envmap_fragment,i.ShaderChunk.linear_to_gamma_fragment,i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},standard:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.aomap,i.UniformsLib.lightmap,i.UniformsLib.emissivemap,i.UniformsLib.bumpmap,i.UniformsLib.normalmap,i.UniformsLib.displacementmap,i.UniformsLib.roughnessmap,i.UniformsLib.metalnessmap,i.UniformsLib.fog,i.UniformsLib.ambient,i.UniformsLib.lights,i.UniformsLib.shadowmap,{emissive:{type:"c",value:new i.Color(0)},roughness:{type:"f",value:.5},metalness:{type:"f",value:0},envMapIntensity:{type:"f",value:1}}]),vertexShader:["#define STANDARD","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","	varying vec3 vNormal;","#endif",i.ShaderChunk.common,i.ShaderChunk.uv_pars_vertex,i.ShaderChunk.uv2_pars_vertex,i.ShaderChunk.displacementmap_pars_vertex,i.ShaderChunk.envmap_pars_vertex,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,i.ShaderChunk.shadowmap_pars_vertex,i.ShaderChunk.specularmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.uv_vertex,i.ShaderChunk.uv2_vertex,i.ShaderChunk.color_vertex,i.ShaderChunk.beginnormal_vertex,i.ShaderChunk.morphnormal_vertex,i.ShaderChunk.skinbase_vertex,i.ShaderChunk.skinnormal_vertex,i.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED","	vNormal = normalize( transformedNormal );","#endif",i.ShaderChunk.begin_vertex,i.ShaderChunk.displacementmap_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,"	vViewPosition = - mvPosition.xyz;",i.ShaderChunk.worldpos_vertex,i.ShaderChunk.envmap_vertex,i.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define STANDARD","uniform vec3 diffuse;","uniform vec3 emissive;","uniform float roughness;","uniform float metalness;","uniform float opacity;","uniform float envMapIntensity;","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","	varying vec3 vNormal;","#endif",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.uv_pars_fragment,i.ShaderChunk.uv2_pars_fragment,i.ShaderChunk.map_pars_fragment,i.ShaderChunk.alphamap_pars_fragment,i.ShaderChunk.aomap_pars_fragment,i.ShaderChunk.lightmap_pars_fragment,i.ShaderChunk.emissivemap_pars_fragment,i.ShaderChunk.envmap_pars_fragment,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.bsdfs,i.ShaderChunk.ambient_pars,i.ShaderChunk.lights_pars,i.ShaderChunk.lights_standard_pars_fragment,i.ShaderChunk.shadowmap_pars_fragment,i.ShaderChunk.bumpmap_pars_fragment,i.ShaderChunk.normalmap_pars_fragment,i.ShaderChunk.roughnessmap_pars_fragment,i.ShaderChunk.metalnessmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	vec4 diffuseColor = vec4( diffuse, opacity );","	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","	vec3 totalEmissiveLight = emissive;",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.map_fragment,i.ShaderChunk.color_fragment,i.ShaderChunk.alphamap_fragment,i.ShaderChunk.alphatest_fragment,i.ShaderChunk.specularmap_fragment,i.ShaderChunk.roughnessmap_fragment,i.ShaderChunk.metalnessmap_fragment,i.ShaderChunk.normal_fragment,i.ShaderChunk.emissivemap_fragment,i.ShaderChunk.shadowmap_fragment,i.ShaderChunk.lights_standard_fragment,i.ShaderChunk.lights_template,i.ShaderChunk.aomap_fragment,"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",i.ShaderChunk.linear_to_gamma_fragment,i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},points:{uniforms:i.UniformsUtils.merge([i.UniformsLib.points,i.UniformsLib.fog,i.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",i.ShaderChunk.common,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.shadowmap_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.color_vertex,i.ShaderChunk.begin_vertex,i.ShaderChunk.project_vertex,"	#ifdef USE_SIZEATTENUATION","		gl_PointSize = size * ( scale / - mvPosition.z );","	#else","		gl_PointSize = size;","	#endif",i.ShaderChunk.logdepthbuf_vertex,i.ShaderChunk.worldpos_vertex,i.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.map_particle_pars_fragment,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.shadowmap_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.map_particle_fragment,i.ShaderChunk.color_fragment,i.ShaderChunk.alphatest_fragment,i.ShaderChunk.shadowmap_fragment,"	outgoingLight = diffuseColor.rgb * shadowMask;",i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},dashed:{uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",i.ShaderChunk.common,i.ShaderChunk.color_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.color_vertex,"	vLineDistance = scale * lineDistance;","	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","	gl_Position = projectionMatrix * mvPosition;",i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",i.ShaderChunk.common,i.ShaderChunk.color_pars_fragment,i.ShaderChunk.fog_pars_fragment,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	if ( mod( vLineDistance, totalSize ) > dashSize ) {","		discard;","	}","	vec3 outgoingLight = vec3( 0.0 );","	vec4 diffuseColor = vec4( diffuse, opacity );",i.ShaderChunk.logdepthbuf_fragment,i.ShaderChunk.color_fragment,"	outgoingLight = diffuseColor.rgb;",i.ShaderChunk.fog_fragment,"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[i.ShaderChunk.common,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",i.ShaderChunk.logdepthbuf_fragment,"	#ifdef USE_LOGDEPTHBUF_EXT","		float depth = gl_FragDepthEXT / gl_FragCoord.w;","	#else","		float depth = gl_FragCoord.z / gl_FragCoord.w;","	#endif","	float color = 1.0 - smoothstep( mNear, mFar, depth );","	gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",i.ShaderChunk.common,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","	vNormal = normalize( normalMatrix * normal );",i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",i.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","	vWorldPosition = transformDirection( position, modelMatrix );","	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","	gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",i.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {","	vWorldPosition = transformDirection( position, modelMatrix );","	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",i.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[i.ShaderChunk.common,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,i.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",i.ShaderChunk.skinbase_vertex,i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[i.ShaderChunk.common,i.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {","	const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","	const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","	vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","	res -= res.xxyz * bit_mask;","	return res;","}","void main() {",i.ShaderChunk.logdepthbuf_fragment,"	#ifdef USE_LOGDEPTHBUF_EXT","		gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","	#else","		gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","	#endif","}"].join("\n")},distanceRGBA:{uniforms:{lightPos:{type:"v3",value:new i.Vector3(0,0,0)}},vertexShader:["varying vec4 vWorldPosition;",i.ShaderChunk.common,i.ShaderChunk.morphtarget_pars_vertex,i.ShaderChunk.skinning_pars_vertex,"void main() {",i.ShaderChunk.skinbase_vertex,i.ShaderChunk.begin_vertex,i.ShaderChunk.morphtarget_vertex,i.ShaderChunk.skinning_vertex,i.ShaderChunk.project_vertex,i.ShaderChunk.worldpos_vertex,"vWorldPosition = worldPosition;","}"].join("\n"),fragmentShader:["uniform vec3 lightPos;","varying vec4 vWorldPosition;",i.ShaderChunk.common,"vec4 pack1K ( float depth ) {","   depth /= 1000.0;","   const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","	const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","	vec4 res = fract( depth * bitSh );","	res -= res.xxyz * bitMsk;","	return res; ","}","float unpack1K ( vec4 color ) {","	const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );","	return dot( color, bitSh ) * 1000.0;","}","void main () {","	gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );","}"].join("\n")}},i.WebGLRenderer=function(e){function t(){return null===Ae?oe:1}function r(e,t,r,n){le===!0&&(e*=n,t*=n,r*=n),Ue.clearColor(e,t,r,n)}function n(){We.init(),We.scissor(Re),We.viewport(De),r(de.r,de.g,de.b,pe)}function o(){Ee=null,Le=null,Te="",Ce=-1,We.reset()}function a(e){e.preventDefault(),o(),n(),qe.clear()}function s(e){var t=e.target;t.removeEventListener("dispose",s),l(t),Ve.textures--}function h(e){var t=e.target;t.removeEventListener("dispose",h),u(t),Ve.textures--}function c(e){var t=e.target;t.removeEventListener("dispose",c),d(t)}function l(e){var t=qe.get(e);if(e.image&&t.__image__webglTextureCube)Ue.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;Ue.deleteTexture(t.__webglTexture)}qe["delete"](e)}function u(e){var t=qe.get(e),r=qe.get(e.texture);if(e&&void 0!==r.__webglTexture){if(Ue.deleteTexture(r.__webglTexture),e instanceof i.WebGLRenderTargetCube)for(var n=0;6>n;n++)Ue.deleteFramebuffer(t.__webglFramebuffer[n]),Ue.deleteRenderbuffer(t.__webglDepthbuffer[n]);else Ue.deleteFramebuffer(t.__webglFramebuffer),Ue.deleteRenderbuffer(t.__webglDepthbuffer);qe["delete"](e.texture),qe["delete"](e)}}function d(e){p(e),qe["delete"](e)}function p(e){var t=qe.get(e).program;e.program=void 0,void 0!==t&&Ye.releaseProgram(t)}function f(e,t,r,n){var o;if(r instanceof i.InstancedBufferGeometry&&(o=Ge.get("ANGLE_instanced_arrays"),null===o))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===n&&(n=0),We.initAttributes();var a=r.attributes,s=t.getAttributes(),h=e.defaultAttributeValues;for(var c in s){var l=s[c];if(l>=0){var u=a[c];if(void 0!==u){var d=u.itemSize,p=Xe.getAttributeBuffer(u);
  
  if(u instanceof i.InterleavedBufferAttribute){var f=u.data,m=f.stride,v=u.offset;f instanceof i.InstancedInterleavedBuffer?(We.enableAttributeAndDivisor(l,f.meshPerAttribute,o),void 0===r.maxInstancedCount&&(r.maxInstancedCount=f.meshPerAttribute*f.count)):We.enableAttribute(l),Ue.bindBuffer(Ue.ARRAY_BUFFER,p),Ue.vertexAttribPointer(l,d,Ue.FLOAT,!1,m*f.array.BYTES_PER_ELEMENT,(n*m+v)*f.array.BYTES_PER_ELEMENT)}else u instanceof i.InstancedBufferAttribute?(We.enableAttributeAndDivisor(l,u.meshPerAttribute,o),void 0===r.maxInstancedCount&&(r.maxInstancedCount=u.meshPerAttribute*u.count)):We.enableAttribute(l),Ue.bindBuffer(Ue.ARRAY_BUFFER,p),Ue.vertexAttribPointer(l,d,Ue.FLOAT,!1,0,n*d*4)}else if(void 0!==h){var g=h[c];if(void 0!==g)switch(g.length){case 2:Ue.vertexAttrib2fv(l,g);break;case 3:Ue.vertexAttrib3fv(l,g);break;case 4:Ue.vertexAttrib4fv(l,g);break;default:Ue.vertexAttrib1fv(l,g)}}}}We.disableUnusedAttributes()}function m(e,t){return Math.abs(t[0])-Math.abs(e[0])}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function g(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function y(e,t,r,n,i){var o,a;r.transparent?(o=ge,a=++ye):(o=me,a=++ve);var s=o[a];void 0!==s?(s.id=e.id,s.object=e,s.geometry=t,s.material=r,s.z=Ie.z,s.group=i):(s={id:e.id,object:e,geometry:t,material:r,z:Ie.z,group:i},o.push(s))}function b(e,t){if(e.visible!==!1){if(e.layers.test(t.layers))if(e instanceof i.Light)fe.push(e);else if(e instanceof i.Sprite)(e.frustumCulled===!1||Oe.intersectsObject(e)===!0)&&xe.push(e);else if(e instanceof i.LensFlare)we.push(e);else if(e instanceof i.ImmediateRenderObject)Me.sortObjects===!0&&(Ie.setFromMatrixPosition(e.matrixWorld),Ie.applyProjection(Ne)),y(e,null,e.material,Ie.z,null);else if((e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&(e instanceof i.SkinnedMesh&&e.skeleton.update(),e.frustumCulled===!1||Oe.intersectsObject(e)===!0)){var r=e.material;if(r.visible===!0){Me.sortObjects===!0&&(Ie.setFromMatrixPosition(e.matrixWorld),Ie.applyProjection(Ne));var n=Xe.update(e);if(r instanceof i.MultiMaterial)for(var o=n.groups,a=r.materials,s=0,h=o.length;h>s;s++){var c=o[s],l=a[c.materialIndex];l.visible===!0&&y(e,n,l,Ie.z,c)}else y(e,n,r,Ie.z,null)}}for(var u=e.children,s=0,h=u.length;h>s;s++)b(u[s],t)}}function x(e,t,r,n){for(var o=0,a=e.length;a>o;o++){var s=e[o],h=s.object,c=s.geometry,l=void 0===n?s.material:n,u=s.group;if(h.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),h instanceof i.ImmediateRenderObject){M(l);var d=E(t,r,l,h);Te="",h.render(function(e){Me.renderBufferImmediate(e,d,l)})}else Me.renderBufferDirect(t,r,c,l,h,u)}}function w(e,t,r){var n=qe.get(e),o=Ye.getParameters(e,Fe,t,r),a=Ye.getProgramCode(e,o),s=n.program,h=!0;if(void 0===s)e.addEventListener("dispose",c);else if(s.code!==a)p(e);else{if(void 0!==o.shaderID)return;h=!1}if(h){if(o.shaderID){var l=i.ShaderLib[o.shaderID];n.__webglShader={name:e.type,uniforms:i.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else n.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=n.__webglShader,s=Ye.acquireProgram(e,o,a),n.program=s,e.program=s}var u=s.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<Me.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(var d=0;d<Me.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}n.uniformsList=[];var f=n.__webglShader.uniforms,m=n.program.getUniforms();for(var v in f){var g=m[v];g&&n.uniformsList.push([n.__webglShader.uniforms[v],g])}(e instanceof i.MeshPhongMaterial||e instanceof i.MeshLambertMaterial||e instanceof i.MeshStandardMaterial||e.lights)&&(n.lightsHash=Fe.hash,f.ambientLightColor.value=Fe.ambient,f.directionalLights.value=Fe.directional,f.pointLights.value=Fe.point,f.spotLights.value=Fe.spot,f.hemisphereLights.value=Fe.hemi),n.hasDynamicUniforms=!1;for(var y=0,b=n.uniformsList.length;b>y;y++){var x=n.uniformsList[y][0];if(x.dynamic===!0){n.hasDynamicUniforms=!0;break}}}function M(e){_(e),e.transparent===!0?We.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):We.setBlending(i.NoBlending),We.setDepthFunc(e.depthFunc),We.setDepthTest(e.depthTest),We.setDepthWrite(e.depthWrite),We.setColorWrite(e.colorWrite),We.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function _(e){e.side!==i.DoubleSide?We.enable(Ue.CULL_FACE):We.disable(Ue.CULL_FACE),We.setFlipSided(e.side===i.BackSide)}function E(e,t,r,n){ke=0;var o=qe.get(r);void 0===o.program&&(r.needsUpdate=!0),void 0!==o.lightsHash&&o.lightsHash!==Fe.hash&&(r.needsUpdate=!0),r.needsUpdate&&(w(r,t,n),r.needsUpdate=!1);var a=!1,s=!1,h=!1,c=o.program,l=c.getUniforms(),u=o.__webglShader.uniforms;if(c.id!==Ee&&(Ue.useProgram(c.program),Ee=c.id,a=!0,s=!0,h=!0),r.id!==Ce&&(Ce=r.id,s=!0),(a||e!==Le)&&(Ue.uniformMatrix4fv(l.projectionMatrix,!1,e.projectionMatrix.elements),He.logarithmicDepthBuffer&&Ue.uniform1f(l.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==Le&&(Le=e,s=!0,h=!0),(r instanceof i.ShaderMaterial||r instanceof i.MeshPhongMaterial||r instanceof i.MeshStandardMaterial||r.envMap)&&void 0!==l.cameraPosition&&(Ie.setFromMatrixPosition(e.matrixWorld),Ue.uniform3f(l.cameraPosition,Ie.x,Ie.y,Ie.z)),(r instanceof i.MeshPhongMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshBasicMaterial||r instanceof i.MeshStandardMaterial||r instanceof i.ShaderMaterial||r.skinning)&&void 0!==l.viewMatrix&&Ue.uniformMatrix4fv(l.viewMatrix,!1,e.matrixWorldInverse.elements)),r.skinning)if(n.bindMatrix&&void 0!==l.bindMatrix&&Ue.uniformMatrix4fv(l.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&void 0!==l.bindMatrixInverse&&Ue.uniformMatrix4fv(l.bindMatrixInverse,!1,n.bindMatrixInverse.elements),He.floatVertexTextures&&n.skeleton&&n.skeleton.useVertexTexture){if(void 0!==l.boneTexture){var d=F();Ue.uniform1i(l.boneTexture,d),Me.setTexture(n.skeleton.boneTexture,d)}void 0!==l.boneTextureWidth&&Ue.uniform1i(l.boneTextureWidth,n.skeleton.boneTextureWidth),void 0!==l.boneTextureHeight&&Ue.uniform1i(l.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&void 0!==l.boneGlobalMatrices&&Ue.uniformMatrix4fv(l.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return s&&((r instanceof i.MeshPhongMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshStandardMaterial||r.lights)&&O(u,h),t&&r.fog&&k(u,t),(r instanceof i.MeshBasicMaterial||r instanceof i.MeshLambertMaterial||r instanceof i.MeshPhongMaterial||r instanceof i.MeshStandardMaterial)&&S(u,r),r instanceof i.LineBasicMaterial?C(u,r):r instanceof i.LineDashedMaterial?(C(u,r),T(u,r)):r instanceof i.PointsMaterial?L(u,r):r instanceof i.MeshLambertMaterial?R(u,r):r instanceof i.MeshPhongMaterial?P(u,r):r instanceof i.MeshStandardMaterial?D(u,r):r instanceof i.MeshDepthMaterial?(u.mNear.value=e.near,u.mFar.value=e.far,u.opacity.value=r.opacity):r instanceof i.MeshNormalMaterial&&(u.opacity.value=r.opacity),Ze.enabled&&n.receiveShadow&&!r._shadowPass&&N(u,e),V(o.uniformsList)),I(l,n),void 0!==l.modelMatrix&&Ue.uniformMatrix4fv(l.modelMatrix,!1,n.matrixWorld.elements),o.hasDynamicUniforms===!0&&A(o.uniformsList,n,e),c}function A(e,t,r){for(var n=[],i=0,o=e.length;o>i;i++){var a=e[i][0],s=a.onUpdateCallback;void 0!==s&&(s.bind(a)(t,r),n.push(e[i]))}V(n)}function S(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&(e.emissive.value=t.emissive),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.roughnessMap?r=t.roughnessMap:t.metalnessMap?r=t.metalnessMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r){r instanceof i.WebGLRenderTarget&&(r=r.texture);var n=r.offset,o=r.repeat;e.offsetRepeat.value.set(n.x,n.y,o.x,o.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof i.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function C(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function T(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function L(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=te.height/2,e.map.value=t.map,null!==t.map){var r=t.map.offset,n=t.map.repeat;e.offsetRepeat.value.set(r.x,r.y,n.x,n.y)}}function k(e,t){e.fogColor.value=t.color,t instanceof i.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof i.FogExp2&&(e.fogDensity.value=t.density)}function R(e,t){t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}function P(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function D(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function O(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLights.needsUpdate=t,e.pointLights.needsUpdate=t,e.spotLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function N(e){if(e.shadowMatrix)for(var t=Fe.shadows,r=0,n=t.length;n>r;r++){var o=t[r],a=o.shadow;o instanceof i.PointLight?(Ie.setFromMatrixPosition(o.matrixWorld).negate(),a.matrix.identity().setPosition(Ie),e.shadowDarkness.value[r]=-a.darkness):e.shadowDarkness.value[r]=a.darkness,e.shadowBias.value[r]=a.bias,e.shadowMap.value[r]=a.map,e.shadowMapSize.value[r]=a.mapSize,e.shadowMatrix.value[r]=a.matrix}}function I(e,t){Ue.uniformMatrix4fv(e.modelViewMatrix,!1,t.modelViewMatrix.elements),e.normalMatrix&&Ue.uniformMatrix3fv(e.normalMatrix,!1,t.normalMatrix.elements)}function F(){var e=ke;return e>=He.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+He.maxTextures),ke+=1,e}function V(e){for(var t,r,n=0,o=e.length;o>n;n++){var a=e[n][0];if(a.needsUpdate!==!1){var s=a.type,h=a.value,c=e[n][1];switch(s){case"1i":Ue.uniform1i(c,h);break;case"1f":Ue.uniform1f(c,h);break;case"2f":Ue.uniform2f(c,h[0],h[1]);break;case"3f":Ue.uniform3f(c,h[0],h[1],h[2]);break;case"4f":Ue.uniform4f(c,h[0],h[1],h[2],h[3]);break;case"1iv":Ue.uniform1iv(c,h);break;case"3iv":Ue.uniform3iv(c,h);break;case"1fv":Ue.uniform1fv(c,h);break;case"2fv":Ue.uniform2fv(c,h);break;case"3fv":Ue.uniform3fv(c,h);break;case"4fv":Ue.uniform4fv(c,h);break;case"Matrix2fv":Ue.uniformMatrix2fv(c,!1,h);break;case"Matrix3fv":Ue.uniformMatrix3fv(c,!1,h);break;case"Matrix4fv":Ue.uniformMatrix4fv(c,!1,h);break;case"i":Ue.uniform1i(c,h);break;case"f":Ue.uniform1f(c,h);break;case"v2":Ue.uniform2f(c,h.x,h.y);break;case"v3":Ue.uniform3f(c,h.x,h.y,h.z);break;case"v4":Ue.uniform4f(c,h.x,h.y,h.z,h.w);break;case"c":Ue.uniform3f(c,h.r,h.g,h.b);break;case"sa":for(var l=0;l<h.length;l++)for(var u in a.properties){var d=a.properties[u],p=c[l][u],f=h[l][u];switch(d.type){case"i":Ue.uniform1i(p,f);break;case"f":Ue.uniform1f(p,f);break;case"v2":Ue.uniform2f(p,f.x,f.y);break;case"v3":Ue.uniform3f(p,f.x,f.y,f.z);break;case"v4":Ue.uniform4f(p,f.x,f.y,f.z,f.w);break;case"c":Ue.uniform3f(p,f.r,f.g,f.b)}}break;case"iv1":Ue.uniform1iv(c,h);break;case"iv":Ue.uniform3iv(c,h);break;case"fv1":Ue.uniform1fv(c,h);break;case"fv":Ue.uniform3fv(c,h);break;case"v2v":void 0===a._array&&(a._array=new Float32Array(2*h.length));for(var l=0,m=0,v=h.length;v>l;l++,m+=2)a._array[m+0]=h[l].x,a._array[m+1]=h[l].y;Ue.uniform2fv(c,a._array);break;case"v3v":void 0===a._array&&(a._array=new Float32Array(3*h.length));for(var l=0,g=0,v=h.length;v>l;l++,g+=3)a._array[g+0]=h[l].x,a._array[g+1]=h[l].y,a._array[g+2]=h[l].z;Ue.uniform3fv(c,a._array);break;case"v4v":void 0===a._array&&(a._array=new Float32Array(4*h.length));for(var l=0,y=0,v=h.length;v>l;l++,y+=4)a._array[y+0]=h[l].x,a._array[y+1]=h[l].y,a._array[y+2]=h[l].z,a._array[y+3]=h[l].w;Ue.uniform4fv(c,a._array);break;case"m2":Ue.uniformMatrix2fv(c,!1,h.elements);break;case"m3":Ue.uniformMatrix3fv(c,!1,h.elements);break;case"m3v":void 0===a._array&&(a._array=new Float32Array(9*h.length));for(var l=0,v=h.length;v>l;l++)h[l].flattenToArrayOffset(a._array,9*l);Ue.uniformMatrix3fv(c,!1,a._array);break;case"m4":Ue.uniformMatrix4fv(c,!1,h.elements);break;case"m4v":void 0===a._array&&(a._array=new Float32Array(16*h.length));for(var l=0,v=h.length;v>l;l++)h[l].flattenToArrayOffset(a._array,16*l);Ue.uniformMatrix4fv(c,!1,a._array);break;case"t":if(t=h,r=F(),Ue.uniform1i(c,r),!t)continue;t instanceof i.CubeTexture||Array.isArray(t.image)&&6===t.image.length?q(t,r):t instanceof i.WebGLRenderTargetCube?X(t.texture,r):t instanceof i.WebGLRenderTarget?Me.setTexture(t.texture,r):Me.setTexture(t,r);break;case"tv":void 0===a._array&&(a._array=[]);for(var l=0,v=a.value.length;v>l;l++)a._array[l]=F();Ue.uniform1iv(c,a._array);for(var l=0,v=a.value.length;v>l;l++)t=a.value[l],r=a._array[l],t&&(t instanceof i.CubeTexture||t.image instanceof Array&&6===t.image.length?q(t,r):t instanceof i.WebGLRenderTarget?Me.setTexture(t.texture,r):t instanceof i.WebGLRenderTargetCube?X(t.texture,r):Me.setTexture(t,r));break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+s)}}}}function B(e,t){var r,n,o,a,s,h,c=0,l=0,u=0,d=t.matrixWorldInverse,p=0,f=0,m=0,v=0,g=0;for(Fe.shadowsPointLight=0,r=0,n=e.length;n>r;r++)if(o=e[r],a=o.color,s=o.intensity,h=o.distance,o instanceof i.AmbientLight)c+=a.r*s,l+=a.g*s,u+=a.b*s;else if(o instanceof i.DirectionalLight){var y=Qe.get(o);y.direction.setFromMatrixPosition(o.matrixWorld),Ie.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Ie),y.direction.transformDirection(d),y.color.copy(o.color).multiplyScalar(o.intensity),o.castShadow?(y.shadow=g,Fe.shadows[g++]=o):y.shadow=-1,Fe.directional[p++]=y}else if(o instanceof i.PointLight){var y=Qe.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(d),y.color.copy(o.color).multiplyScalar(o.intensity),y.distance=o.distance,y.decay=0===o.distance?0:o.decay,o.castShadow?(y.shadow=g,Fe.shadows[g++]=o,Fe.shadowsPointLight++):y.shadow=-1,Fe.point[f++]=y}else if(o instanceof i.SpotLight){var y=Qe.get(o);y.position.setFromMatrixPosition(o.matrixWorld),y.position.applyMatrix4(d),y.color.copy(a).multiplyScalar(s),y.distance=h,y.direction.setFromMatrixPosition(o.matrixWorld),Ie.setFromMatrixPosition(o.target.matrixWorld),y.direction.sub(Ie),y.direction.transformDirection(d),y.angleCos=Math.cos(o.angle),y.exponent=o.exponent,y.decay=0===o.distance?0:o.decay,o.castShadow?(y.shadow=g,Fe.shadows[g++]=o):y.shadow=-1,Fe.spot[m++]=y}else if(o instanceof i.HemisphereLight){var y=Qe.get(o);y.direction.setFromMatrixPosition(o.matrixWorld),y.direction.transformDirection(d),y.direction.normalize(),y.skyColor.copy(o.color).multiplyScalar(s),y.groundColor.copy(o.groundColor).multiplyScalar(s),Fe.hemi[v++]=y}Fe.ambient[0]=c,Fe.ambient[1]=l,Fe.ambient[2]=u,Fe.directional.length=p,Fe.point.length=f,Fe.spot.length=m,Fe.hemi.length=v,Fe.shadows.length=g,Fe.hash=p+","+f+","+m+","+v+","+g}function U(e,t,r){var n;if(r?(Ue.texParameteri(e,Ue.TEXTURE_WRAP_S,ee(t.wrapS)),Ue.texParameteri(e,Ue.TEXTURE_WRAP_T,ee(t.wrapT)),Ue.texParameteri(e,Ue.TEXTURE_MAG_FILTER,ee(t.magFilter)),Ue.texParameteri(e,Ue.TEXTURE_MIN_FILTER,ee(t.minFilter))):(Ue.texParameteri(e,Ue.TEXTURE_WRAP_S,Ue.CLAMP_TO_EDGE),Ue.texParameteri(e,Ue.TEXTURE_WRAP_T,Ue.CLAMP_TO_EDGE),(t.wrapS!==i.ClampToEdgeWrapping||t.wrapT!==i.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",t),Ue.texParameteri(e,Ue.TEXTURE_MAG_FILTER,J(t.magFilter)),Ue.texParameteri(e,Ue.TEXTURE_MIN_FILTER,J(t.minFilter)),t.minFilter!==i.NearestFilter&&t.minFilter!==i.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",t)),n=Ge.get("EXT_texture_filter_anisotropic")){if(t.type===i.FloatType&&null===Ge.get("OES_texture_float_linear"))return;if(t.type===i.HalfFloatType&&null===Ge.get("OES_texture_half_float_linear"))return;(t.anisotropy>1||qe.get(t).__currentAnisotropy)&&(Ue.texParameterf(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Me.getMaxAnisotropy())),qe.get(t).__currentAnisotropy=t.anisotropy)}}function z(e,t,r){void 0===e.__webglInit&&(e.__webglInit=!0,t.addEventListener("dispose",s),e.__webglTexture=Ue.createTexture(),Ve.textures++),We.activeTexture(Ue.TEXTURE0+r),We.bindTexture(Ue.TEXTURE_2D,e.__webglTexture),Ue.pixelStorei(Ue.UNPACK_FLIP_Y_WEBGL,t.flipY),Ue.pixelStorei(Ue.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Ue.pixelStorei(Ue.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=j(t.image,He.maxTextureSize),H(t)&&G(t.image)===!1&&(t.image=W(t.image));var n=t.image,o=G(n),a=ee(t.format),h=ee(t.type);U(Ue.TEXTURE_2D,t,o);var c,l=t.mipmaps;if(t instanceof i.DataTexture)if(l.length>0&&o){for(var u=0,d=l.length;d>u;u++)c=l[u],We.texImage2D(Ue.TEXTURE_2D,u,a,c.width,c.height,0,a,h,c.data);t.generateMipmaps=!1}else We.texImage2D(Ue.TEXTURE_2D,0,a,n.width,n.height,0,a,h,n.data);else if(t instanceof i.CompressedTexture)for(var u=0,d=l.length;d>u;u++)c=l[u],t.format!==i.RGBAFormat&&t.format!==i.RGBFormat?We.getCompressedTextureFormats().indexOf(a)>-1?We.compressedTexImage2D(Ue.TEXTURE_2D,u,a,c.width,c.height,0,c.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):We.texImage2D(Ue.TEXTURE_2D,u,a,c.width,c.height,0,a,h,c.data);else if(l.length>0&&o){for(var u=0,d=l.length;d>u;u++)c=l[u],We.texImage2D(Ue.TEXTURE_2D,u,a,a,h,c);t.generateMipmaps=!1}else We.texImage2D(Ue.TEXTURE_2D,0,a,a,h,t.image);t.generateMipmaps&&o&&Ue.generateMipmap(Ue.TEXTURE_2D),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function j(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),n=document.createElement("canvas");n.width=Math.floor(e.width*r),n.height=Math.floor(e.height*r);var i=n.getContext("2d");return i.drawImage(e,0,0,e.width,e.height,0,0,n.width,n.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+n.width+"x"+n.height,e),n}return e}function G(e){return i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height)}function H(e){return e.wrapS!==i.ClampToEdgeWrapping||e.wrapT!==i.ClampToEdgeWrapping?!0:e.minFilter!==i.NearestFilter&&e.minFilter!==i.LinearFilter?!0:!1}function W(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement){var t=document.createElement("canvas");t.width=i.Math.nearestPowerOfTwo(e.width),t.height=i.Math.nearestPowerOfTwo(e.height);var r=t.getContext("2d");return r.drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}function q(e,t){var r=qe.get(e);if(6===e.image.length)if(e.version>0&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",s),r.__image__webglTextureCube=Ue.createTexture(),Ve.textures++),We.activeTexture(Ue.TEXTURE0+t),We.bindTexture(Ue.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),Ue.pixelStorei(Ue.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var n=e instanceof i.CompressedTexture,o=e.image[0]instanceof i.DataTexture,a=[],h=0;6>h;h++)a[h]=!Me.autoScaleCubemaps||n||o?o?e.image[h].image:e.image[h]:j(e.image[h],He.maxCubemapSize);var c=a[0],l=G(c),u=ee(e.format),d=ee(e.type);U(Ue.TEXTURE_CUBE_MAP,e,l);for(var h=0;6>h;h++)if(n)for(var p,f=a[h].mipmaps,m=0,v=f.length;v>m;m++)p=f[m],e.format!==i.RGBAFormat&&e.format!==i.RGBFormat?We.getCompressedTextureFormats().indexOf(u)>-1?We.compressedTexImage2D(Ue.TEXTURE_CUBE_MAP_POSITIVE_X+h,m,u,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):We.texImage2D(Ue.TEXTURE_CUBE_MAP_POSITIVE_X+h,m,u,p.width,p.height,0,u,d,p.data);else o?We.texImage2D(Ue.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,u,a[h].width,a[h].height,0,u,d,a[h].data):We.texImage2D(Ue.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,u,u,d,a[h]);e.generateMipmaps&&l&&Ue.generateMipmap(Ue.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else We.activeTexture(Ue.TEXTURE0+t),We.bindTexture(Ue.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function X(e,t){We.activeTexture(Ue.TEXTURE0+t),We.bindTexture(Ue.TEXTURE_CUBE_MAP,qe.get(e).__webglTexture)}function Y(e,t,r,n){var i=ee(t.texture.format),o=ee(t.texture.type);We.texImage2D(n,0,i,t.width,t.height,0,i,o,null),Ue.bindFramebuffer(Ue.FRAMEBUFFER,e),Ue.framebufferTexture2D(Ue.FRAMEBUFFER,r,n,qe.get(t.texture).__webglTexture,0),Ue.bindFramebuffer(Ue.FRAMEBUFFER,null)}function Q(e,t){Ue.bindRenderbuffer(Ue.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Ue.renderbufferStorage(Ue.RENDERBUFFER,Ue.DEPTH_COMPONENT16,t.width,t.height),Ue.framebufferRenderbuffer(Ue.FRAMEBUFFER,Ue.DEPTH_ATTACHMENT,Ue.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Ue.renderbufferStorage(Ue.RENDERBUFFER,Ue.DEPTH_STENCIL,t.width,t.height),Ue.framebufferRenderbuffer(Ue.FRAMEBUFFER,Ue.DEPTH_STENCIL_ATTACHMENT,Ue.RENDERBUFFER,e)):Ue.renderbufferStorage(Ue.RENDERBUFFER,Ue.RGBA4,t.width,t.height),Ue.bindRenderbuffer(Ue.RENDERBUFFER,null)}function K(e){var t=qe.get(e),r=e instanceof i.WebGLRenderTargetCube;if(r){t.__webglDepthbuffer=[];for(var n=0;6>n;n++)Ue.bindFramebuffer(Ue.FRAMEBUFFER,t.__webglFramebuffer[n]),t.__webglDepthbuffer[n]=Ue.createRenderbuffer(),Q(t.__webglDepthbuffer[n],e)}else Ue.bindFramebuffer(Ue.FRAMEBUFFER,t.__webglFramebuffer),t.__webglDepthbuffer=Ue.createRenderbuffer(),Q(t.__webglDepthbuffer,e);Ue.bindFramebuffer(Ue.FRAMEBUFFER,null)}function $(e){var t=qe.get(e),r=qe.get(e.texture);e.addEventListener("dispose",h),r.__webglTexture=Ue.createTexture(),Ve.textures++;var n=e instanceof i.WebGLRenderTargetCube,o=i.Math.isPowerOfTwo(e.width)&&i.Math.isPowerOfTwo(e.height);if(n){t.__webglFramebuffer=[];for(var a=0;6>a;a++)t.__webglFramebuffer[a]=Ue.createFramebuffer()}else t.__webglFramebuffer=Ue.createFramebuffer();if(n){We.bindTexture(Ue.TEXTURE_CUBE_MAP,r.__webglTexture),U(Ue.TEXTURE_CUBE_MAP,e.texture,o);for(var a=0;6>a;a++)Y(t.__webglFramebuffer[a],e,Ue.COLOR_ATTACHMENT0,Ue.TEXTURE_CUBE_MAP_POSITIVE_X+a);e.texture.generateMipmaps&&o&&Ue.generateMipmap(Ue.TEXTURE_CUBE_MAP),We.bindTexture(Ue.TEXTURE_CUBE_MAP,null)}else We.bindTexture(Ue.TEXTURE_2D,r.__webglTexture),U(Ue.TEXTURE_2D,e.texture,o),Y(t.__webglFramebuffer,e,Ue.COLOR_ATTACHMENT0,Ue.TEXTURE_2D),e.texture.generateMipmaps&&o&&Ue.generateMipmap(Ue.TEXTURE_2D),We.bindTexture(Ue.TEXTURE_2D,null);e.depthBuffer&&K(e)}function Z(e){var t=e instanceof i.WebGLRenderTargetCube?Ue.TEXTURE_CUBE_MAP:Ue.TEXTURE_2D,r=qe.get(e.texture).__webglTexture;We.bindTexture(t,r),Ue.generateMipmap(t),We.bindTexture(t,null)}function J(e){return e===i.NearestFilter||e===i.NearestMipMapNearestFilter||e===i.NearestMipMapLinearFilter?Ue.NEAREST:Ue.LINEAR}function ee(e){var t;if(e===i.RepeatWrapping)return Ue.REPEAT;if(e===i.ClampToEdgeWrapping)return Ue.CLAMP_TO_EDGE;if(e===i.MirroredRepeatWrapping)return Ue.MIRRORED_REPEAT;if(e===i.NearestFilter)return Ue.NEAREST;if(e===i.NearestMipMapNearestFilter)return Ue.NEAREST_MIPMAP_NEAREST;if(e===i.NearestMipMapLinearFilter)return Ue.NEAREST_MIPMAP_LINEAR;if(e===i.LinearFilter)return Ue.LINEAR;if(e===i.LinearMipMapNearestFilter)return Ue.LINEAR_MIPMAP_NEAREST;if(e===i.LinearMipMapLinearFilter)return Ue.LINEAR_MIPMAP_LINEAR;if(e===i.UnsignedByteType)return Ue.UNSIGNED_BYTE;if(e===i.UnsignedShort4444Type)return Ue.UNSIGNED_SHORT_4_4_4_4;if(e===i.UnsignedShort5551Type)return Ue.UNSIGNED_SHORT_5_5_5_1;if(e===i.UnsignedShort565Type)return Ue.UNSIGNED_SHORT_5_6_5;if(e===i.ByteType)return Ue.BYTE;if(e===i.ShortType)return Ue.SHORT;if(e===i.UnsignedShortType)return Ue.UNSIGNED_SHORT;if(e===i.IntType)return Ue.INT;if(e===i.UnsignedIntType)return Ue.UNSIGNED_INT;if(e===i.FloatType)return Ue.FLOAT;if(t=Ge.get("OES_texture_half_float"),null!==t&&e===i.HalfFloatType)return t.HALF_FLOAT_OES;if(e===i.AlphaFormat)return Ue.ALPHA;if(e===i.RGBFormat)return Ue.RGB;if(e===i.RGBAFormat)return Ue.RGBA;if(e===i.LuminanceFormat)return Ue.LUMINANCE;if(e===i.LuminanceAlphaFormat)return Ue.LUMINANCE_ALPHA;if(e===i.AddEquation)return Ue.FUNC_ADD;if(e===i.SubtractEquation)return Ue.FUNC_SUBTRACT;if(e===i.ReverseSubtractEquation)return Ue.FUNC_REVERSE_SUBTRACT;if(e===i.ZeroFactor)return Ue.ZERO;if(e===i.OneFactor)return Ue.ONE;if(e===i.SrcColorFactor)return Ue.SRC_COLOR;if(e===i.OneMinusSrcColorFactor)return Ue.ONE_MINUS_SRC_COLOR;if(e===i.SrcAlphaFactor)return Ue.SRC_ALPHA;if(e===i.OneMinusSrcAlphaFactor)return Ue.ONE_MINUS_SRC_ALPHA;if(e===i.DstAlphaFactor)return Ue.DST_ALPHA;if(e===i.OneMinusDstAlphaFactor)return Ue.ONE_MINUS_DST_ALPHA;if(e===i.DstColorFactor)return Ue.DST_COLOR;if(e===i.OneMinusDstColorFactor)return Ue.ONE_MINUS_DST_COLOR;if(e===i.SrcAlphaSaturateFactor)return Ue.SRC_ALPHA_SATURATE;if(t=Ge.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===i.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===i.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===i.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Ge.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===i.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===i.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===i.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===i.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Ge.get("EXT_blend_minmax"),null!==t){if(e===i.MinEquation)return t.MIN_EXT;if(e===i.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",i.REVISION),e=e||{};var te=void 0!==e.canvas?e.canvas:document.createElement("canvas"),re=void 0!==e.context?e.context:null,ne=te.width,ie=te.height,oe=1,ae=void 0!==e.alpha?e.alpha:!1,se=void 0!==e.depth?e.depth:!0,he=void 0!==e.stencil?e.stencil:!0,ce=void 0!==e.antialias?e.antialias:!1,le=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,ue=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,de=new i.Color(0),pe=0,fe=[],me=[],ve=-1,ge=[],ye=-1,be=new Float32Array(8),xe=[],we=[];this.domElement=te,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var Me=this,_e=null,Ee=null,Ae=null,Se=null,Ce=-1,Te="",Le=null,ke=0,Re=new i.Vector4(0,0,te.width,te.height),Pe=!1,De=new i.Vector4(0,0,te.width,te.height),Oe=new i.Frustum,Ne=new i.Matrix4,Ie=new i.Vector3,Fe={hash:"",ambient:[0,0,0],directional:[],point:[],spot:[],hemi:[],shadows:[],shadowsPointLight:0},Ve={geometries:0,textures:0},Be={calls:0,vertices:0,faces:0,points:0};this.info={render:Be,memory:Ve,programs:null};var Ue;try{var ze={alpha:ae,depth:se,stencil:he,antialias:ce,premultipliedAlpha:le,preserveDrawingBuffer:ue};if(Ue=re||te.getContext("webgl",ze)||te.getContext("experimental-webgl",ze),null===Ue)throw null!==te.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";te.addEventListener("webglcontextlost",a,!1)}catch(je){console.error("THREE.WebGLRenderer: "+je)}var Ge=new i.WebGLExtensions(Ue);Ge.get("OES_texture_float"),Ge.get("OES_texture_float_linear"),Ge.get("OES_texture_half_float"),Ge.get("OES_texture_half_float_linear"),Ge.get("OES_standard_derivatives"),Ge.get("ANGLE_instanced_arrays"),Ge.get("OES_element_index_uint")&&(i.BufferGeometry.MaxIndex=4294967296);var He=new i.WebGLCapabilities(Ue,Ge,e),We=new i.WebGLState(Ue,Ge,ee),qe=new i.WebGLProperties,Xe=new i.WebGLObjects(Ue,qe,this.info),Ye=new i.WebGLPrograms(this,He),Qe=new i.WebGLLights;this.info.programs=Ye.programs;var Ke=new i.WebGLBufferRenderer(Ue,Ge,Be),$e=new i.WebGLIndexedBufferRenderer(Ue,Ge,Be);n(),this.context=Ue,this.capabilities=He,this.extensions=Ge,this.properties=qe,this.state=We;var Ze=new i.WebGLShadowMap(this,Fe,Xe);this.shadowMap=Ze;var Je=new i.SpritePlugin(this,xe),et=new i.LensFlarePlugin(this,we);this.getContext=function(){return Ue},this.getContextAttributes=function(){return Ue.getContextAttributes()},this.forceContextLoss=function(){Ge.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=Ge.get("EXT_texture_filter_anisotropic");return e=null!==t?Ue.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return He.precision},this.getPixelRatio=function(){return oe},this.setPixelRatio=function(e){void 0!==e&&(oe=e)},this.getSize=function(){return{width:ne,height:ie}},this.setSize=function(e,t,r){ne=e,ie=t,te.width=e*oe,te.height=t*oe,r!==!1&&(te.style.width=e+"px",te.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,n){De.set(e,t,r,n).multiplyScalar(oe),We.viewport(De)},this.setScissor=function(e,t,r,n){Re.set(e,t,r,n).multiplyScalar(oe),We.scissor(Re)},this.setScissorTest=function(e){Pe=e,We.setScissorTest(e)},this.getClearColor=function(){return de},this.setClearColor=function(e,t){de.set(e),pe=void 0!==t?t:1,r(de.r,de.g,de.b,pe)},this.getClearAlpha=function(){return pe},this.setClearAlpha=function(e){pe=e,r(de.r,de.g,de.b,pe)},this.clear=function(e,t,r){var n=0;(void 0===e||e)&&(n|=Ue.COLOR_BUFFER_BIT),(void 0===t||t)&&(n|=Ue.DEPTH_BUFFER_BIT),(void 0===r||r)&&(n|=Ue.STENCIL_BUFFER_BIT),Ue.clear(n)},this.clearColor=function(){Ue.clear(Ue.COLOR_BUFFER_BIT)},this.clearDepth=function(){Ue.clear(Ue.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Ue.clear(Ue.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,r,n){this.setRenderTarget(e),this.clear(t,r,n)},this.resetGLState=o,this.dispose=function(){te.removeEventListener("webglcontextlost",a,!1)},this.renderBufferImmediate=function(e,t,r){We.initAttributes();var n=qe.get(e);e.hasPositions&&!n.position&&(n.position=Ue.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=Ue.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=Ue.createBuffer()),e.hasColors&&!n.color&&(n.color=Ue.createBuffer());var o=t.getAttributes();if(e.hasPositions&&(Ue.bindBuffer(Ue.ARRAY_BUFFER,n.position),Ue.bufferData(Ue.ARRAY_BUFFER,e.positionArray,Ue.DYNAMIC_DRAW),We.enableAttribute(o.position),Ue.vertexAttribPointer(o.position,3,Ue.FLOAT,!1,0,0)),
  e.hasNormals){if(Ue.bindBuffer(Ue.ARRAY_BUFFER,n.normal),"MeshPhongMaterial"!==r.type&&"MeshStandardMaterial"!==r.type&&r.shading===i.FlatShading)for(var a=0,s=3*e.count;s>a;a+=9){var h=e.normalArray,c=(h[a+0]+h[a+3]+h[a+6])/3,l=(h[a+1]+h[a+4]+h[a+7])/3,u=(h[a+2]+h[a+5]+h[a+8])/3;h[a+0]=c,h[a+1]=l,h[a+2]=u,h[a+3]=c,h[a+4]=l,h[a+5]=u,h[a+6]=c,h[a+7]=l,h[a+8]=u}Ue.bufferData(Ue.ARRAY_BUFFER,e.normalArray,Ue.DYNAMIC_DRAW),We.enableAttribute(o.normal),Ue.vertexAttribPointer(o.normal,3,Ue.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(Ue.bindBuffer(Ue.ARRAY_BUFFER,n.uv),Ue.bufferData(Ue.ARRAY_BUFFER,e.uvArray,Ue.DYNAMIC_DRAW),We.enableAttribute(o.uv),Ue.vertexAttribPointer(o.uv,2,Ue.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==i.NoColors&&(Ue.bindBuffer(Ue.ARRAY_BUFFER,n.color),Ue.bufferData(Ue.ARRAY_BUFFER,e.colorArray,Ue.DYNAMIC_DRAW),We.enableAttribute(o.color),Ue.vertexAttribPointer(o.color,3,Ue.FLOAT,!1,0,0)),We.disableUnusedAttributes(),Ue.drawArrays(Ue.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,r,n,o,a,s){M(o);var h=E(e,r,o,a),c=!1,l=n.id+"_"+h.id+"_"+o.wireframe;l!==Te&&(Te=l,c=!0);var u=a.morphTargetInfluences;if(void 0!==u){for(var d=[],p=0,v=u.length;v>p;p++){var g=u[p];d.push([g,p])}d.sort(m),d.length>8&&(d.length=8);for(var y=n.morphAttributes,p=0,v=d.length;v>p;p++){var g=d[p];if(be[p]=g[0],0!==g[0]){var b=g[1];o.morphTargets===!0&&y.position&&n.addAttribute("morphTarget"+p,y.position[b]),o.morphNormals===!0&&y.normal&&n.addAttribute("morphNormal"+p,y.normal[b])}else o.morphTargets===!0&&n.removeAttribute("morphTarget"+p),o.morphNormals===!0&&n.removeAttribute("morphNormal"+p)}var x=h.getUniforms();null!==x.morphTargetInfluences&&Ue.uniform1fv(x.morphTargetInfluences,be),c=!0}var b=n.index,w=n.attributes.position;o.wireframe===!0&&(b=Xe.getWireframeAttribute(n));var _;null!==b?(_=$e,_.setIndex(b)):_=Ke,c&&(f(o,h,n),null!==b&&Ue.bindBuffer(Ue.ELEMENT_ARRAY_BUFFER,Xe.getAttributeBuffer(b)));var A=0,S=1/0;null!==b?S=b.count:void 0!==w&&(S=w.count);var C=n.drawRange.start,T=n.drawRange.count,L=null!==s?s.start:0,k=null!==s?s.count:1/0,R=Math.max(A,C,L),P=Math.min(A+S,C+T,L+k)-1,D=Math.max(0,P-R+1);if(a instanceof i.Mesh)if(o.wireframe===!0)We.setLineWidth(o.wireframeLinewidth*t()),_.setMode(Ue.LINES);else switch(a.drawMode){case i.TrianglesDrawMode:_.setMode(Ue.TRIANGLES);break;case i.TriangleStripDrawMode:_.setMode(Ue.TRIANGLE_STRIP);break;case i.TriangleFanDrawMode:_.setMode(Ue.TRIANGLE_FAN)}else if(a instanceof i.Line){var O=o.linewidth;void 0===O&&(O=1),We.setLineWidth(O*t()),_.setMode(a instanceof i.LineSegments?Ue.LINES:Ue.LINE_STRIP)}else a instanceof i.Points&&_.setMode(Ue.POINTS);n instanceof i.InstancedBufferGeometry&&n.maxInstancedCount>0?_.renderInstances(n,R,D):_.render(R,D)},this.render=function(e,t,r,n){if(t instanceof i.Camera==!1)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=e.fog;if(Te="",Ce=-1,Le=null,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),Ne.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Oe.setFromMatrix(Ne),fe.length=0,ve=-1,ye=-1,xe.length=0,we.length=0,b(e,t),me.length=ve+1,ge.length=ye+1,Me.sortObjects===!0&&(me.sort(v),ge.sort(g)),B(fe,t),Ze.render(e,t),Be.calls=0,Be.vertices=0,Be.faces=0,Be.points=0,void 0===r&&(r=null),this.setRenderTarget(r),(this.autoClear||n)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){var a=e.overrideMaterial;x(me,t,o,a),x(ge,t,o,a)}else We.setBlending(i.NoBlending),x(me,t,o),x(ge,t,o);if(Je.render(e,t),et.render(e,t,_e),r){var s=r.texture;s.generateMipmaps&&G(r)&&s.minFilter!==i.NearestFilter&&s.minFilter!==i.LinearFilter&&Z(r)}We.setDepthTest(!0),We.setDepthWrite(!0),We.setColorWrite(!0)},this.setFaceCulling=function(e,t){e===i.CullFaceNone?We.disable(Ue.CULL_FACE):(Ue.frontFace(t===i.FrontFaceDirectionCW?Ue.CW:Ue.CCW),Ue.cullFace(e===i.CullFaceBack?Ue.BACK:e===i.CullFaceFront?Ue.FRONT:Ue.FRONT_AND_BACK),We.enable(Ue.CULL_FACE))},this.setTexture=function(e,t){var r=qe.get(e);if(e.version>0&&r.__version!==e.version){var n=e.image;return void 0===n?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e):n.complete===!1?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e):void z(r,e,t)}We.activeTexture(Ue.TEXTURE0+t),We.bindTexture(Ue.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(e){Ae=e,e&&void 0===qe.get(e).__webglFramebuffer&&$(e);var t,r,n,o,a=e instanceof i.WebGLRenderTargetCube;if(e){var s=qe.get(e);t=a?s.__webglFramebuffer[e.activeCubeFace]:s.__webglFramebuffer,r=e.scissor,n=e.scissorTest,o=e.viewport}else t=null,r=Re,n=Pe,o=De;if(t!==Se&&(Ue.bindFramebuffer(Ue.FRAMEBUFFER,t),Se=t),We.scissor(r),We.setScissorTest(n),We.viewport(o),a){var h=qe.get(e.texture);Ue.framebufferTexture2D(Ue.FRAMEBUFFER,Ue.COLOR_ATTACHMENT0,Ue.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,h.__webglTexture,0)}_e=o},this.readRenderTargetPixels=function(e,t,r,n,o,a){if(e instanceof i.WebGLRenderTarget==!1)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var s=qe.get(e).__webglFramebuffer;if(s){var h=!1;s!==Se&&(Ue.bindFramebuffer(Ue.FRAMEBUFFER,s),h=!0);try{var c=e.texture;if(c.format!==i.RGBAFormat&&ee(c.format)!==Ue.getParameter(Ue.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(c.type===i.UnsignedByteType||ee(c.type)===Ue.getParameter(Ue.IMPLEMENTATION_COLOR_READ_TYPE)||c.type===i.FloatType&&Ge.get("WEBGL_color_buffer_float")||c.type===i.HalfFloatType&&Ge.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Ue.checkFramebufferStatus(Ue.FRAMEBUFFER)===Ue.FRAMEBUFFER_COMPLETE?Ue.readPixels(t,r,n,o,ee(c.format),ee(c.type),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{h&&Ue.bindFramebuffer(Ue.FRAMEBUFFER,Se)}}}},i.WebGLRenderTarget=function(e,t,r){this.uuid=i.Math.generateUUID(),this.width=e,this.height=t,this.scissor=new i.Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new i.Vector4(0,0,e,t),r=r||{},void 0===r.minFilter&&(r.minFilter=i.LinearFilter),this.texture=new i.Texture(void 0,void 0,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy),this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0},i.WebGLRenderTarget.prototype={constructor:i.WebGLRenderTarget,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.shareDepthFrom=e.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},i.EventDispatcher.prototype.apply(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube=function(e,t,r){i.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},i.WebGLRenderTargetCube.prototype=Object.create(i.WebGLRenderTarget.prototype),i.WebGLRenderTargetCube.prototype.constructor=i.WebGLRenderTargetCube,i.WebGLBufferRenderer=function(e,t,r){function n(e){s=e}function o(t,n){e.drawArrays(s,t,n),r.calls++,r.vertices+=n,s===e.TRIANGLES&&(r.faces+=n/3)}function a(e){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var n=e.attributes.position;n instanceof i.InterleavedBufferAttribute?r.drawArraysInstancedANGLE(s,0,n.data.count,e.maxInstancedCount):r.drawArraysInstancedANGLE(s,0,n.count,e.maxInstancedCount)}var s;this.setMode=n,this.render=o,this.renderInstances=a},i.WebGLIndexedBufferRenderer=function(e,t,r){function n(e){s=e}function i(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(h=e.UNSIGNED_INT,c=4):(h=e.UNSIGNED_SHORT,c=2)}function o(t,n){e.drawElements(s,n,h,t*c),r.calls++,r.vertices+=n,s===e.TRIANGLES&&(r.faces+=n/3)}function a(e,r,n){var i=t.get("ANGLE_instanced_arrays");return null===i?void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):void i.drawElementsInstancedANGLE(s,n,h,r*c,e.maxInstancedCount)}var s,h,c;this.setMode=n,this.setIndex=i,this.render=o,this.renderInstances=a},i.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var n;switch(r){case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(r)}return null===n&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=n,n}},i.WebGLCapabilities=function(e,t,r){function n(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}this.getMaxPrecision=n,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer?r.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var i=n(this.precision);i!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",i,"instead."),this.precision=i),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},i.WebGLGeometries=function(e,t,r){function n(e){var t=e.geometry;if(void 0!==l[t.id])return l[t.id];t.addEventListener("dispose",o);var n;return t instanceof i.BufferGeometry?n=t:t instanceof i.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new i.BufferGeometry).setFromObject(e)),n=t._bufferGeometry),l[t.id]=n,r.memory.geometries++,n}function o(e){var n=e.target,i=l[n.id];null!==i.index&&s(i.index),h(i.attributes),n.removeEventListener("dispose",o),delete l[n.id];var a=t.get(n);a.wireframe&&s(a.wireframe),t["delete"](n);var c=t.get(i);c.wireframe&&s(c.wireframe),t["delete"](i),r.memory.geometries--}function a(e){return e instanceof i.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function s(t){var r=a(t);void 0!==r&&(e.deleteBuffer(r),c(t))}function h(e){for(var t in e)s(e[t])}function c(e){t["delete"](e instanceof i.InterleavedBufferAttribute?e.data:e)}var l={};this.get=n},i.WebGLLights=function(){var e={};this.get=function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"HemisphereLight":r={direction:new i.Vector3,skyColor:new i.Color,groundColor:new i.Color};break;case"DirectionalLight":r={direction:new i.Vector3,color:new i.Color,shadow:-1};break;case"PointLight":r={position:new i.Vector3,color:new i.Color,distance:0,decay:0,shadow:-1};break;case"SpotLight":r={position:new i.Vector3,direction:new i.Vector3,color:new i.Color,distance:0,angleCos:0,exponent:0,decay:0,shadow:-1}}return e[t.id]=r,r}},i.WebGLObjects=function(e,t,r){function n(t){var r=u.get(t);t.geometry instanceof i.Geometry&&r.updateFromObject(t);var n=r.index,a=r.attributes;null!==n&&o(n,e.ELEMENT_ARRAY_BUFFER);for(var s in a)o(a[s],e.ARRAY_BUFFER);var h=r.morphAttributes;for(var s in h)for(var c=h[s],l=0,d=c.length;d>l;l++)o(c[l],e.ARRAY_BUFFER);return r}function o(e,r){var n=e instanceof i.InterleavedBufferAttribute?e.data:e,o=t.get(n);void 0===o.__webglBuffer?a(o,n,r):o.version!==n.version&&s(o,n,r)}function a(t,r,n){t.__webglBuffer=e.createBuffer(),e.bindBuffer(n,t.__webglBuffer);var i=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(n,r.array,i),t.version=r.version}function s(t,r,n){e.bindBuffer(n,t.__webglBuffer),r.dynamic===!1||-1===r.updateRange.count?e.bufferSubData(n,0,r.array):0===r.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(n,r.updateRange.offset*r.array.BYTES_PER_ELEMENT,r.array.subarray(r.updateRange.offset,r.updateRange.offset+r.updateRange.count)),r.updateRange.count=0),t.version=r.version}function h(e){return e instanceof i.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function c(r){var n=t.get(r);if(void 0!==n.wireframe)return n.wireframe;var a=[],s=r.index,h=r.attributes,c=h.position;if(null!==s)for(var u={},d=s.array,p=0,f=d.length;f>p;p+=3){var m=d[p+0],v=d[p+1],g=d[p+2];l(u,m,v)&&a.push(m,v),l(u,v,g)&&a.push(v,g),l(u,g,m)&&a.push(g,m)}else for(var d=h.position.array,p=0,f=d.length/3-1;f>p;p+=3){var m=p+0,v=p+1,g=p+2;a.push(m,v,v,g,g,m)}var y=c.count>65535?Uint32Array:Uint16Array,b=new i.BufferAttribute(new y(a),1);return o(b,e.ELEMENT_ARRAY_BUFFER),n.wireframe=b,b}function l(e,t,r){if(t>r){var n=t;t=r,r=n}var i=e[t];return void 0===i?(e[t]=[r],!0):-1===i.indexOf(r)?(i.push(r),!0):!1}var u=new i.WebGLGeometries(e,t,r);this.getAttributeBuffer=h,this.getWireframeAttribute=c,this.update=n},i.WebGLProgram=function(){function e(e,t,r){e=e||{};var n=[e.derivatives||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&r.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&r.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&r.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return n.filter(o).join("\n")}function t(e){var t=[];for(var r in e){var n=e[r];n!==!1&&t.push("#define "+r+" "+n)}return t.join("\n")}function r(e,t){for(var r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i=0;n>i;i++){var o=e.getActiveUniform(t,i),a=o.name,l=e.getUniformLocation(t,a),u=s.exec(a);if(u){var d=u[1],p=u[2],f=r[d];f||(f=r[d]={}),f[p]=l}else if(u=h.exec(a)){var m=u[1],v=u[2],g=u[3],y=r[m];y||(y=r[m]=[]);var b=y[v];b||(b=y[v]={}),b[g]=l}else if(u=c.exec(a)){var m=u[1];r[m]=l}else r[a]=l}return r}function n(e,t){for(var r={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;n>i;i++){var o=e.getActiveAttrib(t,i),a=o.name;r[a]=e.getAttribLocation(t,a)}return r}function o(e){return""!==e}var a=0,s=/^([\w\d_]+)\.([\w\d_]+)$/,h=/^([\w\d_]+)\[(\d+)\]\.([\w\d_]+)$/,c=/^([\w\d_]+)\[0\]$/;return function(s,h,c,l){var u=s.context,d=c.extensions,p=c.defines,f=c.__webglShader.vertexShader,m=c.__webglShader.fragmentShader,v="SHADOWMAP_TYPE_BASIC";l.shadowMapType===i.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":l.shadowMapType===i.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");var g="ENVMAP_TYPE_CUBE",y="ENVMAP_MODE_REFLECTION",b="ENVMAP_BLENDING_MULTIPLY";if(l.envMap){switch(c.envMap.mapping){case i.CubeReflectionMapping:case i.CubeRefractionMapping:g="ENVMAP_TYPE_CUBE";break;case i.EquirectangularReflectionMapping:case i.EquirectangularRefractionMapping:g="ENVMAP_TYPE_EQUIREC";break;case i.SphericalReflectionMapping:g="ENVMAP_TYPE_SPHERE"}switch(c.envMap.mapping){case i.CubeRefractionMapping:case i.EquirectangularRefractionMapping:y="ENVMAP_MODE_REFRACTION"}switch(c.combine){case i.MultiplyOperation:b="ENVMAP_BLENDING_MULTIPLY";break;case i.MixOperation:b="ENVMAP_BLENDING_MIX";break;case i.AddOperation:b="ENVMAP_BLENDING_ADD"}}var x,w,M=s.gammaFactor>0?s.gammaFactor:1,_=e(d,l,s.extensions),E=t(p),A=u.createProgram();c instanceof i.RawShaderMaterial?(x="",w=""):(x=["precision "+l.precision+" float;","precision "+l.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,E,l.supportsVertexTextures?"#define VERTEX_TEXTURES":"",s.gammaInput?"#define GAMMA_INPUT":"",s.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+M,"#define NUM_DIR_LIGHTS "+l.numDirLights,"#define NUM_POINT_LIGHTS "+l.numPointLights,"#define NUM_SPOT_LIGHTS "+l.numSpotLights,"#define NUM_HEMI_LIGHTS "+l.numHemiLights,"#define NUM_SHADOWS "+l.numShadows,"#define MAX_BONES "+l.maxBones,l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define "+y:"",l.lightMap?"#define USE_LIGHTMAP":"",l.aoMap?"#define USE_AOMAP":"",l.emissiveMap?"#define USE_EMISSIVEMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.displacementMap&&l.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.roughnessMap?"#define USE_ROUGHNESSMAP":"",l.metalnessMap?"#define USE_METALNESSMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.flatShading?"#define FLAT_SHADED":"",l.skinning?"#define USE_SKINNING":"",l.useVertexTexture?"#define BONE_TEXTURE":"",l.morphTargets?"#define USE_MORPHTARGETS":"",l.morphNormals&&l.flatShading===!1?"#define USE_MORPHNORMALS":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.shadowMapEnabled?"#define USE_SHADOWMAP":"",l.shadowMapEnabled?"#define "+v:"",l.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",l.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",l.sizeAttenuation?"#define USE_SIZEATTENUATION":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer&&s.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","	attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(o).join("\n"),w=[_,"precision "+l.precision+" float;","precision "+l.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,E,"#define NUM_DIR_LIGHTS "+l.numDirLights,"#define NUM_POINT_LIGHTS "+l.numPointLights,"#define NUM_SPOT_LIGHTS "+l.numSpotLights,"#define NUM_HEMI_LIGHTS "+l.numHemiLights,"#define NUM_SHADOWS "+l.numShadows,l.alphaTest?"#define ALPHATEST "+l.alphaTest:"",s.gammaInput?"#define GAMMA_INPUT":"",s.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+M,l.useFog&&l.fog?"#define USE_FOG":"",l.useFog&&l.fogExp?"#define FOG_EXP2":"",l.map?"#define USE_MAP":"",l.envMap?"#define USE_ENVMAP":"",l.envMap?"#define "+g:"",l.envMap?"#define "+y:"",l.envMap?"#define "+b:"",l.lightMap?"#define USE_LIGHTMAP":"",l.aoMap?"#define USE_AOMAP":"",l.emissiveMap?"#define USE_EMISSIVEMAP":"",l.bumpMap?"#define USE_BUMPMAP":"",l.normalMap?"#define USE_NORMALMAP":"",l.specularMap?"#define USE_SPECULARMAP":"",l.roughnessMap?"#define USE_ROUGHNESSMAP":"",l.metalnessMap?"#define USE_METALNESSMAP":"",l.alphaMap?"#define USE_ALPHAMAP":"",l.vertexColors?"#define USE_COLOR":"",l.flatShading?"#define FLAT_SHADED":"",l.doubleSided?"#define DOUBLE_SIDED":"",l.flipSided?"#define FLIP_SIDED":"",l.shadowMapEnabled?"#define USE_SHADOWMAP":"",l.shadowMapEnabled?"#define "+v:"",l.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",l.pointLightShadows>0?"#define POINT_LIGHT_SHADOWS":"",l.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",l.logarithmicDepthBuffer&&s.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",l.envMap&&s.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(o).join("\n"));var S=x+f,C=w+m,T=i.WebGLShader(u,u.VERTEX_SHADER,S),L=i.WebGLShader(u,u.FRAGMENT_SHADER,C);u.attachShader(A,T),u.attachShader(A,L),void 0!==c.index0AttributeName?u.bindAttribLocation(A,0,c.index0AttributeName):l.morphTargets===!0&&u.bindAttribLocation(A,0,"position"),u.linkProgram(A);var k=u.getProgramInfoLog(A),R=u.getShaderInfoLog(T),P=u.getShaderInfoLog(L),D=!0,O=!0;u.getProgramParameter(A,u.LINK_STATUS)===!1?(D=!1,console.error("THREE.WebGLProgram: shader error: ",u.getError(),"gl.VALIDATE_STATUS",u.getProgramParameter(A,u.VALIDATE_STATUS),"gl.getProgramInfoLog",k,R,P)):""!==k?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",k):(""===R||""===P)&&(O=!1),O&&(this.diagnostics={runnable:D,material:c,programLog:k,vertexShader:{log:R,prefix:x},fragmentShader:{log:P,prefix:w}}),u.deleteShader(T),u.deleteShader(L);var N;this.getUniforms=function(){return void 0===N&&(N=r(u,A)),N};var I;return this.getAttributes=function(){return void 0===I&&(I=n(u,A)),I},this.destroy=function(){u.deleteProgram(A),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=a++,this.code=h,this.usedTimes=1,this.program=A,this.vertexShader=T,this.fragmentShader=L,this}}(),i.WebGLPrograms=function(e,t){function r(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var r=t.maxVertexUniforms,n=Math.floor((r-20)/4),o=n;return void 0!==e&&e instanceof i.SkinnedMesh&&(o=Math.min(e.skeleton.bones.length,o),o<e.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+o+" (try OpenGL instead of ANGLE)")),o}var n=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"standard",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","envMap","envMapMode","lightMap","aoMap","emissiveMap","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","numDirLights","numPointLights","numSpotLights","numHemiLights","numShadows","shadowMapEnabled","pointLightShadows","shadowMapType","shadowMapDebug","alphaTest","doubleSided","flipSided"];this.getParameters=function(n,a,s,h){var c=o[n.type],l=r(h),u=e.getPrecision();null!==n.precision&&(u=t.getMaxPrecision(n.precision),u!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",u,"instead."));var d={shaderID:c,precision:u,supportsVertexTextures:t.vertexTextures,map:!!n.map,envMap:!!n.envMap,envMapMode:n.envMap&&n.envMap.mapping,lightMap:!!n.lightMap,aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,combine:n.combine,vertexColors:n.vertexColors,fog:s,useFog:n.fog,fogExp:s instanceof i.FogExp2,flatShading:n.shading===i.FlatShading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:t.logarithmicDepthBuffer,skinning:n.skinning,maxBones:l,useVertexTexture:t.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numHemiLights:a.hemi.length,numShadows:a.shadows.length,pointLightShadows:a.shadowsPointLight,shadowMapEnabled:e.shadowMap.enabled&&h.receiveShadow&&a.shadows.length>0,shadowMapType:e.shadowMap.type,shadowMapDebug:e.shadowMap.debug,alphaTest:n.alphaTest,doubleSided:n.side===i.DoubleSide,flipSided:n.side===i.BackSide};return d},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var n in e.defines)r.push(n),r.push(e.defines[n]);for(var i=0;i<a.length;i++){var o=a[i];r.push(o),r.push(t[o])}return r.join()},this.acquireProgram=function(t,r,o){for(var a,s=0,h=n.length;h>s;s++){var c=n[s];if(c.code===o){a=c,++a.usedTimes;break}}return void 0===a&&(a=new i.WebGLProgram(e,o,t,r),n.push(a)),a},this.releaseProgram=function(e){if(0===--e.usedTimes){var t=n.indexOf(e);n[t]=n[n.length-1],n.pop(),e.destroy()}},this.programs=n},i.WebGLProperties=function(){var e={};this.get=function(t){var r=t.uuid,n=e[r];return void 0===n&&(n={},e[r]=n),n},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},i.WebGLShader=function(){function e(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")}return function(t,r,n){var i=t.createShader(r);return t.shaderSource(i,n),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)===!1&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",r===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),e(n)),i}}(),i.WebGLShadowMap=function(e,t,r){function n(e,t,r,n){var o=e.geometry,a=null,s=v,h=e.customDepthMaterial;if(r&&(s=g,h=e.customDistanceMaterial),h)a=h;else{var c=void 0!==o.morphTargets&&o.morphTargets.length>0&&t.morphTargets,l=e instanceof i.SkinnedMesh&&t.skinning,u=0;c&&(u|=p),l&&(u|=f),a=s[u]}return a.visible=t.visible,a.wireframe=t.wireframe,a.wireframeLinewidth=t.wireframeLinewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(n),a}function o(e,t,r){if(e.visible!==!1){if(e.layers.test(t.layers)&&(e instanceof i.Mesh||e instanceof i.Line||e instanceof i.Points)&&e.castShadow&&(e.frustumCulled===!1||h.intersectsObject(e)===!0)){var n=e.material;n.visible===!0&&(e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),d.push(e))}for(var a=e.children,s=0,c=a.length;c>s;s++)o(a[s],t,r)}}for(var a=e.context,s=e.state,h=new i.Frustum,c=new i.Matrix4,l=new i.Vector3,u=new i.Vector3,d=[],p=1,f=2,m=(p|f)+1,v=new Array(m),g=new Array(m),y=[new i.Vector3(1,0,0),new i.Vector3(-1,0,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1),new i.Vector3(0,1,0),new i.Vector3(0,-1,0)],b=[new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,1,0),new i.Vector3(0,0,1),new i.Vector3(0,0,-1)],x=[new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4,new i.Vector4],w=i.ShaderLib.depthRGBA,M=i.UniformsUtils.clone(w.uniforms),_=i.ShaderLib.distanceRGBA,E=i.UniformsUtils.clone(_.uniforms),A=0;A!==m;++A){var S=0!==(A&p),C=0!==(A&f),T=new i.ShaderMaterial({uniforms:M,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:S,skinning:C});T._shadowPass=!0,v[A]=T;var L=new i.ShaderMaterial({uniforms:E,vertexShader:_.vertexShader,fragmentShader:_.fragmentShader,morphTargets:S,skinning:C});L._shadowPass=!0,g[A]=L}var k=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=i.PCFShadowMap,this.cullFace=i.CullFaceFront,this.render=function(p,f){var m,v;if(k.enabled!==!1&&(k.autoUpdate!==!1||k.needsUpdate!==!1)){a.clearColor(1,1,1,1),s.disable(a.BLEND),s.enable(a.CULL_FACE),a.frontFace(a.CCW),a.cullFace(k.cullFace===i.CullFaceFront?a.FRONT:a.BACK),s.setDepthTest(!0),s.setScissorTest(!1);for(var g=t.shadows,w=0,M=g.length;M>w;w++){var _=g[w],E=_.shadow,A=E.camera,S=E.mapSize;if(_ instanceof i.PointLight){m=6,v=!0;var C=S.x/4,T=S.y/2;x[0].set(2*C,T,C,T),x[1].set(0,T,C,T),x[2].set(3*C,T,C,T),x[3].set(C,T,C,T),x[4].set(3*C,0,C,T),x[5].set(C,0,C,T)}else m=1,v=!1;if(null===E.map){var L=i.LinearFilter;k.type===i.PCFSoftShadowMap&&(L=i.NearestFilter);var R={minFilter:L,magFilter:L,format:i.RGBAFormat};E.map=new i.WebGLRenderTarget(S.x,S.y,R),E.matrix=new i.Matrix4,_ instanceof i.SpotLight&&(A.aspect=S.x/S.y),A.updateProjectionMatrix()}var P=E.map,D=E.matrix;u.setFromMatrixPosition(_.matrixWorld),A.position.copy(u),e.setRenderTarget(P),e.clear();for(var O=0;m>O;O++){if(v){l.copy(A.position),l.add(y[O]),A.up.copy(b[O]),A.lookAt(l);var N=x[O];s.viewport(N)}else l.setFromMatrixPosition(_.target.matrixWorld),A.lookAt(l);A.updateMatrixWorld(),A.matrixWorldInverse.getInverse(A.matrixWorld),D.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),D.multiply(A.projectionMatrix),D.multiply(A.matrixWorldInverse),c.multiplyMatrices(A.projectionMatrix,A.matrixWorldInverse),h.setFromMatrix(c),d.length=0,o(p,f,A);for(var I=0,F=d.length;F>I;I++){var V=d[I],B=r.update(V),U=V.material;if(U instanceof i.MeshFaceMaterial)for(var z=B.groups,j=U.materials,G=0,H=z.length;H>G;G++){var W=z[G],q=j[W.materialIndex];if(q.visible===!0){var X=n(V,q,v,u);e.renderBufferDirect(A,null,B,X,V,W)}}else{var X=n(V,U,v,u);e.renderBufferDirect(A,null,B,X,V,null)}}}e.resetGLState()}var Y=e.getClearColor(),Q=e.getClearAlpha();e.setClearColor(Y,Q),s.enable(a.BLEND),k.cullFace===i.CullFaceFront&&a.cullFace(a.BACK),e.resetGLState(),k.needsUpdate=!1}}},i.WebGLState=function(e,t,r){var n=this,o=new Uint8Array(16),a=new Uint8Array(16),s=new Uint8Array(16),h={},c=null,l=null,u=null,d=null,p=null,f=null,m=null,v=null,g=null,y=null,b=null,x=null,w=null,M=null,_=null,E=null,A=null,S=null,C=null,T=null,L=null,k=null,R=null,P=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),D=void 0,O={},N=new i.Vector4,I=new i.Vector4;this.init=function(){e.clearColor(0,0,0,1),e.clearDepth(1),e.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=o.length;t>e;e++)o[e]=0},this.enableAttribute=function(r){if(o[r]=1,0===a[r]&&(e.enableVertexAttribArray(r),a[r]=1),0!==s[r]){var n=t.get("ANGLE_instanced_arrays");n.vertexAttribDivisorANGLE(r,0),s[r]=0}},this.enableAttributeAndDivisor=function(t,r,n){o[t]=1,0===a[t]&&(e.enableVertexAttribArray(t),a[t]=1),s[t]!==r&&(n.vertexAttribDivisorANGLE(t,r),s[t]=r)},this.disableUnusedAttributes=function(){for(var t=0,r=a.length;r>t;t++)a[t]!==o[t]&&(e.disableVertexAttribArray(t),a[t]=0)},this.enable=function(t){h[t]!==!0&&(e.enable(t),h[t]=!0)},this.disable=function(t){h[t]!==!1&&(e.disable(t),
  h[t]=!1)},this.getCompressedTextureFormats=function(){if(null===c&&(c=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),n=0;n<r.length;n++)c.push(r[n]);return c},this.setBlending=function(t,n,o,a,s,h,c){t===i.NoBlending?this.disable(e.BLEND):this.enable(e.BLEND),t!==l&&(t===i.AdditiveBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):t===i.SubtractiveBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):t===i.MultiplyBlending?(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),l=t),t===i.CustomBlending?(s=s||n,h=h||o,c=c||a,(n!==u||s!==f)&&(e.blendEquationSeparate(r(n),r(s)),u=n,f=s),(o!==d||a!==p||h!==m||c!==v)&&(e.blendFuncSeparate(r(o),r(a),r(h),r(c)),d=o,p=a,m=h,v=c)):(u=null,d=null,p=null,f=null,m=null,v=null)},this.setDepthFunc=function(t){if(g!==t){if(t)switch(t){case i.NeverDepth:e.depthFunc(e.NEVER);break;case i.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case i.LessDepth:e.depthFunc(e.LESS);break;case i.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case i.EqualDepth:e.depthFunc(e.EQUAL);break;case i.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case i.GreaterDepth:e.depthFunc(e.GREATER);break;case i.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);g=t}},this.setDepthTest=function(t){t?this.enable(e.DEPTH_TEST):this.disable(e.DEPTH_TEST)},this.setDepthWrite=function(t){y!==t&&(e.depthMask(t),y=t)},this.setColorWrite=function(t){b!==t&&(e.colorMask(t,t,t,t),b=t)},this.setStencilFunc=function(t,r,n){(w!==t||M!==r||_!==n)&&(e.stencilFunc(t,r,n),w=t,M=r,_=n)},this.setStencilOp=function(t,r,n){(E!==t||A!==r||S!==n)&&(e.stencilOp(t,r,n),E=t,A=r,S=n)},this.setStencilTest=function(t){t?this.enable(e.STENCIL_TEST):this.disable(e.STENCIL_TEST)},this.setStencilWrite=function(t){x!==t&&(e.stencilMask(t),x=t)},this.setFlipSided=function(t){C!==t&&(e.frontFace(t?e.CW:e.CCW),C=t)},this.setLineWidth=function(t){t!==T&&(e.lineWidth(t),T=t)},this.setPolygonOffset=function(t,r,n){t?this.enable(e.POLYGON_OFFSET_FILL):this.disable(e.POLYGON_OFFSET_FILL),!t||L===r&&k===n||(e.polygonOffset(r,n),L=r,k=n)},this.getScissorTest=function(){return R},this.setScissorTest=function(t){R=t,t?this.enable(e.SCISSOR_TEST):this.disable(e.SCISSOR_TEST)},this.activeTexture=function(t){void 0===t&&(t=e.TEXTURE0+P-1),D!==t&&(e.activeTexture(t),D=t)},this.bindTexture=function(t,r){void 0===D&&n.activeTexture();var i=O[D];void 0===i&&(i={type:void 0,texture:void 0},O[D]=i),(i.type!==t||i.texture!==r)&&(e.bindTexture(t,r),i.type=t,i.texture=r)},this.compressedTexImage2D=function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.texImage2D=function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(t)}},this.scissor=function(t){N.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),N.copy(t))},this.viewport=function(t){I.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),I.copy(t))},this.reset=function(){for(var t=0;t<a.length;t++)1===a[t]&&(e.disableVertexAttribArray(t),a[t]=0);h={},c=null,l=null,y=null,b=null,C=null}},i.LensFlarePlugin=function(e,t){function r(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=p.createBuffer(),a=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,o),p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),p.bufferData(p.ELEMENT_ARRAY_BUFFER,t,p.STATIC_DRAW),u=p.createTexture(),d=p.createTexture(),f.bindTexture(p.TEXTURE_2D,u),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),f.bindTexture(p.TEXTURE_2D,d),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),l=p.getParameter(p.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var r;r=l?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =        visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},s=n(r),h={vertex:p.getAttribLocation(s,"position"),uv:p.getAttribLocation(s,"uv")},c={renderType:p.getUniformLocation(s,"renderType"),map:p.getUniformLocation(s,"map"),occlusionMap:p.getUniformLocation(s,"occlusionMap"),opacity:p.getUniformLocation(s,"opacity"),color:p.getUniformLocation(s,"color"),scale:p.getUniformLocation(s,"scale"),rotation:p.getUniformLocation(s,"rotation"),screenPosition:p.getUniformLocation(s,"screenPosition")}}function n(t){var r=p.createProgram(),n=p.createShader(p.FRAGMENT_SHADER),i=p.createShader(p.VERTEX_SHADER),o="precision "+e.getPrecision()+" float;\n";return p.shaderSource(n,o+t.fragmentShader),p.shaderSource(i,o+t.vertexShader),p.compileShader(n),p.compileShader(i),p.attachShader(r,n),p.attachShader(r,i),p.linkProgram(r),r}var o,a,s,h,c,l,u,d,p=e.context,f=e.state;this.render=function(n,m,v){if(0!==t.length){var g=new i.Vector3,y=v.w/v.z,b=.5*v.z,x=.5*v.w,w=16/v.w,M=new i.Vector2(w*y,w),_=new i.Vector3(1,1,0),E=new i.Vector2(1,1);void 0===s&&r(),p.useProgram(s),f.initAttributes(),f.enableAttribute(h.vertex),f.enableAttribute(h.uv),f.disableUnusedAttributes(),p.uniform1i(c.occlusionMap,0),p.uniform1i(c.map,1),p.bindBuffer(p.ARRAY_BUFFER,o),p.vertexAttribPointer(h.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),f.disable(p.CULL_FACE),f.setDepthWrite(!1);for(var A=0,S=t.length;S>A;A++){w=16/v.w,M.set(w*y,w);var C=t[A];if(g.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),g.applyMatrix4(m.matrixWorldInverse),g.applyProjection(m.projectionMatrix),_.copy(g),E.x=_.x*b+b,E.y=_.y*x+x,l||E.x>0&&E.x<v.z&&E.y>0&&E.y<v.w){f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,null),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,v.x+E.x-8,v.y+E.y-8,16,16,0),p.uniform1i(c.renderType,0),p.uniform2f(c.scale,M.x,M.y),p.uniform3f(c.screenPosition,_.x,_.y,_.z),f.disable(p.BLEND),f.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),f.activeTexture(p.TEXTURE0),f.bindTexture(p.TEXTURE_2D,d),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,v.x+E.x-8,v.y+E.y-8,16,16,0),p.uniform1i(c.renderType,1),f.disable(p.DEPTH_TEST),f.activeTexture(p.TEXTURE1),f.bindTexture(p.TEXTURE_2D,u),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),C.positionScreen.copy(_),C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares(),p.uniform1i(c.renderType,2),f.enable(p.BLEND);for(var T=0,L=C.lensFlares.length;L>T;T++){var k=C.lensFlares[T];k.opacity>.001&&k.scale>.001&&(_.x=k.x,_.y=k.y,_.z=k.z,w=k.size*k.scale/v.w,M.x=w*y,M.y=w,p.uniform3f(c.screenPosition,_.x,_.y,_.z),p.uniform2f(c.scale,M.x,M.y),p.uniform1f(c.rotation,k.rotation),p.uniform1f(c.opacity,k.opacity),p.uniform3f(c.color,k.color.r,k.color.g,k.color.b),f.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst),e.setTexture(k.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}f.enable(p.CULL_FACE),f.enable(p.DEPTH_TEST),f.setDepthWrite(!0),e.resetGLState()}}},i.SpritePlugin=function(e,t){function r(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);a=d.createBuffer(),s=d.createBuffer(),d.bindBuffer(d.ARRAY_BUFFER,a),d.bufferData(d.ARRAY_BUFFER,e,d.STATIC_DRAW),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.bufferData(d.ELEMENT_ARRAY_BUFFER,t,d.STATIC_DRAW),h=n(),c={position:d.getAttribLocation(h,"position"),uv:d.getAttribLocation(h,"uv")},l={uvOffset:d.getUniformLocation(h,"uvOffset"),uvScale:d.getUniformLocation(h,"uvScale"),rotation:d.getUniformLocation(h,"rotation"),scale:d.getUniformLocation(h,"scale"),color:d.getUniformLocation(h,"color"),map:d.getUniformLocation(h,"map"),opacity:d.getUniformLocation(h,"opacity"),modelViewMatrix:d.getUniformLocation(h,"modelViewMatrix"),projectionMatrix:d.getUniformLocation(h,"projectionMatrix"),fogType:d.getUniformLocation(h,"fogType"),fogDensity:d.getUniformLocation(h,"fogDensity"),fogNear:d.getUniformLocation(h,"fogNear"),fogFar:d.getUniformLocation(h,"fogFar"),fogColor:d.getUniformLocation(h,"fogColor"),alphaTest:d.getUniformLocation(h,"alphaTest")};var r=document.createElement("canvas");r.width=8,r.height=8;var o=r.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),u=new i.Texture(r),u.needsUpdate=!0}function n(){var t=d.createProgram(),r=d.createShader(d.VERTEX_SHADER),n=d.createShader(d.FRAGMENT_SHADER);return d.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),d.shaderSource(n,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),d.compileShader(r),d.compileShader(n),d.attachShader(t,r),d.attachShader(t,n),d.linkProgram(t),t}function o(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var a,s,h,c,l,u,d=e.context,p=e.state,f=new i.Vector3,m=new i.Quaternion,v=new i.Vector3;this.render=function(n,g){if(0!==t.length){void 0===h&&r(),d.useProgram(h),p.initAttributes(),p.enableAttribute(c.position),p.enableAttribute(c.uv),p.disableUnusedAttributes(),p.disable(d.CULL_FACE),p.enable(d.BLEND),d.bindBuffer(d.ARRAY_BUFFER,a),d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0),d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,s),d.uniformMatrix4fv(l.projectionMatrix,!1,g.projectionMatrix.elements),p.activeTexture(d.TEXTURE0),d.uniform1i(l.map,0);var y=0,b=0,x=n.fog;x?(d.uniform3f(l.fogColor,x.color.r,x.color.g,x.color.b),x instanceof i.Fog?(d.uniform1f(l.fogNear,x.near),d.uniform1f(l.fogFar,x.far),d.uniform1i(l.fogType,1),y=1,b=1):x instanceof i.FogExp2&&(d.uniform1f(l.fogDensity,x.density),d.uniform1i(l.fogType,2),y=2,b=2)):(d.uniform1i(l.fogType,0),y=0,b=0);for(var w=0,M=t.length;M>w;w++){var _=t[w];_.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,_.matrixWorld),_.z=-_.modelViewMatrix.elements[14]}t.sort(o);for(var E=[],w=0,M=t.length;M>w;w++){var _=t[w],A=_.material;d.uniform1f(l.alphaTest,A.alphaTest),d.uniformMatrix4fv(l.modelViewMatrix,!1,_.modelViewMatrix.elements),_.matrixWorld.decompose(f,m,v),E[0]=v.x,E[1]=v.y;var S=0;n.fog&&A.fog&&(S=b),y!==S&&(d.uniform1i(l.fogType,S),y=S),null!==A.map?(d.uniform2f(l.uvOffset,A.map.offset.x,A.map.offset.y),d.uniform2f(l.uvScale,A.map.repeat.x,A.map.repeat.y)):(d.uniform2f(l.uvOffset,0,0),d.uniform2f(l.uvScale,1,1)),d.uniform1f(l.opacity,A.opacity),d.uniform3f(l.color,A.color.r,A.color.g,A.color.b),d.uniform1f(l.rotation,A.rotation),d.uniform2fv(l.scale,E),p.setBlending(A.blending,A.blendEquation,A.blendSrc,A.blendDst),p.setDepthTest(A.depthTest),p.setDepthWrite(A.depthWrite),A.map&&A.map.image&&A.map.image.width?e.setTexture(A.map,0):e.setTexture(u,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}p.enable(d.CULL_FACE),e.resetGLState()}}},Object.defineProperties(i.Box2.prototype,{empty:{value:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}}}),Object.defineProperties(i.Box3.prototype,{empty:{value:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()}},isIntersectionBox:{value:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Matrix3.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}}}),Object.defineProperties(i.Matrix4.prototype,{extractPosition:{value:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}},setRotationFromQuaternion:{value:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)}},multiplyVector3:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)}},multiplyVector4:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},multiplyVector3Array:{value:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)}},rotateAxis:{value:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)}},crossVector:{value:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)}},translate:{value:function(){console.error("THREE.Matrix4: .translate() has been removed.")}},rotateX:{value:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")}},rotateY:{value:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")}},rotateZ:{value:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")}},rotateByAxis:{value:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}}),Object.defineProperties(i.Plane.prototype,{isIntersectionLine:{value:function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)}}}),Object.defineProperties(i.Quaternion.prototype,{multiplyVector3:{value:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)}}}),Object.defineProperties(i.Ray.prototype,{isIntersectionBox:{value:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)}},isIntersectionPlane:{value:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)}},isIntersectionSphere:{value:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}}),Object.defineProperties(i.Vector3.prototype,{setEulerFromRotationMatrix:{value:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")}},setEulerFromQuaternion:{value:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")}},getPositionFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)}},getScaleFromMatrix:{value:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)}},getColumnFromMatrix:{value:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}}),Object.defineProperties(i.Object3D.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},getChildByName:{value:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)}},renderDepth:{set:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")}},translate:{value:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(i,{PointCloud:{value:function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new i.Points(e,t)}},ParticleSystem:{value:function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new i.Points(e,t)}}}),Object.defineProperties(i.Light.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){this.shadow.bias=e}},shadowDarkness:{set:function(e){this.shadow.darkness=e}},shadowMapWidth:{set:function(e){this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){this.shadow.mapSize.height=e}}}),Object.defineProperties(i.BufferAttribute.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.defineProperties(i.BufferGeometry.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}},addIndex:{value:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)}},addDrawCall:{value:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)}},clearDrawCalls:{value:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()}},computeTangents:{value:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")}},computeOffsets:{value:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}}),Object.defineProperties(i.Material.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new i.Color}}}),Object.defineProperties(i,{PointCloudMaterial:{value:function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleBasicMaterial:{value:function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}},ParticleSystemMaterial:{value:function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new i.PointsMaterial(e)}}}),Object.defineProperties(i.MeshPhongMaterial.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(i.ShaderMaterial.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.defineProperties(i.WebGLRenderer.prototype,{supportsFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")}},supportsHalfFloatTextures:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")}},supportsStandardDerivatives:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")}},supportsCompressedTextureS3TC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")}},supportsCompressedTexturePVRTC:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")}},supportsBlendMinMax:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")}},supportsVertexTextures:{value:function(){return this.capabilities.vertexTextures}},supportsInstancedArrays:{value:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")}},enableScissorTest:{value:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)}},initMaterial:{value:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")}},addPrePlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")}},addPostPlugin:{value:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")}},updateShadowMap:{value:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=e}},shadowMapDebug:{get:function(){return this.shadowMap.debug},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug."),this.shadowMap.debug=e}}}),Object.defineProperties(i.WebGLRenderTarget.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),i.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var n;t instanceof i.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},i.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var o=new i.TextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,r,void 0,n);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,r,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
  
  var o=new i.CubeTextureLoader;o.setCrossOrigin(this.crossOrigin);var a=o.load(e,r,void 0,n);return t&&(a.mapping=t),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},i.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},i.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},i.TextGeometry=function(){console.error("THREE.TextGeometry has been moved to /examples/js/geometries/TextGeometry.js"),console.error("THREE.FontUtils has been moved to /examples/js/utils/FontUtils.js")},i.MeshFaceMaterial=i.MultiMaterial,i.CurveUtils={tangentQuadraticBezier:function(e,t,r,n){return 2*(1-e)*(r-t)+2*e*(n-r)},tangentCubicBezier:function(e,t,r,n,i){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*n*(1-e)-3*e*e*n+3*e*e*i},tangentSpline:function(e){var t=6*e*e-6*e,r=3*e*e-4*e+1,n=-6*e*e+6*e,i=3*e*e-2*e;return t+r+n+i},interpolate:function(e,t,r,n,i){var o=.5*(r-e),a=.5*(n-t),s=i*i,h=i*s;return(2*t-2*r+o+a)*h+(-3*t+3*r-2*o-a)*s+o*i+t}},i.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new i.Group,n=0,o=t.length;o>n;n++)r.add(new i.Mesh(e,t[n]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var n=new i.Matrix4;n.getInverse(r.matrixWorld),e.applyMatrix(n),t.remove(e),r.add(e)}},i.ShapeUtils={area:function(e){for(var t=e.length,r=0,n=t-1,i=0;t>i;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return.5*r},triangulate:function(){function e(e,t,r,n,i,o){var a,s,h,c,l,u,d,p,f;if(s=e[o[t]].x,h=e[o[t]].y,c=e[o[r]].x,l=e[o[r]].y,u=e[o[n]].x,d=e[o[n]].y,Number.EPSILON>(c-s)*(d-h)-(l-h)*(u-s))return!1;var m,v,g,y,b,x,w,M,_,E,A,S,C,T,L;for(m=u-c,v=d-l,g=s-u,y=h-d,b=c-s,x=l-h,a=0;i>a;a++)if(p=e[o[a]].x,f=e[o[a]].y,!(p===s&&f===h||p===c&&f===l||p===u&&f===d)&&(w=p-s,M=f-h,_=p-c,E=f-l,A=p-u,S=f-d,L=m*E-v*_,C=b*M-x*w,T=g*S-y*A,L>=-Number.EPSILON&&T>=-Number.EPSILON&&C>=-Number.EPSILON))return!1;return!0}return function(t,r){var n=t.length;if(3>n)return null;var o,a,s,h=[],c=[],l=[];if(i.ShapeUtils.area(t)>0)for(a=0;n>a;a++)c[a]=a;else for(a=0;n>a;a++)c[a]=n-1-a;var u=n,d=2*u;for(a=u-1;u>2;){if(d--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),r?l:h;if(o=a,o>=u&&(o=0),a=o+1,a>=u&&(a=0),s=a+1,s>=u&&(s=0),e(t,o,a,s,u,c)){var p,f,m,v,g;for(p=c[o],f=c[a],m=c[s],h.push([t[p],t[f],t[m]]),l.push([c[o],c[a],c[s]]),v=a,g=a+1;u>g;v++,g++)c[v]=c[g];u--,d=2*u}}return r?l:h}}(),triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.x<t.x?e.x<=r.x&&r.x<=t.x:t.x<=r.x&&r.x<=e.x:e.y<t.y?e.y<=r.y&&r.y<=t.y:t.y<=r.y&&r.y<=e.y}function n(e,t,n,i,o){var a=t.x-e.x,s=t.y-e.y,h=i.x-n.x,c=i.y-n.y,l=e.x-n.x,u=e.y-n.y,d=s*h-a*c,p=s*l-a*u;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(0>p||p>d)return[];if(f=c*l-h*u,0>f||f>d)return[]}else{if(p>0||d>p)return[];if(f=c*l-h*u,f>0||d>f)return[]}if(0===f)return!o||0!==p&&p!==d?[e]:[];if(f===d)return!o||0!==p&&p!==d?[t]:[];if(0===p)return[n];if(p===d)return[i];var m=f/d;return[{x:e.x+m*a,y:e.y+m*s}]}if(0!==p||c*l!==h*u)return[];var v=0===a&&0===s,g=0===h&&0===c;if(v&&g)return e.x!==n.x||e.y!==n.y?[]:[e];if(v)return r(n,i,e)?[e]:[];if(g)return r(e,t,n)?[n]:[];var y,b,x,w,M,_,E,A;return 0!==a?(e.x<t.x?(y=e,x=e.x,b=t,w=t.x):(y=t,x=t.x,b=e,w=e.x),n.x<i.x?(M=n,E=n.x,_=i,A=i.x):(M=i,E=i.x,_=n,A=n.x)):(e.y<t.y?(y=e,x=e.y,b=t,w=t.y):(y=t,x=t.y,b=e,w=e.y),n.y<i.y?(M=n,E=n.y,_=i,A=i.y):(M=i,E=i.y,_=n,A=n.y)),E>=x?E>w?[]:w===E?o?[]:[M]:A>=w?[M,b]:[M,_]:x>A?[]:x===A?o?[]:[y]:A>=w?[y,b]:[y,_]}function o(e,t,r,n){var i=t.x-e.x,o=t.y-e.y,a=r.x-e.x,s=r.y-e.y,h=n.x-e.x,c=n.y-e.y,l=i*s-o*a,u=i*c-o*h;if(Math.abs(l)>Number.EPSILON){var d=h*s-c*a;return l>0?u>=0&&d>=0:u>=0||d>=0}return u>0}function a(e,t){function r(e,t){var r=y.length-1,n=e-1;0>n&&(n=r);var i=e+1;i>r&&(i=0);var a=o(y[e],y[n],y[i],s[t]);if(!a)return!1;var h=s.length-1,c=t-1;0>c&&(c=h);var l=t+1;return l>h&&(l=0),a=o(s[t],s[c],s[l],y[e]),a?!0:!1}function i(e,t){var r,i,o;for(r=0;r<y.length;r++)if(i=r+1,i%=y.length,o=n(e,t,y[r],y[i],!0),o.length>0)return!0;return!1}function a(e,r){var i,o,a,s,h;for(i=0;i<b.length;i++)for(o=t[b[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,h=n(e,r,o[a],o[s],!0),h.length>0)return!0;return!1}for(var s,h,c,l,u,d,p,f,m,v,g,y=e.concat(),b=[],x=[],w=0,M=t.length;M>w;w++)b.push(w);for(var _=0,E=2*b.length;b.length>0;){if(E--,0>E){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(c=_;c<y.length;c++){l=y[c],h=-1;for(var w=0;w<b.length;w++)if(d=b[w],p=l.x+":"+l.y+":"+d,void 0===x[p]){s=t[d];for(var A=0;A<s.length;A++)if(u=s[A],r(c,A)&&!i(l,u)&&!a(l,u)){h=A,b.splice(w,1),f=y.slice(0,c+1),m=y.slice(c),v=s.slice(h),g=s.slice(0,h+1),y=f.concat(v).concat(g).concat(m),_=c;break}if(h>=0)break;x[p]=!0}if(h>=0)break}}return y}for(var s,h,c,l,u,d,p={},f=e.concat(),m=0,v=t.length;v>m;m++)Array.prototype.push.apply(f,t[m]);for(s=0,h=f.length;h>s;s++)u=f[s].x+":"+f[s].y,void 0!==p[u]&&console.warn("THREE.Shape: Duplicate point",u),p[u]=s;var g=a(e,t),y=i.ShapeUtils.triangulate(g,!1);for(s=0,h=y.length;h>s;s++)for(l=y[s],c=0;3>c;c++)u=l[c].x+":"+l[c].y,d=p[u],void 0!==d&&(l[c]=d);return y.concat()},isClockWise:function(e){return i.ShapeUtils.area(e)<0},b2:function(){function e(e,t){var r=1-e;return r*r*t}function t(e,t){return 2*(1-e)*e*t}function r(e,t){return e*e*t}return function(n,i,o,a){return e(n,i)+t(n,o)+r(n,a)}}(),b3:function(){function e(e,t){var r=1-e;return r*r*r*t}function t(e,t){var r=1-e;return 3*r*r*e*t}function r(e,t){var r=1-e;return 3*r*e*e*t}function n(e,t){return e*e*e*t}return function(i,o,a,s,h){return e(i,o)+t(i,a)+r(i,s)+n(i,h)}}()},i.Curve=function(){},i.Curve.prototype={constructor:i.Curve,getPoint:function(){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},getPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},getSpacedPoints:function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,n=[],i=this.getPoint(0),o=0;for(n.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(i),n.push(o),i=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,n=this.getLengths(),i=0,o=n.length;r=t?t:e*n[o-1];for(var a,s=0,h=o-1;h>=s;)if(i=Math.floor(s+(h-s)/2),a=n[i]-r,0>a)s=i+1;else{if(!(a>0)){h=i;break}h=i-1}if(i=h,n[i]===r){var c=i/(o-1);return c}var l=n[i],u=n[i+1],d=u-l,p=(r-l)/d,c=(i+p)/(o-1);return c},getTangent:function(e){var t=1e-4,r=e-t,n=e+t;0>r&&(r=0),n>1&&(n=1);var i=this.getPoint(r),o=this.getPoint(n),a=o.clone().sub(i);return a.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)}},i.Curve.Utils=i.CurveUtils,i.Curve.create=function(e,t){return e.prototype=Object.create(i.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},i.CurvePath=function(){this.curves=[],this.autoClose=!1},i.CurvePath.prototype=Object.create(i.Curve.prototype),i.CurvePath.prototype.constructor=i.CurvePath,i.CurvePath.prototype.add=function(e){this.curves.push(e)},i.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new i.LineCurve(t,e))},i.CurvePath.prototype.getPoint=function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),n=0;n<r.length;){if(r[n]>=t){var i=r[n]-t,o=this.curves[n],a=1-i/o.getLength();return o.getPointAt(a)}n++}return null},i.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},i.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;n>r;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e},i.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e);return this.createGeometry(t)},i.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e);return this.createGeometry(t)},i.CurvePath.prototype.createGeometry=function(e){for(var t=new i.Geometry,r=0,n=e.length;n>r;r++){var o=e[r];t.vertices.push(new i.Vector3(o.x,o.y,o.z||0))}return t},i.Path=function(e){i.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},i.Path.prototype=Object.create(i.CurvePath.prototype),i.Path.prototype.constructor=i.Path,i.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},i.Path.prototype.moveTo=function(e,t){this.actions.push({action:"moveTo",args:[e,t]})},i.Path.prototype.lineTo=function(e,t){var r=this.actions[this.actions.length-1].args,n=r[r.length-2],o=r[r.length-1],a=new i.LineCurve(new i.Vector2(n,o),new i.Vector2(e,t));this.curves.push(a),this.actions.push({action:"lineTo",args:[e,t]})},i.Path.prototype.quadraticCurveTo=function(e,t,r,n){var o=this.actions[this.actions.length-1].args,a=o[o.length-2],s=o[o.length-1],h=new i.QuadraticBezierCurve(new i.Vector2(a,s),new i.Vector2(e,t),new i.Vector2(r,n));this.curves.push(h),this.actions.push({action:"quadraticCurveTo",args:[e,t,r,n]})},i.Path.prototype.bezierCurveTo=function(e,t,r,n,o,a){var s=this.actions[this.actions.length-1].args,h=s[s.length-2],c=s[s.length-1],l=new i.CubicBezierCurve(new i.Vector2(h,c),new i.Vector2(e,t),new i.Vector2(r,n),new i.Vector2(o,a));this.curves.push(l),this.actions.push({action:"bezierCurveTo",args:[e,t,r,n,o,a]})},i.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,n=r[r.length-2],o=r[r.length-1],a=[new i.Vector2(n,o)];Array.prototype.push.apply(a,e);var s=new i.SplineCurve(a);this.curves.push(s),this.actions.push({action:"splineThru",args:t})},i.Path.prototype.arc=function(e,t,r,n,i,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1];this.absarc(e+s,t+h,r,n,i,o)},i.Path.prototype.absarc=function(e,t,r,n,i,o){this.absellipse(e,t,r,r,n,i,o)},i.Path.prototype.ellipse=function(e,t,r,n,i,o,a,s){var h=this.actions[this.actions.length-1].args,c=h[h.length-2],l=h[h.length-1];this.absellipse(e+c,t+l,r,n,i,o,a,s)},i.Path.prototype.absellipse=function(e,t,r,n,o,a,s,h){var c=[e,t,r,n,o,a,s,h||0],l=new i.EllipseCurve(e,t,r,n,o,a,s,h);this.curves.push(l);var u=l.getPoint(1);c.push(u.x),c.push(u.y),this.actions.push({action:"ellipse",args:c})},i.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],r=0;e>r;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t},i.Path.prototype.getPoints=function(e){e=e||12;for(var t,r,n,o,a,s,h,c,l,u,d,p=i.ShapeUtils.b2,f=i.ShapeUtils.b3,m=[],v=0,g=this.actions.length;g>v;v++){var y=this.actions[v],b=y.action,x=y.args;switch(b){case"moveTo":m.push(new i.Vector2(x[0],x[1]));break;case"lineTo":m.push(new i.Vector2(x[0],x[1]));break;case"quadraticCurveTo":t=x[2],r=x[3],a=x[0],s=x[1],m.length>0?(l=m[m.length-1],h=l.x,c=l.y):(l=this.actions[v-1].args,h=l[l.length-2],c=l[l.length-1]);for(var w=1;e>=w;w++){var M=w/e;u=p(M,h,a,t),d=p(M,c,s,r),m.push(new i.Vector2(u,d))}break;case"bezierCurveTo":t=x[4],r=x[5],a=x[0],s=x[1],n=x[2],o=x[3],m.length>0?(l=m[m.length-1],h=l.x,c=l.y):(l=this.actions[v-1].args,h=l[l.length-2],c=l[l.length-1]);for(var w=1;e>=w;w++){var M=w/e;u=f(M,h,a,n,t),d=f(M,c,s,o,r),m.push(new i.Vector2(u,d))}break;case"splineThru":l=this.actions[v-1].args;var _=new i.Vector2(l[l.length-2],l[l.length-1]),E=[_],A=e*x[0].length;E=E.concat(x[0]);for(var S=new i.SplineCurve(E),w=1;A>=w;w++)m.push(S.getPointAt(w/A));break;case"arc":for(var C,T=x[0],L=x[1],k=x[2],R=x[3],P=x[4],D=!!x[5],O=P-R,N=2*e,w=1;N>=w;w++){var M=w/N;D||(M=1-M),C=R+M*O,u=T+k*Math.cos(C),d=L+k*Math.sin(C),m.push(new i.Vector2(u,d))}break;case"ellipse":var C,I,F,T=x[0],L=x[1],V=x[2],B=x[3],R=x[4],P=x[5],D=!!x[6],U=x[7],O=P-R,N=2*e;0!==U&&(I=Math.cos(U),F=Math.sin(U));for(var w=1;N>=w;w++){var M=w/N;if(D||(M=1-M),C=R+M*O,u=T+V*Math.cos(C),d=L+B*Math.sin(C),0!==U){var z=u,j=d;u=(z-T)*I-(j-L)*F+T,d=(z-T)*F+(j-L)*I+L}m.push(new i.Vector2(u,d))}}}var G=m[m.length-1];return Math.abs(G.x-m[0].x)<Number.EPSILON&&Math.abs(G.y-m[0].y)<Number.EPSILON&&m.splice(m.length-1,1),this.autoClose&&m.push(m[0]),m},i.Path.prototype.toShapes=function(e,t){function r(e){for(var t=[],r=new i.Path,n=0,o=e.length;o>n;n++){var a=e[n],s=a.args,h=a.action;"moveTo"===h&&0!==r.actions.length&&(t.push(r),r=new i.Path),r[h].apply(r,s)}return 0!==r.actions.length&&t.push(r),t}function n(e){for(var t=[],r=0,n=e.length;n>r;r++){var o=e[r],a=new i.Shape;a.actions=o.actions,a.curves=o.curves,t.push(a)}return t}function o(e,t){for(var r=t.length,n=!1,i=r-1,o=0;r>o;i=o++){var a=t[i],s=t[o],h=s.x-a.x,c=s.y-a.y;if(Math.abs(c)>Number.EPSILON){if(0>c&&(a=t[o],h=-h,s=t[i],c=-c),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=c*(e.x-a.x)-h*(e.y-a.y);if(0===l)return!0;if(0>l)continue;n=!n}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return n}var a=i.ShapeUtils.isClockWise,s=r(this.actions);if(0===s.length)return[];if(t===!0)return n(s);var h,c,l,u=[];if(1===s.length)return c=s[0],l=new i.Shape,l.actions=c.actions,l.curves=c.curves,u.push(l),u;var d=!a(s[0].getPoints());d=e?!d:d;var p,f=[],m=[],v=[],g=0;m[g]=void 0,v[g]=[];for(var y=0,b=s.length;b>y;y++)c=s[y],p=c.getPoints(),h=a(p),h=e?!h:h,h?(!d&&m[g]&&g++,m[g]={s:new i.Shape,p:p},m[g].s.actions=c.actions,m[g].s.curves=c.curves,d&&g++,v[g]=[]):v[g].push({h:c,p:p[0]});if(!m[0])return n(s);if(m.length>1){for(var x=!1,w=[],M=0,_=m.length;_>M;M++)f[M]=[];for(var M=0,_=m.length;_>M;M++)for(var E=v[M],A=0;A<E.length;A++){for(var S=E[A],C=!0,T=0;T<m.length;T++)o(S.p,m[T].p)&&(M!==T&&w.push({froms:M,tos:T,hole:A}),C?(C=!1,f[T].push(S)):x=!0);C&&f[M].push(S)}w.length>0&&(x||(v=f))}for(var L,y=0,k=m.length;k>y;y++){l=m[y].s,u.push(l),L=v[y];for(var R=0,P=L.length;P>R;R++)l.holes.push(L[R].h)}return u},i.Shape=function(){i.Path.apply(this,arguments),this.holes=[]},i.Shape.prototype=Object.create(i.Path.prototype),i.Shape.prototype.constructor=i.Shape,i.Shape.prototype.extrude=function(e){return new i.ExtrudeGeometry(this,e)},i.Shape.prototype.makeGeometry=function(e){return new i.ShapeGeometry(this,e)},i.Shape.prototype.getPointsHoles=function(e){for(var t=[],r=0,n=this.holes.length;n>r;r++)t[r]=this.holes[r].getPoints(e);return t},i.Shape.prototype.extractAllPoints=function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},i.Shape.prototype.extractPoints=function(e){return this.extractAllPoints(e)},i.Shape.Utils=i.ShapeUtils,i.LineCurve=function(e,t){this.v1=e,this.v2=t},i.LineCurve.prototype=Object.create(i.Curve.prototype),i.LineCurve.prototype.constructor=i.LineCurve,i.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},i.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},i.LineCurve.prototype.getTangent=function(){var e=this.v2.clone().sub(this.v1);return e.normalize()},i.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},i.QuadraticBezierCurve.prototype=Object.create(i.Curve.prototype),i.QuadraticBezierCurve.prototype.constructor=i.QuadraticBezierCurve,i.QuadraticBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b2;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y))},i.QuadraticBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentQuadraticBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y)).normalize()},i.CubicBezierCurve=function(e,t,r,n){this.v0=e,this.v1=t,this.v2=r,this.v3=n},i.CubicBezierCurve.prototype=Object.create(i.Curve.prototype),i.CubicBezierCurve.prototype.constructor=i.CubicBezierCurve,i.CubicBezierCurve.prototype.getPoint=function(e){var t=i.ShapeUtils.b3;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},i.CubicBezierCurve.prototype.getTangent=function(e){var t=i.CurveUtils.tangentCubicBezier;return new i.Vector2(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},i.SplineCurve=function(e){this.points=void 0==e?[]:e},i.SplineCurve.prototype=Object.create(i.Curve.prototype),i.SplineCurve.prototype.constructor=i.SplineCurve,i.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,a=t[0===n?n:n-1],s=t[n],h=t[n>t.length-2?t.length-1:n+1],c=t[n>t.length-3?t.length-1:n+2],l=i.CurveUtils.interpolate;return new i.Vector2(l(a.x,s.x,h.x,c.x,o),l(a.y,s.y,h.y,c.y,o))},i.EllipseCurve=function(e,t,r,n,i,o,a,s){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},i.EllipseCurve.prototype=Object.create(i.Curve.prototype),i.EllipseCurve.prototype.constructor=i.EllipseCurve,i.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var n=this.aX+this.xRadius*Math.cos(r),o=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var a=Math.cos(this.aRotation),s=Math.sin(this.aRotation),h=n,c=o;n=(h-this.aX)*a-(c-this.aY)*s+this.aX,o=(h-this.aX)*s+(c-this.aY)*a+this.aY}return new i.Vector2(n,o)},i.ArcCurve=function(e,t,r,n,o,a){i.EllipseCurve.call(this,e,t,r,r,n,o,a)},i.ArcCurve.prototype=Object.create(i.EllipseCurve.prototype),i.ArcCurve.prototype.constructor=i.ArcCurve,i.LineCurve3=i.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new i.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),i.QuadraticBezierCurve3=i.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=i.ShapeUtils.b2;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x),t(e,this.v0.y,this.v1.y,this.v2.y),t(e,this.v0.z,this.v1.z,this.v2.z))}),i.CubicBezierCurve3=i.Curve.create(function(e,t,r,n){this.v0=e,this.v1=t,this.v2=r,this.v3=n},function(e){var t=i.ShapeUtils.b3;return new i.Vector3(t(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),i.SplineCurve3=i.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,n=Math.floor(r),o=r-n,a=t[0==n?n:n-1],s=t[n],h=t[n>t.length-2?t.length-1:n+1],c=t[n>t.length-3?t.length-1:n+2],l=i.CurveUtils.interpolate;return new i.Vector3(l(a.x,s.x,h.x,c.x,o),l(a.y,s.y,h.y,c.y,o),l(a.z,s.z,h.z,c.z,o))}),i.CatmullRomCurve3=function(){function e(){}var t=new i.Vector3,r=new e,n=new e,o=new e;return e.prototype.init=function(e,t,r,n){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-n,this.c3=2*e-2*t+r+n},e.prototype.initNonuniformCatmullRom=function(e,t,r,n,i,o,a){var s=(t-e)/i-(r-e)/(i+o)+(r-t)/o,h=(r-t)/o-(n-t)/(o+a)+(n-r)/a;s*=o,h*=o,this.init(t,r,s,h)},e.prototype.initCatmullRom=function(e,t,r,n,i){this.init(t,r,i*(r-e),i*(n-t))},e.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},i.Curve.create(function(e){this.points=e||[],this.closed=!1},function(e){var a,s,h,c,l=this.points;c=l.length,2>c&&console.log("duh, you need at least 2 points"),a=(c-(this.closed?0:1))*e,s=Math.floor(a),h=a-s,this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/l.length)+1)*l.length:0===h&&s===c-1&&(s=c-2,h=1);var u,d,p,f;if(this.closed||s>0?u=l[(s-1)%c]:(t.subVectors(l[0],l[1]).add(l[0]),u=t),d=l[s%c],p=l[(s+1)%c],this.closed||c>s+2?f=l[(s+2)%c]:(t.subVectors(l[c-1],l[c-2]).add(l[c-2]),f=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(d),m),g=Math.pow(d.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(f),m);1e-4>g&&(g=1),1e-4>v&&(v=g),1e-4>y&&(y=g),r.initNonuniformCatmullRom(u.x,d.x,p.x,f.x,v,g,y),n.initNonuniformCatmullRom(u.y,d.y,p.y,f.y,v,g,y),o.initNonuniformCatmullRom(u.z,d.z,p.z,f.z,v,g,y)}else if("catmullrom"===this.type){var b=void 0!==this.tension?this.tension:.5;r.initCatmullRom(u.x,d.x,p.x,f.x,b),n.initCatmullRom(u.y,d.y,p.y,f.y,b),o.initCatmullRom(u.z,d.z,p.z,f.z,b)}var x=new i.Vector3(r.calc(h),n.calc(h),o.calc(h));return x})}(),i.ClosedSplineCurve3=function(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),i.CatmullRomCurve3.call(this,e),this.type="catmullrom",this.closed=!0},i.ClosedSplineCurve3.prototype=Object.create(i.CatmullRomCurve3.prototype),i.BoxGeometry=function(e,t,r,n,o,a){function s(e,t,r,n,o,a,s,c){var l,u,d,p=h.widthSegments,f=h.heightSegments,m=o/2,v=a/2,g=h.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?l="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(l="y",f=h.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(l="x",p=h.depthSegments);var y=p+1,b=f+1,x=o/p,w=a/f,M=new i.Vector3;for(M[l]=s>0?1:-1,d=0;b>d;d++)for(u=0;y>u;u++){var _=new i.Vector3;_[e]=(u*x-m)*r,_[t]=(d*w-v)*n,_[l]=s,h.vertices.push(_)}for(d=0;f>d;d++)for(u=0;p>u;u++){var E=u+y*d,A=u+y*(d+1),S=u+1+y*(d+1),C=u+1+y*d,T=new i.Vector2(u/p,1-d/f),L=new i.Vector2(u/p,1-(d+1)/f),k=new i.Vector2((u+1)/p,1-(d+1)/f),R=new i.Vector2((u+1)/p,1-d/f),P=new i.Face3(E+g,A+g,C+g);P.normal.copy(M),P.vertexNormals.push(M.clone(),M.clone(),M.clone()),P.materialIndex=c,h.faces.push(P),h.faceVertexUvs[0].push([T,L,R]),P=new i.Face3(A+g,S+g,C+g),P.normal.copy(M),P.vertexNormals.push(M.clone(),M.clone(),M.clone()),P.materialIndex=c,h.faces.push(P),h.faceVertexUvs[0].push([L.clone(),k,R.clone()])}}i.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:o,depthSegments:a},this.widthSegments=n||1,this.heightSegments=o||1,this.depthSegments=a||1;var h=this,c=e/2,l=t/2,u=r/2;s("z","y",-1,-1,r,t,c,0),s("z","y",1,-1,r,t,-c,1),s("x","z",1,1,e,r,l,2),s("x","z",1,-1,e,r,-l,3),s("x","y",1,-1,e,t,u,4),s("x","y",-1,-1,e,t,-u,5),this.mergeVertices()},i.BoxGeometry.prototype=Object.create(i.Geometry.prototype),i.BoxGeometry.prototype.constructor=i.BoxGeometry,i.CubeGeometry=i.BoxGeometry,i.CircleGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new i.CircleBufferGeometry(e,t,r,n))},i.CircleGeometry.prototype=Object.create(i.Geometry.prototype),i.CircleGeometry.prototype.constructor=i.CircleGeometry,i.CircleBufferGeometry=function(e,t,r,n){i.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var o=t+2,a=new Float32Array(3*o),s=new Float32Array(3*o),h=new Float32Array(2*o);s[2]=1,h[0]=.5,h[1]=.5;for(var c=0,l=3,u=2;t>=c;c++,l+=3,u+=2){var d=r+c/t*n;a[l]=e*Math.cos(d),a[l+1]=e*Math.sin(d),s[l+2]=1,h[u]=(a[l]/e+1)/2,h[u+1]=(a[l+1]/e+1)/2}for(var p=[],l=1;t>=l;l++)p.push(l,l+1,0);this.setIndex(new i.BufferAttribute(new Uint16Array(p),1)),this.addAttribute("position",new i.BufferAttribute(a,3)),this.addAttribute("normal",new i.BufferAttribute(s,3)),this.addAttribute("uv",new i.BufferAttribute(h,2)),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.CircleBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.CircleBufferGeometry.prototype.constructor=i.CircleBufferGeometry,i.CylinderGeometry=function(e,t,r,n,o,a,s,h){i.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:h},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,n=n||8,o=o||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,h=void 0!==h?h:2*Math.PI;var c,l,u=r/2,d=[],p=[];for(l=0;o>=l;l++){var f=[],m=[],v=l/o,g=v*(t-e)+e;for(c=0;n>=c;c++){var y=c/n,b=new i.Vector3;b.x=g*Math.sin(y*h+s),b.y=-v*r+u,b.z=g*Math.cos(y*h+s),this.vertices.push(b),f.push(this.vertices.length-1),m.push(new i.Vector2(y,1-v))}d.push(f),p.push(m)}var x,w,M=(t-e)/r;for(c=0;n>c;c++)for(0!==e?(x=this.vertices[d[0][c]].clone(),w=this.vertices[d[0][c+1]].clone()):(x=this.vertices[d[1][c]].clone(),w=this.vertices[d[1][c+1]].clone()),x.setY(Math.sqrt(x.x*x.x+x.z*x.z)*M).normalize(),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*M).normalize(),l=0;o>l;l++){var _=d[l][c],E=d[l+1][c],A=d[l+1][c+1],S=d[l][c+1],C=x.clone(),T=x.clone(),L=w.clone(),k=w.clone(),R=p[l][c].clone(),P=p[l+1][c].clone(),D=p[l+1][c+1].clone(),O=p[l][c+1].clone();this.faces.push(new i.Face3(_,E,S,[C,T,k])),this.faceVertexUvs[0].push([R,P,O]),this.faces.push(new i.Face3(E,A,S,[T.clone(),L,k.clone()])),this.faceVertexUvs[0].push([P.clone(),D,O.clone()])}if(a===!1&&e>0)for(this.vertices.push(new i.Vector3(0,u,0)),c=0;n>c;c++){var _=d[0][c],E=d[0][c+1],A=this.vertices.length-1,C=new i.Vector3(0,1,0),T=new i.Vector3(0,1,0),L=new i.Vector3(0,1,0),R=p[0][c].clone(),P=p[0][c+1].clone(),D=new i.Vector2(P.x,0);this.faces.push(new i.Face3(_,E,A,[C,T,L],void 0,1)),this.faceVertexUvs[0].push([R,P,D])}if(a===!1&&t>0)for(this.vertices.push(new i.Vector3(0,-u,0)),c=0;n>c;c++){var _=d[o][c+1],E=d[o][c],A=this.vertices.length-1,C=new i.Vector3(0,-1,0),T=new i.Vector3(0,-1,0),L=new i.Vector3(0,-1,0),R=p[o][c+1].clone(),P=p[o][c].clone(),D=new i.Vector2(P.x,1);this.faces.push(new i.Face3(_,E,A,[C,T,L],void 0,2)),this.faceVertexUvs[0].push([R,P,D])}this.computeFaceNormals()},i.CylinderGeometry.prototype=Object.create(i.Geometry.prototype),i.CylinderGeometry.prototype.constructor=i.CylinderGeometry,i.EdgesGeometry=function(e,t){function r(e,t){return e-t}i.BufferGeometry.call(this),t=void 0!==t?t:1;var n,o=Math.cos(i.Math.degToRad(t)),a=[0,0],s={},h=["a","b","c"];e instanceof i.BufferGeometry?(n=new i.Geometry,n.fromBufferGeometry(e)):n=e.clone(),n.mergeVertices(),n.computeFaceNormals();for(var c=n.vertices,l=n.faces,u=0,d=l.length;d>u;u++)for(var p=l[u],f=0;3>f;f++){a[0]=p[h[f]],a[1]=p[h[(f+1)%3]],a.sort(r);var m=a.toString();void 0===s[m]?s[m]={vert1:a[0],vert2:a[1],face1:u,face2:void 0}:s[m].face2=u}var v=[];for(var m in s){var g=s[m];if(void 0===g.face2||l[g.face1].normal.dot(l[g.face2].normal)<=o){var y=c[g.vert1];v.push(y.x),v.push(y.y),v.push(y.z),y=c[g.vert2],v.push(y.x),v.push(y.y),v.push(y.z)}}this.addAttribute("position",new i.BufferAttribute(new Float32Array(v),3))},i.EdgesGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.EdgesGeometry.prototype.constructor=i.EdgesGeometry,i.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(i.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},i.ExtrudeGeometry.prototype=Object.create(i.Geometry.prototype),i.ExtrudeGeometry.prototype.constructor=i.ExtrudeGeometry,i.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,n=0;r>n;n++){var i=e[n];this.addShape(i,t)}},i.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function n(e,t,r){var n,o,a=1,s=e.x-t.x,h=e.y-t.y,c=r.x-e.x,l=r.y-e.y,u=s*s+h*h,d=s*l-h*c;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(c*c+l*l),m=t.x-h/p,v=t.y+s/p,g=r.x-l/f,y=r.y+c/f,b=((g-m)*l-(y-v)*c)/(s*l-h*c);n=m+s*b-e.x,o=v+h*b-e.y;var x=n*n+o*o;if(2>=x)return new i.Vector2(n,o);a=Math.sqrt(x/2)}else{var w=!1;s>Number.EPSILON?c>Number.EPSILON&&(w=!0):s<-Number.EPSILON?c<-Number.EPSILON&&(w=!0):Math.sign(h)===Math.sign(l)&&(w=!0),w?(n=-h,o=s,a=Math.sqrt(u)):(n=s,o=h,a=Math.sqrt(u/2))}return new i.Vector2(n/a,o/a)}function o(){if(x){var e=0,t=G*e;for(q=0;H>q;q++)j=N[q],c(j[2]+t,j[1]+t,j[0]+t);for(e=M+2*b,t=G*e,q=0;H>q;q++)j=N[q],c(j[0]+t,j[1]+t,j[2]+t)}else{for(q=0;H>q;q++)j=N[q],c(j[2],j[1],j[0]);for(q=0;H>q;q++)j=N[q],c(j[0]+G*M,j[1]+G*M,j[2]+G*M)}}function a(){var e=0;for(s(I,e),e+=I.length,C=0,T=D.length;T>C;C++)S=D[C],s(S,e),e+=S.length}function s(e,t){var r,n;for(q=e.length;--q>=0;){r=q,n=q-1,0>n&&(n=e.length-1);var i=0,o=M+2*b;for(i=0;o>i;i++){var a=G*i,s=G*(i+1),h=t+r+a,c=t+n+a,u=t+n+s,d=t+r+s;l(h,c,u,d,e,i,o,r,n)}}}function h(e,t,r){L.vertices.push(new i.Vector3(e,t,r))}function c(e,t,r){e+=k,t+=k,r+=k,L.faces.push(new i.Face3(e,t,r,null,null,0));var n=A.generateTopUV(L,e,t,r);L.faceVertexUvs[0].push(n)}function l(e,t,r,n){e+=k,t+=k,r+=k,n+=k,L.faces.push(new i.Face3(e,t,n,null,null,1)),L.faces.push(new i.Face3(t,r,n,null,null,1));var o=A.generateSideWallUV(L,e,t,r,n);L.faceVertexUvs[0].push([o[0],o[1],o[3]]),L.faceVertexUvs[0].push([o[1],o[2],o[3]])}var u,d,p,f,m,v=void 0!==t.amount?t.amount:100,g=void 0!==t.bevelThickness?t.bevelThickness:6,y=void 0!==t.bevelSize?t.bevelSize:g-2,b=void 0!==t.bevelSegments?t.bevelSegments:3,x=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,M=void 0!==t.steps?t.steps:1,_=t.extrudePath,E=!1,A=void 0!==t.UVGenerator?t.UVGenerator:i.ExtrudeGeometry.WorldUVGenerator;_&&(u=_.getSpacedPoints(M),E=!0,x=!1,d=void 0!==t.frames?t.frames:new i.TubeGeometry.FrenetFrames(_,M,!1),p=new i.Vector3,f=new i.Vector3,m=new i.Vector3),x||(b=0,g=0,y=0);var S,C,T,L=this,k=this.vertices.length,R=e.extractPoints(w),P=R.shape,D=R.holes,O=!i.ShapeUtils.isClockWise(P);if(O){for(P=P.reverse(),C=0,T=D.length;T>C;C++)S=D[C],i.ShapeUtils.isClockWise(S)&&(D[C]=S.reverse());O=!1}var N=i.ShapeUtils.triangulateShape(P,D),I=P;for(C=0,T=D.length;T>C;C++)S=D[C],P=P.concat(S);for(var F,V,B,U,z,j,G=P.length,H=N.length,W=[],q=0,X=I.length,Y=X-1,Q=q+1;X>q;q++,Y++,Q++)Y===X&&(Y=0),Q===X&&(Q=0),W[q]=n(I[q],I[Y],I[Q]);var K,$=[],Z=W.concat();for(C=0,T=D.length;T>C;C++){for(S=D[C],K=[],q=0,X=S.length,Y=X-1,Q=q+1;X>q;q++,Y++,Q++)Y===X&&(Y=0),Q===X&&(Q=0),K[q]=n(S[q],S[Y],S[Q]);$.push(K),Z=Z.concat(K)}for(F=0;b>F;F++){for(B=F/b,U=g*(1-B),V=y*Math.sin(B*Math.PI/2),q=0,X=I.length;X>q;q++)z=r(I[q],W[q],V),h(z.x,z.y,-U);for(C=0,T=D.length;T>C;C++)for(S=D[C],K=$[C],q=0,X=S.length;X>q;q++)z=r(S[q],K[q],V),h(z.x,z.y,-U)}for(V=y,q=0;G>q;q++)z=x?r(P[q],Z[q],V):P[q],E?(f.copy(d.normals[0]).multiplyScalar(z.x),p.copy(d.binormals[0]).multiplyScalar(z.y),m.copy(u[0]).add(f).add(p),h(m.x,m.y,m.z)):h(z.x,z.y,0);var J;for(J=1;M>=J;J++)for(q=0;G>q;q++)z=x?r(P[q],Z[q],V):P[q],E?(f.copy(d.normals[J]).multiplyScalar(z.x),p.copy(d.binormals[J]).multiplyScalar(z.y),m.copy(u[J]).add(f).add(p),h(m.x,m.y,m.z)):h(z.x,z.y,v/M*J);for(F=b-1;F>=0;F--){for(B=F/b,U=g*(1-B),V=y*Math.sin(B*Math.PI/2),q=0,X=I.length;X>q;q++)z=r(I[q],W[q],V),h(z.x,z.y,v+U);for(C=0,T=D.length;T>C;C++)for(S=D[C],K=$[C],q=0,X=S.length;X>q;q++)z=r(S[q],K[q],V),E?h(z.x,z.y+u[M-1].y,u[M-1].x+U):h(z.x,z.y,v+U)}o(),a()},i.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,n){
  var o=e.vertices,a=o[t],s=o[r],h=o[n];return[new i.Vector2(a.x,a.y),new i.Vector2(s.x,s.y),new i.Vector2(h.x,h.y)]},generateSideWallUV:function(e,t,r,n,o){var a=e.vertices,s=a[t],h=a[r],c=a[n],l=a[o];return Math.abs(s.y-h.y)<.01?[new i.Vector2(s.x,1-s.z),new i.Vector2(h.x,1-h.z),new i.Vector2(c.x,1-c.z),new i.Vector2(l.x,1-l.z)]:[new i.Vector2(s.y,1-s.z),new i.Vector2(h.y,1-h.z),new i.Vector2(c.y,1-c.z),new i.Vector2(l.y,1-l.z)]}},i.ShapeGeometry=function(e,t){i.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},i.ShapeGeometry.prototype=Object.create(i.Geometry.prototype),i.ShapeGeometry.prototype.constructor=i.ShapeGeometry,i.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,n=e.length;n>r;r++)this.addShape(e[r],t);return this},i.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,n,o,a=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,h=void 0===t.UVGenerator?i.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,c=this.vertices.length,l=e.extractPoints(a),u=l.shape,d=l.holes,p=!i.ShapeUtils.isClockWise(u);if(p){for(u=u.reverse(),r=0,n=d.length;n>r;r++)o=d[r],i.ShapeUtils.isClockWise(o)&&(d[r]=o.reverse());p=!1}var f=i.ShapeUtils.triangulateShape(u,d);for(r=0,n=d.length;n>r;r++)o=d[r],u=u.concat(o);var m,v,g=u.length,y=f.length;for(r=0;g>r;r++)m=u[r],this.vertices.push(new i.Vector3(m.x,m.y,0));for(r=0;y>r;r++){v=f[r];var b=v[0]+c,x=v[1]+c,w=v[2]+c;this.faces.push(new i.Face3(b,x,w,null,null,s)),this.faceVertexUvs[0].push(h.generateTopUV(this,b,x,w))}},i.LatheGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=t||12,r=r||0,n=n||2*Math.PI;for(var o=1/(e.length-1),a=1/t,s=0,h=t;h>=s;s++)for(var c=r+s*a*n,l=Math.cos(c),u=Math.sin(c),d=0,p=e.length;p>d;d++){var f=e[d],m=new i.Vector3;m.x=l*f.x-u*f.y,m.y=u*f.x+l*f.y,m.z=f.z,this.vertices.push(m)}for(var v=e.length,s=0,h=t;h>s;s++)for(var d=0,p=e.length-1;p>d;d++){var g=d+v*s,y=g,b=g+v,l=g+1+v,x=g+1,w=s*a,M=d*o,_=w+a,E=M+o;this.faces.push(new i.Face3(y,b,x)),this.faceVertexUvs[0].push([new i.Vector2(w,M),new i.Vector2(_,M),new i.Vector2(w,E)]),this.faces.push(new i.Face3(b,l,x)),this.faceVertexUvs[0].push([new i.Vector2(_,M),new i.Vector2(_,E),new i.Vector2(w,E)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},i.LatheGeometry.prototype=Object.create(i.Geometry.prototype),i.LatheGeometry.prototype.constructor=i.LatheGeometry,i.PlaneGeometry=function(e,t,r,n){i.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new i.PlaneBufferGeometry(e,t,r,n))},i.PlaneGeometry.prototype=Object.create(i.Geometry.prototype),i.PlaneGeometry.prototype.constructor=i.PlaneGeometry,i.PlaneBufferGeometry=function(e,t,r,n){i.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};for(var o=e/2,a=t/2,s=Math.floor(r)||1,h=Math.floor(n)||1,c=s+1,l=h+1,u=e/s,d=t/h,p=new Float32Array(c*l*3),f=new Float32Array(c*l*3),m=new Float32Array(c*l*2),v=0,g=0,y=0;l>y;y++)for(var b=y*d-a,x=0;c>x;x++){var w=x*u-o;p[v]=w,p[v+1]=-b,f[v+2]=1,m[g]=x/s,m[g+1]=1-y/h,v+=3,g+=2}v=0;for(var M=new(p.length/3>65535?Uint32Array:Uint16Array)(s*h*6),y=0;h>y;y++)for(var x=0;s>x;x++){var _=x+c*y,E=x+c*(y+1),A=x+1+c*(y+1),S=x+1+c*y;M[v]=_,M[v+1]=E,M[v+2]=S,M[v+3]=E,M[v+4]=A,M[v+5]=S,v+=6}this.setIndex(new i.BufferAttribute(M,1)),this.addAttribute("position",new i.BufferAttribute(p,3)),this.addAttribute("normal",new i.BufferAttribute(f,3)),this.addAttribute("uv",new i.BufferAttribute(m,2))},i.PlaneBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.PlaneBufferGeometry.prototype.constructor=i.PlaneBufferGeometry,i.RingGeometry=function(e,t,r,n,o,a){i.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:o,thetaLength:a},e=e||0,t=t||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8,n=void 0!==n?Math.max(1,n):8;var s,h,c=[],l=e,u=(t-e)/n;for(s=0;n+1>s;s++){for(h=0;r+1>h;h++){var d=new i.Vector3,p=o+h/r*a;d.x=l*Math.cos(p),d.y=l*Math.sin(p),this.vertices.push(d),c.push(new i.Vector2((d.x/t+1)/2,(d.y/t+1)/2))}l+=u}var f=new i.Vector3(0,0,1);for(s=0;n>s;s++){var m=s*(r+1);for(h=0;r>h;h++){var p=h+m,v=p,g=p+r+1,y=p+r+2;this.faces.push(new i.Face3(v,g,y,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()]),v=p,g=p+r+2,y=p+1,this.faces.push(new i.Face3(v,g,y,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()])}}this.computeFaceNormals(),this.boundingSphere=new i.Sphere(new i.Vector3,l)},i.RingGeometry.prototype=Object.create(i.Geometry.prototype),i.RingGeometry.prototype.constructor=i.RingGeometry,i.SphereGeometry=function(e,t,r,n,o,a,s){i.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new i.SphereBufferGeometry(e,t,r,n,o,a,s))},i.SphereGeometry.prototype=Object.create(i.Geometry.prototype),i.SphereGeometry.prototype.constructor=i.SphereGeometry,i.SphereBufferGeometry=function(e,t,r,n,o,a,s){i.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:o,thetaStart:a,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,o=void 0!==o?o:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;for(var h=a+s,c=(t+1)*(r+1),l=new i.BufferAttribute(new Float32Array(3*c),3),u=new i.BufferAttribute(new Float32Array(3*c),3),d=new i.BufferAttribute(new Float32Array(2*c),2),p=0,f=[],m=new i.Vector3,v=0;r>=v;v++){for(var g=[],y=v/r,b=0;t>=b;b++){var x=b/t,w=-e*Math.cos(n+x*o)*Math.sin(a+y*s),M=e*Math.cos(a+y*s),_=e*Math.sin(n+x*o)*Math.sin(a+y*s);m.set(w,M,_).normalize(),l.setXYZ(p,w,M,_),u.setXYZ(p,m.x,m.y,m.z),d.setXY(p,x,1-y),g.push(p),p++}f.push(g)}for(var E=[],v=0;r>v;v++)for(var b=0;t>b;b++){var A=f[v][b+1],S=f[v][b],C=f[v+1][b],T=f[v+1][b+1];(0!==v||a>0)&&E.push(A,S,T),(v!==r-1||h<Math.PI)&&E.push(S,C,T)}this.setIndex(new(l.count>65535?i.Uint32Attribute:i.Uint16Attribute)(E,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",d),this.boundingSphere=new i.Sphere(new i.Vector3,e)},i.SphereBufferGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.SphereBufferGeometry.prototype.constructor=i.SphereBufferGeometry,i.TorusGeometry=function(e,t,r,n,o){i.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:o},e=e||100,t=t||40,r=r||8,n=n||6,o=o||2*Math.PI;for(var a=new i.Vector3,s=[],h=[],c=0;r>=c;c++)for(var l=0;n>=l;l++){var u=l/n*o,d=c/r*Math.PI*2;a.x=e*Math.cos(u),a.y=e*Math.sin(u);var p=new i.Vector3;p.x=(e+t*Math.cos(d))*Math.cos(u),p.y=(e+t*Math.cos(d))*Math.sin(u),p.z=t*Math.sin(d),this.vertices.push(p),s.push(new i.Vector2(l/n,c/r)),h.push(p.clone().sub(a).normalize())}for(var c=1;r>=c;c++)for(var l=1;n>=l;l++){var f=(n+1)*c+l-1,m=(n+1)*(c-1)+l-1,v=(n+1)*(c-1)+l,g=(n+1)*c+l,y=new i.Face3(f,m,g,[h[f].clone(),h[m].clone(),h[g].clone()]);this.faces.push(y),this.faceVertexUvs[0].push([s[f].clone(),s[m].clone(),s[g].clone()]),y=new i.Face3(m,v,g,[h[m].clone(),h[v].clone(),h[g].clone()]),this.faces.push(y),this.faceVertexUvs[0].push([s[m].clone(),s[v].clone(),s[g].clone()])}this.computeFaceNormals()},i.TorusGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusGeometry.prototype.constructor=i.TorusGeometry,i.TorusKnotGeometry=function(e,t,r,n,o,a,s){function h(e,t,r,n,o){var a=Math.cos(e),s=Math.sin(e),h=t/r*e,c=Math.cos(h),l=n*(2+c)*.5*a,u=n*(2+c)*s*.5,d=o*n*Math.sin(h)*.5;return new i.Vector3(l,u,d)}i.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,p:o,q:a,heightScale:s},e=e||100,t=t||40,r=r||64,n=n||8,o=o||2,a=a||3,s=s||1;for(var c=new Array(r),l=new i.Vector3,u=new i.Vector3,d=new i.Vector3,p=0;r>p;++p){c[p]=new Array(n);var f=p/r*2*o*Math.PI,m=h(f,a,o,e,s),v=h(f+.01,a,o,e,s);l.subVectors(v,m),u.addVectors(v,m),d.crossVectors(l,u),u.crossVectors(d,l),d.normalize(),u.normalize();for(var g=0;n>g;++g){var y=g/n*2*Math.PI,b=-t*Math.cos(y),x=t*Math.sin(y),w=new i.Vector3;w.x=m.x+b*u.x+x*d.x,w.y=m.y+b*u.y+x*d.y,w.z=m.z+b*u.z+x*d.z,c[p][g]=this.vertices.push(w)-1}}for(var p=0;r>p;++p)for(var g=0;n>g;++g){var M=(p+1)%r,_=(g+1)%n,E=c[p][g],A=c[M][g],S=c[M][_],C=c[p][_],T=new i.Vector2(p/r,g/n),L=new i.Vector2((p+1)/r,g/n),k=new i.Vector2((p+1)/r,(g+1)/n),R=new i.Vector2(p/r,(g+1)/n);this.faces.push(new i.Face3(E,A,C)),this.faceVertexUvs[0].push([T,L,R]),this.faces.push(new i.Face3(A,S,C)),this.faceVertexUvs[0].push([L.clone(),k,R.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},i.TorusKnotGeometry.prototype=Object.create(i.Geometry.prototype),i.TorusKnotGeometry.prototype.constructor=i.TorusKnotGeometry,i.TubeGeometry=function(e,t,r,n,o,a){function s(e,t,r){return k.vertices.push(new i.Vector3(e,t,r))-1}i.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:n,closed:o,taper:a},t=t||64,r=r||1,n=n||8,o=o||!1,a=a||i.TubeGeometry.NoTaper;var h,c,l,u,d,p,f,m,v,g,y,b,x,w,M,_,E,A,S,C,T,L=[],k=this,R=t+1,P=new i.Vector3,D=new i.TubeGeometry.FrenetFrames(e,t,o),O=D.tangents,N=D.normals,I=D.binormals;for(this.tangents=O,this.normals=N,this.binormals=I,g=0;R>g;g++)for(L[g]=[],u=g/(R-1),v=e.getPointAt(u),h=O[g],c=N[g],l=I[g],p=r*a(u),y=0;n>y;y++)d=y/n*2*Math.PI,f=-p*Math.cos(d),m=p*Math.sin(d),P.copy(v),P.x+=f*c.x+m*l.x,P.y+=f*c.y+m*l.y,P.z+=f*c.z+m*l.z,L[g][y]=s(P.x,P.y,P.z);for(g=0;t>g;g++)for(y=0;n>y;y++)b=o?(g+1)%t:g+1,x=(y+1)%n,w=L[g][y],M=L[b][y],_=L[b][x],E=L[g][x],A=new i.Vector2(g/t,y/n),S=new i.Vector2((g+1)/t,y/n),C=new i.Vector2((g+1)/t,(y+1)/n),T=new i.Vector2(g/t,(y+1)/n),this.faces.push(new i.Face3(w,M,E)),this.faceVertexUvs[0].push([A,S,T]),this.faces.push(new i.Face3(M,_,E)),this.faceVertexUvs[0].push([S.clone(),C,T.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.TubeGeometry.prototype=Object.create(i.Geometry.prototype),i.TubeGeometry.prototype.constructor=i.TubeGeometry,i.TubeGeometry.NoTaper=function(){return 1},i.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},i.TubeGeometry.FrenetFrames=function(e,t,r){function n(){f[0]=new i.Vector3,m[0]=new i.Vector3,a=Number.MAX_VALUE,s=Math.abs(p[0].x),h=Math.abs(p[0].y),c=Math.abs(p[0].z),a>=s&&(a=s,d.set(1,0,0)),a>=h&&(a=h,d.set(0,1,0)),a>=c&&d.set(0,0,1),v.crossVectors(p[0],d).normalize(),f[0].crossVectors(p[0],v),m[0].crossVectors(p[0],f[0])}var o,a,s,h,c,l,u,d=new i.Vector3,p=[],f=[],m=[],v=new i.Vector3,g=new i.Matrix4,y=t+1;for(this.tangents=p,this.normals=f,this.binormals=m,l=0;y>l;l++)u=l/(y-1),p[l]=e.getTangentAt(u),p[l].normalize();for(n(),l=1;y>l;l++)f[l]=f[l-1].clone(),m[l]=m[l-1].clone(),v.crossVectors(p[l-1],p[l]),v.length()>Number.EPSILON&&(v.normalize(),o=Math.acos(i.Math.clamp(p[l-1].dot(p[l]),-1,1)),f[l].applyMatrix4(g.makeRotationAxis(v,o))),m[l].crossVectors(p[l],f[l]);if(r)for(o=Math.acos(i.Math.clamp(f[0].dot(f[y-1]),-1,1)),o/=y-1,p[0].dot(v.crossVectors(f[0],f[y-1]))>0&&(o=-o),l=1;y>l;l++)f[l].applyMatrix4(g.makeRotationAxis(p[l],o*l)),m[l].crossVectors(p[l],f[l])},i.PolyhedronGeometry=function(e,t,r,n){function o(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var r=h(e)/2/Math.PI+.5,n=c(e)/Math.PI+.5;return t.uv=new i.Vector2(r,1-n),t}function a(e,t,r,n){var o=new i.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,n);u.faces.push(o),x.copy(e).add(t).add(r).divideScalar(3);var a=h(x);u.faceVertexUvs[0].push([l(e.uv,e,a),l(t.uv,t,a),l(r.uv,r,a)])}function s(e,t){for(var r=Math.pow(2,t),n=o(u.vertices[e.a]),i=o(u.vertices[e.b]),s=o(u.vertices[e.c]),h=[],c=e.materialIndex,l=0;r>=l;l++){h[l]=[];for(var d=o(n.clone().lerp(s,l/r)),p=o(i.clone().lerp(s,l/r)),f=r-l,m=0;f>=m;m++)h[l][m]=0===m&&l===r?d:o(d.clone().lerp(p,m/f))}for(var l=0;r>l;l++)for(var m=0;2*(r-l)-1>m;m++){var v=Math.floor(m/2);m%2===0?a(h[l][v+1],h[l+1][v],h[l][v],c):a(h[l][v+1],h[l+1][v+1],h[l+1][v],c)}}function h(e){return Math.atan2(e.z,-e.x)}function c(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function l(e,t,r){return 0>r&&1===e.x&&(e=new i.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new i.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}i.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n},r=r||1,n=n||0;for(var u=this,d=0,p=e.length;p>d;d+=3)o(new i.Vector3(e[d],e[d+1],e[d+2]));for(var f=this.vertices,m=[],d=0,v=0,p=t.length;p>d;d+=3,v++){var g=f[t[d]],y=f[t[d+1]],b=f[t[d+2]];m[v]=new i.Face3(g.index,y.index,b.index,[g.clone(),y.clone(),b.clone()],void 0,v)}for(var x=new i.Vector3,d=0,p=m.length;p>d;d++)s(m[d],n);for(var d=0,p=this.faceVertexUvs[0].length;p>d;d++){var w=this.faceVertexUvs[0][d],M=w[0].x,_=w[1].x,E=w[2].x,A=Math.max(M,_,E),S=Math.min(M,_,E);A>.9&&.1>S&&(.2>M&&(w[0].x+=1),.2>_&&(w[1].x+=1),.2>E&&(w[2].x+=1))}for(var d=0,p=this.vertices.length;p>d;d++)this.vertices[d].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new i.Sphere(new i.Vector3,r)},i.PolyhedronGeometry.prototype=Object.create(i.Geometry.prototype),i.PolyhedronGeometry.prototype.constructor=i.PolyhedronGeometry,i.DodecahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,n=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];i.PolyhedronGeometry.call(this,o,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},i.DodecahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.DodecahedronGeometry.prototype.constructor=i.DodecahedronGeometry,i.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];i.PolyhedronGeometry.call(this,n,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},i.IcosahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.IcosahedronGeometry.prototype.constructor=i.IcosahedronGeometry,i.OctahedronGeometry=function(e,t){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];i.PolyhedronGeometry.call(this,r,n,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},i.OctahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.OctahedronGeometry.prototype.constructor=i.OctahedronGeometry,i.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];i.PolyhedronGeometry.call(this,r,n,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},i.TetrahedronGeometry.prototype=Object.create(i.PolyhedronGeometry.prototype),i.TetrahedronGeometry.prototype.constructor=i.TetrahedronGeometry,i.ParametricGeometry=function(e,t,r){i.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var n,o,a,s,h,c=this.vertices,l=this.faces,u=this.faceVertexUvs[0],d=t+1;for(n=0;r>=n;n++)for(h=n/r,o=0;t>=o;o++)s=o/t,a=e(s,h),c.push(a);var p,f,m,v,g,y,b,x;for(n=0;r>n;n++)for(o=0;t>o;o++)p=n*d+o,f=n*d+o+1,m=(n+1)*d+o+1,v=(n+1)*d+o,g=new i.Vector2(o/t,n/r),y=new i.Vector2((o+1)/t,n/r),b=new i.Vector2((o+1)/t,(n+1)/r),x=new i.Vector2(o/t,(n+1)/r),l.push(new i.Face3(p,f,v)),u.push([g,y,x]),l.push(new i.Face3(f,m,v)),u.push([y.clone(),b,x.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},i.ParametricGeometry.prototype=Object.create(i.Geometry.prototype),i.ParametricGeometry.prototype.constructor=i.ParametricGeometry,i.WireframeGeometry=function(e){function t(e,t){return e-t}i.BufferGeometry.call(this);var r=[0,0],n={},o=["a","b","c"];if(e instanceof i.Geometry){for(var a=e.vertices,s=e.faces,h=0,c=new Uint32Array(6*s.length),l=0,u=s.length;u>l;l++)for(var d=s[l],p=0;3>p;p++){r[0]=d[o[p]],r[1]=d[o[(p+1)%3]],r.sort(t);var f=r.toString();void 0===n[f]&&(c[2*h]=r[0],c[2*h+1]=r[1],n[f]=!0,h++)}for(var m=new Float32Array(2*h*3),l=0,u=h;u>l;l++)for(var p=0;2>p;p++){var v=a[c[2*l+p]],g=6*l+3*p;m[g+0]=v.x,m[g+1]=v.y,m[g+2]=v.z}this.addAttribute("position",new i.BufferAttribute(m,3))}else if(e instanceof i.BufferGeometry)if(null!==e.index){var y=e.index.array,a=e.attributes.position,b=e.groups,h=0;0===b.length&&e.addGroup(0,y.length);for(var c=new Uint32Array(2*y.length),x=0,w=b.length;w>x;++x)for(var M=b[x],_=M.start,E=M.count,l=_,A=_+E;A>l;l+=3)for(var p=0;3>p;p++){r[0]=y[l+p],r[1]=y[l+(p+1)%3],r.sort(t);var f=r.toString();void 0===n[f]&&(c[2*h]=r[0],c[2*h+1]=r[1],n[f]=!0,h++)}for(var m=new Float32Array(2*h*3),l=0,u=h;u>l;l++)for(var p=0;2>p;p++){var g=6*l+3*p,S=c[2*l+p];m[g+0]=a.getX(S),m[g+1]=a.getY(S),m[g+2]=a.getZ(S)}this.addAttribute("position",new i.BufferAttribute(m,3))}else{for(var a=e.attributes.position.array,h=a.length/3,C=h/3,m=new Float32Array(2*h*3),l=0,u=C;u>l;l++)for(var p=0;3>p;p++){var g=18*l+6*p,T=9*l+3*p;m[g+0]=a[T],m[g+1]=a[T+1],m[g+2]=a[T+2];var S=9*l+3*((p+1)%3);m[g+3]=a[S],m[g+4]=a[S+1],m[g+5]=a[S+2]}this.addAttribute("position",new i.BufferAttribute(m,3))}},i.WireframeGeometry.prototype=Object.create(i.BufferGeometry.prototype),i.WireframeGeometry.prototype.constructor=i.WireframeGeometry,i.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),n=new i.BufferGeometry;n.addAttribute("position",new i.BufferAttribute(t,3)),n.addAttribute("color",new i.BufferAttribute(r,3));var o=new i.LineBasicMaterial({vertexColors:i.VertexColors});i.LineSegments.call(this,n,o)},i.AxisHelper.prototype=Object.create(i.LineSegments.prototype),i.AxisHelper.prototype.constructor=i.AxisHelper,i.ArrowHelper=function(){var e=new i.Geometry;e.vertices.push(new i.Vector3(0,0,0),new i.Vector3(0,1,0));var t=new i.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(r,n,o,a,s,h){i.Object3D.call(this),void 0===a&&(a=16776960),void 0===o&&(o=1),void 0===s&&(s=.2*o),void 0===h&&(h=.2*s),this.position.copy(n),this.line=new i.Line(e,new i.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new i.Mesh(t,new i.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(o,s,h)}}(),i.ArrowHelper.prototype=Object.create(i.Object3D.prototype),i.ArrowHelper.prototype.constructor=i.ArrowHelper,i.ArrowHelper.prototype.setDirection=function(){var e,t=new i.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),i.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},i.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},i.BoxHelper=function(e){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),n=new i.BufferGeometry;n.setIndex(new i.BufferAttribute(t,1)),n.addAttribute("position",new i.BufferAttribute(r,3)),i.LineSegments.call(this,n,new i.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},i.BoxHelper.prototype=Object.create(i.LineSegments.prototype),i.BoxHelper.prototype.constructor=i.BoxHelper,i.BoxHelper.prototype.update=function(){var e=new i.Box3;return function(t){if(e.setFromObject(t),!e.isEmpty()){var r=e.min,n=e.max,i=this.geometry.attributes.position,o=i.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=r.x,o[4]=n.y,o[5]=n.z,o[6]=r.x,o[7]=r.y,o[8]=n.z,o[9]=n.x,o[10]=r.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=r.z,o[15]=r.x,o[16]=n.y,o[17]=r.z,o[18]=r.x,o[19]=r.y,o[20]=r.z,o[21]=n.x,o[22]=r.y,o[23]=r.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),i.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new i.Box3,i.Mesh.call(this,new i.BoxGeometry(1,1,1),new i.MeshBasicMaterial({color:r,wireframe:!0}))},i.BoundingBoxHelper.prototype=Object.create(i.Mesh.prototype),i.BoundingBoxHelper.prototype.constructor=i.BoundingBoxHelper,i.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},i.CameraHelper=function(e){function t(e,t,n){r(e,n),r(t,n)}function r(e,t){n.vertices.push(new i.Vector3),n.colors.push(new i.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(n.vertices.length-1)}var n=new i.Geometry,o=new i.LineBasicMaterial({color:16777215,vertexColors:i.FaceColors}),a={},s=16755200,h=16711680,c=43775,l=16777215,u=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s),t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",l),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),i.LineSegments.call(this,n,o),this.camera=e,this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},i.CameraHelper.prototype=Object.create(i.LineSegments.prototype),i.CameraHelper.prototype.constructor=i.CameraHelper,i.CameraHelper.prototype.update=function(){function e(e,i,a,s){n.set(i,a,s).unproject(o);var h=r[e];if(void 0!==h)for(var c=0,l=h.length;l>c;c++)t.vertices[h[c]].copy(n)}var t,r,n=new i.Vector3,o=new i.Camera;return function(){t=this.geometry,r=this.pointMap;var n=1,i=1;o.projectionMatrix.copy(this.camera.projectionMatrix),e("c",0,0,-1),e("t",0,0,1),e("n1",-n,-i,-1),e("n2",n,-i,-1),e("n3",-n,i,-1),e("n4",n,i,-1),e("f1",-n,-i,1),e("f2",n,-i,1),e("f3",-n,i,1),e("f4",n,i,1),e("u1",.7*n,1.1*i,-1),e("u2",.7*-n,1.1*i,-1),e("u3",0,2*i,-1),e("cf1",-n,0,1),e("cf2",n,0,1),e("cf3",0,-i,1),e("cf4",0,i,1),e("cn1",-n,0,-1),e("cn2",n,0,-1),e("cn3",0,-i,-1),e("cn4",0,i,-1),t.verticesNeedUpdate=!0}}(),i.DirectionalLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new i.Geometry;r.vertices.push(new i.Vector3(-t,t,0),new i.Vector3(t,t,0),new i.Vector3(t,-t,0),new i.Vector3(-t,-t,0),new i.Vector3(-t,t,0));var n=new i.LineBasicMaterial({fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new i.Line(r,n),this.add(this.lightPlane),r=new i.Geometry,r.vertices.push(new i.Vector3,new i.Vector3),n=new i.LineBasicMaterial({fog:!1}),n.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new i.Line(r,n),this.add(this.targetLine),this.update()},i.DirectionalLightHelper.prototype=Object.create(i.Object3D.prototype),i.DirectionalLightHelper.prototype.constructor=i.DirectionalLightHelper,i.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},i.DirectionalLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),i.EdgesHelper=function(e,t,r){var n=void 0!==t?t:16777215;i.LineSegments.call(this,new i.EdgesGeometry(e.geometry,r),new i.LineBasicMaterial({color:n})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.EdgesHelper.prototype=Object.create(i.LineSegments.prototype),i.EdgesHelper.prototype.constructor=i.EdgesHelper,i.FaceNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==r?r:16776960,a=void 0!==n?n:1,s=0,h=this.object.geometry;h instanceof i.Geometry?s=h.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new i.BufferGeometry,l=new i.Float32Attribute(2*s*3,3);c.addAttribute("position",l),i.LineSegments.call(this,c,new i.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},i.FaceNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.FaceNormalsHelper.prototype.constructor=i.FaceNormalsHelper,i.FaceNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var n=this.object.matrixWorld,i=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,h=0,c=0,l=s.length;l>c;c++){var u=s[c],d=u.normal;e.copy(a[u.a]).add(a[u.b]).add(a[u.c]).divideScalar(3).applyMatrix4(n),t.copy(d).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),i.setXYZ(h,e.x,e.y,e.z),h+=1,i.setXYZ(h,t.x,t.y,t.z),h+=1}return i.needsUpdate=!0,this}}(),i.GridHelper=function(e,t){var r=new i.Geometry,n=new i.LineBasicMaterial({vertexColors:i.VertexColors});this.color1=new i.Color(4473924),this.color2=new i.Color(8947848);for(var o=-e;e>=o;o+=t){r.vertices.push(new i.Vector3(-e,0,o),new i.Vector3(e,0,o),new i.Vector3(o,0,-e),new i.Vector3(o,0,e));var a=0===o?this.color1:this.color2;r.colors.push(a,a,a,a)}i.LineSegments.call(this,r,n)},i.GridHelper.prototype=Object.create(i.LineSegments.prototype),i.GridHelper.prototype.constructor=i.GridHelper,i.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},i.HemisphereLightHelper=function(e,t){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new i.Color,new i.Color];var r=new i.SphereGeometry(t,4,2);r.rotateX(-Math.PI/2);for(var n=0,o=8;o>n;n++)r.faces[n].color=this.colors[4>n?0:1];var a=new i.MeshBasicMaterial({vertexColors:i.FaceColors,wireframe:!0});this.lightSphere=new i.Mesh(r,a),this.add(this.lightSphere),this.update()},i.HemisphereLightHelper.prototype=Object.create(i.Object3D.prototype),i.HemisphereLightHelper.prototype.constructor=i.HemisphereLightHelper,i.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},i.HemisphereLightHelper.prototype.update=function(){var e=new i.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),i.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new i.SphereGeometry(t,4,2),n=new i.MeshBasicMaterial({wireframe:!0,fog:!1});n.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.Mesh.call(this,r,n),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},i.PointLightHelper.prototype=Object.create(i.Mesh.prototype),i.PointLightHelper.prototype.constructor=i.PointLightHelper,i.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},i.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},i.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new i.Geometry,r=0;r<this.bones.length;r++){var n=this.bones[r];n.parent instanceof i.Bone&&(t.vertices.push(new i.Vector3),t.vertices.push(new i.Vector3),t.colors.push(new i.Color(0,0,1)),t.colors.push(new i.Color(0,1,0)))}t.dynamic=!0;var o=new i.LineBasicMaterial({vertexColors:i.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});i.LineSegments.call(this,t,o),this.root=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.update()},i.SkeletonHelper.prototype=Object.create(i.LineSegments.prototype),i.SkeletonHelper.prototype.constructor=i.SkeletonHelper,i.SkeletonHelper.prototype.getBoneList=function(e){var t=[];e instanceof i.Bone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,this.getBoneList(e.children[r]));return t},i.SkeletonHelper.prototype.update=function(){for(var e=this.geometry,t=(new i.Matrix4).getInverse(this.root.matrixWorld),r=new i.Matrix4,n=0,o=0;o<this.bones.length;o++){var a=this.bones[o];a.parent instanceof i.Bone&&(r.multiplyMatrices(t,a.matrixWorld),e.vertices[n].setFromMatrixPosition(r),r.multiplyMatrices(t,a.parent.matrixWorld),e.vertices[n+1].setFromMatrixPosition(r),n+=2)}e.verticesNeedUpdate=!0,e.computeBoundingSphere()},i.SpotLightHelper=function(e){i.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;var t=new i.CylinderGeometry(0,1,1,8,1,!0);t.translate(0,-.5,0),t.rotateX(-Math.PI/2);var r=new i.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new i.Mesh(t,r),this.add(this.cone),this.update()},i.SpotLightHelper.prototype=Object.create(i.Object3D.prototype),i.SpotLightHelper.prototype.constructor=i.SpotLightHelper,i.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},i.SpotLightHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3;return function(){var r=this.light.distance?this.light.distance:1e4,n=r*Math.tan(this.light.angle);this.cone.scale.set(n,n,r),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),i.VertexNormalsHelper=function(e,t,r,n){this.object=e,this.size=void 0!==t?t:1;var o=void 0!==r?r:16711680,a=void 0!==n?n:1,s=0,h=this.object.geometry;h instanceof i.Geometry?s=3*h.faces.length:h instanceof i.BufferGeometry&&(s=h.attributes.normal.count);var c=new i.BufferGeometry,l=new i.Float32Attribute(2*s*3,3);c.addAttribute("position",l),i.LineSegments.call(this,c,new i.LineBasicMaterial({color:o,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},i.VertexNormalsHelper.prototype=Object.create(i.LineSegments.prototype),i.VertexNormalsHelper.prototype.constructor=i.VertexNormalsHelper,i.VertexNormalsHelper.prototype.update=function(){var e=new i.Vector3,t=new i.Vector3,r=new i.Matrix3;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);var o=this.object.matrixWorld,a=this.geometry.attributes.position,s=this.object.geometry;if(s instanceof i.Geometry)for(var h=s.vertices,c=s.faces,l=0,u=0,d=c.length;d>u;u++)for(var p=c[u],f=0,m=p.vertexNormals.length;m>f;f++){var v=h[p[n[f]]],g=p.vertexNormals[f];e.copy(v).applyMatrix4(o),t.copy(g).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}else if(s instanceof i.BufferGeometry)for(var y=s.attributes.position,b=s.attributes.normal,l=0,f=0,m=y.count;m>f;f++)e.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(o),
  t.set(b.getX(f),b.getY(f),b.getZ(f)),t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1;return a.needsUpdate=!0,this}}(),i.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;i.LineSegments.call(this,new i.WireframeGeometry(e.geometry),new i.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},i.WireframeHelper.prototype=Object.create(i.LineSegments.prototype),i.WireframeHelper.prototype.constructor=i.WireframeHelper,i.ImmediateRenderObject=function(e){i.Object3D.call(this),this.material=e,this.render=function(){}},i.ImmediateRenderObject.prototype=Object.create(i.Object3D.prototype),i.ImmediateRenderObject.prototype.constructor=i.ImmediateRenderObject,i.MorphBlendMesh=function(e,t){i.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,n="__default",o=0,a=r-1,s=r/1;this.createAnimation(n,o,a,s),this.setAnimationWeight(n,1)},i.MorphBlendMesh.prototype=Object.create(i.Mesh.prototype),i.MorphBlendMesh.prototype.constructor=i.MorphBlendMesh,i.MorphBlendMesh.prototype.createAnimation=function(e,t,r,n){var i={start:t,end:r,length:r-t+1,fps:n,duration:(r-t)/n,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=i,this.animationsList.push(i)},i.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/i,n={},i=this.geometry,o=0,a=i.morphTargets.length;a>o;o++){var s=i.morphTargets[o],h=s.name.match(r);if(h&&h.length>1){var c=h[1];n[c]||(n[c]={start:1/0,end:-(1/0)});var l=n[c];o<l.start&&(l.start=o),o>l.end&&(l.end=o),t||(t=c)}}for(var c in n){var l=n[c];this.createAnimation(c,l.start,l.end,e)}this.firstAnimation=t},i.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},i.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},i.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},i.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},i.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},i.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},i.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},i.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},i.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},i.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},i.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var n=this.animationsList[t];if(n.active){var o=n.duration/n.length;n.time+=n.direction*e,n.mirroredLoop?(n.time>n.duration||n.time<0)&&(n.direction*=-1,n.time>n.duration&&(n.time=n.duration,n.directionBackwards=!0),n.time<0&&(n.time=0,n.directionBackwards=!1)):(n.time=n.time%n.duration,n.time<0&&(n.time+=n.duration));var a=n.start+i.Math.clamp(Math.floor(n.time/o),0,n.length-1),s=n.weight;a!==n.currentFrame&&(this.morphTargetInfluences[n.lastFrame]=0,this.morphTargetInfluences[n.currentFrame]=1*s,this.morphTargetInfluences[a]=0,n.lastFrame=n.currentFrame,n.currentFrame=a);var h=n.time%o/o;n.directionBackwards&&(h=1-h),n.currentFrame!==n.lastFrame?(this.morphTargetInfluences[n.currentFrame]=h*s,this.morphTargetInfluences[n.lastFrame]=(1-h)*s):this.morphTargetInfluences[n.currentFrame]=s}}}},{}],36:[function(){THREE.VRControls=function(e,t){function r(e){var t=e.filter(function(e){return-1!==e.deviceName.toLowerCase().indexOf("oculus")});return t.length>=1?e.filter(function(e){return-1===e.deviceName.toLowerCase().indexOf("cardboard")}):e}function n(e){e=r(e);for(var n=0;n<e.length;n++)e[n]instanceof PositionSensorVRDevice&&o.push(e[n]);t&&t("HMD not available")}var i=this,o=[];navigator.getVRDevices&&navigator.getVRDevices().then(n),this.scale=1,this.update=function(){for(var t=0;t<o.length;t++){var r=o[t],n=r.getState();null!==n.orientation&&e.quaternion.copy(n.orientation),null!==n.position&&e.position.copy(n.position).multiplyScalar(i.scale)}},this.resetSensor=function(){for(var e=0;e<o.length;e++){var t=o[e];void 0!==t.resetSensor?t.resetSensor():void 0!==t.zeroSensor&&t.zeroSensor()}},this.zeroSensor=function(){console.warn("THREE.VRControls: .zeroSensor() is now .resetSensor()."),this.resetSensor()},this.dispose=function(){o=[]}}},{}],37:[function(){THREE.VREffect=function(e,t){function r(e){for(var r=0;r<e.length;r++)if(e[r]instanceof HMDVRDevice){a=e[r];break}void 0===a&&t&&t("HMD not available")}function n(e){var t=2/(e.leftTan+e.rightTan),r=(e.leftTan-e.rightTan)*t*.5,n=2/(e.upTan+e.downTan),i=(e.upTan-e.downTan)*n*.5;return{scale:[t,n],offset:[r,i]}}function i(e,t,r,i){t=void 0===t?!0:t,r=void 0===r?.01:r,i=void 0===i?1e4:i;var o=t?-1:1,a=new THREE.Matrix4,s=a.elements,h=n(e);return s[0]=h.scale[0],s[1]=0,s[2]=h.offset[0]*o,s[3]=0,s[4]=0,s[5]=h.scale[1],s[6]=-h.offset[1]*o,s[7]=0,s[8]=0,s[9]=0,s[10]=i/(r-i)*-o,s[11]=i*r/(r-i),s[12]=0,s[13]=0,s[14]=o,s[15]=0,a.transpose(),a}function o(e,t,r,n){var o=Math.PI/180,a={upTan:Math.tan(e.upDegrees*o),downTan:Math.tan(e.downDegrees*o),leftTan:Math.tan(e.leftDegrees*o),rightTan:Math.tan(e.rightDegrees*o)};return i(a,t,r,n)}var a,s,h,c,l;navigator.getVRDevices&&navigator.getVRDevices().then(r),this.scale=1,this.setSize=function(t,r){e.setSize(t,r)};var u=!1,d=e.domElement,p=d.mozRequestFullScreen?"mozfullscreenchange":"webkitfullscreenchange";document.addEventListener(p,function(){u=document.mozFullScreenElement||document.webkitFullscreenElement},!1),this.setFullScreen=function(e){void 0!==a&&u!==e&&(d.mozRequestFullScreen?d.mozRequestFullScreen({vrDisplay:a}):d.webkitRequestFullscreen&&d.webkitRequestFullscreen({vrDisplay:a}))};var f=new THREE.PerspectiveCamera;f.layers.enable(1);var m=new THREE.PerspectiveCamera;m.layers.enable(2),this.render=function(t,r){if(a){var n=a.getEyeParameters("left"),i=a.getEyeParameters("right");s=n.eyeTranslation,c=i.eyeTranslation,h=n.recommendedFieldOfView,l=i.recommendedFieldOfView,Array.isArray(t)&&(console.warn("THREE.VREffect.render() no longer supports arrays. Use object.layers instead."),t=t[0]);var u=e.getSize();return u.width/=2,e.setScissorTest(!0),e.clear(),null===r.parent&&r.updateMatrixWorld(),f.projectionMatrix=o(h,!0,r.near,r.far),m.projectionMatrix=o(l,!0,r.near,r.far),r.matrixWorld.decompose(f.position,f.quaternion,f.scale),r.matrixWorld.decompose(m.position,m.quaternion,m.scale),f.translateX(s.x*this.scale),m.translateX(c.x*this.scale),e.setViewport(0,0,u.width,u.height),e.setScissor(0,0,u.width,u.height),e.render(t,f),e.setViewport(u.width,0,u.width,u.height),e.setScissor(u.width,0,u.width,u.height),e.render(t,m),void e.setScissorTest(!1)}e.render(t,r)}}},{}],38:[function(){THREE.ColladaLoader=function(){function e(e,r,n,i){var o=0;if(document.implementation&&document.implementation.createDocument){var a=new XMLHttpRequest;a.onreadystatechange=function(){4===a.readyState?(0===a.status||200===a.status)&&(a.response?(Ve=r,t(a.response,void 0,e)):i?i():console.error("ColladaLoader: Empty or non-existing file ("+e+")")):3===a.readyState&&n&&(0===o&&(o=a.getResponseHeader("Content-Length")),n({total:o,loaded:a.responseText.length}))},a.open("GET",e,!0),a.send(null)}else alert("Don't know how to parse XML!")}function t(e,t,r){if(Ie=(new DOMParser).parseFromString(e,"text/xml"),t=t||Ve,void 0!==r){var h=r.split("/");h.pop(),De=(h.length<1?".":h.join("/"))+"/"}n(),xe(),Ue=i("library_images image",S,"image"),He=i("library_materials material",q,"material"),We=i("library_effects effect",$,"effect"),Ge=i("library_geometries geometry",I,"geometry"),qe=i("library_cameras camera",ne,"camera"),Xe=i("library_lights light",oe,"light"),je=i("library_controllers controller",C,"controller"),ze=i("library_animations animation",J,"animation"),Re=i("library_visual_scenes visual_scene",k,"visual_scene"),Pe=i("library_kinematics_models kinematics_model",se,"kinematics_model"),Oe=[],Ne=[],Ce=o(),Fe=new THREE.Group;for(var c=0;c<Ce.nodes.length;c++)Fe.add(g(Ce.nodes[c]));Fe.scale.multiplyScalar(Ke),s(),Te=a(),v();var l={scene:Fe,morphs:Oe,skins:Ne,animations:Le,kinematics:ke,dae:{images:Ue,materials:He,cameras:qe,lights:Xe,effects:We,geometries:Ge,controllers:je,animations:ze,visualScenes:Re,visualScene:Ce,scene:Ce,kinematicsModels:Pe,kinematicsModel:Te}};return t&&t(l),l}function r(e){Ye=e}function n(){var e=Ie.querySelectorAll("asset"),t=e[0];if(t&&t.childNodes)for(var r=0;r<t.childNodes.length;r++){var n=t.childNodes[r];switch(n.nodeName){case"unit":var i=n.getAttribute("meter");i&&(Ke=parseFloat(i));break;case"up_axis":$e=n.textContent.charAt(0)}}}function i(e,t,r){for(var n=Ie.querySelectorAll(e),i={},o=0,a=n.length,s=0;a>s;s++){var h=n[s],c=(new t).parse(h);c.id&&0!==c.id.length||(c.id=r+o++),i[c.id]=c}return i}function o(){var e=Ie.querySelectorAll("scene instance_visual_scene")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return Re[t.length>0?t:"visual_scene0"]}return null}function a(){var e=Ie.querySelectorAll("instance_kinematics_model")[0];if(e){var t=e.getAttribute("url").replace(/^#/,"");return Pe[t.length>0?t:"kinematics_model0"]}return null}function s(){Le=[],h(Fe)}function h(e){var t=Ce.getChildById(e.colladaId,!0),r=null;if(t&&t.keys){r={fps:60,hierarchy:[{node:t,keys:t.keys,sids:t.sids}],node:e,name:"animation_"+e.name,length:0},Le.push(r);for(var n=0,i=t.keys.length;i>n;n++)r.length=Math.max(r.length,t.keys[n].time)}else r={hierarchy:[{keys:[],sids:[]}]};for(var n=0,i=e.children.length;i>n;n++)for(var o=h(e.children[n]),a=0,s=o.hierarchy.length;s>a;a++)r.hierarchy.push({keys:[],sids:[]});return r}function c(){var e,t=1e6,r=-t,n=0;for(var i in ze){var o=ze[i];e=e||o.id;for(var a=0;a<o.sampler.length;a++){var s=o.sampler[a];s.create(),t=Math.min(t,s.startTime),r=Math.max(r,s.endTime),n=Math.max(n,s.input.length)}}return{start:t,end:r,frames:n,ID:e}}function l(e,t){var r=t instanceof D?je[t.url]:t;if(!r||!r.morph)return void console.log("could not find morph controller!");for(var n=r.morph,i=0;i<n.targets.length;i++){var o=n.targets[i],a=Ge[o];if(a.mesh&&a.mesh.primitives&&a.mesh.primitives.length){var s=a.mesh.primitives[0].geometry;s.vertices.length===e.vertices.length&&e.morphTargets.push({name:"target_1",vertices:s.vertices})}}e.morphTargets.push({name:"target_Z",vertices:e.vertices})}function u(e,t,r,n){if(e.world=e.world||new THREE.Matrix4,e.localworld=e.localworld||new THREE.Matrix4,e.world.copy(e.matrix),e.localworld.copy(e.matrix),e.channels&&e.channels.length){var i=e.channels[0],o=i.sampler.output[r];o instanceof THREE.Matrix4&&(e.world.copy(o),e.localworld.copy(o),0===r&&e.matrix.copy(o))}n&&e.world.multiplyMatrices(n,e.world),t.push(e);for(var a=0;a<e.nodes.length;a++)u(e.nodes[a],t,r,e.world)}function d(e,t){for(var r=0;r<e.length;r++){var n=e[r],i=-1;if("JOINT"==n.type){for(var o=0;o<t.joints.length;o++)if(n.sid===t.joints[o]){i=o;break}if(i>=0){var a=t.invBindMatrices[i];n.invBindMatrix=a,n.skinningMatrix=new THREE.Matrix4,n.skinningMatrix.multiplyMatrices(n.world,a),n.animatrix=new THREE.Matrix4,n.animatrix.copy(n.localworld),n.weights=[];for(var o=0;o<t.weights.length;o++)for(var s=0;s<t.weights[o].length;s++){var h=t.weights[o][s];h.joint===i&&n.weights.push(h)}}else console.warn("ColladaLoader: Could not find joint '"+n.sid+"'."),n.skinningMatrix=new THREE.Matrix4,n.weights=[]}}}function p(e){var t=[],r=function(e,t,n){var i={};i.name=t.sid,i.parent=e,i.matrix=t.matrix;var o=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];i.matrix.decompose(o[0],o[1],o[2]),i.pos=[o[0].x,o[0].y,o[0].z],i.scl=[o[2].x,o[2].y,o[2].z],i.rotq=[o[1].x,o[1].y,o[1].z,o[1].w],n.push(i);for(var a in t.nodes)r(t.sid,t.nodes[a],n)};return r(-1,e,t),t}function f(e,t,r){var n=[];u(t,n,-1),d(n,r.skin);for(var i=new THREE.Vector3,o=[],a=0;a<e.vertices.length;a++)o.push(new THREE.Vector3);for(a=0;a<n.length;a++)if("JOINT"==n[a].type)for(var s=0;s<n[a].weights.length;s++){var h=n[a].weights[s],c=h.index,l=h.weight,p=e.vertices[c],f=o[c];i.x=p.x,i.y=p.y,i.z=p.z,i.applyMatrix4(n[a].skinningMatrix),f.x+=i.x*l,f.y+=i.y*l,f.z+=i.z*l}for(var a=0;a<e.vertices.length;a++)e.vertices[a]=o[a]}function m(e,t,r){var n=je[t.url];if(r=void 0!==r?r:40,!n||!n.skin)return void console.log("ColladaLoader: Could not find skin controller.");if(!t.skeleton||!t.skeleton.length)return void console.log("ColladaLoader: Could not find the skeleton for the skin. ");for(var i=c(),o=Ce.getChildById(t.skeleton[0],!0)||Ce.getChildBySid(t.skeleton[0],!0),a=p(o),s=n.skin.joints,h=[],l=0;l<s.length;l++)for(var m=0;m<a.length;m++)a[m].name===s[l]&&(h[l]=a[m]);for(var l=0;l<h.length;l++)for(var m=0;m<h.length;m++)h[l].parent===h[m].name&&(h[l].parent=m);{var l,m,v;new THREE.Vector3}for(l=0;l<e.vertices.length;l++)e.vertices[l].applyMatrix4(n.skin.bindShapeMatrix);for(var g=[],y=[],b=n.skin.weights,l=0;l<b.length;l++){var x=new THREE.Vector4(b[l][0]?b[l][0].joint:0,b[l][1]?b[l][1].joint:0,b[l][2]?b[l][2].joint:0,b[l][3]?b[l][3].joint:0),v=new THREE.Vector4(b[l][0]?b[l][0].weight:0,b[l][1]?b[l][1].weight:0,b[l][2]?b[l][2].weight:0,b[l][3]?b[l][3].weight:0);g.push(x),y.push(v)}e.skinIndices=g,e.skinWeights=y,e.bones=h;for(var w={name:i.ID,fps:30,length:i.frames/30,hierarchy:[]},m=0;m<h.length;m++)w.hierarchy.push({parent:h[m].parent,name:h[m].name,keys:[]});for(console.log("ColladaLoader:",i.ID+" has "+h.length+" bones."),f(e,o,n),r=0;r<i.frames;r++){var M=[];u(o,M,r),d(M,n.skin);for(var l=0;l<M.length;l++)for(var m=0;m<w.hierarchy.length;m++)if(w.hierarchy[m].name===M[l].sid){var _={};_.time=r/30,_.matrix=M[l].animatrix,0===r&&(M[l].matrix=_.matrix);var E=[new THREE.Vector3,new THREE.Quaternion,new THREE.Vector3];_.matrix.decompose(E[0],E[1],E[2]),_.pos=[E[0].x,E[0].y,E[0].z],_.scl=[E[2].x,E[2].y,E[2].z],_.rot=E[1],w.hierarchy[m].keys.push(_)}e.animation=w}}function v(){if(Te&&0===Te.joints.length)return void(ke=void 0);var e={},t=function(t,r){var n=r.getAttribute("id"),i=Ce.getChildById(n,!0),o=Te.joints[t];Fe.traverse(function(r){r.colladaId==n&&(e[t]={node:r,transforms:i.transforms,joint:o,position:o.zeroPosition})})};ke={joints:Te&&Te.joints,getJointValue:function(t){var r=e[t];return r?r.position:void console.log("getJointValue: joint "+t+" doesn't exist")},setJointValue:function(t,r){var i=e[t];if(i){var o=i.joint;if(r>o.limits.max||r<o.limits.min)console.log("setJointValue: joint "+t+" value "+r+" outside of limits (min: "+o.limits.min+", max: "+o.limits.max+")");else if(o["static"])console.log("setJointValue: joint "+t+" is static");else{var a=i.node,s=o.axis,h=i.transforms,c=new THREE.Matrix4;for(n=0;n<h.length;n++){var l=h[n];if(l.sid&&-1!==l.sid.indexOf("joint"+t))switch(o.type){case"revolute":c.multiply(u.makeRotationAxis(s,THREE.Math.degToRad(r)));break;case"prismatic":c.multiply(u.makeTranslation(s.x*r,s.y*r,s.z*r));break;default:console.warn("setJointValue: unknown joint type: "+o.type)}else{var u=new THREE.Matrix4;switch(l.type){case"matrix":c.multiply(l.obj);break;case"translate":c.multiply(u.makeTranslation(l.obj.x,l.obj.y,l.obj.z));break;case"rotate":c.multiply(u.makeRotationAxis(l.obj,l.angle))}}}var d=c.elements,p=Array.prototype.slice.call(d),f=[p[0],p[4],p[8],p[12],p[1],p[5],p[9],p[13],p[2],p[6],p[10],p[14],p[3],p[7],p[11],p[15]];a.matrix.set.apply(a.matrix,f),a.matrix.decompose(a.position,a.quaternion,a.scale)}}else console.log("setJointValue: joint "+t+" doesn't exist")}};var r=Ie.querySelector("scene instance_kinematics_scene");if(r)for(var n=0;n<r.childNodes.length;n++){var i=r.childNodes[n];if(1==i.nodeType)switch(i.nodeName){case"bind_joint_axis":var o=i.getAttribute("target").split("/").pop(),a=i.querySelector("axis param").textContent,s=parseInt(a.split("joint").pop().split(".")[0]),h=Ie.querySelector('[sid="'+o+'"]');if(h){var c=h.parentElement;t(s,c)}}}}function g(e){var t,r,n,i,o=new THREE.Object3D,a=!1;for(n=0;n<e.controllers.length;n++){var s=je[e.controllers[n].url];switch(s.type){case"skin":if(Ge[s.skin.source]){var h=new N;h.url=s.skin.source,h.instance_material=e.controllers[n].instance_material,e.geometries.push(h),a=!0,t=e.controllers[n]}else if(je[s.skin.source]){var c=je[s.skin.source];if(r=c,c.morph&&Ge[c.morph.source]){var h=new N;h.url=c.morph.source,h.instance_material=e.controllers[n].instance_material,e.geometries.push(h)}}break;case"morph":if(Ge[s.morph.source]){var h=new N;h.url=s.morph.source,h.instance_material=e.controllers[n].instance_material,e.geometries.push(h),r=e.controllers[n]}console.log("ColladaLoader: Morph-controller partially supported.")}}var u={};for(n=0;n<e.geometries.length;n++){var d,p=e.geometries[n],f=p.instance_material,v=Ge[p.url],y={},b=[],x=0;if(v){if(!v.mesh||!v.mesh.primitives)continue;if(0===o.name.length&&(o.name=v.id),f)for(i=0;i<f.length;i++){var w=f[i],M=He[w.target],_=M.instance_effect.url,E=We[_].shader,A=E.material;if(v.doubleSided){if(!(w.symbol in u)){var S=A.clone();S.side=THREE.DoubleSide,u[w.symbol]=S}A=u[w.symbol]}A.opacity=A.opacity?A.opacity:1,y[w.symbol]=x,b.push(A),d=A,d.name=null===M.name||""===M.name?M.id:M.name,x++}var C,T=d||new THREE.MeshLambertMaterial({color:14540253,side:v.doubleSided?THREE.DoubleSide:THREE.FrontSide}),L=v.mesh.geometry3js;x>1&&(T=new THREE.MeshFaceMaterial(b)),void 0!==t?(m(L,t),L.morphTargets.length>0?(T.morphTargets=!0,T.skinning=!1):(T.morphTargets=!1,T.skinning=!0),C=new THREE.SkinnedMesh(L,T,!1),C.name="skin_"+Ne.length,Ne.push(C)):void 0!==r?(l(L,r),T.morphTargets=!0,C=new THREE.Mesh(L,T),C.name="morph_"+Oe.length,Oe.push(C)):C=L.isLineStrip===!0?new THREE.Line(L):new THREE.Mesh(L,T),o.add(C)}}for(n=0;n<e.cameras.length;n++){var k=e.cameras[n],R=qe[k.url],P=new THREE.PerspectiveCamera(R.yfov,parseFloat(R.aspect_ratio),parseFloat(R.znear),parseFloat(R.zfar));o.add(P)}for(n=0;n<e.lights.length;n++){var D=null,O=e.lights[n],I=Xe[O.url];if(I&&I.technique){var F,V=I.color.getHex(),B=I.intensity,U=I.distance,z=I.falloff_angle;switch(I.technique){case"directional":D=new THREE.DirectionalLight(V,B,U),D.position.set(0,0,1);break;case"point":D=new THREE.PointLight(V,B,U);break;case"spot":D=new THREE.SpotLight(V,B,U,z,F),D.position.set(0,0,1);break;case"ambient":D=new THREE.AmbientLight(V)}}D&&o.add(D)}if(o.name=e.name||e.id||"",o.colladaId=e.id||"",o.layer=e.layer||"",o.matrix=e.matrix,o.matrix.decompose(o.position,o.quaternion,o.scale),Qe.centerGeometry&&o.geometry){var j=o.geometry.center();j.multiply(o.scale),j.applyQuaternion(o.quaternion),o.position.sub(j)}for(n=0;n<e.nodes.length;n++)o.add(g(e.nodes[n],e));return o}function y(e){for(var t=Ie.querySelectorAll("library_nodes node"),r=0;r<t.length;r++){var n=t[r].attributes.getNamedItem("id");if(n&&n.value===e)return t[r]}return void 0}function b(e){var t=[],r=1e6,n=-1e6;for(var i in ze)for(var o=ze[i],a=0;a<o.channel.length;a++){var s=o.channel[a],h=o.sampler[a],i=s.target.split("/")[0];i==e.id&&(h.create(),s.sampler=h,r=Math.min(r,h.startTime),n=Math.max(n,h.endTime),t.push(s))}return t.length&&(e.startTime=r,e.endTime=n),t}function x(e){if(e.channels&&e.channels.length){for(var t=[],r=[],n=0,i=e.channels.length;i>n;n++){var o,a=e.channels[n],s=a.fullSid,h=a.sampler,c=h.input,l=e.getTransformBySid(a.sid);if(a.arrIndices){o=[];for(var u=0,d=a.arrIndices.length;d>u;u++)o[u]=Ae(a.arrIndices[u])}else o=Se(a.member);if(l){-1===r.indexOf(s)&&r.push(s);for(var u=0,d=c.length;d>u;u++){var p=c[u],f=h.getData(l.type,u,o),m=w(t,p);if(!m){m=new re(p);var v=M(t,p);t.splice(-1===v?t.length:v,0,m)}m.addTarget(s,l,o,f)}}else console.log('Could not find transform "'+a.sid+'" in node '+e.id)}for(var n=0;n<r.length;n++)for(var g=r[n],u=0;u<t.length;u++){var m=t[u];m.hasTarget(g)||_(t,m,u,g)}e.keys=t,e.sids=r}}function w(e,t){for(var r=null,n=0,i=e.length;i>n&&null===r;n++){var o=e[n];if(o.time===t)r=o;else if(o.time>t)break}return r}function M(e,t){for(var r=-1,n=0,i=e.length;i>n&&-1===r;n++){var o=e[n];o.time>=t&&(r=n)}return r}function _(e,t,r,n){var i=A(e,n,r?r-1:0),o=E(e,n,r+1);if(i&&o){var a,s=(t.time-i.time)/(o.time-i.time),h=i.getTarget(n),c=o.getTarget(n).data,l=h.data;if("matrix"===h.type)a=l;else if(l.length){a=[];for(var u=0;u<l.length;++u)a[u]=l[u]+(c[u]-l[u])*s}else a=l+(c-l)*s;t.addTarget(n,h.transform,h.member,a)}}function E(e,t,r){for(;r<e.length;r++){var n=e[r];if(n.hasTarget(t))return n}return null}function A(e,t,r){for(r=r>=0?r:r+e.length;r>=0;r--){var n=e[r];if(n.hasTarget(t))return n}return null}function S(){this.id="",this.init_from=""}function C(){this.id="",this.name="",this.type="",this.skin=null,this.morph=null}function T(){this.method=null,this.source=null,this.targets=null,this.weights=null}function L(){this.source="",this.bindShapeMatrix=null,this.invBindMatrices=[],this.joints=[],this.weights=[]}function k(){this.id="",this.name="",this.nodes=[],this.scene=new THREE.Group}function R(){this.id="",this.name="",this.sid="",this.nodes=[],this.controllers=[],this.transforms=[],this.geometries=[],this.channels=[],this.matrix=new THREE.Matrix4}function P(){this.sid="",this.type="",this.data=[],this.obj=null}function D(){this.url="",this.skeleton=[],this.instance_material=[]}function O(){this.symbol="",this.target=""}function N(){this.url="",this.instance_material=[]}function I(){this.id="",this.mesh=null}function F(e){this.geometry=e.id,this.primitives=[],this.vertices=null,this.geometry3js=null}function V(){this.material="",this.count=0,this.inputs=[],this.vcount=null,this.p=[],this.geometry=new THREE.Geometry}function B(){V.call(this),this.vcount=[]}function U(){V.call(this),this.vcount=1}function z(){V.call(this),this.vcount=3}function j(){this.source="",this.count=0,this.stride=0,this.params=[]}function G(){this.input={}}function H(){this.semantic="",this.offset=0,this.source="",this.set=0}function W(e){this.id=e,this.type=null}function q(){this.id="",this.name="",this.instance_effect=null}function X(){this.color=new THREE.Color,this.color.setRGB(Math.random(),Math.random(),Math.random()),this.color.a=1,this.texture=null,this.texcoord=null,this.texOpts=null}function Y(e,t){this.type=e,this.effect=t,this.material=null}function Q(e){this.effect=e,this.init_from=null,this.format=null}function K(e){this.effect=e,this.source=null,this.wrap_s=null,this.wrap_t=null,this.minfilter=null,this.magfilter=null,this.mipfilter=null}function $(){this.id="",this.name="",this.shader=null,this.surface={},this.sampler={}}function Z(){this.url=""}function J(){this.id="",this.name="",this.source={},this.sampler=[],this.channel=[]}function ee(e){this.animation=e,this.source="",this.target="",this.fullSid=null,this.sid=null,this.dotSyntax=null,this.arrSyntax=null,this.arrIndices=null,this.member=null}function te(e){this.id="",this.animation=e,this.inputs=[],this.input=null,this.output=null,this.strideOut=null,this.interpolation=null,this.startTime=null,this.endTime=null,this.duration=0}function re(e){this.targets=[],this.time=e}function ne(){this.id="",this.name="",this.technique=""}function ie(){this.url=""}function oe(){this.id="",this.name="",this.technique=""}function ae(){this.url=""}function se(){this.id="",this.name="",this.joints=[],this.links=[]}function he(){this.sid="",this.name="",this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this["static"]=!1,this.zeroPosition=0,this.middlePosition=0}function ce(){this.sid="",this.name="",this.transforms=[],this.attachments=[]}function le(){this.joint="",this.transforms=[],this.links=[]}function ue(e){var t=e.getAttribute("id");return void 0!=Be[t]?Be[t]:(Be[t]=new W(t).parse(e),Be[t])}function de(e){for(var t=me(e),r=[],n=0,i=t.length;i>n;n++)r.push("true"===t[n]||"1"===t[n]?!0:!1);return r}function pe(e){for(var t=me(e),r=[],n=0,i=t.length;i>n;n++)r.push(parseFloat(t[n]));return r}function fe(e){for(var t=me(e),r=[],n=0,i=t.length;i>n;n++)r.push(parseInt(t[n],10));return r}function me(e){return e.length>0?ve(e).split(/\s+/):[]}function ve(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function ge(e,t,r){return e.hasAttribute(t)?parseInt(e.getAttribute(t),10):r}function ye(e,t){var r=new THREE.ImageLoader;r.load(t,function(t){e.image=t,e.needsUpdate=!0})}function be(e,t){e.doubleSided=!1;var r=t.querySelectorAll("extra double_sided")[0];r&&r&&1===parseInt(r.textContent,10)&&(e.doubleSided=!0)}function xe(){if(Qe.convertUpAxis!==!0||$e===Qe.upAxis)Ze=null;else switch($e){case"X":Ze="Y"===Qe.upAxis?"XtoY":"XtoZ";break;case"Y":Ze="X"===Qe.upAxis?"YtoX":"YtoZ";break;case"Z":Ze="X"===Qe.upAxis?"ZtoX":"ZtoY"}}function we(e,t){if(Qe.convertUpAxis===!0&&$e!==Qe.upAxis)switch(Ze){case"XtoY":var r=e[0];e[0]=t*e[1],e[1]=r;break;case"XtoZ":var r=e[2];e[2]=e[1],e[1]=e[0],e[0]=r;break;case"YtoX":var r=e[0];e[0]=e[1],e[1]=t*r;break;case"YtoZ":var r=e[1];e[1]=t*e[2],e[2]=r;break;case"ZtoX":var r=e[0];e[0]=e[1],e[1]=e[2],e[2]=r;break;case"ZtoY":var r=e[1];e[1]=e[2],e[2]=t*r}}function Me(e,t){if(Qe.convertUpAxis!==!0||$e===Qe.upAxis)return t;switch(e){case"X":t="XtoY"===Ze?-1*t:t;break;case"Y":t="YtoZ"===Ze||"YtoX"===Ze?-1*t:t;break;case"Z":t="ZtoY"===Ze?-1*t:t}return t}function _e(e,t){var r=[e[t],e[t+1],e[t+2]];return we(r,-1),new THREE.Vector3(r[0],r[1],r[2])}function Ee(e){if(Qe.convertUpAxis){var t=[e[0],e[4],e[8]];we(t,-1),e[0]=t[0],e[4]=t[1],e[8]=t[2],t=[e[1],e[5],e[9]],we(t,-1),e[1]=t[0],e[5]=t[1],e[9]=t[2],t=[e[2],e[6],e[10]],we(t,-1),e[2]=t[0],e[6]=t[1],e[10]=t[2],t=[e[0],e[1],e[2]],we(t,-1),e[0]=t[0],e[1]=t[1],e[2]=t[2],t=[e[4],e[5],e[6]],we(t,-1),e[4]=t[0],e[5]=t[1],e[6]=t[2],t=[e[8],e[9],e[10]],we(t,-1),e[8]=t[0],e[9]=t[1],e[10]=t[2],t=[e[3],e[7],e[11]],we(t,-1),e[3]=t[0],e[7]=t[1],e[11]=t[2]}return(new THREE.Matrix4).set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Ae(e){if(e>-1&&3>e){var t=["X","Y","Z"],r={X:0,Y:1,Z:2};e=Se(t[e]),e=r[e]}return e}function Se(e){if(Qe.convertUpAxis)switch(e){case"X":switch(Ze){case"XtoY":case"XtoZ":case"YtoX":e="Y";break;case"ZtoX":e="Z"}break;case"Y":switch(Ze){case"XtoY":case"YtoX":case"ZtoX":e="X";break;case"XtoZ":case"YtoZ":case"ZtoY":e="Z"}break;case"Z":switch(Ze){case"XtoZ":e="X";break;case"YtoZ":case"ZtoX":case"ZtoY":e="Y"}}return e}var Ce,Te,Le,ke,Re,Pe,De,Oe,Ne,Ie=null,Fe=null,Ve=null,Be={},Ue={},ze={},je={},Ge={},He={},We={},qe={},Xe={},Ye=THREE.SmoothShading,Qe={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y",defaultEnvMap:null},Ke=1,$e="Y",Ze=null;return S.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];"init_from"===r.nodeName&&(this.init_from=r.textContent)}return this},C.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.type="none";for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"skin":this.skin=(new L).parse(r),this.type=r.nodeName;break;case"morph":this.morph=(new T).parse(r),this.type=r.nodeName}}return this},T.prototype.parse=function(e){var t,r={},n=[];for(this.method=e.getAttribute("method"),this.source=e.getAttribute("source").replace(/^#/,""),t=0;t<e.childNodes.length;t++){var i=e.childNodes[t];if(1==i.nodeType)switch(i.nodeName){case"source":var o=(new W).parse(i);r[o.id]=o;break;case"targets":n=this.parseInputs(i);break;default:console.log(i.nodeName)}}for(t=0;t<n.length;t++){var a=n[t],o=r[a.source];switch(a.semantic){case"MORPH_TARGET":this.targets=o.read();break;case"MORPH_WEIGHT":this.weights=o.read()}}return this},T.prototype.parseInputs=function(e){for(var t=[],r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"input":t.push((new H).parse(n))}}return t},L.prototype.parse=function(e){var t,r,n={};this.source=e.getAttribute("source").replace(/^#/,""),this.invBindMatrices=[],this.joints=[],this.weights=[];for(var i=0;i<e.childNodes.length;i++){var o=e.childNodes[i];if(1==o.nodeType)switch(o.nodeName){case"bind_shape_matrix":var a=pe(o.textContent);this.bindShapeMatrix=Ee(a);break;case"source":var s=(new W).parse(o);n[s.id]=s;break;case"joints":t=o;break;case"vertex_weights":r=o;break;default:console.log(o.nodeName)}}return this.parseJoints(t,n),this.parseWeights(r,n),this},L.prototype.parseJoints=function(e,t){for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"input":var i=(new H).parse(n),o=t[i.source];"JOINT"===i.semantic?this.joints=o.read():"INV_BIND_MATRIX"===i.semantic&&(this.invBindMatrices=o.read())}}},L.prototype.parseWeights=function(e,t){for(var r,n,i=[],o=0;o<e.childNodes.length;o++){var a=e.childNodes[o];if(1==a.nodeType)switch(a.nodeName){case"input":i.push((new H).parse(a));break;case"v":r=fe(a.textContent);break;case"vcount":n=fe(a.textContent)}}for(var s=0,o=0;o<n.length;o++){for(var h=n[o],c=[],l=0;h>l;l++){for(var u={},d=0;d<i.length;d++){var p=i[d],f=r[s+p.offset];switch(p.semantic){case"JOINT":u.joint=f;break;case"WEIGHT":u.weight=t[p.source].data[f]}}c.push(u),s+=i.length}for(var l=0;l<c.length;l++)c[l].index=o;this.weights.push(c)}},k.prototype.getChildById=function(e,t){for(var r=0;r<this.nodes.length;r++){var n=this.nodes[r].getChildById(e,t);if(n)return n}return null},k.prototype.getChildBySid=function(e,t){for(var r=0;r<this.nodes.length;r++){var n=this.nodes[r].getChildBySid(e,t);if(n)return n}return null},k.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.nodes=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"node":this.nodes.push((new R).parse(r))}}return this},R.prototype.getChannelForTransform=function(e){for(var t=0;t<this.channels.length;t++){var r,n,i=this.channels[t],o=i.target.split("/"),a=(o.shift(),o.shift()),s=a.indexOf(".")>=0,h=a.indexOf("(")>=0;if(s)o=a.split("."),a=o.shift(),n=o.shift();else if(h){r=a.split("("),a=r.shift();for(var c=0;c<r.length;c++)r[c]=parseInt(r[c].replace(/\)/,""))}if(a===e)return i.info={sid:a,dotSyntax:s,arrSyntax:h,arrIndices:r},i}return null},R.prototype.getChildById=function(e,t){if(this.id===e)return this;if(t)for(var r=0;r<this.nodes.length;r++){var n=this.nodes[r].getChildById(e,t);if(n)return n}return null},R.prototype.getChildBySid=function(e,t){if(this.sid===e)return this;if(t)for(var r=0;r<this.nodes.length;r++){var n=this.nodes[r].getChildBySid(e,t);if(n)return n}return null},R.prototype.getTransformBySid=function(e){for(var t=0;t<this.transforms.length;t++)if(this.transforms[t].sid===e)return this.transforms[t];return null},R.prototype.parse=function(e){var t;this.id=e.getAttribute("id"),this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.type=e.getAttribute("type"),this.layer=e.getAttribute("layer"),this.type="JOINT"===this.type?this.type:"NODE",this.nodes=[],this.transforms=[],this.geometries=[],this.cameras=[],this.lights=[],this.controllers=[],this.matrix=new THREE.Matrix4;for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"node":this.nodes.push((new R).parse(n));break;case"instance_camera":this.cameras.push((new ie).parse(n));break;case"instance_controller":this.controllers.push((new D).parse(n));break;case"instance_geometry":this.geometries.push((new N).parse(n));break;case"instance_light":this.lights.push((new ae).parse(n));break;case"instance_node":t=n.getAttribute("url").replace(/^#/,"");var i=y(t);i&&this.nodes.push((new R).parse(i));break;case"rotate":case"translate":case"scale":case"matrix":case"lookat":case"skew":this.transforms.push((new P).parse(n));break;case"extra":
  break;default:console.log(n.nodeName)}}return this.channels=b(this),x(this),this.updateMatrix(),this},R.prototype.updateMatrix=function(){this.matrix.identity();for(var e=0;e<this.transforms.length;e++)this.transforms[e].apply(this.matrix)},P.prototype.parse=function(e){return this.sid=e.getAttribute("sid"),this.type=e.nodeName,this.data=pe(e.textContent),this.convert(),this},P.prototype.convert=function(){switch(this.type){case"matrix":this.obj=Ee(this.data);break;case"rotate":this.angle=THREE.Math.degToRad(this.data[3]);case"translate":we(this.data,-1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case"scale":we(this.data,1),this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}},P.prototype.apply=function(){var e=new THREE.Matrix4;return function(t){switch(this.type){case"matrix":t.multiply(this.obj);break;case"translate":t.multiply(e.makeTranslation(this.obj.x,this.obj.y,this.obj.z));break;case"rotate":t.multiply(e.makeRotationAxis(this.obj,this.angle));break;case"scale":t.scale(this.obj)}}}(),P.prototype.update=function(e,t){var r=["X","Y","Z","ANGLE"];switch(this.type){case"matrix":if(t)if(1===t.length)switch(t[0]){case 0:this.obj.n11=e[0],this.obj.n21=e[1],this.obj.n31=e[2],this.obj.n41=e[3];break;case 1:this.obj.n12=e[0],this.obj.n22=e[1],this.obj.n32=e[2],this.obj.n42=e[3];break;case 2:this.obj.n13=e[0],this.obj.n23=e[1],this.obj.n33=e[2],this.obj.n43=e[3];break;case 3:this.obj.n14=e[0],this.obj.n24=e[1],this.obj.n34=e[2],this.obj.n44=e[3]}else if(2===t.length){var n="n"+(t[0]+1)+(t[1]+1);this.obj[n]=e}else console.log("Incorrect addressing of matrix in transform.");else this.obj.copy(e);break;case"translate":case"scale":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=r[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2]}break;case"rotate":switch("[object Array]"===Object.prototype.toString.call(t)&&(t=r[t[0]]),t){case"X":this.obj.x=e;break;case"Y":this.obj.y=e;break;case"Z":this.obj.z=e;break;case"ANGLE":this.angle=THREE.Math.degToRad(e);break;default:this.obj.x=e[0],this.obj.y=e[1],this.obj.z=e[2],this.angle=THREE.Math.degToRad(e[3])}}},D.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.skeleton=[],this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1===r.nodeType)switch(r.nodeName){case"skeleton":this.skeleton.push(r.textContent.replace(/^#/,""));break;case"bind_material":for(var n=r.querySelectorAll("instance_material"),i=0;i<n.length;i++){var o=n[i];this.instance_material.push((new O).parse(o))}break;case"extra":}}return this},O.prototype.parse=function(e){return this.symbol=e.getAttribute("symbol"),this.target=e.getAttribute("target").replace(/^#/,""),this},N.prototype.parse=function(e){this.url=e.getAttribute("url").replace(/^#/,""),this.instance_material=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType&&"bind_material"===r.nodeName){for(var n=r.querySelectorAll("instance_material"),i=0;i<n.length;i++){var o=n[i];this.instance_material.push((new O).parse(o))}break}}return this},I.prototype.parse=function(e){this.id=e.getAttribute("id"),be(this,e);for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"mesh":this.mesh=new F(this).parse(r);break;case"extra":}}return this},F.prototype.parse=function(e){this.primitives=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"source":ue(r);break;case"vertices":this.vertices=(new G).parse(r);break;case"linestrips":this.primitives.push((new U).parse(r));break;case"triangles":this.primitives.push((new z).parse(r));break;case"polygons":this.primitives.push((new V).parse(r));break;case"polylist":this.primitives.push((new B).parse(r))}}if(this.geometry3js=new THREE.Geometry,null===this.vertices)return this;for(var n=Be[this.vertices.input.POSITION.source].data,t=0;t<n.length;t+=3)this.geometry3js.vertices.push(_e(n,t).clone());for(var t=0;t<this.primitives.length;t++){var i=this.primitives[t];i.setVertices(this.vertices),this.handlePrimitive(i,this.geometry3js)}return this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals),this},F.prototype.handlePrimitive=function(e,t){if(e instanceof U)return void(t.isLineStrip=!0);var r,n,i,o,a,s,h,c=e.p,l=e.inputs,u=0,d=3,p=0,f=[];for(r=0;r<l.length;r++){i=l[r];var m=i.offset+1;switch(p=m>p?m:p,i.semantic){case"TEXCOORD":f.push(i.set)}}for(var v=0;v<c.length;++v)for(var g=c[v],y=0;y<g.length;){var b=[],x=[],w=null,M=[];for(d=e.vcount?e.vcount.length?e.vcount[u++]:e.vcount:g.length/p,r=0;d>r;r++)for(n=0;n<l.length;n++)switch(i=l[n],s=Be[i.source],o=g[y+r*p+i.offset],h=s.accessor.params.length,a=o*h,i.semantic){case"VERTEX":b.push(o);break;case"NORMAL":x.push(_e(s.data,a));break;case"TEXCOORD":w=w||{},void 0===w[i.set]&&(w[i.set]=[]),w[i.set].push(new THREE.Vector2(s.data[a],s.data[a+1]));break;case"COLOR":M.push((new THREE.Color).setRGB(s.data[a],s.data[a+1],s.data[a+2]))}if(0===x.length)if(i=this.vertices.input.NORMAL){s=Be[i.source],h=s.accessor.params.length;for(var _=0,E=b.length;E>_;_++)x.push(_e(s.data,b[_]*h))}else t.calcNormals=!0;if(!w&&(w={},i=this.vertices.input.TEXCOORD)){f.push(i.set),s=Be[i.source],h=s.accessor.params.length;for(var _=0,E=b.length;E>_;_++)a=b[_]*h,void 0===w[i.set]&&(w[i.set]=[]),w[i.set].push(new THREE.Vector2(s.data[a],1-s.data[a+1]))}if(0===M.length&&(i=this.vertices.input.COLOR)){s=Be[i.source],h=s.accessor.params.length;for(var _=0,E=b.length;E>_;_++)a=b[_]*h,M.push((new THREE.Color).setRGB(s.data[a],s.data[a+1],s.data[a+2]))}var A,S,C=null,T=[];if(3===d)T.push(new THREE.Face3(b[0],b[1],b[2],x,M.length?M:new THREE.Color));else if(4===d)T.push(new THREE.Face3(b[0],b[1],b[3],[x[0].clone(),x[1].clone(),x[3].clone()],M.length?[M[0],M[1],M[3]]:new THREE.Color)),T.push(new THREE.Face3(b[1],b[2],b[3],[x[1].clone(),x[2].clone(),x[3].clone()],M.length?[M[1],M[2],M[3]]:new THREE.Color));else if(d>4&&Qe.subdivideFaces){var L=M.length?M:new THREE.Color;for(n=1;d-1>n;)T.push(new THREE.Face3(b[0],b[n],b[n+1],[x[0].clone(),x[n++].clone(),x[n].clone()],L))}if(T.length)for(var _=0,E=T.length;E>_;_++)for(C=T[_],C.daeMaterial=e.material,t.faces.push(C),n=0;n<f.length;n++)A=w[f[n]],S=d>4?[A[0],A[_+1],A[_+2]]:4===d?0===_?[A[0],A[1],A[3]]:[A[1].clone(),A[2],A[3].clone()]:[A[0],A[1],A[2]],void 0===t.faceVertexUvs[n]&&(t.faceVertexUvs[n]=[]),t.faceVertexUvs[n].push(S);else console.log("dropped face with vcount "+d+" for geometry with id: "+t.id);y+=p*d}},V.prototype.setVertices=function(e){for(var t=0;t<this.inputs.length;t++)this.inputs[t].source===e.id&&(this.inputs[t].source=e.input.POSITION.source)},V.prototype.parse=function(e){this.material=e.getAttribute("material"),this.count=ge(e,"count",0);for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"input":this.inputs.push((new H).parse(e.childNodes[t]));break;case"vcount":this.vcount=fe(r.textContent);break;case"p":this.p.push(fe(r.textContent));break;case"ph":console.warn("polygon holes not yet supported!")}}return this},B.prototype=Object.create(V.prototype),B.prototype.constructor=B,U.prototype=Object.create(V.prototype),U.prototype.constructor=U,z.prototype=Object.create(V.prototype),z.prototype.constructor=z,j.prototype.parse=function(e){this.params=[],this.source=e.getAttribute("source"),this.count=ge(e,"count",0),this.stride=ge(e,"stride",0);for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if("param"===r.nodeName){var n={};n.name=r.getAttribute("name"),n.type=r.getAttribute("type"),this.params.push(n)}}return this},G.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++)if("input"===e.childNodes[t].nodeName){var r=(new H).parse(e.childNodes[t]);this.input[r.semantic]=r}return this},H.prototype.parse=function(e){return this.semantic=e.getAttribute("semantic"),this.source=e.getAttribute("source").replace(/^#/,""),this.set=ge(e,"set",-1),this.offset=ge(e,"offset",0),"TEXCOORD"===this.semantic&&this.set<0&&(this.set=0),this},W.prototype.parse=function(e){this.id=e.getAttribute("id");for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"bool_array":this.data=de(r.textContent),this.type=r.nodeName;break;case"float_array":this.data=pe(r.textContent),this.type=r.nodeName;break;case"int_array":this.data=fe(r.textContent),this.type=r.nodeName;break;case"IDREF_array":case"Name_array":this.data=me(r.textContent),this.type=r.nodeName;break;case"technique_common":for(var n=0;n<r.childNodes.length;n++)if("accessor"===r.childNodes[n].nodeName){this.accessor=(new j).parse(r.childNodes[n]);break}}}return this},W.prototype.read=function(){var e=[],t=this.accessor.params[0];switch(t.type){case"IDREF":case"Name":case"name":case"float":return this.data;case"float4x4":for(var r=0;r<this.data.length;r+=16){var n=this.data.slice(r,r+16),i=Ee(n);e.push(i)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+t.type+".")}return e},q.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++)if("instance_effect"===e.childNodes[t].nodeName){this.instance_effect=(new Z).parse(e.childNodes[t]);break}return this},X.prototype.isColor=function(){return null===this.texture},X.prototype.isTexture=function(){return null!=this.texture},X.prototype.parse=function(e){"transparent"===e.nodeName&&(this.opaque=e.getAttribute("opaque"));for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"color":var n=pe(r.textContent);this.color=new THREE.Color,this.color.setRGB(n[0],n[1],n[2]),this.color.a=n[3];break;case"texture":this.texture=r.getAttribute("texture"),this.texcoord=r.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(r)}}return this},X.prototype.parseTexture=function(e){if(!e.childNodes)return this;e.childNodes[1]&&"extra"===e.childNodes[1].nodeName&&(e=e.childNodes[1],e.childNodes[1]&&"technique"===e.childNodes[1].nodeName&&(e=e.childNodes[1]));for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"offsetU":case"offsetV":case"repeatU":case"repeatV":this.texOpts[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":this.texOpts[r.nodeName]="TRUE"===r.textContent.toUpperCase()?1:parseInt(r.textContent);break;default:this.texOpts[r.nodeName]=r.textContent}}return this},Y.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"transparent":this[r.nodeName]=(new X).parse(r);break;case"bump":var n=r.getAttribute("bumptype");n?"heightfield"===n.toLowerCase()?this.bump=(new X).parse(r):"normalmap"===n.toLowerCase()?this.normal=(new X).parse(r):(console.error("Shader.prototype.parse: Invalid value for attribute 'bumptype' ("+n+") - valid bumptypes are 'HEIGHTFIELD' and 'NORMALMAP' - defaulting to 'HEIGHTFIELD'"),this.bump=(new X).parse(r)):(console.warn("Shader.prototype.parse: Attribute 'bumptype' missing from bump node - defaulting to 'HEIGHTFIELD'"),this.bump=(new X).parse(r));break;case"shininess":case"reflectivity":case"index_of_refraction":case"transparency":var i=r.querySelectorAll("float");i.length>0&&(this[r.nodeName]=parseFloat(i[0].textContent))}}return this.create(),this},Y.prototype.create=function(){var e={},t=!1;if(void 0!==this.transparency&&void 0!==this.transparent){var r=(this.transparent,(this.transparent.color.r+this.transparent.color.g+this.transparent.color.b)/3*this.transparency);r>0&&(t=!0,e.transparent=!0,e.opacity=1-r)}var n={diffuse:"map",ambient:"lightMap",specular:"specularMap",emission:"emissionMap",bump:"bumpMap",normal:"normalMap"};for(var i in this)switch(i){case"ambient":case"emission":case"diffuse":case"specular":case"bump":case"normal":var o=this[i];if(o instanceof X)if(o.isTexture()){var a=o.texture,s=this.effect.sampler[a];if(void 0!==s&&void 0!==s.source){var h=this.effect.surface[s.source];if(void 0!==h){var c=Ue[h.init_from];if(c){var l,u=De+c.init_from,d=THREE.Loader.Handlers.get(u);null!==d?l=d.load(u):(l=new THREE.Texture,ye(l,u)),l.wrapS=o.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.wrapT=o.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,l.offset.x=o.texOpts.offsetU,l.offset.y=o.texOpts.offsetV,l.repeat.x=o.texOpts.repeatU,l.repeat.y=o.texOpts.repeatV,e[n[i]]=l,"emission"===i&&(e.emissive=16777215)}}}}else"diffuse"!==i&&t||("emission"===i?e.emissive=o.color.getHex():e[i]=o.color.getHex());break;case"shininess":e[i]=this[i];break;case"reflectivity":e[i]=this[i],e[i]>0&&(e.envMap=Qe.defaultEnvMap),e.combine=THREE.MixOperation;break;case"index_of_refraction":e.refractionRatio=this[i],1!==this[i]&&(e.envMap=Qe.defaultEnvMap);break;case"transparency":}switch(e.shading=Ye,e.side=this.effect.doubleSided?THREE.DoubleSide:THREE.FrontSide,void 0!==e.diffuse&&(e.color=e.diffuse,delete e.diffuse),this.type){case"constant":void 0!=e.emissive&&(e.color=e.emissive),this.material=new THREE.MeshBasicMaterial(e);break;case"phong":case"blinn":this.material=new THREE.MeshPhongMaterial(e);break;case"lambert":default:this.material=new THREE.MeshLambertMaterial(e)}return this.material},Q.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"init_from":this.init_from=r.textContent;break;case"format":this.format=r.textContent;break;default:console.log("unhandled Surface prop: "+r.nodeName)}}return this},K.prototype.parse=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"source":this.source=r.textContent;break;case"minfilter":this.minfilter=r.textContent;break;case"magfilter":this.magfilter=r.textContent;break;case"mipfilter":this.mipfilter=r.textContent;break;case"wrap_s":this.wrap_s=r.textContent;break;case"wrap_t":this.wrap_t=r.textContent;break;default:console.log("unhandled Sampler2D prop: "+r.nodeName)}}return this},$.prototype.create=function(){return null===this.shader?null:void 0},$.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),be(this,e),this.shader=null;for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(r))}}return this},$.prototype.parseNewparam=function(e){for(var t=e.getAttribute("sid"),r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"surface":this.surface[t]=new Q(this).parse(n);break;case"sampler2D":this.sampler[t]=new K(this).parse(n);break;case"extra":break;default:console.log(n.nodeName)}}},$.prototype.parseProfileCOMMON=function(e){for(var t,r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(1==n.nodeType)switch(n.nodeName){case"profile_COMMON":this.parseProfileCOMMON(n);break;case"technique":t=n;break;case"newparam":this.parseNewparam(n);break;case"image":var i=(new S).parse(n);Ue[i.id]=i;break;case"extra":break;default:console.log(n.nodeName)}}return t},$.prototype.parseTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":this.shader=new Y(r.nodeName,this).parse(r);break;case"extra":this.parseExtra(r)}}},$.prototype.parseExtra=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"technique":this.parseExtraTechnique(r)}}},$.prototype.parseExtraTechnique=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"bump":this.shader.parse(e)}}},Z.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},J.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.source={};for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"animation":var n=(new J).parse(r);for(var i in n.source)this.source[i]=n.source[i];for(var o=0;o<n.channel.length;o++)this.channel.push(n.channel[o]),this.sampler.push(n.sampler[o]);break;case"source":var i=(new W).parse(r);this.source[i.id]=i;break;case"sampler":this.sampler.push(new te(this).parse(r));break;case"channel":this.channel.push(new ee(this).parse(r))}}return this},ee.prototype.parse=function(e){this.source=e.getAttribute("source").replace(/^#/,""),this.target=e.getAttribute("target");var t=this.target.split("/"),r=(t.shift(),t.shift()),n=r.indexOf(".")>=0,i=r.indexOf("(")>=0;if(n)t=r.split("."),this.sid=t.shift(),this.member=t.shift();else if(i){var o=r.split("(");this.sid=o.shift();for(var a=0;a<o.length;a++)o[a]=parseInt(o[a].replace(/\)/,""));this.arrIndices=o}else this.sid=r;return this.fullSid=r,this.dotSyntax=n,this.arrSyntax=i,this},te.prototype.parse=function(e){this.id=e.getAttribute("id"),this.inputs=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"input":this.inputs.push((new H).parse(r))}}return this},te.prototype.create=function(){for(var e=0;e<this.inputs.length;e++){var t=this.inputs[e],r=this.animation.source[t.source];switch(t.semantic){case"INPUT":this.input=r.read();break;case"OUTPUT":this.output=r.read(),this.strideOut=r.accessor.stride;break;case"INTERPOLATION":this.interpolation=r.read();break;case"IN_TANGENT":break;case"OUT_TANGENT":break;default:console.log(t.semantic)}}if(this.startTime=0,this.endTime=0,this.duration=0,this.input.length){this.startTime=1e8,this.endTime=-1e8;for(var e=0;e<this.input.length;e++)this.startTime=Math.min(this.startTime,this.input[e]),this.endTime=Math.max(this.endTime,this.input[e]);this.duration=this.endTime-this.startTime}},te.prototype.getData=function(e,t,r){var n;if("matrix"===e&&16===this.strideOut)n=this.output[t];else if(this.strideOut>1){n=[],t*=this.strideOut;for(var i=0;i<this.strideOut;++i)n[i]=this.output[t+i];if(3===this.strideOut)switch(e){case"rotate":case"translate":we(n,-1);break;case"scale":we(n,1)}else 4===this.strideOut&&"matrix"===e&&we(n,-1)}else n=this.output[t],r&&"translate"===e&&(n=Me(r,n));return n},re.prototype.addTarget=function(e,t,r,n){this.targets.push({sid:e,member:r,transform:t,data:n})},re.prototype.apply=function(e){for(var t=0;t<this.targets.length;++t){var r=this.targets[t];e&&r.sid!==e||r.transform.update(r.data,r.member)}},re.prototype.getTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return this.targets[t];return null},re.prototype.hasTarget=function(e){for(var t=0;t<this.targets.length;++t)if(this.targets[t].sid===e)return!0;return!1},re.prototype.interpolate=function(e,t){for(var r=0,n=this.targets.length;n>r;r++){var i,o=this.targets[r],a=e.getTarget(o.sid);if("matrix"!==o.transform.type&&a){var s=(t-this.time)/(e.time-this.time),h=a.data,c=o.data;if(0>s&&(s=0),s>1&&(s=1),c.length){i=[];for(var l=0;l<c.length;++l)i[l]=c[l]+(h[l]-c[l])*s}else i=c+(h-c)*s}else i=o.data;o.transform.update(i,o.member)}},ne.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"optics":this.parseOptics(r)}}return this},ne.prototype.parseOptics=function(e){for(var t=0;t<e.childNodes.length;t++)if("technique_common"===e.childNodes[t].nodeName)for(var r=e.childNodes[t],n=0;n<r.childNodes.length;n++)if(this.technique=r.childNodes[n].nodeName,"perspective"===this.technique)for(var i=r.childNodes[n],o=0;o<i.childNodes.length;o++){var a=i.childNodes[o];switch(a.nodeName){case"yfov":this.yfov=a.textContent;break;case"xfov":this.xfov=a.textContent;break;case"znear":this.znear=a.textContent;break;case"zfar":this.zfar=a.textContent;break;case"aspect_ratio":this.aspect_ratio=a.textContent}}else if("orthographic"===this.technique)for(var s=r.childNodes[n],o=0;o<s.childNodes.length;o++){var a=s.childNodes[o];switch(a.nodeName){case"xmag":this.xmag=a.textContent;break;case"ymag":this.ymag=a.textContent;break;case"znear":this.znear=a.textContent;break;case"zfar":this.zfar=a.textContent;break;case"aspect_ratio":this.aspect_ratio=a.textContent}}return this},ie.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},oe.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name");for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"technique_common":this.parseCommon(r);break;case"technique":this.parseTechnique(r)}}return this},oe.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++)switch(e.childNodes[t].nodeName){case"directional":case"point":case"spot":case"ambient":this.technique=e.childNodes[t].nodeName;for(var r=e.childNodes[t],n=0;n<r.childNodes.length;n++){var i=r.childNodes[n];switch(i.nodeName){case"color":var o=pe(i.textContent);this.color=new THREE.Color(0),this.color.setRGB(o[0],o[1],o[2]),this.color.a=o[3];break;case"falloff_angle":this.falloff_angle=parseFloat(i.textContent);break;case"quadratic_attenuation":var a=parseFloat(i.textContent);this.distance=a?Math.sqrt(1/a):0}}}return this},oe.prototype.parseTechnique=function(e){this.profile=e.getAttribute("profile");for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];switch(r.nodeName){case"intensity":this.intensity=parseFloat(r.textContent)}}return this},ae.prototype.parse=function(e){return this.url=e.getAttribute("url").replace(/^#/,""),this},se.prototype.parse=function(e){this.id=e.getAttribute("id"),this.name=e.getAttribute("name"),this.joints=[],this.links=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"technique_common":this.parseCommon(r)}}return this},se.prototype.parseCommon=function(e){for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(e.childNodes[t].nodeName){case"joint":this.joints.push((new he).parse(r));break;case"link":this.links.push((new ce).parse(r))}}return this},he.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.axis=new THREE.Vector3,this.limits={min:0,max:0},this.type="",this["static"]=!1,this.zeroPosition=0,this.middlePosition=0;var t=e.querySelector("axis"),r=pe(t.textContent);this.axis=_e(r,0);var n=e.querySelector("limits min")?parseFloat(e.querySelector("limits min").textContent):-360,i=e.querySelector("limits max")?parseFloat(e.querySelector("limits max").textContent):360;this.limits={min:n,max:i};for(var o=["prismatic","revolute"],a=0;a<o.length;a++){var s=o[a],h=e.querySelector(s);h&&(this.type=s)}return this.limits.min>=this.limits.max&&(this["static"]=!0),this.middlePosition=(this.limits.min+this.limits.max)/2,this},ce.prototype.parse=function(e){this.sid=e.getAttribute("sid"),this.name=e.getAttribute("name"),this.transforms=[],this.attachments=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"attachment_full":this.attachments.push((new le).parse(r));break;case"rotate":case"translate":case"matrix":this.transforms.push((new P).parse(r))}}return this},le.prototype.parse=function(e){this.joint=e.getAttribute("joint").split("/").pop(),this.links=[];for(var t=0;t<e.childNodes.length;t++){var r=e.childNodes[t];if(1==r.nodeType)switch(r.nodeName){case"link":this.links.push((new ce).parse(r));break;case"rotate":case"translate":case"matrix":this.transforms.push((new P).parse(r))}}return this},{load:e,parse:t,setPreferredShading:r,applySkin:m,geometries:Ge,options:Qe}}},{}],39:[function(){THREE.OBJLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager,this.materials=null},THREE.OBJLoader.prototype={constructor:THREE.OBJLoader,load:function(e,t,r,n){var i=this,o=new THREE.XHRLoader(i.manager);o.setPath(this.path),o.load(e,function(e){t(i.parse(e))},r,n)},setPath:function(e){this.path=e},setMaterials:function(e){this.materials=e},parse:function(e){function t(e){var t={vertices:[],normals:[],uvs:[]},r={name:"",smooth:!0};c={name:e,geometry:t,material:r},l.push(c)}function r(e){var t=parseInt(e);return 3*(t>=0?t-1:t+d.length/3)}function n(e){var t=parseInt(e);return 3*(t>=0?t-1:t+p.length/3)}function i(e){var t=parseInt(e);return 2*(t>=0?t-1:t+f.length/2)}function o(e,t,r){c.geometry.vertices.push(d[e],d[e+1],d[e+2],d[t],d[t+1],d[t+2],d[r],d[r+1],d[r+2])}function a(e,t,r){c.geometry.normals.push(p[e],p[e+1],p[e+2],p[t],p[t+1],p[t+2],p[r],p[r+1],p[r+2])}function s(e,t,r){c.geometry.uvs.push(f[e],f[e+1],f[t],f[t+1],f[r],f[r+1])}function h(e,t,h,c,l,u,d,p,f,m,v,g){var y,b=r(e),x=r(t),w=r(h);void 0===c?o(b,x,w):(y=r(c),o(b,x,y),o(x,w,y)),void 0!==l&&(b=i(l),x=i(u),w=i(d),void 0===c?s(b,x,w):(y=i(p),s(b,x,y),s(x,w,y))),void 0!==f&&(b=n(f),x=n(m),w=n(v),void 0===c?a(b,x,w):(y=n(g),a(b,x,y),a(x,w,y)))}console.time("OBJLoader");var c,l=[],u=!1,d=[],p=[],f=[];t("");for(var m=/^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,v=/^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,g=/^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/,y=/^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/,b=/^f\s+((-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+))(?:\s+((-?\d+)\/(-?\d+)))?/,x=/^f\s+((-?\d+)\/(-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+)\/(-?\d+))\s+((-?\d+)\/(-?\d+)\/(-?\d+))(?:\s+((-?\d+)\/(-?\d+)\/(-?\d+)))?/,w=/^f\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))\s+((-?\d+)\/\/(-?\d+))(?:\s+((-?\d+)\/\/(-?\d+)))?/,M=/^[og]\s+(.+)/,_=/^s\s+([01]|on|off)/,E=e.split("\n"),A=0;A<E.length;A++){var S=E[A];S=S.trim();var C;if(0!==S.length&&"#"!==S.charAt(0))if(null!==(C=m.exec(S)))d.push(parseFloat(C[1]),parseFloat(C[2]),parseFloat(C[3]));else if(null!==(C=v.exec(S)))p.push(parseFloat(C[1]),parseFloat(C[2]),parseFloat(C[3]));else if(null!==(C=g.exec(S)))f.push(parseFloat(C[1]),parseFloat(C[2]));else if(null!==(C=y.exec(S)))h(C[1],C[2],C[3],C[4]);else if(null!==(C=b.exec(S)))h(C[2],C[5],C[8],C[11],C[3],C[6],C[9],C[12]);else if(null!==(C=x.exec(S)))h(C[2],C[6],C[10],C[14],C[3],C[7],C[11],C[15],C[4],C[8],C[12],C[16]);else if(null!==(C=w.exec(S)))h(C[2],C[5],C[8],C[11],void 0,void 0,void 0,void 0,C[3],C[6],C[9],C[12]);else if(null!==(C=M.exec(S))){var T=C[1].trim();u===!1?(u=!0,c.name=T):t(T)}else/^usemtl /.test(S)?c.material.name=S.substring(7).trim():/^mtllib /.test(S)||null!==(C=_.exec(S))&&(c.material.smooth="1"===C[1]||"on"===C[1])}for(var L=new THREE.Group,A=0,k=l.length;k>A;A++){c=l[A];var R=c.geometry,P=new THREE.BufferGeometry;P.addAttribute("position",new THREE.BufferAttribute(new Float32Array(R.vertices),3)),R.normals.length>0?P.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(R.normals),3)):P.computeVertexNormals(),R.uvs.length>0&&P.addAttribute("uv",new THREE.BufferAttribute(new Float32Array(R.uvs),2));var D;null!==this.materials&&(D=this.materials.create(c.material.name)),D||(D=new THREE.MeshPhongMaterial,D.name=c.material.name),D.shading=c.material.smooth?THREE.SmoothShading:THREE.FlatShading;var O=new THREE.Mesh(P,D);O.name=c.name,L.add(O)}return console.timeEnd("OBJLoader"),L}}},{}],40:[function(e){!function t(r,n,i){function o(s,h){if(!n[s]){if(!r[s]){var c="function"==typeof e&&e;if(!h&&c)return c(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};r[s][0].call(u.exports,function(e){var t=r[s][1][e];return o(t?t:e)},u,u.exports,t,r,n,i)}return n[s].exports}for(var a="function"==typeof e&&e,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,t){function r(){this.hardwareUnitId="webvr-polyfill hardwareUnitId",this.deviceId="webvr-polyfill deviceId",this.deviceName="webvr-polyfill deviceName"}function n(){}function i(){}n.prototype=new r,i.prototype=new r,t.exports.VRDevice=r,t.exports.HMDVRDevice=n,t.exports.PositionSensorVRDevice=i},{}],2:[function(e,t){function r(){this.fov={upDegrees:s,downDegrees:a,leftDegrees:o,rightDegrees:o},this.eyeTranslationLeft={x:i*-.5,y:0,z:0},this.eyeTranslationRight={x:.5*i,y:0,z:0}}var n=e("./base.js").HMDVRDevice,i=.06,o=40,a=40,s=40;r.prototype=new n,r.prototype.getEyeParameters=function(e){var t;if("left"==e)t=this.eyeTranslationLeft;else{if("right"!=e)return console.error("Invalid eye provided: %s",e),null;t=this.eyeTranslationRight}return{recommendedFieldOfView:this.fov,eyeTranslation:t}},t.exports=r},{"./base.js":1}],3:[function(e,t){function r(e){this.kFilter=e,this.currentAccelMeasurement=new n,this.currentGyroMeasurement=new n,this.previousGyroMeasurement=new n,this.filterQ=new i.Quaternion,this.previousFilterQ=new i.Quaternion,this.accelQ=new i.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new i.Vector3,this.measuredGravity=new i.Vector3,this.gyroIntegralQ=new i.Quaternion}var n=e("./sensor-sample.js"),i=e("./three-math.js"),o=e("./util.js"),a=!1;r.prototype.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},r.prototype.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var r=t-this.previousGyroMeasurement.timestampS;o.isTimestampDeltaValid(r)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},r.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var r=new i.Quaternion;r.copy(this.filterQ),r.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(r),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var n=new i.Quaternion;n.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),n.inverse(),a&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",i.Math.radToDeg(o.getQuaternionAngle(n)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new i.Quaternion;s.copy(this.filterQ),s.multiply(n),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},r.prototype.getOrientation=function(){return this.filterQ},r.prototype.accelToQuaternion_=function(e){var t=new i.Vector3;t.copy(e),t.normalize();var r=new i.Quaternion;return r.setFromUnitVectors(new i.Vector3(0,0,-1),t),r.inverse(),r},r.prototype.gyroToQuaternionDelta_=function(e,t){var r=new i.Quaternion,n=new i.Vector3;return n.copy(e),n.normalize(),r.setFromAxisAngle(n,e.length()*t),r},t.exports=r},{"./sensor-sample.js":8,"./three-math.js":9,"./util.js":11}],4:[function(e,t){function r(){this.deviceId="webvr-polyfill:fused",this.deviceName="VR Position Device (webvr-polyfill:fused)",this.accelerometer=new s.Vector3,this.gyroscope=new s.Vector3,window.addEventListener("devicemotion",this.onDeviceMotionChange_.bind(this)),window.addEventListener("orientationchange",this.onScreenOrientationChange_.bind(this)),this.filter=new i(WebVRConfig.K_FILTER||.98),this.posePredictor=new o(WebVRConfig.PREDICTION_TIME_S||.04),this.touchPanner=new a,this.filterToWorldQ=new s.Quaternion,h.isIOS()?this.filterToWorldQ.setFromAxisAngle(new s.Vector3(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new s.Vector3(1,0,0),-Math.PI/2),this.worldToScreenQ=new s.Quaternion,this.setScreenTransform_(),
  this.resetQ=new s.Quaternion,this.isFirefoxAndroid=h.isFirefoxAndroid(),this.isIOS=h.isIOS()}var n=e("./base.js").PositionSensorVRDevice,i=e("./complementary-filter.js"),o=e("./pose-predictor.js"),a=e("./touch-panner.js"),s=e("./three-math.js"),h=e("./util.js");r.prototype=new n,r.prototype.getState=function(){return{hasOrientation:!0,orientation:this.getOrientation(),hasPosition:!1,position:null}},r.prototype.getOrientation=function(){var e=this.filter.getOrientation();this.predictedQ=this.posePredictor.getPrediction(e,this.gyroscope,this.previousTimestampS);var t=new s.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),WebVRConfig.TOUCH_PANNER_DISABLED||t.multiply(this.touchPanner.getOrientation()),t.multiply(this.predictedQ),t.multiply(this.worldToScreenQ),WebVRConfig.YAW_ONLY&&(t.x=0,t.z=0,t.normalize()),t},r.prototype.resetSensor=function(){var e=new s.Euler;e.setFromQuaternion(this.filter.getOrientation());var t=e.y;console.log("resetSensor with yaw: %f",t),this.resetQ.setFromAxisAngle(new s.Vector3(0,0,1),-t),WebVRConfig.TOUCH_PANNER_DISABLED||this.touchPanner.resetSensor()},r.prototype.onDeviceMotionChange_=function(e){var t=e.accelerationIncludingGravity,r=e.rotationRate,n=e.timeStamp/1e3;this.isFirefoxAndroid&&(n/=1e3);var i=n-this.previousTimestampS;return i<=h.MIN_TIMESTEP||i>h.MAX_TIMESTEP?(console.warn("Invalid timestamps detected. Time step between successive gyroscope sensor samples is very small or not monotonic"),void(this.previousTimestampS=n)):(this.accelerometer.set(-t.x,-t.y,-t.z),this.gyroscope.set(r.alpha,r.beta,r.gamma),(this.isIOS||this.isFirefoxAndroid)&&this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,n),this.filter.addGyroMeasurement(this.gyroscope,n),void(this.previousTimestampS=n))},r.prototype.onScreenOrientationChange_=function(){this.setScreenTransform_()},r.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new s.Vector3(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new s.Vector3(0,0,1),Math.PI/2);break;case 180:}},t.exports=r},{"./base.js":1,"./complementary-filter.js":3,"./pose-predictor.js":7,"./three-math.js":9,"./touch-panner.js":10,"./util.js":11}],5:[function(e){var t=e("./webvr-polyfill.js");window.WebVRConfig=window.WebVRConfig||{},new t},{"./webvr-polyfill.js":12}],6:[function(e,t){function r(){this.deviceId="webvr-polyfill:mouse-keyboard",this.deviceName="VR Position Device (webvr-polyfill:mouse-keyboard)",window.addEventListener("keydown",this.onKeyDown_.bind(this)),window.addEventListener("mousemove",this.onMouseMove_.bind(this)),window.addEventListener("mousedown",this.onMouseDown_.bind(this)),window.addEventListener("mouseup",this.onMouseUp_.bind(this)),this.phi=0,this.theta=0,this.targetAngle=null,this.euler=new i.Euler,this.orientation=new i.Quaternion,this.rotateStart=new i.Vector2,this.rotateEnd=new i.Vector2,this.rotateDelta=new i.Vector2}var n=e("./base.js").PositionSensorVRDevice,i=e("./three-math.js"),o=e("./util.js"),a=.15,s=80,h=.5,c=.3;r.prototype=new n,r.prototype.getState=function(){return this.euler.set(this.phi,this.theta,0,"YXZ"),this.orientation.setFromEuler(this.euler),{hasOrientation:!0,orientation:this.orientation,hasPosition:!1,position:null}},r.prototype.onKeyDown_=function(e){38==e.keyCode?this.animatePhi_(this.phi+a):39==e.keyCode?this.animateTheta_(this.theta-a):40==e.keyCode?this.animatePhi_(this.phi-a):37==e.keyCode&&this.animateTheta_(this.theta+a)},r.prototype.animateTheta_=function(e){this.animateKeyTransitions_("theta",e)},r.prototype.animatePhi_=function(e){e=o.clamp(e,-Math.PI/2,Math.PI/2),this.animateKeyTransitions_("phi",e)},r.prototype.animateKeyTransitions_=function(e,t){this.angleAnimation&&clearInterval(this.angleAnimation);var r=this[e],n=new Date;this.angleAnimation=setInterval(function(){var i=new Date-n;if(i>=s)return this[e]=t,void clearInterval(this.angleAnimation);var o=i/s;this[e]=r+(t-r)*o}.bind(this),1e3/60)},r.prototype.onMouseDown_=function(e){this.rotateStart.set(e.clientX,e.clientY),this.isDragging=!0},r.prototype.onMouseMove_=function(e){if(this.isDragging||this.isPointerLocked_()){if(this.isPointerLocked_()){var t=e.movementX||e.mozMovementX||0,r=e.movementY||e.mozMovementY||0;this.rotateEnd.set(this.rotateStart.x-t,this.rotateStart.y-r)}else this.rotateEnd.set(e.clientX,e.clientY);this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd);var n=document.body;this.phi+=2*Math.PI*this.rotateDelta.y/n.clientHeight*c,this.theta+=2*Math.PI*this.rotateDelta.x/n.clientWidth*h,this.phi=o.clamp(this.phi,-Math.PI/2,Math.PI/2)}},r.prototype.onMouseUp_=function(){this.isDragging=!1},r.prototype.isPointerLocked_=function(){var e=document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement;return void 0!==e},r.prototype.resetSensor=function(){console.error("Not implemented yet.")},t.exports=r},{"./base.js":1,"./three-math.js":9,"./util.js":11}],7:[function(e,t){function r(e){this.predictionTimeS=e,this.previousQ=new n.Quaternion,this.previousTimestampS=null,this.deltaQ=new n.Quaternion,this.outQ=new n.Quaternion}var n=e("./three-math.js"),i=!1;r.prototype.getPrediction=function(e,t,r){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=r,e;var o=new n.Vector3;o.copy(t),o.normalize();var a=t.length();if(a<n.Math.degToRad(20))return i&&console.log("Moving slowly, at %s deg/s: no prediction",n.Math.radToDeg(a).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var s=(r-this.previousTimestampS,a*this.predictionTimeS);return this.deltaQ.setFromAxisAngle(o,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.outQ},t.exports=r},{"./three-math.js":9}],8:[function(e,t){function r(e,t){this.set(e,t)}r.prototype.set=function(e,t){this.sample=e,this.timestampS=t},r.prototype.copy=function(e){this.set(e.sample,e.timestampS)},t.exports=r},{}],9:[function(e,t){var r=window.THREE||{};r.Quaternion&&r.Vector3&&r.Vector2&&r.Euler&&r.Math||(console.log("No THREE.js found."),r.Quaternion=function(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1},r.Quaternion.prototype={constructor:r.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this.onChangeCallback(),this},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof r.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=Math.cos(e._x/2),i=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),h=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=a*i*o+n*s*h,this._y=n*s*o-a*i*h,this._z=n*i*h+a*s*o,this._w=n*i*o-a*s*h):"YXZ"===e.order?(this._x=a*i*o+n*s*h,this._y=n*s*o-a*i*h,this._z=n*i*h-a*s*o,this._w=n*i*o+a*s*h):"ZXY"===e.order?(this._x=a*i*o-n*s*h,this._y=n*s*o+a*i*h,this._z=n*i*h+a*s*o,this._w=n*i*o-a*s*h):"ZYX"===e.order?(this._x=a*i*o-n*s*h,this._y=n*s*o+a*i*h,this._z=n*i*h-a*s*o,this._w=n*i*o+a*s*h):"YZX"===e.order?(this._x=a*i*o+n*s*h,this._y=n*s*o+a*i*h,this._z=n*i*h-a*s*o,this._w=n*i*o-a*s*h):"XZY"===e.order&&(this._x=a*i*o-n*s*h,this._y=n*s*o-a*i*h,this._z=n*i*h+a*s*o,this._w=n*i*o+a*s*h),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,n=r[0],i=r[4],o=r[8],a=r[1],s=r[5],h=r[9],c=r[2],l=r[6],u=r[10],d=n+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(l-h)*t,this._y=(o-c)*t,this._z=(a-i)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),this._w=(l-h)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+c)/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(o-c)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(h+l)/t):(t=2*Math.sqrt(1+u-n-s),this._w=(a-i)/t,this._x=(o+c)/t,this._y=(h+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,n=1e-6;return function(i,o){return void 0===e&&(e=new r.Vector3),t=i.dot(o)+1,n>t?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,o),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._w;return this._x=r*c+o*a+n*h-i*s,this._y=n*c+o*s+i*a-r*h,this._z=i*c+o*h+r*s-n*a,this._w=o*c-r*a-n*s-i*h,this.onChangeCallback(),this},multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,o=this._w,a=o*e._w+r*e._x+n*e._y+i*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=n,this._z=i,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);if(Math.abs(h)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(n+this._y),this._z=.5*(i+this._z),this;var c=Math.sin((1-t)*s)/h,l=Math.sin(t*s)/h;return this._w=o*c+this._w*l,this._x=r*c+this._x*l,this._y=n*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new r.Quaternion(this._x,this._y,this._z,this._w)}},r.Quaternion.slerp=function(e,t,r,n){return r.copy(e).slerp(t,n)},r.Vector2=function(e,t){this.x=e||0,this.y=t||0},r.Vector2.prototype={constructor:r.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScalar:function(e){return this.x+=e,this.y+=e,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new r.Vector2,t=new r.Vector2),e.set(n,n),t.set(i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new r.Vector2(this.x,this.y)}},r.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},r.Vector3.prototype={constructor:r.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof r.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new r.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,n){return void 0===e&&(e=new r.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,n)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6]*n,this.y=i[1]*t+i[4]*r+i[7]*n,this.z=i[2]*t+i[5]*r+i[8]*n,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n+i[12],this.y=i[1]*t+i[5]*r+i[9]*n+i[13],this.z=i[2]*t+i[6]*r+i[10]*n+i[14],this},applyProjection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements,o=1/(i[3]*t+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*o,this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*o,this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z,s=e.w,h=s*t+o*n-a*r,c=s*r+a*t-i*n,l=s*n+i*r-o*t,u=-i*t-o*r-a*n;return this.x=h*s+u*-i+c*-a-l*-o,this.y=c*s+u*-o+l*-i-h*-a,this.z=l*s+u*-a+h*-o-c*-i,this},project:function(){var e;return function(t){return void 0===e&&(e=new r.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new r.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n,this.y=i[1]*t+i[5]*r+i[9]*n,this.z=i[2]*t+i[6]*r+i[10]*n,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(n,i){return void 0===e&&(e=new r.Vector3,t=new r.Vector3),e.set(n,n,n),t.set(i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,n=this.y,i=this.z;return this.x=n*e.z-i*e.y,this.y=i*e.x-r*e.z,this.z=r*e.y-n*e.x,this},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=n*s-i*a,this.y=i*o-r*s,this.z=r*a-n*o,this},projectOnVector:function(){var e,t;return function(n){return void 0===e&&(e=new r.Vector3),e.copy(n).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new r.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new r.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(r.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n},setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=n,this},setFromMatrixColumn:function(e,t){var r=4*e,n=t.elements;return this.x=n[r],this.y=n[r+1],this.z=n[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new r.Vector3(this.x,this.y,this.z)}},r.Euler=function(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||r.Euler.DefaultOrder},r.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],r.Euler.DefaultOrder="XYZ",r.Euler.prototype={constructor:r.Euler,_x:0,_y:0,_z:0,_order:r.Euler.DefaultOrder,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this.onChangeCallback(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=r.Math.clamp,o=e.elements,a=o[0],s=o[4],h=o[8],c=o[1],l=o[5],u=o[9],d=o[2],p=o[6],f=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(h,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-d,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-i(d,-1,1)),Math.abs(d)<.99999?(this._x=Math.atan2(p,f),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===t?(this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,n!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,n,i){return void 0===e&&(e=new r.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,i),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new r.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(){return[this._x,this._y,this._z,this._order]},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new r.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new r.Euler(this._x,this._y,this._z,this._order)}},r.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),n=0;return function(){for(var i=0;36>i;i++)8==i||13==i||18==i||23==i?r[i]="-":14==i?r[i]="4":(2>=n&&(n=33554432+16777216*Math.random()|0),e=15&n,n>>=4,r[i]=t[19==i?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return t>e?t:e>r?r:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}}),t.exports=r},{}],10:[function(e,t){function r(){window.addEventListener("touchstart",this.onTouchStart_.bind(this)),window.addEventListener("touchmove",this.onTouchMove_.bind(this)),window.addEventListener("touchend",this.onTouchEnd_.bind(this)),this.isTouching=!1,this.rotateStart=new n.Vector2,this.rotateEnd=new n.Vector2,this.rotateDelta=new n.Vector2,this.theta=0,this.orientation=new n.Quaternion}var n=e("./three-math.js"),i=e("./util.js"),o=.5;r.prototype.getOrientation=function(){return this.orientation.setFromEuler(new n.Euler(0,0,this.theta)),this.orientation},r.prototype.resetSensor=function(){this.theta=0},r.prototype.onTouchStart_=function(e){1==e.touches.length&&(this.rotateStart.set(e.touches[0].pageX,e.touches[0].pageY),this.isTouching=!0)},r.prototype.onTouchMove_=function(e){if(this.isTouching){this.rotateEnd.set(e.touches[0].pageX,e.touches[0].pageY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd),i.isIOS()&&(this.rotateDelta.x*=-1);var t=document.body;this.theta+=2*Math.PI*this.rotateDelta.x/t.clientWidth*o}},r.prototype.onTouchEnd_=function(){this.isTouching=!1},t.exports=r},{"./three-math.js":9,"./util.js":11}],11:[function(e,t){var r=window.Util||{};r.MIN_TIMESTEP=.001,r.MAX_TIMESTEP=1,r.clamp=function(e,t,r){return Math.min(Math.max(t,e),r)},r.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.platform)},r.isFirefoxAndroid=function(){return-1!==navigator.userAgent.indexOf("Firefox")&&-1!==navigator.userAgent.indexOf("Android")},r.isTimestampDeltaValid=function(e){return isNaN(e)?!1:e<=r.MIN_TIMESTEP?!1:e>r.MAX_TIMESTEP?!1:!0},t.exports=r},{}],12:[function(e,t){function r(){this.devices=[],this.isWebVRAvailable()||this.enablePolyfill()}var n=e("./cardboard-hmd-vr-device.js"),i=e("./fusion-position-sensor-vr-device.js"),o=e("./mouse-keyboard-position-sensor-vr-device.js"),a=e("./base.js").HMDVRDevice,s=e("./base.js").PositionSensorVRDevice;r.prototype.isWebVRAvailable=function(){return"getVRDevices"in navigator||"mozGetVRDevices"in navigator},r.prototype.enablePolyfill=function(){this.isCardboardCompatible()&&this.devices.push(new n),this.isMobile()?this.devices.push(new i):WebVRConfig.MOUSE_KEYBOARD_CONTROLS_DISABLED||this.devices.push(new o),navigator.getVRDevices=this.getVRDevices.bind(this),window.HMDVRDevice=a,window.PositionSensorVRDevice=s},r.prototype.getVRDevices=function(){var e=this.devices;return new Promise(function(t,r){try{t(e)}catch(n){r(n)}})},r.prototype.isMobile=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},r.prototype.isCardboardCompatible=function(){return this.isMobile()||WebVRConfig.FORCE_ENABLE_VR},t.exports=r},{"./base.js":1,"./cardboard-hmd-vr-device.js":2,"./fusion-position-sensor-vr-device.js":4,"./mouse-keyboard-position-sensor-vr-device.js":6}]},{},[5])},{}],41:[function(e,t){t.exports={name:"aframe-core",version:"0.1.6",homepage:"https://github.com/aframevr/aframe-core",license:"MIT",main:"src/index.js",dependencies:{debug:"^2.2.0","document-register-element":"^0.5.2","es6-promise":"^3.0.2","object-assign":"^4.0.1",present:"0.0.6","request-interval":"^1.0.0","style-attr":"^1.0.1","three-dev":"^0.74.0-beta8","tween.js":"^15.0.0","webvr-polyfill":"github:borismus/webvr-polyfill#3f47796"},devDependencies:{browserify:"^11.0.1","browserify-css":"^0.8.2",budo:"^7.0.2","chai-shallow-deep-equal":"^1.3.0",exorcist:"^0.4.0","gh-pages":"^0.4.0",husky:"^0.10.1",karma:"^0.13.15","karma-browserify":"^4.4.0","karma-chai-shallow-deep-equal":"0.0.4","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^0.1.6","karma-mocha":"^0.2.0","karma-mocha-reporter":"^1.1.0","karma-sinon-chai":"^1.1.0",mocha:"^2.3.3","mozilla-download":"^1.0.5",replace:"^0.3.0",semistandard:"^7.0.2",snazzy:"^2.0.1",uglifyjs:"^2.4.10"},scripts:{start:"npm run dev",dev:"npm run build && budo src/index.js:build/aframe-core.js --debug --verbose --port 9001 --onupdate 'semistandard -v $(git ls-files \"*.js\") | snazzy' -- ./src/index.js -s 'aframe-core'",browserify:"browserify ./src/index.js -s 'aframe-core'",build:"mkdir -p build/ && npm run browserify -- --debug -o build/aframe-core.js",dist:"rm -rf dist/ && mkdir -p dist/ && npm run dist:js","dist:js":"npm run browserify -s -- --debug | exorcist dist/aframe-core.js.map > dist/aframe-core.js && uglifyjs dist/aframe-core.js -c warnings=false -m -o dist/aframe-core.min.js",preghpages:"npm run dist && rm -rf gh-pages && mkdir -p gh-pages && cp -r {.nojekyll,dist,lib,examples,style,index.html} gh-pages/. && git checkout dist/ && replace 'build/aframe-core.js' 'dist/aframe-core.min.js' gh-pages/ -r --silent",ghpages:"node ./scripts/gh-pages","gh-pages":"npm run ghpages",version:"npm run dist","release:bump":"npm version patch --preminor && git commit -a -C HEAD --amend","release:push":"npm login && npm publish && git push --follow-tags",test:"karma start ./tests/karma.conf.js","test:ci":"TEST_ENV=ci karma start ./tests/karma.conf.js --single-run",lint:"semistandard -v $(git ls-files '*.js') | snazzy",precommit:"npm run lint"},repository:{type:"git",url:"git+https://github.com/aframevr/aframe-core.git"},bugs:{url:"https://github.com/aframevr/aframe-core/issues"},semistandard:{ignore:["dist/**","examples/_js/**","lib/vendor/**","src/shaders/**"]},browserify:{transform:["browserify-css"]
  },"browserify-css":{minify:!0},engines:{node:">= 0.12.7",npm:">= 2.12.1"},gitHead:"b951d8d5de537fa75443587bff979a7fd9427b6b",description:"> `aframe-core` has merged into [aframe dev branch](https://github.com/aframevr/aframe/tree/dev) and all development has moved to the [aframe repo](https://github.com/aframevr/aframe). This repository will be removed later.",_id:"aframe-core@0.1.6",_shasum:"fcb04280ee32b62f276013c9238022ac933f8546",_from:"aframe-core@0.1.6",_npmVersion:"2.11.2",_nodeVersion:"0.12.6",_npmUser:{name:"ngokevin",email:"me@ngokevin.com"},dist:{shasum:"fcb04280ee32b62f276013c9238022ac933f8546",tarball:"http://registry.npmjs.org/aframe-core/-/aframe-core-0.1.6.tgz"},maintainers:[{name:"caseyyee",email:"caseyyee.ca@gmail.com"},{name:"cvan",email:"hearcomestreble@gmail.com"},{name:"dmarcos",email:"diego.marcos@gmail.com"},{name:"mozvr",email:"cvan@mozilla.com"},{name:"ngokevin",email:"me@ngokevin.com"}],_npmOperationalInternal:{host:"packages-13-west.internal.npmjs.com",tmp:"tmp/aframe-core-0.1.6.tgz_1457747622022_0.8922319989651442"},directories:{},_resolved:"https://registry.npmjs.org/aframe-core/-/aframe-core-0.1.6.tgz"}},{}],42:[function(e,t){var r=e("../core/component").registerComponent,n=e("../../lib/three");t.exports.Component=r("camera",{schema:{far:{"default":1e4},fov:{"default":80,min:0},near:{"default":.5,min:0}},init:function(){var e=this.camera=new n.PerspectiveCamera,t=this.el;t.object3D.add(e),t.sceneEl.cameraEl=t},update:function(){var e=this.data,t=this.camera;t.aspect=e.aspect||window.innerWidth/window.innerHeight,t.far=e.far,t.fov=e.fov,t.near=e.near,t.updateProjectionMatrix()}})},{"../../lib/three":30,"../core/component":68}],43:[function(e,t){var r=e("../core/component").registerComponent,n=e("../utils/");t.exports.Component=r("cursor",{schema:{timeout:{"default":1500,min:0},maxDistance:{"default":5,min:0},fuse:{"default":!1}},dependencies:["raycaster"],init:function(){this.raycaster=this.el.components.raycaster,this.schema.fuse["default"]=n.isMobile(),this.attachEventListeners()},attachEventListeners:function(){var e=this.el,t=e.sceneEl.canvas;t.addEventListener("mousedown",this.onMouseDown.bind(this)),t.addEventListener("mouseup",this.onMouseUp.bind(this)),e.addEventListener("intersection",this.onIntersection.bind(this)),e.addEventListener("intersectioncleared",this.onIntersectionCleared.bind(this))},onMouseDown:function(){this.emit("mousedown"),this.mouseDownEl=this.intersectedEl},onMouseUp:function(){this.emit("mouseup"),this.data.fuse||this.intersectedEl&&this.mouseDownEl===this.intersectedEl&&this.emit("click")},emit:function(e){var t=this.intersectedEl;this.el.emit(e),t&&t.emit(e)},emitter:function(e){return function(){this.emit(e)}.bind(this)},onIntersection:function(e){function t(){r.el.removeState("fusing"),r.emit("click")}var r=this,n=this.data,i=e.detail.el,o=e.detail.distance;this.intersectedEl!==i&&(o>=this.data.maxDistance||(this.intersectedEl=i,i.addState("hovered"),i.emit("mouseenter"),this.el.addState("hovering"),0!==n.timeout&&n.fuse&&(this.el.addState("fusing"),this.fuseTimeout=setTimeout(t,n.timeout))))},onIntersectionCleared:function(e){var t=e.detail.el;t&&this.intersectedEl&&(this.intersectedEl=null,t.removeState("hovered"),t.emit("mouseleave"),this.el.removeState("hovering"),this.el.removeState("fusing"),clearTimeout(this.fuseTimeout))}})},{"../core/component":68,"../utils/":73}],44:[function(e,t){function r(e){var t;return t="exponential"===e.type?new i.FogExp2(e.color,e.density):new i.Fog(e.color,e.near,e.far),t.name=e.type,t}var n=e("../core/component").registerComponent,i=e("../../lib/three"),o=e("../utils/debug"),a=o("components:fog:warn");t.exports.Component=n("fog",{schema:{color:{"default":"#000"},density:{"default":25e-5},far:{"default":1e3,min:0},near:{"default":1,min:0},type:{"default":"linear",oneOf:["linear","exponential"]}},update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;return t.isScene?n&&e.type===n.name?void Object.keys(this.schema).forEach(function(t){var r=e[t];"color"===t&&(r=new i.Color(r)),n[t]=r}):(t.object3D.fog=r(e),void t.updateMaterials()):void a("Fog component can only be applied to <a-scene>")},remove:function(){var e=this.el.object3D.fog;e&&(e.density=0,e.far=0,e.near=0)}})},{"../../lib/three":30,"../core/component":68,"../utils/debug":72}],45:[function(e,t){function r(e){switch(e.primitive){case"box":return new a.BoxGeometry(e.width,e.height,e.depth);case"circle":return new a.CircleGeometry(e.radius,e.segments,l(e.thetaStart),l(e.thetaLength));case"cone":return new a.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,l(e.thetaStart),l(e.thetaLength));case"cylinder":return new a.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,l(e.thetaStart),l(e.thetaLength));case"plane":return new a.PlaneBufferGeometry(e.width,e.height);case"ring":return new a.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,l(e.thetaStart),l(e.thetaLength));case"sphere":return new a.SphereGeometry(e.radius,e.segmentsWidth,e.segmentsHeight);case"torus":return new a.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,l(e.arc));case"torusKnot":return new a.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,e.p,e.q,e.scaleHeight);default:return u("Primitive type not supported: "+e.primitive),new a.Geometry}}function n(e,t,r){var n=c.makeTranslation(t.x-r.x,t.y-r.y,t.z-r.z);e.applyMatrix(n),e.verticesNeedsUpdate=!0}var i=e("../utils/debug"),o=e("../core/component").registerComponent,a=e("../../lib/three"),s=e("../utils"),h=1,c=new a.Matrix4,l=a.Math.degToRad,u=i("components:geometry:warn");t.exports.Component=o("geometry",{schema:{arc:{"default":360,"if":{primitive:["torus"]}},depth:{"default":2,min:0,"if":{primitive:["box"]}},height:{"default":2,min:0,"if":{primitive:["box","plane"]}},openEnded:{"default":!1,"if":{primitive:["cylinder"]}},p:{"default":2,"if":{primitive:["torusKnot"]}},translate:{"default":{x:0,y:0,z:0}},primitive:{"default":"",oneOf:["","box","circle","cylinder","plane","ring","sphere","torus","torusKnot"]},q:{"default":3,"if":{primitive:["torusKnot"]}},radius:{"default":h,min:0,"if":{primitive:["circle","cylinder","sphere","torus","torusKnot"]}},radiusBottom:{"default":h,min:0,"if":{primitive:["cylinder"]}},radiusInner:{"default":.8,min:0,"if":{primitive:["ring"]}},radiusOuter:{"default":1.2,min:0,"if":{primitive:["ring"]}},radiusTop:{"default":h,"if":{primitive:["cylinder"]}},radiusTubular:{"default":.2,min:0,"if":{primitive:["torus"]}},scaleHeight:{"default":1,min:0,"if":{primitive:["torusKnot"]}},segments:{"default":8,min:0,"if":{primitive:["circle"]}},segmentsHeight:{"default":18,min:0,"if":{primitive:["cylinder","sphere"]}},segmentsPhi:{"default":8,min:0,"if":{primitive:["ring"]}},segmentsRadial:{"default":36,min:0,"if":{primitive:["cylinder"]}},segmentsTheta:{"default":8,min:0,"if":{primitive:["ring"]}},segmentsTubular:{"default":8,min:0,"if":{primitive:["torus","torusKnot"]}},segmentsWidth:{"default":36,min:0,"if":{primitive:["sphere"]}},thetaLength:{"default":360,min:0,"if":{primitive:["circle","cylinder","ring"]}},thetaStart:{"default":0,"if":{primitive:["circle","cylinder","ring"]}},width:{"default":2,min:0,"if":{primitive:["box","plane"]}}},update:function(e){e=e||{};var t=this.data,i=e.translate||this.schema.translate["default"],o=s.diff(e,t),a=this.el.object3D.geometry,h=!(1===Object.keys(o).length&&"translate"in o),c=!s.deepEqual(t.translate,i);h&&(a=this.el.object3D.geometry=r(this.data,this.schema)),c&&n(a,t.translate,i)},remove:function(){this.el.object3D.geometry=new a.Geometry}})},{"../../lib/three":30,"../core/component":68,"../utils":73,"../utils/debug":72}],46:[function(e){e("../components/camera"),e("../components/cursor"),e("../components/fog"),e("../components/geometry"),e("../components/light"),e("../components/loader"),e("../components/look-at"),e("../components/look-controls"),e("../components/material"),e("../components/position"),e("../components/raycaster"),e("../components/rotation"),e("../components/scale"),e("../components/sound"),e("../components/visible"),e("../components/wasd-controls")},{"../components/camera":42,"../components/cursor":43,"../components/fog":44,"../components/geometry":45,"../components/light":47,"../components/loader":48,"../components/look-at":49,"../components/look-controls":50,"../components/material":51,"../components/position":52,"../components/raycaster":53,"../components/rotation":54,"../components/scale":55,"../components/sound":56,"../components/visible":57,"../components/wasd-controls":58}],47:[function(e,t){function r(e){var t=e.angle,r=new a.Color(e.color).getHex(),n=e.decay,i=e.distance,o=new a.Color(e.groundColor).getHex(),c=e.intensity,l=e.type;switch(l.toLowerCase()){case"ambient":return new a.AmbientLight(r);case"directional":return new a.DirectionalLight(r,c);case"hemisphere":return new a.HemisphereLight(r,o,c);case"point":return new a.PointLight(r,c,i,n);case"spot":return new a.SpotLight(r,c,i,s(t),e.exponent,n);default:h("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",l)}}var n=e("../utils").diff,i=e("../utils/debug"),o=e("../core/component").registerComponent,a=e("../../lib/three"),s=a.Math.degToRad,h=i("components:light:warn");t.exports.Component=o("light",{schema:{angle:{"default":60,"if":{type:["spot"]}},color:{"default":"#FFF"},groundColor:{"default":"#FFF","if":{type:["hemisphere"]}},decay:{"default":1,"if":{type:["point","spot"]}},distance:{"default":0,min:0,"if":{type:["point","spot"]}},exponent:{"default":10,"if":{type:["spot"]}},intensity:{"default":1,min:0,"if":{type:["directional","hemisphere","point","spot"]}},type:{"default":"directional",oneOf:["ambient","directional","hemisphere","point","spot"]}},init:function(){var e=this.el;this.light=null,e.sceneEl.registerLight(e)},update:function(e){var t=this.data,i=n(t,e||{}),o=this.el,s=this.light;if(s){if("type"in i){var h=r(t);return void(h&&(o.object3D.remove(s),o.object3D.add(h),this.light=h))}return void Object.keys(i).forEach(function(e){var r=t[e];-1!==["color","groundColor"].indexOf(e)&&(r=new a.Color(r)),s[e]=r})}this.light=r(t),this.light&&o.object3D.add(this.light)},remove:function(){this.light&&this.el.object3D.remove(this.light)}})},{"../../lib/three":30,"../core/component":68,"../utils":73,"../utils/debug":72}],48:[function(e,t){var r=e("../utils/debug"),n=e("../core/component").registerComponent,i=e("../utils/src-loader").parseUrl,o=e("../../lib/three"),a=r("components:loader:warn");t.exports.Component=n("loader",{dependencies:["material"],schema:{src:{"default":""},format:{"default":"obj",oneOf:["obj","collada"]}},update:function(){var e=this.el,t=this.data,r=this.model,n=i(t.src),o=t.format;if(r&&e.object3D.remove(r),!n)return void a("Model URL not provided");switch(o){case"obj":this.loadObj(n);break;case"collada":this.loadCollada(n);break;default:a("Model format not supported")}},loadObj:function(e){var t=this,r=this.el,n=new o.OBJLoader;n.load(e,function(e){t.model=e,t.applyMaterial(),r.object3D.add(e)})},applyMaterial:function(){var e=this.el.components.material.material;this.model&&this.model.traverse(function(t){t instanceof o.Mesh&&(t.material=e)})},loadCollada:function(e){var t=this,r=this.el,n=new o.ColladaLoader;n.options.convertUpAxis=!0,n.load(e,function(e){t.model=e.scene,r.object3D.add(e.scene)})}})},{"../../lib/three":30,"../core/component":68,"../utils/debug":72,"../utils/src-loader":74}],49:[function(e,t){var r=e("../utils/debug"),n=e("../utils/coordinates"),i=e("../core/component").registerComponent,o=e("../../lib/three"),a=r("components:look-at:warn"),s=n.isCoordinate;t.exports.Component=i("look-at",{init:function(){this.target3D=null,this.vector=new o.Vector3},update:function(){var e,t=this,r=t.data,n=r.position,i=t.el.object3D,s=t.target3D,h=r.targetSelector;return s?i.lookAt(t.vector.setFromMatrixPosition(s.matrixWorld)):h?(e=document.querySelector(h),e?e.object3D?t.beginTracking(e):e.addEventListener("loaded",function(){t.beginTracking(e)}):void a('"'+h+'" does not point to a valid entity to look-at')):n?void i.lookAt(new o.Vector3(n.x,n.y,n.z)):n||h?void 0:t.remove()},remove:function(){this.el.sceneEl.removeBehavior(this)},beginTracking:function(e){this.target3D=e.object3D,this.el.sceneEl.addBehavior(this)},parse:function(e){return e?s(e)?{position:n.parse(e),targetSelector:null}:{position:null,targetSelector:e}:{position:null,targetSelector:null}},stringify:n.componentMixin.stringify})},{"../../lib/three":30,"../core/component":68,"../utils/coordinates":71,"../utils/debug":72}],50:[function(e,t){var r=e("../core/component").registerComponent,n=e("../../lib/three"),i=Math.PI/2;t.exports.Component=r("look-controls",{dependencies:["position","rotation"],schema:{enabled:{"default":!0}},init:function(){var e=this.el.sceneEl;this.setupMouseControls(),this.setupHMDControls(),this.attachEventListeners(),e.addBehavior(this),this.previousPosition=new n.Vector3,this.deltaPosition=new n.Vector3},setupMouseControls:function(){this.canvasEl=document.querySelector("a-scene").canvas,this.mouseDown=!1,this.pitchObject=new n.Object3D,this.yawObject=new n.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},setupHMDControls:function(){this.dolly=new n.Object3D,this.euler=new n.Euler,this.controls=new n.VRControls(this.dolly),this.zeroQuaternion=new n.Quaternion},attachEventListeners:function(){var e=document.querySelector("a-scene").canvas;e.addEventListener("mousedown",this.onMouseDown.bind(this),!0),e.addEventListener("mousemove",this.onMouseMove.bind(this),!0),e.addEventListener("mouseup",this.releaseMouse.bind(this),!0),e.addEventListener("mouseout",this.releaseMouse.bind(this),!0),e.addEventListener("touchstart",this.onTouchStart.bind(this)),e.addEventListener("touchmove",this.onTouchMove.bind(this)),e.addEventListener("touchend",this.onTouchEnd.bind(this))},update:function(){this.data.enabled&&(this.controls.update(),this.updateOrientation(),this.updatePosition())},updateOrientation:function(){var e=new n.Euler;return e.order="YXZ",function(){var t=this.pitchObject,r=this.yawObject,i=this.calculateHMDQuaternion();e.setFromQuaternion(i),this.el.setAttribute("rotation",{x:n.Math.radToDeg(e.x)+n.Math.radToDeg(t.rotation.x),y:n.Math.radToDeg(e.y)+n.Math.radToDeg(r.rotation.y),z:n.Math.radToDeg(e.z)})}}(),calculateHMDQuaternion:function(){var e=new n.Quaternion;return function(){var t=this.dolly;return this.zeroed||t.quaternion.equals(this.zeroQuaternion)||(this.zeroOrientation(),this.zeroed=!0),e.copy(this.zeroQuaternion).multiply(t.quaternion),e}}(),updatePosition:function(){var e=this.el,t=this.calculateDeltaPosition(),r=e.getComputedAttribute("position");e.setAttribute("position",{x:r.x+t.x,y:r.y+t.y,z:r.z+t.z})},calculateDeltaPosition:function(){var e=this.dolly,t=this.deltaPosition,r=this.previousPosition;return t.copy(e.position),t.sub(r),r.copy(e.position),t},updateHMDQuaternion:function(){var e=new n.Quaternion;return function(){var t=this.dolly;return this.controls.update(),this.zeroed||t.quaternion.equals(this.zeroQuaternion)||(this.zeroOrientation(),this.zeroed=!0),e.copy(this.zeroQuaternion).multiply(t.quaternion),e}}(),zeroOrientation:function(){var e=new n.Euler;e.setFromQuaternion(this.dolly.quaternion.clone().inverse()),e.z=0,e.x=0,this.zeroQuaternion.setFromEuler(e)},onMouseMove:function(e){var t=this.pitchObject,r=this.yawObject,n=this.previousMouseEvent;if(this.mouseDown&&this.data.enabled){var o=e.movementX||e.mozMovementX,a=e.movementY||e.mozMovementY;(void 0===o||void 0===a)&&(o=e.screenX-n.screenX,a=e.screenY-n.screenY),this.previousMouseEvent=e,r.rotation.y-=.002*o,t.rotation.x-=.002*a,t.rotation.x=Math.max(-i,Math.min(i,t.rotation.x))}},onMouseDown:function(e){this.mouseDown=!0,this.previousMouseEvent=e},releaseMouse:function(){this.mouseDown=!1},onTouchStart:function(e){1===e.touches.length&&(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,r=this.yawObject;this.touchStarted&&(t=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/this.canvasEl.clientWidth,r.rotation.y-=.5*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1}})},{"../../lib/three":30,"../core/component":68}],51:[function(e,t){function r(e,t,r){function n(t){t instanceof f.Texture||(t=new f.Texture(t));var n;r&&(n=r.split(" "),2===n.length&&(t.wrapS=f.RepeatWrapping,t.wrapT=f.RepeatWrapping,t.repeat.set(parseInt(n[0],10),parseInt(n[1],10)))),e.map=t,t.needsUpdate=!0,e.needsUpdate=!0}var i="string"!=typeof t,o=n,a=function(){},s=function(e){v('The URL "$s" could not be fetched (Error code: %s; Response: %s)',e.status,e.statusText)};i?n(t):g.load(t,o,a,s)}function n(e,t,r,n){function i(){b('The URL "$s" is not a valid image or video',t)}var o=e.videoEl||document.createElement("video");return o.width=r,o.height=n,o!==this.videoEl&&(o.autoplay=!0,o.loop=!0,o.crossOrigin=!0,o.addEventListener("error",i,!0),e.videoEl=o),o.src=t,o}function i(e,t,r,i){var a="string"!=typeof t?o(t):n(e,t,r,i),s=new f.VideoTexture(a);s.minFilter=f.LinearFilter,s.needsUpdate=!0,e.map=s,e.needsUpdate=!0}function o(e){return e.autoplay="false"!==e.getAttribute("autoplay"),e.controls="false"!==e.getAttribute("controls"),"false"===e.getAttribute("preload")&&(e.preload="none"),e}function a(e){var t={color:e.color,side:e.side,opacity:e.opacity,transparent:e.transparent!==!1||e.opacity<1};return h(e)===w&&(t.metalness=e.metalness,t.reflectivity=e.reflectivity,t.roughness=e.roughness),s(t)}function s(e){return"color"in e&&(e.color=new f.Color(e.color)),"opacity"in e&&e.opacity<1&&(e.transparent=!0),"side"in e&&(e.side=c(e.side)),e}function h(e){return"flat"===e.shader?x:w}function c(e){switch(e){case"back":return f.BackSide;case"double":return f.DoubleSide;default:return f.FrontSide}}var l=e("../utils/debug"),u=e("../utils").diff,d=e("../core/component").registerComponent,p=e("../utils/src-loader"),f=e("../../lib/three"),m=new f.CubeTextureLoader,v=l("components:material:error"),g=new f.TextureLoader,y={},b=l("components:material:warn"),x="MeshBasicMaterial",w="MeshStandardMaterial";t.exports.Component=d("material",{schema:{color:{"default":"#FFF"},envMap:{"default":""},fog:{"default":!0},height:{"default":360},metalness:{"default":0,min:0,max:1,"if":{shader:["standard"]}},opacity:{"default":1,min:0,max:1},reflectivity:{"default":1,min:0,max:1,"if":{shader:["standard"]}},repeat:{"default":""},roughness:{"default":.5,min:0,max:1,"if":{shader:["standard"]}},shader:{"default":"standard",oneOf:["flat","standard"]},side:{"default":"front",oneOf:["front","back","double"]},src:{"default":""},transparent:{"default":!1},width:{"default":640}},init:function(){this.isLoadingEnvMap=!1,this.material=null,this.textureSrc=null},update:function(e){var t,r=this.data,n=h(r),i=r.src;t=e&&h(e)===n?this.updateMaterial(s(u(e,r))):this.createMaterial(a(r),n),t.type===w&&this.updateEnvMap(),this.updateTexture(i)},remove:function(){var e=this.el,t=this.schema.color["default"],r=new f.MeshBasicMaterial({color:t}),n=e.object3D;n&&(n.material=r),e.sceneEl.unregisterMaterial(this.material)},createMaterial:function(e,t){var r,n=this.el.sceneEl;return this.material&&n.unregisterMaterial(this.material),r=this.material=this.el.object3D.material=new f[t](e),n.registerMaterial(r),r},updateMaterial:function(e){var t=this.material;return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},updateEnvMap:function(){var e=this,t=this.material,r=this.data.envMap;return!r||this.isLoadingEnvMap?(t.envMap=null,void(t.needsUpdate=!0)):(this.isLoadingEnvMap=!0,void(y[r]?y[r].then(function(r){e.isLoadingEnvMap=!1,t.envMap=r,t.needsUpdate=!0}):y[r]=new Promise(function(n){p.validateCubemapSrc(r,function(r){m.load(r,function(r){e.isLoadingEnvMap=!1,t.envMap=r,n(r)})})})))},updateTexture:function(e){function t(e){r(a,e,o.repeat)}function n(e){i(a,e,o.width,o.height)}var o=this.data,a=this.material;e?e!==this.textureSrc&&(this.textureSrc=e,p.validateSrc(e,t,n)):(a.map=null,a.needsUpdate=!0)}})},{"../../lib/three":30,"../core/component":68,"../utils":73,"../utils/debug":72,"../utils/src-loader":74}],52:[function(e,t){var r=e("../utils/coordinates").componentMixin,n=e("../core/component").registerComponent,i=e("../utils/");t.exports.Component=n("position",i.extend({schema:{x:{"default":0},y:{"default":0},z:{"default":0}},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)}},r))},{"../core/component":68,"../utils/":73,"../utils/coordinates":71}],53:[function(e,t){var r=e("../core/component").registerComponent,n=e("request-interval"),i=e("../../lib/three");t.exports.Component=r("raycaster",{init:function(){this.raycaster=new i.Raycaster,this.intersectedEl=null,this.pollForHoverIntersections()},remove:function(){n.clear(this.pollInterval)},pollForHoverIntersections:function(){this.pollInterval=n(100,this.getIntersections.bind(this))},getIntersections:function(){var e=this.getClosestIntersected();return e?void this.handleIntersection(e):void(this.intersectedEl&&this.clearExistingIntersection())},intersect:function(e){var t=this.el,r=this.raycaster,n=t.object3D,o=t.parentNode.object3D,a=(new i.Vector3).setFromMatrixPosition(o.matrixWorld),s=(new i.Vector3).setFromMatrixPosition(n.matrixWorld),h=s.sub(a).normalize();return r.set(a,h),r.intersectObjects(e,!0)},getClosestIntersected:function(){for(var e,t=this.el.sceneEl.object3D,r=this.el,n=this.intersect(t.children),i=0;i<n.length;++i)if(e=n[i],void 0!==e.object.el&&e.object.el!==r&&e.object.visible)return e;return null},setExistingIntersection:function(e,t){this.intersectedEl=e,this.el.emit("intersection",{el:e,distance:t})},clearExistingIntersection:function(){var e=this.intersectedEl;this.el.emit("intersectioncleared",{el:e}),this.intersectedEl=null},handleIntersection:function(e){var t=e.object.el;this.intersectedEl!==t&&this.clearExistingIntersection(),this.setExistingIntersection(t,e.distance)}})},{"../../lib/three":30,"../core/component":68,"request-interval":86}],54:[function(e,t){var r=e("../utils/coordinates").componentMixin,n=e("../core/component").registerComponent,i=e("../../lib/three"),o=e("../utils/");t.exports.Component=n("rotation",o.extend({schema:{x:{"default":0},y:{"default":0},z:{"default":0}},update:function(){var e=this.data,t=this.el.object3D;t.rotation.set(i.Math.degToRad(e.x),i.Math.degToRad(e.y),i.Math.degToRad(e.z)),t.rotation.order="YXZ"}},r))},{"../../lib/three":30,"../core/component":68,"../utils/":73,"../utils/coordinates":71}],55:[function(e,t){var r=e("../utils/coordinates").componentMixin,n=e("../core/component").registerComponent,i=e("../utils/"),o=1e-5;t.exports.Component=n("scale",i.extend({schema:{x:{"default":1},y:{"default":1},z:{"default":1}},update:function(){var e=this.data,t=this.el.object3D,r=0===e.x?o:e.x,n=0===e.y?o:e.y,i=0===e.z?o:e.z;t.scale.set(r,n,i)}},r))},{"../core/component":68,"../utils/":73,"../utils/coordinates":71}],56:[function(e,t){var r=e("../utils/debug"),n=e("../utils").diff,i=e("../core/component").registerComponent,o=e("../../lib/three"),a=r("components:sound:warn");t.exports.Component=i("sound",{schema:{src:{"default":""},on:{"default":"click"},autoplay:{"default":!1},loop:{"default":!1},volume:{"default":1}},init:function(){this.listener=null,this.sound=null},update:function(e){var t=this.data,r=n(e||{},t),i=this.el,o=this.sound,s=t.src,h="src"in r;if(h){if(!s)return void a("Audio source was not specified with `src`");o=this.setupSound()}(h||"autoplay"in r)&&(o.autoplay=t.autoplay),(h||"loop"in r)&&o.setLoop(t.loop),(h||"volume"in r)&&o.setVolume(t.volume),"on"in r&&(e&&e.on&&i.removeEventListener(e.on),i.addEventListener(t.on,this.play.bind(this))),h&&o.load(s)},remove:function(){this.el.object3D.remove(this.sound)},setupSound:function(){var e,t=this.el,r=this.sound;return r&&(this.stop(),t.object3D.remove(r)),e=this.listener=new o.AudioListener,r=this.sound=new o.Audio(e),t.object3D.add(r),r},play:function(){this.sound.play()},stop:function(){this.sound.stop()},pause:function(){this.sound.pause()}})},{"../../lib/three":30,"../core/component":68,"../utils":73,"../utils/debug":72}],57:[function(e,t){var r=e("../core/component").registerComponent;t.exports.Component=r("visible",{schema:{"default":!0},update:function(){this.el.object3D.visible=this.data},parse:function(e){return"false"!==e},stringify:function(e){return e.toString()}})},{"../core/component":68}],58:[function(e,t){var r=e("../core/component").registerComponent,n=e("../../lib/three"),i=.2;t.exports.Component=r("wasd-controls",{schema:{easing:{"default":20},acceleration:{"default":65},enabled:{"default":!0},fly:{"default":!1},wsAxis:{"default":"z",oneOf:["x","y","z"]},adAxis:{"default":"x",oneOf:["x","y","z"]},wsInverted:{"default":!1},wsEnabled:{"default":!0},adInverted:{"default":!1},adEnabled:{"default":!0}},init:function(){this.setupControls()},setupControls:function(){var e=this.el.sceneEl;this.prevTime=Date.now(),this.keys={},this.velocity=new n.Vector3,this.attachEventListeners(),e.addBehavior(this)},update:function(e){var t,r=this.data,n=r.acceleration,o=r.easing,a=this.velocity,s=window.performance.now(),h=(s-this.prevTime)/1e3,c=this.keys,l=r.adAxis,u=r.wsAxis,d=r.adInverted?-1:1,p=r.wsInverted?-1:1,f=this.el;if(this.prevTime=s,e||h>i)return a[l]=0,void(a[u]=0);a[l]-=a[l]*o*h,a[u]-=a[u]*o*h;var m=f.getComputedAttribute("position");r.enabled&&(r.adEnabled&&(c[65]&&(a[l]-=d*n*h),c[68]&&(a[l]+=d*n*h)),r.wsEnabled&&(c[87]&&(a[u]-=p*n*h),c[83]&&(a[u]+=p*n*h))),t=this.getMovementVector(h),f.object3D.translateX(t.x),f.object3D.translateY(t.y),f.object3D.translateZ(t.z),f.setAttribute("position",{x:m.x+t.x,y:m.y+t.y,z:m.z+t.z})},attachEventListeners:function(){window.addEventListener("keydown",this.onKeyDown.bind(this),!1),window.addEventListener("keyup",this.onKeyUp.bind(this),!1)},onKeyDown:function(e){this.keys[e.keyCode]=!0},onKeyUp:function(e){this.keys[e.keyCode]=!1},getMovementVector:function(){var e=new n.Vector3(0,0,0),t=new n.Euler(0,0,0,"YXZ");return function(r){var i=this.velocity,o=this.el.getAttribute("rotation");return e.copy(i),e.multiplyScalar(r),o?(this.data.fly||(o.x=0),t.set(n.Math.degToRad(o.x),n.Math.degToRad(o.y),0),e.applyEuler(t),e):e}}()})},{"../../lib/three":30,"../core/component":68}],59:[function(e,t){var r=e("tween.js"),n={alternate:"alternate",alternateReverse:"alternate-reverse",normal:"normal",reverse:"reverse"},i={linear:r.Easing.Linear.None,ease:r.Easing.Cubic.InOut,"ease-in":r.Easing.Cubic.In,"ease-out":r.Easing.Cubic.Out,"ease-in-out":r.Easing.Cubic.InOut,"ease-cubic":r.Easing.Cubic.In,"ease-in-cubic":r.Easing.Cubic.In,"ease-out-cubic":r.Easing.Cubic.Out,"ease-in-out-cubic":r.Easing.Cubic.InOut,"ease-quad":r.Easing.Quadratic.InOut,"ease-in-quad":r.Easing.Quadratic.In,"ease-out-quad":r.Easing.Quadratic.Out,"ease-in-out-quad":r.Easing.Quadratic.InOut,"ease-quart":r.Easing.Quartic.InOut,"ease-in-quart":r.Easing.Quartic.In,"ease-out-quart":r.Easing.Quartic.Out,"ease-in-out-quart":r.Easing.Quartic.InOut,"ease-quint":r.Easing.Quintic.InOut,"ease-in-quint":r.Easing.Quintic.In,"ease-out-quint":r.Easing.Quintic.Out,"ease-in-out-quint":r.Easing.Quintic.InOut,"ease-sine":r.Easing.Sinusoidal.InOut,"ease-in-sine":r.Easing.Sinusoidal.In,"ease-out-sine":r.Easing.Sinusoidal.Out,"ease-in-out-sine":r.Easing.Sinusoidal.InOut,"ease-expo":r.Easing.Exponential.InOut,"ease-in-expo":r.Easing.Exponential.In,"ease-out-expo":r.Easing.Exponential.Out,"ease-in-out-expo":r.Easing.Exponential.InOut,"ease-circ":r.Easing.Circular.InOut,"ease-in-circ":r.Easing.Circular.In,"ease-out-circ":r.Easing.Circular.Out,"ease-in-out-circ":r.Easing.Circular.InOut,"ease-elastic":r.Easing.Elastic.InOut,"ease-in-elastic":r.Easing.Elastic.In,"ease-out-elastic":r.Easing.Elastic.Out,"ease-in-out-elastic":r.Easing.Elastic.InOut,"ease-back":r.Easing.Back.InOut,"ease-in-back":r.Easing.Back.In,"ease-out-back":r.Easing.Back.Out,"ease-in-out-back":r.Easing.Back.InOut,"ease-bounce":r.Easing.Bounce.InOut,"ease-in-bounce":r.Easing.Bounce.In,"ease-out-bounce":r.Easing.Bounce.Out,"ease-in-out-bounce":r.Easing.Bounce.InOut},o={backwards:"backwards",both:"both",forwards:"forwards",none:"none"},a={indefinite:"indefinite"},s={attribute:"rotation",begin:"0",dur:1e3,easing:"ease",direction:n.normal,fill:o.forwards,from:void 0,repeat:0,to:void 0};t.exports.defaults=s,t.exports.directions=n,t.exports.easingFunctions=i,t.exports.fills=o,t.exports.repeats=a},{"tween.js":90}],60:[function(e,t){function r(e){return d.extend({},e)}function n(e,t,r,n,a){function h(){v=b[0],m=b[1],f=e.components[v],f||(e.setAttribute(v,""),f=e.components[v]),p=f.schema,x[t]=void 0===r?e.getComputedAttribute(v)[m]:r,x[t]=s(x[t],p,m),w[t]=s(n,p,m),g=function(r){e.setAttribute(v,m,r[t])}}function l(){x=r?c.parse(r):a,w=c.parse(n),g=function(r){e.setAttribute(t,r)}}function u(){x[t]=void 0===r?!1:i(r),x[t]=o(x[t]),w[t]=o(i(n)),g=function(r){e.setAttribute(t,!!r[t])}}function d(){x[t]=parseFloat(void 0===r?e.getAttribute(t):r),w[t]=parseFloat(n),g=function(r){e.setAttribute(t,r[t])}}var p,f,m,v,g,b=t.split("."),x={},w={};return 2===b.length?h():n&&y(n)?l():-1!==["true","false"].indexOf(n)?u():d(),{from:x,partialSetAttribute:g,to:w}}function i(e){return"true"===e?!0:!1}function o(e){return e?1:0}var a=e("./a-node"),s=e("../utils/").coerce,h=e("../constants/animation"),c=e("../utils/").coordinates,l=e("./a-register-element").registerElement,u=e("tween.js"),d=e("../utils/"),p=h.defaults,f=h.directions,m=h.easingFunctions,v=h.fills,g=h.repeats,y=c.isCoordinate;t.exports.AAnimation=l("a-animation",{prototype:Object.create(a.prototype,{createdCallback:{value:function(){this.isRunning=!1,this.partialSetAttribute=function(){},this.tween=null}},attachedCallback:{value:function(){function e(){t.bindMethods(),t.applyMixin(),t.update(),t.load()}var t=this,r=t.el=t.parentNode;r.isNode?e():r.addEventListener("nodeready",e.bind(t))}},attributeChangedCallback:{value:function(){this.hasLoaded&&this.isRunning&&(this.stop(),this.applyMixin(),this.update())}},getTween:{value:function(){var e,t,i,o,a=this,s=a.data,h=a.el,c=s.attribute,l=parseInt(s.begin,10),d=h.getComputedAttribute(c),p=a.getDirection(s.direction),y=m[s.easing],b=s.fill,x=s.repeat===g.indefinite?1/0:0,w=!1;return e=n(h,c,s.from,s.to,d),t=e.from,i=e.to,a.partialSetAttribute=e.partialSetAttribute,void 0===a.count&&(a.count=x===1/0?0:parseInt(s.repeat,10)),isNaN(l)&&(l=0),a.initialValue=r(d),x===1/0&&b===v.forwards&&-1!==[f.alternate,f.alternateReverse].indexOf(s.direction)&&(w=!0),p===f.reverse&&(o=i,i=r(t),t=r(o)),-1!==[v.backwards,v.both].indexOf(b)&&a.partialSetAttribute(t),new u.Tween(r(t)).to(i,s.dur).delay(l).easing(y).repeat(x).yoyo(w).onUpdate(function(){a.partialSetAttribute(this)}).onComplete(a.onCompleted.bind(a))}},update:{value:function(){var e=this.data,t=e.begin;this.removeEventListeners(this.evt),this.addEventListeners(t),this.evt=t,isNaN(t)||(this.stop(),this.start())},writable:window.debug},onCompleted:{value:function(){var e=this.data;return this.isRunning=!1,-1!==[v.backwards,v.none].indexOf(e.fill)&&this.partialSetAttribute(this.initialValue),0===this.count?(this.count=void 0,void this.emit("animationend")):(this.isRunning=!1,this.count--,void this.start())}},start:{value:function(){this.isRunning||(this.tween=this.getTween(),this.isRunning=!0,this.tween.start(),this.emit("animationstart"))},writable:!0},stop:{value:function(){var e=this.tween;e&&(e.stop(),this.isRunning=!1,this.partialSetAttribute(this.initialValue))},writable:!0},getDirection:{value:function(e){return e===f.alternate?(this.prevDirection=this.prevDirection===f.normal?f.reverse:f.normal,this.prevDirection):e===f.alternateReverse?(this.prevDirection=this.prevDirection===f.reverse?f.normal:f.reverse,this.prevDirection):e}},bindMethods:{value:function(){this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.onStateAdded=this.onStateAdded.bind(this),
  this.onStateRemoved=this.onStateRemoved.bind(this)}},addEventListeners:{value:function(e){var t=this.el,r=this.start.bind(this);d.splitString(e).forEach(function(e){t.addEventListener(e,r)}),t.addEventListener("stateadded",this.onStateAdded),t.addEventListener("stateremoved",this.onStateRemoved)}},removeEventListeners:{value:function(e){var t=this.el,r=this.start;d.splitString(e).forEach(function(e){t.removeEventListener(e,r)}),t.removeEventListener("stateadded",this.onStateAdded),t.removeEventListener("stateremoved",this.onStateRemoved)}},onStateAdded:{value:function(e){e.detail.state===this.data.begin&&this.start()},writable:!0},onStateRemoved:{value:function(e){e.detail.state===this.data.begin&&this.stop()},writable:!0},applyMixin:{value:function(){var e,t,r,n={};r=document.querySelector("#"+this.getAttribute("mixin")),t=r?d.getElData(r,p):{},e=d.getElData(this,p),d.extend(n,p,t,e),this.data=n}}})}),t.exports.getAnimationValues=n},{"../constants/animation":59,"../utils/":73,"./a-node":65,"./a-register-element":66,"tween.js":90}],61:[function(e,t){var r=e("./a-register-element"),n=e("../utils/"),i=r.isNode,o=r.registerElement;t.exports=o("a-assets",{prototype:Object.create(HTMLElement.prototype,{attachedCallback:{value:function(){this.attachEventListeners()}},attachEventListeners:{value:function(){function e(e){i(e)&&(e.hasLoaded||(t(e),r.assetsPending++))}function t(e){e.addEventListener("loaded",n)}var r=this,n=this.assetLoaded.bind(this);this.assetsPending=0;var o=this.querySelectorAll("*");Array.prototype.slice.call(o).forEach(e),this.assetsPending||n()}},assetLoaded:{value:function(){this.assetsPending--,this.assetsPending<=0&&this.load()}},load:{value:function(){if(!this.hasLoaded){this.hasLoaded=!0;var e={bubbles:!1,detail:{}};n.fireEvent(this,"loaded",e)}}}})})},{"../utils/":73,"./a-register-element":66}],62:[function(e,t){var r=e("../utils/debug"),n=e("./a-register-element").registerElement,i=r("core:cubemap:warn");t.exports=n("a-cubemap",{prototype:Object.create(HTMLElement.prototype,{attachedCallback:{value:function(){this.srcs=this.validate()},writable:window.debug},validate:{value:function(){var e,t=this.querySelectorAll("[src]"),r=[];if(6===t.length){for(e=0;e<t.length;e++)r.push(t[e].getAttribute("src"));return r}i("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")},writable:window.debug}})})},{"../utils/debug":72,"./a-register-element":66}],63:[function(e,t){var r=e("./a-node"),n=e("./component").components,i=e("../utils/debug"),o=e("./a-register-element"),a=e("../../lib/three"),s=o.isNode,h=i("core:a-entity"),c=i("core:a-entity:error"),l=o.registerElement,u={defaults:{value:{position:"",rotation:"",scale:"",visible:""}},createdCallback:{value:function(){this.states=[],this.components={},this.object3D=new a.Mesh}},attributeChangedCallback:{value:function(e,t,r){this.setEntityAttribute(e,t,r)}},attachedCallback:{value:function(){this.addToParent(),this.load()}},detachedCallback:{value:function(){this.parentEl&&!this.isScene&&(this.removeComponents(),this.parentEl.remove(this))}},applyMixin:{value:function(e){var t=this.getAttribute(e);return e?void this.updateComponent(e,t):void this.updateComponents()}},mapStateMixins:{value:function(e,t){var r,n=this.getAttribute("mixin");n&&(r=n.split(" "),r.forEach(function(r){var n=r+"-"+e;t(n)}),this.updateComponents())}},updateStateMixins:{value:function(e,t){var r=this;t=t||"";var n=e.split(" "),i=t?t.split(" "):[],o=i.filter(function(e){return n.indexOf(e)<0});o.forEach(function(e){var t=Array.prototype.forEach,n=document.querySelectorAll("[id^="+e+"-]"),i=[];t.call(n,function(e){i.push(e.id)}),i.forEach(r.unregisterMixin.bind(r))}),this.states.forEach(function(e){n.forEach(function(t){var n=t+"-"+e;r.registerMixin(n)})})}},add:{value:function(e){e.object3D||c("Trying to add an object3D that doesn't exist"),this.object3D.add(e.object3D)}},addToParent:{value:function(){function e(){t.attachedToParent=!0,r.add&&r.add(t)}var t=this,r=this.parentEl=this.parentNode,n=this.attachedToParent;return r&&!n?s(r)?void e():void r.addEventListener("nodeready",e):void 0}},load:{value:function(){this.hasLoaded||(this.object3D.el=this,this.addToParent(),this.updateComponents(),r.prototype.load.call(this))},writable:window.debug},remove:{value:function(e){this.object3D.remove(e.object3D)}},isComponentDefined:{value:function(e){var t=this.defaults[e],r=this.hasAttribute(e);return void 0!==t||r?!0:this.isComponentMixedIn(e)}},isComponentMixedIn:{value:function(e){var t,r=!1,n=this.mixinEls;for(t=0;t<n.length&&!(r=n[t].hasAttribute(e));++t);return r}},initComponent:{value:function(e,t){var r;n[e]&&!this.components[e]&&(r=this.isComponentDefined(e),(r||t)&&(this.initComponentDependencies(e),t&&!r?this.setAttribute(e,""):this.components[e]=new n[e].Component(this),h("Component initialized: %s",e)))}},initComponentDependencies:{value:function(e){var t,r=this,i=n[e];i&&(t=n[e].dependencies,t&&t.forEach(function(e){r.initComponent(e,!0)}))}},removeComponents:{value:function(){function e(e){t.components[e].remove(),delete t.components[e]}var t=this,r=Object.keys(this.components);r.forEach(e)}},updateComponents:{value:function(){function e(e){var r=t.getAttribute(e);t.updateComponent(e,r)}var t=this,r=Object.keys(n);r.forEach(e)}},updateComponent:{value:function(e,t){var r=this.components[e],n=e in this.defaults,i=this.isComponentMixedIn(e);return r?this.isComponentDefined(e)&&(null!==t||n||i)?("string"==typeof t&&(t=r.parse(t)),void r.updateAttributes(t)):(r.remove(),void delete this.components[e]):void this.initComponent(e)}},removeAttribute:{value:function(e,t){var r=n[e];r&&(t?this.setAttribute(e,t,void 0):this.setEntityAttribute(e,void 0,null)),HTMLElement.prototype.removeAttribute.call(this,e)}},setEntityAttribute:{value:function(e,t,r){var i=n[e];return t=t||this.getAttribute(e),this.hasLoaded?"mixin"===e?(this.updateStateMixins(r,t),void this.updateComponents()):void(i&&this.updateComponent(e,r)):void 0}},setAttribute:{value:function(e,t,i){var o,a=this,s=n[e];t=void 0===t?"":t;var h,c=t;s&&("string"==typeof t&&void 0!==i&&(o=a.getAttribute(e)||{},o[t]=i,t=o),c=s.stringify(t)),h=this.getAttribute(e),r.prototype.setAttribute.call(a,e,c),a.setEntityAttribute(e,h,t)},writable:window.debug},getAttribute:{value:function(e){var t=n[e],r=HTMLElement.prototype.getAttribute.call(this,e);return t&&"string"==typeof r?t.parse(r):r},writable:window.debug},getComputedAttribute:{value:function(e){var t=this.components[e];return t?t.getData():HTMLElement.prototype.getAttribute.call(this,e)}},addState:{value:function(e){this.is(e)||(this.states.push(e),this.mapStateMixins(e,this.registerMixin.bind(this)),this.emit("stateadded",{state:e}))}},removeState:{value:function(e){var t=this.is(e);t!==!1&&(this.states.splice(t,1),this.mapStateMixins(e,this.unregisterMixin.bind(this)),this.emit("stateremoved",{state:e}))}},is:{value:function(e){var t=!1;return this.states.forEach(function(r,n){r===e&&(t=n)}),t}}};t.exports=l("a-entity",{prototype:Object.create(r.prototype,u)})},{"../../lib/three":30,"../utils/debug":72,"./a-node":65,"./a-register-element":66,"./component":68}],64:[function(e,t){var r=e("./component").components,n=e("./a-node"),i=e("./a-register-element").registerElement;t.exports=i("a-mixin",{prototype:Object.create(n.prototype,{attachedCallback:{value:function(){this.load()},writable:window.debug},setAttribute:{value:function(e,t){var n=r[e];n&&"object"==typeof t&&(t=n.stringify(t)),HTMLElement.prototype.setAttribute.call(this,e,t)},writable:window.debug},getAttribute:{value:function(e){var t=r[e],n=HTMLElement.prototype.getAttribute.call(this,e);return t&&"string"==typeof n?t.parse(n):n},writable:window.debug}})})},{"./a-node":65,"./a-register-element":66,"./component":68}],65:[function(e,t){var r=e("./a-register-element").registerElement,n=e("../utils/");t.exports=r("a-node",{prototype:Object.create(HTMLElement.prototype,{createdCallback:{value:function(){this.isNode=!0,this.mixinEls=[],this.mixinObservers={}}},attachedCallback:{value:function(){var e=this.getAttribute("mixin");this.sceneEl=document.querySelector("a-scene"),this.emit("nodeready",{},!1),e&&this.updateMixins(e)}},detachedCallback:{value:function(){}},attributeChangedCallback:{value:function(e,t,r){"mixin"===e&&this.updateMixins(r,t)}},load:{value:function(){this.hasLoaded||(this.hasLoaded=!0,this.emit("loaded",{},!1))}},updateMixins:{value:function(e,t){var r=e.split(" "),n=t?t.split(" "):[],i=n.filter(function(e){return r.indexOf(e)<0});this.mixinEls=[],i.forEach(this.unregisterMixin.bind(this)),r.forEach(this.registerMixin.bind(this))}},addMixin:{value:function(e){var t,r=this.getAttribute("mixin"),n=r.split(" ");for(t=0;t<n.length;++t)if(n[t]===e)return;n.push(e),this.setAttribute("mixin",n.join(" "))}},removeMixin:{value:function(e){var t,r=this.getAttribute("mixin"),n=r.split(" ");for(t=0;t<n.length;++t)if(n[t]===e)return n.splice(t,1),void this.setAttribute("mixin",n.join(" "))}},registerMixin:{value:function(e){var t=document.querySelector("a-mixin#"+e);t&&(this.attachMixinListener(t),this.mixinEls.push(t))}},setAttribute:{value:function(e,t){"mixin"===e&&this.updateMixins(t),HTMLElement.prototype.setAttribute.call(this,e,t)}},unregisterMixin:{value:function(e){var t,r,n=this.mixinEls;for(r=0;r<n.length;++r)if(t=n[r],e===t.id){n.splice(r,1);break}this.removeMixinListener(e)}},removeMixinListener:{value:function(e){var t=this.mixinObservers[e];t&&(t.disconnect(),this.mixinObservers[e]=null)}},attachMixinListener:{value:function(e){var t=this,r=e.id,n=this.mixinObservers[r];if(e&&!n){var i=new MutationObserver(function(e){var r=e[0].attributeName;t.applyMixin(r)}),o={attributes:!0};i.observe(e,o),this.mixinObservers[r]=i}}},applyMixin:{value:function(){}},emit:{value:function(e,t,r){var i=this;t=t||{},void 0===r&&(r=!0);var o={bubbles:!!r,detail:t};return e.split(" ").map(function(e){return n.fireEvent(i,e,o)})}},emitter:{value:function(e,t,r){var n=this;return function(){n.emit(e,t,r)}}}})})},{"../utils/":73,"./a-register-element":66}],66:[function(e,t){function r(e){var t={},r=["attachedCallback","attributeChangedCallback","createdCallback"];return i(t,r,e,l.prototype),a(e,t),t}function n(e){var t={},r=["attachedCallback","attributeChangedCallback","createdCallback"],n=["attributeChangedCallback","attachedCallback","createdCallback","detachedCallback"];return i(t,r,e,l.prototype),i(t,n,e,u.prototype),a(e,t),t}function i(e,t,r,n){t.forEach(function(t){o(e,t,r,n)})}function o(e,t,r,n){var i=r[t],o=n[t];if(i&&o&&i!==o){var a=function(){return o.apply(this,arguments),i.apply(this,arguments)};e[t]={value:a,writable:window.debug}}}function a(e,t){var r=Object.getOwnPropertyNames(e);r.forEach(function(r){var n;t[r]||(n=Object.getOwnPropertyDescriptor(e,r),t[r]={value:e[r],writable:n.writable})})}e("document-register-element");var s=document.registerElement,h=t.exports.knownTags={},c=function(e){h[e.toLowerCase()]=!0};t.exports.isNode=function(e){return e.tagName.toLowerCase()in h||e.isNode},t.exports.registerElement=document.registerElement=function(e,t){var i=Object.getPrototypeOf(t.prototype),o=t,a=l&&i===l.prototype,h=u&&i===u.prototype;return(a||h)&&c(e),a&&(o=r(t.prototype),o={prototype:Object.create(i,o)}),h&&(o=n(t.prototype),o={prototype:Object.create(i,o)}),s.call(document,e,o)};var l=e("./a-node"),u=e("./a-entity")},{"./a-entity":63,"./a-node":65,"document-register-element":82}],67:[function(e,t){function r(e){function t(){return d.update(),o=u.quaternion,0!==o._x||0!==o._y||0!==o._z?!0:void 0}var r,n,i,o,a,s,h=E||window.hasNonPolyfillWebVRSupport;return s=document.createElement("div"),s.classList.add(y),r=document.createElement("div"),r.className=M,i=document.createElement("p"),n=document.createElement("a"),n.setAttribute("href","http://mozvr.com/#start"),n.setAttribute("target","_blank"),n.innerHTML="Learn more.",a=document.createElement("button"),a.className=w,r&&(r.appendChild(i),r.appendChild(n),s.appendChild(r)),s.appendChild(a),t()||E||(i.innerHTML="Your browser supports WebVR. To enter VR, connect a headset, or use a mobile phone.",s.setAttribute(b,"")),h?a.addEventListener("click",e):(i.innerHTML="Your browser does not support WebVR. To enter VR, use a VR-compatible browser, or a mobile phone.",s.setAttribute(x,"")),s}function n(){var e,t=document.querySelector('meta[name="viewport"]');t||(e=document.getElementsByTagName("head")[0],t=document.createElement("meta"),t.name="viewport",t.content="width=device-width,initial-scale=1,shrink-to-fit=no,user-scalable=no",e.appendChild(t),t=document.createElement("meta"),t.name="apple-mobile-web-app-capable",t.content="yes",e.appendChild(t),t=document.createElement("meta"),t.name="apple-mobile-web-app-status-bar-style",t.content="black",e.appendChild(t))}var i=e("./a-register-element"),o=e("../../lib/vendor/rStats"),a=e("../../lib/three"),s=e("tween.js"),h=e("../utils/"),c=e("./a-entity"),l=e("../../lib/vendor/wakelock/wakelock"),u=new a.Object3D,d=new a.VRControls(u),p=i.isNode,f="data-aframe-default-camera",m="data-aframe-default-light",v="a-hidden",g=i.registerElement,y="a-enter-vr",b="data-a-enter-vr-no-headset",x="data-a-enter-vr-no-webvr",w="a-enter-vr-button",M="a-enter-vr-modal",_="a-orientation-modal",E=h.isMobile(),A=t.exports=g("a-scene",{prototype:Object.create(c.prototype,{createdCallback:{value:function(){this.behaviors=[],this.defaultLightsEnabled=!0,this.enterVREl=null,this.insideIframe=window.top!==window.self,this.insideLoader=!1,this.isScene=!0,this.materials={},this.object3D=A.scene||new a.Scene,A.scene=this.object3D}},attachedCallback:{value:function(){this.isMobile=E;var e=this.resizeCanvas.bind(this);E&&(n(),this.wakelock=new l),this.setupStats(),this.setupCanvas(),this.setupKeyboardShortcuts(),this.setupRenderer(),this.setupDefaultLights(),this.attachEventListeners(),this.attachFullscreenListeners(),this.attachOrientationListeners(),window.addEventListener("load",e)},writable:window.debug},attributeChangedCallback:{value:function(e,t,r){t!==r&&"stats"===e&&this.setupStats()}},detachedCallback:{value:function(){window.cancelAnimationFrame(this.animationFrameID),this.animationFrameID=null}},addBehavior:{value:function(e){this.behaviors.push(e)}},attachEventListeners:{value:function(){function e(e){p(e)&&(r.pendingElements++,e.hasLoaded?n(e):t(e))}function t(e){e.addEventListener("loaded",n)}var r=this,n=this.elementLoadedCallback.bind(this);this.pendingElements=0;var i=document.querySelector("a-assets");i&&!i.hasLoaded&&(this.pendingElements++,t(i));var o=this.querySelectorAll("*");Array.prototype.slice.call(o).forEach(e)}},attachOrientationListeners:{value:function(){window.addEventListener("orientationchange",this.showOrientationModal.bind(this))}},showOrientationModal:{value:function(){h.isIOS()&&(h.isLandscape()||this.renderer!==this.stereoRenderer?this.orientationModal.classList.add(v):this.orientationModal.classList.remove(v))}},attachFullscreenListeners:{value:function(){function e(){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement;e&&this.isMobile?window.screen.orientation.lock("landscape"):window.screen.orientation.unlock(),e||(this.showUI(),this.setMonoRenderer()),this.wakelock&&this.wakelock.release()}document.addEventListener("mozfullscreenchange",e.bind(this)),document.addEventListener("webkitfullscreenchange",e.bind(this))}},attachMessageListeners:{value:function(){var e=this;window.addEventListener("message",function(t){if(t.data)switch(t.data.type){case"loaderReady":e.insideLoader=!0,e.removeEnterVRButton();break;case"fullscreen":switch(t.data.data){case"enter":e.setStereoRenderer();break;case"exit":e.setMonoRenderer()}}})}},elementLoadedCallback:{value:function(){if(this.pendingElements--,!(this.pendingElements>0||this.renderLoopStarted)){if(this.setupLoader(),!this.cameraEl)return void this.setupDefaultCamera();this.resizeCanvas(),this.render(),this.renderLoopStarted=!0,this.load(),this.checkUrlParameters()}}},checkUrlParameters:{value:function(){var e=h.getUrlParameter("mode");"vr"===e&&this.enterVR();var t=h.getUrlParameter("ui");"false"===t&&this.hideUI()}},enterVR:{value:function(){this.hideUI(),this.setStereoRenderer(),this.setFullscreen(),this.showOrientationModal()}},exitVR:{value:function(){this.showUI(),this.setMonoRenderer(),this.orientationModal.classList.add(v)}},getCanvasSize:{value:function(){var e=this.canvas;return this.isMobile?{height:window.innerHeight,width:window.innerWidth}:(e.style.width="100%",e.style.height="100%",{height:e.offsetHeight,width:e.offsetWidth})}},hideUI:{value:function(){this.statsEl&&this.statsEl.classList.add(v),this.enterVREl&&this.enterVREl.classList.add(v)}},load:{value:function(){this.hasLoaded||0!==this.pendingElements||c.prototype.load.call(this)}},registerLight:{value:function(e){if(this.defaultLightsEnabled&&!e.hasAttribute(m)){for(var t=document.querySelectorAll("["+m+"]"),r=0;r<t.length;r++)this.removeChild(t[r]);this.defaultLightsEnabled=!1}}},registerMaterial:{value:function(e){this.materials[e.uuid]=e}},removeBehavior:{value:function(e){var t=this.behaviors,r=t.indexOf(e);-1!==r&&t.splice(r,1)}},removeEnterVR:{value:function(){this.enterVREl&&this.enterVREl.parentNode.removeChild(this.enterVREl)}},resizeCanvas:{value:function(){if(this.cameraEl){var e=this.cameraEl.components.camera.camera,t=this.getCanvasSize();e.aspect=t.width/t.height,e.updateProjectionMatrix(),this.renderer.setSize(t.width,t.height,!0)}}},setFullscreen:{value:function(){var e=this.canvas;return this.isMobile?(this.wakelock&&this.wakelock.request(),void(e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen())):void this.stereoRenderer.setFullScreen(!0)}},setMonoRenderer:{value:function(){this.renderer=this.monoRenderer,this.resizeCanvas()}},setStereoRenderer:{value:function(){this.renderer=this.stereoRenderer,this.resizeCanvas()}},setupCanvas:{value:function(){var e=this.canvas=document.createElement("canvas");e.classList.add("a-canvas"),e.addEventListener("touchmove",function(e){e.preventDefault()}),document.body.appendChild(e),window.addEventListener("resize",this.resizeCanvas.bind(this),!1)}},setupDefaultCamera:{value:function(){var e,t;this.cameraEl||(e=document.createElement("a-entity"),e.setAttribute("position",{x:0,y:1.8,z:4}),e.setAttribute(f,""),t=document.createElement("a-entity"),t.setAttribute("camera"),t.setAttribute("wasd-controls"),t.setAttribute("look-controls"),this.pendingElements++,t.addEventListener("loaded",this.elementLoadedCallback.bind(this)),e.appendChild(t),this.appendChild(e))}},setupDefaultLights:{value:function(){var e=document.createElement("a-entity");e.setAttribute("light",{color:"#fff",type:"ambient"}),e.setAttribute(m,""),this.appendChild(e);var t=document.createElement("a-entity");t.setAttribute("light",{color:"#fff",intensity:.2}),t.setAttribute("position",{x:-1,y:2,z:1}),t.setAttribute(m,""),this.appendChild(t)}},setupEnterVR:{value:function(){this.enterVREl||(this.enterVREl=r(this.enterVR.bind(this)),document.body.appendChild(this.enterVREl))}},setupOrientationModal:{value:function(){var e=this.orientationModal=document.createElement("div");e.className=_,e.classList.add(v);var t=document.createElement("button");t.innerHTML="Exit VR",t.addEventListener("click",this.exitVR.bind(this)),e.appendChild(t),document.body.appendChild(e)}},setupKeyboardShortcuts:{value:function(){var e=this;window.addEventListener("keyup",function(t){70===t.keyCode&&e.enterVR(),90===t.keyCode&&d.resetSensor()},!1)}},setupLoader:{value:function(){var e=this;e.insideIframe&&(e.attachMessageListeners(),e.vrLoaderMode().then(function(t){t?e.setStereoRenderer():e.setMonoRenderer(),window.top.postMessage({type:"ready"},"*")})),e.insideLoader||(e.setupEnterVR(),e.setupOrientationModal())}},setupRenderer:{value:function(){var e=this.canvas,t="true"===this.getAttribute("antialias"),r=this.renderer=this.monoRenderer=A&&A.renderer||new a.WebGLRenderer({canvas:e,antialias:t,alpha:!0});r.setPixelRatio(window.devicePixelRatio),r.sortObjects=!1,A.renderer=r,this.stereoRenderer=new a.VREffect(r)},writable:window.debug},setupStats:{value:function(){var e="true"===this.getAttribute("stats"),t=this.statsEl=document.querySelector(".rs-base");return e?(t&&t.classList.remove(v),void(this.stats||(this.stats=new o({CSSPath:"../../style/",values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}]}),this.statsEl=document.querySelector(".rs-base")))):void(t&&t.classList.add(v))}},showUI:{value:function(){var e="true"===this.getAttribute("stats");e&&this.statsEl.classList.remove(v),this.enterVREl&&this.enterVREl.classList.remove(v)}},unregisterMaterial:{value:function(e){delete this.materials[e.uuid]}},updateMaterials:{value:function(){var e=this.materials;Object.keys(e).forEach(function(t){e[t].needsUpdate=!0})},writable:window.debug},vrLoaderMode:{value:function(){return new Promise(function(e){var t=new MessageChannel;window.top.postMessage({type:"checkVr"},"*",[t.port2]),t.port1.onmessage=function(t){e(!!t.data.data.isVr)}})}},render:{value:function(e){var t=this.cameraEl.components.camera.camera,r=this.stats;r&&(r("rAF").tick(),r("FPS").frame()),s.update(e),this.behaviors.forEach(function(e){e.update()}),this.renderer.render(this.object3D,t),r&&r().update(),this.animationFrameID=window.requestAnimationFrame(this.render.bind(this))}}})})},{"../../lib/three":30,"../../lib/vendor/rStats":32,"../../lib/vendor/wakelock/wakelock":34,"../utils/":73,"./a-entity":63,"./a-register-element":66,"tween.js":90}],68:[function(e,t){function r(e,t){var r="object"==typeof t;return null===t?e:r?s.extend(e,t):void 0===t?e:t}function n(e){function t(e){return e[1].toUpperCase()}return e.replace(/-([a-z])/g,t)}function i(e){var t=Object.keys(e),r={};return t.forEach(function(t){var i=n(t);r[i]=e[t]}),r}var o=e("../utils/debug"),a=e("style-attr"),s=e("../utils/"),h=t.exports.components={},c=o("core:register-component:error"),l=t.exports.Component=function(e){var t=e.getAttribute(this.name);this.el=e,this.data={},this.parseAttributes(t),this.init(),this.update()};l.prototype={schema:{},init:function(){},update:function(){},remove:function(){},parse:function(e){return"string"!=typeof e?e:i(a.parse(e))},stringify:function(e){return"object"!=typeof e?e:a.stringify(e)},getData:function(){var e=this.data;return"object"!=typeof e?e:s.extend({},e)},updateAttributes:function(e){var t=r({},this.data);this.parseAttributes(e),s.deepEqual(t,this.data)||(this.update(t),this.el.emit("componentchanged",{name:this.name,newData:this.getData(),oldData:t}))},parseAttributes:function(e){function t(e){o[e]=a[e]["default"]}function n(e){var t=e.getAttribute(l);o=r(o,t)}var i=this,o={},a=i.schema,h=i.el,c=h.mixinEls,l=i.name;Object.keys(a).forEach(t),c.forEach(n),o=r(o,e),this.data=s.coerce(o,a)}},t.exports.registerComponent=function(e,t){var r,n={};return Object.keys(t).forEach(function(e){n[e]={value:t[e],writable:window.debug}}),h[e]&&c('The component "'+e+'" has been already registered'),r=function(e){l.call(this,e)},r.prototype=Object.create(l.prototype,n),r.prototype.name=e,r.prototype.constructor=r,h[e]={Component:r,dependencies:r.prototype.dependencies,parse:r.prototype.parse.bind(r.prototype),schema:r.prototype.schema,stringify:r.prototype.stringify.bind(r.prototype)},r}},{"../utils/":73,"../utils/debug":72,"style-attr":89}],69:[function(e,t){e("es6-promise").polyfill(),e("present"),e("../style/aframe-core.css"),e("../style/rStats.css");var r=e("./core/a-scene"),n=e("./core/component").components,i=e("./utils/debug"),o=e("./core/component").registerComponent,a=e("./core/a-register-element"),s=window.THREE=e("../lib/three"),h=e("../package"),c=e("./utils/");e("./components/index");var l=e("./core/a-node"),u=e("./core/a-entity");window.hasNonPolyfillWebVRSupport=!!navigator.getVRDevices,window.WebVRConfig={TOUCH_PANNER_DISABLED:!0,MOUSE_KEYBOARD_CONTROLS_DISABLED:!0},e("webvr-polyfill"),e("./core/a-animation"),e("./core/a-assets"),e("./core/a-cubemap"),e("./core/a-mixin"),e("./core/a-scene"),t.exports={AEntity:u,ANode:l,AScene:r,components:n,debug:i,registerComponent:o,registerElement:a,THREE:s,utils:c,version:h.version}},{"../lib/three":30,"../package":41,"../style/aframe-core.css":75,"../style/rStats.css":76,"./components/index":46,"./core/a-animation":60,"./core/a-assets":61,"./core/a-cubemap":62,"./core/a-entity":63,"./core/a-mixin":64,"./core/a-node":65,"./core/a-register-element":66,"./core/a-scene":67,"./core/component":68,"./utils/":73,"./utils/debug":72,"es6-promise":83,present:85,"webvr-polyfill":40}],70:[function(e,t){var r=e("./coordinates"),n=e("./index");t.exports=function(e,t){function i(e,t){if("string"!=typeof e)return e;switch(typeof t){case"boolean":return"true"===e;case"number":return parseFloat(e);case"object":return n.deepEqual(Object.keys(t),["x","y","z"])?r.parse(e):e;default:return e}}var o=e;return"object"==typeof e?(Object.keys(o).forEach(function(e){var r,a=t[e];return a?(r=a["default"],void(void 0!==r&&(o[e]=i(o[e],r)))):void n.warn("Unknown component attribute: "+e)}),o):i(e,t["default"])}},{"./coordinates":71,"./index":73}],71:[function(e,t){function r(e,t){var r;return t=t||{},"string"!=typeof e||null===e?e:(r=e.trim().replace(/\s+/g," ").split(" "),{x:parseFloat(r[0]||t.x["default"]),y:parseFloat(r[1]||t.y["default"]),z:parseFloat(r[2]||t.z["default"])})}function n(e){return"object"!=typeof e?e:[e.x,e.y,e.z].join(" ")}var i=/\s*(-?\d*\.{0,1}\d+)\s*(-?\d*\.{0,1}\d+)\s*(-?\d*\.{0,1}\d+)\s*/;t.exports.regex=i,t.exports.parse=r,t.exports.stringify=n,t.exports.isCoordinate=function(e){return i.test(e)},t.exports.componentMixin={parse:function(e){return r(e,this.schema)},stringify:n}},{}],72:[function(e,t){(function(r){function n(e){var t=e.split(":");return t[t.length-1]}function i(e){var t=n(e),r=h.colors&&h.colors[t];return r||null}function o(){try{return window.localStorage}catch(e){}}var a=e("debug"),s=e("object-assign"),h={colors:{error:"red",info:"gray",warn:"orange",warning:"orange"}},c=function(e){var t=a(e);return t.color=i(e),t};s(c,a);var l=o();l&&(parseInt(l.logs,10)||"true"===l.logs)?c.enable("*"):(c.save(null),c=function(){return function(){}}),r.browser&&(window.logs=c),t.exports=c}).call(this,e("_process"))},{_process:78,debug:79,"object-assign":84}],73:[function(e,t){function r(e,t){var r,n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(0===n.length)return e===t;for(r=0;r<n.length;++r)if(e[n[r]]!==t[n[r]])return!1;return!0}var n=e("object-assign");t.exports.coerce=e("./coerce"),t.exports.coordinates=e("./coordinates"),t.exports.fireEvent=function(e,t,r){r=r||{},r.detail=r.detail||{},r.detail.target=r.detail.target||e;var n=new CustomEvent(t,r);n.target=e,e.dispatchEvent(n)},t.exports.error=function(e){throw new Error(e)},t.exports.warn=function(){console.warn.apply(console,arguments)},t.exports.log=function(){console.log.apply(console,arguments)},t.exports.extend=n,t.exports.deepEqual=r,t.exports.diff=function(e,t){var n={},i=Object.keys(e);return Object.keys(t).forEach(function(e){-1===i.indexOf(e)&&i.push(e)}),i.forEach(function(i){var o=e[i],a=t[i],s=o&&a&&o.constructor===Object&&a.constructor===Object;(s&&!r(o,a)||!s&&o!==a)&&(n[i]=a)}),n},t.exports.isMobile=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),i()&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e};var i=t.exports.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.platform)};t.exports.isLandscape=function(){return 90===window.orientation||-90===window.orientation},t.exports.splitString=function(e,t){"undefined"==typeof t&&(t=" ");var r=new RegExp(t,"g");return e=(e||"").replace(r,t),e.split(t)},t.exports.getElData=function(e,t){function r(t){e.hasAttribute(t)&&(n[t]=e.getAttribute(t))}t=t||{};var n={};return Object.keys(t).forEach(r),n},t.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),r=t.exec(location.search);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))},t.exports.srcLoader=e("./src-loader")},{"./coerce":70,"./coordinates":71,"./src-loader":74,"object-assign":84}],74:[function(e,t){function r(e,t,r){var n,s,c,l=i(e);return l?void o(l,function(e){return e?void t(l):void r(l)}):(n=a(e))?(s=n&&"IMG"===n.tagName,c=n&&"VIDEO"===n.tagName,s?t(n):c?r(n):void h('"%s" does not point to a valid <img> or <video> element',e)):void 0}function n(e,t){function n(e){l.push(e),6===l.length&&t(l)}var i,o,s,c="",l=[];for(o=0;6>o;o++)c+="url((.+))s*,s*";if(s=e.match(c))for(o=1;7>o;o++)r(s[o],n);else if(i=a(e))return"A-CUBEMAP"===i.tagName&&i.srcs?t(i.srcs):void h('Selector "%s" does not point to <a-cubemap>',e)}function i(e){var t=e.match(/\url\((.+)\)/);if(t)return t[1]}function o(e,t){function r(){t(!0)}function n(){t(!1)}var i=new Image;i.addEventListener("load",r),i.addEventListener("error",n),i.src=e}function a(e){try{var t=document.querySelector(e);return t||h('No element was found matching the selector: "%s"',e),t}catch(r){return void h('"%s" is not a valid selector',e)}}var s=e("./debug"),h=s("utils:src-loader:warn");t.exports={parseUrl:i,validateSrc:r,validateCubemapSrc:n}},{"./debug":72}],75:[function(e,t){var r="html {\n  bottom: 0;\n  left: 0;\n  position: fixed;\n  right: 0;\n  top: 0;\n}\nbody {\n  height: 100%;\n  margin: 0;\n  overflow: hidden;\n  padding: 0;\n  width: 100%;\n}\n.a-hidden {\n  display: none !important;\n}\n.a-canvas {\n  height: 100%;\n  left: 0;\n  position: absolute;\n  top: 0;\n  width: 100%;\n}\na-assets,\na-scene video,\na-scene img {\n  display: none;\n}\n.a-enter-vr {\n  align-items: flex-end;\n  -webkit-align-items: flex-end;\n  bottom: 5px;\n  display: flex;\n  display: -webkit-flex;\n  font-family: sans-serif, monospace;\n  font-size: 13px;\n  font-weight: 200;\n  line-height: 16px;\n  height: 72px;\n  position: fixed;\n  right: 5px;\n}\n.a-enter-vr-button {\n  background: rgba(0, 0, 0, 0.35) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20245.82%20141.73%22%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill%3A%23fff%3Bfill-rule%3Aevenodd%3B%7D%3C%2Fstyle%3E%3C%2Fdefs%3E%3Ctitle%3Emask%3C%2Ftitle%3E%3Cpath%20class%3D%22a%22%20d%3D%22M175.56%2C111.37c-22.52%2C0-40.77-18.84-40.77-42.07S153%2C27.24%2C175.56%2C27.24s40.77%2C18.84%2C40.77%2C42.07S198.08%2C111.37%2C175.56%2C111.37ZM26.84%2C69.31c0-23.23%2C18.25-42.07%2C40.77-42.07s40.77%2C18.84%2C40.77%2C42.07-18.26%2C42.07-40.77%2C42.07S26.84%2C92.54%2C26.84%2C69.31ZM27.27%2C0C11.54%2C0%2C0%2C12.34%2C0%2C28.58V110.9c0%2C16.24%2C11.54%2C30.83%2C27.27%2C30.83H99.57c2.17%2C0%2C4.19-1.83%2C5.4-3.7L116.47%2C118a8%2C8%2C0%2C0%2C1%2C12.52-.18l11.51%2C20.34c1.2%2C1.86%2C3.22%2C3.61%2C5.39%2C3.61h72.29c15.74%2C0%2C27.63-14.6%2C27.63-30.83V28.58C245.82%2C12.34%2C233.93%2C0%2C218.19%2C0H27.27Z%22%2F%3E%3C%2Fsvg%3E) 50% 50% no-repeat;\n  background-size: 70% 70%;\n  border: 0;\n  bottom: 0;\n  color: #FFF;\n  cursor: pointer;\n  height: 50px;\n  transition: background .05s ease;\n  -webkit-transition: background .05s ease;\n  width: 60px;\n  z-index: 999999;\n}\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n  background-color: #666666;\n}\n[data-a-enter-vr-no-webvr] .a-enter-vr-button {\n  border-color: #666666;\n  opacity: 0.65;\n}\n[data-a-enter-vr-no-webvr] .a-enter-vr-button:active,\n[data-a-enter-vr-no-webvr] .a-enter-vr-button:hover {\n  background-color: rgba(0, 0, 0, .35);\n  cursor: not-allowed;\n}\n.a-enter-vr-modal {\n  background-color: #666666;\n  border-radius: 0;\n  color: #FFF;\n  height: 32px;\n  opacity: 0;\n  margin-right: 10px;\n  padding: 9px;\n  width: 280px;\n  position: relative;\n  transition: opacity .05s ease;\n  -webkit-transition: opacity .05s ease;\n}\n.a-enter-vr-modal:after {\n  border-bottom: 10px solid transparent;\n  border-left: 10px solid #666666;\n  border-top: 10px solid transparent;\n  display: inline-block;\n  content: '';\n  position: absolute;\n  right: -5px;\n  top: 5px;\n  width: 0;\n  height: 0;\n}\n.a-enter-vr-modal p {\n  margin: 0;\n  display: inline;\n}\n.a-enter-vr-modal p:after {\n  content: ' ';\n}\n.a-enter-vr-modal a {\n  color: #FFF;\n  display: inline;\n}\n[data-a-enter-vr-no-webvr]:hover .a-enter-vr-modal,\n[data-a-enter-vr-no-headset]:hover .a-enter-vr-modal {\n  opacity: 1;\n}\n.a-orientation-modal {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  top: 0;\n  left: 0;\n  background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E);\n  background-size: 50% 50%;\n  background-repeat: no-repeat;\n  background-position: center center;\n}\n.a-orientation-modal:after {\n  content: \"Insert phone into Cardboard holder.\";\n  color: #333;\n  font-family: sans-serif, monospace;\n  font-size: 13px;\n  text-align: center;\n  position: absolute;\n  width: 100%;\n  top: 70%;\n  transform: translateY(-70%);\n}\n.a-orientation-modal button {\n  background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E);\n  width: 50px;\n  height: 50px;\n  border: none;\n  text-indent: -9999px;\n}\n@media (min-width: 480px) {\n  .a-enter-vr {\n    bottom: 20px;\n    right: 20px;\n  }\n\n  .a-enter-vr-modal {\n    width: 400px;\n  }\n}\n";
  
  e("browserify-css").createStyle(r,{href:"node_modules/aframe-core/style/aframe-core.css"}),t.exports=r},{"browserify-css":77}],76:[function(e,t){var r=".rs-base {\n  background-color: #EF2D5E;\n  border-radius: 0;\n  font-family: 'Roboto Condensed', tahoma, sans-serif;\n  font-size: 10px;\n  line-height: 1.2em;\n  opacity: 0.75;\n  overflow: hidden;\n  padding: 10px;\n  position: fixed;\n  left: 5px;\n  top: 5px;\n  width: 270px;\n  z-index: 10000;\n}\n.rs-base.hidden {\n  display: none;\n}\n.rs-base h1 {\n  color: #fff;\n  cursor: pointer;\n  font-size: 1.4em;\n  font-weight: 300;\n  margin: 0 0 5px;\n  padding: 0;\n}\n.rs-group {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: flex;\n  -webkit-flex-direction: column-reverse;\n  flex-direction: column-reverse;\n}\n.rs-counter-base {\n  align-items: center;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: flex;\n  height: 10px;\n  -webkit-justify-content: space-between;\n  justify-content: space-between;\n  margin: 2px 0;\n}\n.rs-counter-id {\n  font-weight: 300;\n  -webkit-box-ordinal-group: 0;\n  -webkit-order: 0;\n  order: 0;\n}\n.rs-counter-value {\n  font-weight: 300;\n  -webkit-box-ordinal-group: 1;\n  -webkit-order: 1;\n  order: 1;\n  text-align: right;\n  width: 25px;\n}\n.rs-canvas {\n  -webkit-box-ordinal-group: 2;\n  -webkit-order: 2;\n  order: 2;\n}\n@media (min-width: 480px) {\n  .rs-base {\n    left: 20px;\n    top: 20px;\n  }\n}\n";e("browserify-css").createStyle(r,{href:"node_modules/aframe-core/style/rStats.css"}),t.exports=r},{"browserify-css":77}],77:[function(e,t){"use strict";t.exports={createLink:function(e,t){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("link");n.href=e,n.rel="stylesheet";for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];n.setAttribute("data-"+i,o)}r.appendChild(n)},createStyle:function(e,t){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css";for(var i in t)if(t.hasOwnProperty(i)){var o=t[i];n.setAttribute("data-"+i,o)}n.sheet?(n.innerHTML=e,n.sheet.cssText=e,r.appendChild(n)):n.styleSheet?(r.appendChild(n),n.styleSheet.cssText=e):(n.appendChild(document.createTextNode(e)),r.appendChild(n))}}},{}],78:[function(e,t){function r(){c=!1,a.length?h=a.concat(h):l=-1,h.length&&n()}function n(){if(!c){var e=setTimeout(r);c=!0;for(var t=h.length;t;){for(a=h,h=[];++l<t;)a&&a[l].run();l=-1,t=h.length}a=null,c=!1,clearTimeout(e)}}function i(e,t){this.fun=e,this.array=t}function o(){}var a,s=t.exports={},h=[],c=!1,l=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new i(e,t)),1!==h.length||c||setTimeout(n,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=o,s.addListener=o,s.once=o,s.off=o,s.removeListener=o,s.removeAllListeners=o,s.emit=o,s.binding=function(){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],79:[function(e,t,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,n),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(t){}}function s(){var e;try{e=r.storage.debug}catch(t){}return e}function h(){try{return window.localStorage}catch(e){}}r=t.exports=e("./debug"),r.log=o,r.formatArgs=i,r.save=a,r.load=s,r.useColors=n,r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:h(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){return JSON.stringify(e)},r.enable(s())},{"./debug":80}],80:[function(e,t,r){function n(){return r.colors[l++%r.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(c||t);e.diff=o,e.prev=c,e.curr=t,c=t,null==e.useColors&&(e.useColors=r.useColors()),null==e.color&&e.useColors&&(e.color=n());var a=Array.prototype.slice.call(arguments);a[0]=r.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,n){if("%%"===t)return t;s++;var i=r.formatters[n];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof r.formatArgs&&(a=r.formatArgs.apply(e,a));var h=i.log||r.log||console.log.bind(console);h.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=r.enabled(e)?i:t;return o.namespace=e,o}function o(e){r.save(e);for(var t=(e||"").split(/[\s,]+/),n=t.length,i=0;n>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function a(){r.enable("")}function s(e){var t,n;for(t=0,n=r.skips.length;n>t;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;n>t;t++)if(r.names[t].test(e))return!0;return!1}function h(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=i,r.coerce=h,r.disable=a,r.enable=o,r.enabled=s,r.humanize=e("ms"),r.names=[],r.skips=[],r.formatters={};var c,l=0},{ms:81}],81:[function(e,t){function r(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*l;case"days":case"day":case"d":return r*c;case"hours":case"hour":case"hrs":case"hr":case"h":return r*h;case"minutes":case"minute":case"mins":case"min":case"m":return r*s;case"seconds":case"second":case"secs":case"sec":case"s":return r*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function n(e){return e>=c?Math.round(e/c)+"d":e>=h?Math.round(e/h)+"h":e>=s?Math.round(e/s)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return o(e,c,"day")||o(e,h,"hour")||o(e,s,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,r){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var a=1e3,s=60*a,h=60*s,c=24*h,l=365.25*c;t.exports=function(e,t){return t=t||{},"string"==typeof e?r(e):t["long"]?i(e):n(e)}},{}],82:[function(){!function(t,r,n,i){"use strict";function o(e,t){for(var r=0,n=e.length;n>r;r++)g(e[r],t)}function a(e){for(var t,r=0,n=e.length;n>r;r++)t=e[r],E(t,U[h(t)])}function s(e){return function(t){ie(t)&&(g(t,e),o(t.querySelectorAll(z),e))}}function h(e){var t=se.call(e,"is"),r=e.nodeName.toUpperCase(),n=G.call(B,t?I+t.toUpperCase():N+r);return t&&n>-1&&!c(r,t)?-1:n}function c(e,t){return-1<z.indexOf(e+'[is="'+t+'"]')}function l(e){var t=e.currentTarget,r=e.attrChange,n=e.attrName,i=e.target;ge&&(!i||i===t)&&t.attributeChangedCallback&&"style"!==n&&e.prevValue!==e.newValue&&t.attributeChangedCallback(n,r===e[L]?null:e.prevValue,r===e[R]?null:e.newValue)}function u(e){var t=s(e);return function(e){y.push(t,e.target)}}function d(e){ve&&(ve=!1,e.currentTarget.removeEventListener(D,d)),o((e.target||r).querySelectorAll(z),e.detail===C?C:S),ne&&m()}function p(e,t){var r=this;he.call(r,e,t),b.call(r,{target:r})}function f(e,t){ee(e,t),M?M.observe(e,ue):(me&&(e.setAttribute=p,e[A]=w(e),e.addEventListener(O,b)),e.addEventListener(P,l)),e.createdCallback&&ge&&(e.created=!0,e.createdCallback(),e.created=!1)}function m(){for(var e,t=0,r=oe.length;r>t;t++)e=oe[t],j.contains(e)||(r--,oe.splice(t--,1),g(e,C))}function v(e){throw new Error("A "+e+" type is already registered")}function g(e,t){var r,n=h(e);n>-1&&(_(e,U[n]),n=0,t!==S||e[S]?t===C&&!e[C]&&(e[S]=!1,e[C]=!0,n=1):(e[C]=!1,e[S]=!0,n=1,ne&&G.call(oe,e)<0&&oe.push(e)),n&&(r=e[t+"Callback"])&&r.call(e))}if(!(i in r)){var y,b,x,w,M,_,E,A="__"+i+(1e5*Math.random()>>0),S="attached",C="detached",T="extends",L="ADDITION",k="MODIFICATION",R="REMOVAL",P="DOMAttrModified",D="DOMContentLoaded",O="DOMSubtreeModified",N="<",I="=",F=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,V=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],B=[],U=[],z="",j=r.documentElement,G=B.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},H=n.prototype,W=H.hasOwnProperty,q=H.isPrototypeOf,X=n.defineProperty,Y=n.getOwnPropertyDescriptor,Q=n.getOwnPropertyNames,K=n.getPrototypeOf,$=n.setPrototypeOf,Z=!!n.__proto__,J=n.create||function ye(e){return e?(ye.prototype=e,new ye):this},ee=$||(Z?function(e,t){return e.__proto__=t,e}:Q&&Y?function(){function e(e,t){for(var r,n=Q(t),i=0,o=n.length;o>i;i++)r=n[i],W.call(e,r)||X(e,r,Y(t,r))}return function(t,r){do e(t,r);while((r=K(r))&&!q.call(r,t));return t}}():function(e,t){for(var r in t)e[r]=t[r];return e}),te=t.MutationObserver||t.WebKitMutationObserver,re=(t.HTMLElement||t.Element||t.Node).prototype,ne=!q.call(re,j),ie=ne?function(e){return 1===e.nodeType}:function(e){return q.call(re,e)},oe=ne&&[],ae=re.cloneNode,se=re.getAttribute,he=re.setAttribute,ce=re.removeAttribute,le=r.createElement,ue=te&&{attributes:!0,characterData:!0,attributeOldValue:!0},de=te||function(){me=!1,j.removeEventListener(P,de)},pe=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,10)},fe=!1,me=!0,ve=!0,ge=!0;$||Z?(_=function(e,t){q.call(t,e)||f(e,t)},E=f):(_=function(e,t){e[A]||(e[A]=n(!0),f(e,t))},E=_),ne?(me=!1,function(){var t=Y(re,"addEventListener"),r=t.value,n=function(e){var t=new CustomEvent(P,{bubbles:!0});t.attrName=e,t.prevValue=se.call(this,e),t.newValue=null,t[R]=t.attrChange=2,ce.call(this,e),this.dispatchEvent(t)},i=function(t,r){var n=this.hasAttribute(t),i=n&&se.call(this,t);e=new CustomEvent(P,{bubbles:!0}),he.call(this,t,r),e.attrName=t,e.prevValue=n?i:null,e.newValue=r,n?e[k]=e.attrChange=1:e[L]=e.attrChange=0,this.dispatchEvent(e)},o=function(e){var t,r=e.currentTarget,n=r[A],i=e.propertyName;n.hasOwnProperty(i)&&(n=n[i],t=new CustomEvent(P,{bubbles:!0}),t.attrName=n.name,t.prevValue=n.value||null,t.newValue=n.value=r[i]||null,null==t.prevValue?t[L]=t.attrChange=0:t[k]=t.attrChange=1,r.dispatchEvent(t))};t.value=function(e,t,a){e===P&&this.attributeChangedCallback&&this.setAttribute!==i&&(this[A]={className:{name:"class",value:this.className}},this.setAttribute=i,this.removeAttribute=n,r.call(this,"propertychange",o)),r.call(this,e,t,a)},X(re,"addEventListener",t)}()):te||(j.addEventListener(P,de),j.setAttribute(A,1),j.removeAttribute(A),me&&(b=function(e){var t,r,n,i=this;if(i===e.target){t=i[A],i[A]=r=w(i);for(n in r){if(!(n in t))return x(0,i,n,t[n],r[n],L);if(r[n]!==t[n])return x(1,i,n,t[n],r[n],k)}for(n in t)if(!(n in r))return x(2,i,n,t[n],r[n],R)}},x=function(e,t,r,n,i,o){var a={attrChange:e,currentTarget:t,attrName:r,prevValue:n,newValue:i};a[o]=e,l(a)},w=function(e){for(var t,r,n={},i=e.attributes,o=0,a=i.length;a>o;o++)t=i[o],r=t.name,"setAttribute"!==r&&(n[r]=t.value);return n})),r[i]=function(e,t){if(n=e.toUpperCase(),fe||(fe=!0,te?(M=function(e,t){function r(e,t){for(var r=0,n=e.length;n>r;t(e[r++]));}return new te(function(n){for(var i,o,a,s=0,h=n.length;h>s;s++)i=n[s],"childList"===i.type?(r(i.addedNodes,e),r(i.removedNodes,t)):(o=i.target,ge&&o.attributeChangedCallback&&"style"!==i.attributeName&&(a=se.call(o,i.attributeName),a!==i.oldValue&&o.attributeChangedCallback(i.attributeName,i.oldValue,a)))})}(s(S),s(C)),M.observe(r,{childList:!0,subtree:!0})):(y=[],pe(function g(){for(;y.length;)y.shift().call(null,y.shift());pe(g)}),r.addEventListener("DOMNodeInserted",u(S)),r.addEventListener("DOMNodeRemoved",u(C))),r.addEventListener(D,d),r.addEventListener("readystatechange",d),r.createElement=function(e,t){var n=le.apply(r,arguments),i=""+e,o=G.call(B,(t?I:N)+(t||i).toUpperCase()),a=o>-1;return t&&(n.setAttribute("is",t=t.toLowerCase()),a&&(a=c(i.toUpperCase(),t))),ge=!r.createElement.innerHTMLHelper,a&&E(n,U[o]),n},re.cloneNode=function(e){var t=ae.call(this,!!e),r=h(t);return r>-1&&E(t,U[r]),e&&a(t.querySelectorAll(z)),t}),-2<G.call(B,I+n)+G.call(B,N+n)&&v(e),!F.test(n)||-1<G.call(V,n))throw new Error("The type "+e+" is invalid");var n,i,l=function(){return f?r.createElement(m,n):r.createElement(m)},p=t||H,f=W.call(p,T),m=f?t[T].toUpperCase():n;return f&&-1<G.call(B,N+m)&&v(m),i=B.push((f?I:N)+n)-1,z=z.concat(z.length?",":"",f?m+'[is="'+e.toLowerCase()+'"]':m),l.prototype=U[i]=W.call(p,"prototype")?p.prototype:J(re),o(r.querySelectorAll(z),S),l}}}(window,document,Object,"registerElement")},{}],83:[function(e,r){(function(n,i){(function(){"use strict";function o(e){return"function"==typeof e||"object"==typeof e&&null!==e}function a(e){return"function"==typeof e}function s(e){q=e}function h(e){K=e}function c(){return function(){n.nextTick(f)}}function l(){return function(){W(f)}}function u(){var e=0,t=new J(f),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=f,function(){e.port2.postMessage(0)}}function p(){return function(){setTimeout(f,1)}}function f(){for(var e=0;Q>e;e+=2){var t=re[e],r=re[e+1];t(r),re[e]=void 0,re[e+1]=void 0}Q=0}function m(){try{var t=e,r=t("vertx");return W=r.runOnLoop||r.runOnContext,l()}catch(n){return p()}}function v(e,t){var r=this,n=r._state;if(n===ae&&!e||n===se&&!t)return this;var i=new this.constructor(y),o=r._result;if(n){var a=arguments[n-1];K(function(){O(n,i,a,o)})}else k(r,i,e,t);return i}function g(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(y);return S(r,e),r}function y(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function x(){return new TypeError("A promises callback cannot return that same promise.")}function w(e){try{return e.then}catch(t){return he.error=t,he}}function M(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function _(e,t,r){K(function(e){var n=!1,i=M(r,t,function(r){n||(n=!0,t!==r?S(e,r):T(e,r))},function(t){n||(n=!0,L(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,L(e,i))},e)}function E(e,t){t._state===ae?T(e,t._result):t._state===se?L(e,t._result):k(t,void 0,function(t){S(e,t)},function(t){L(e,t)})}function A(e,t,r){t.constructor===e.constructor&&r===ne&&constructor.resolve===ie?E(e,t):r===he?L(e,he.error):void 0===r?T(e,t):a(r)?_(e,t,r):T(e,t)}function S(e,t){e===t?L(e,b()):o(t)?A(e,t,w(t)):T(e,t)}function C(e){e._onerror&&e._onerror(e._result),R(e)}function T(e,t){e._state===oe&&(e._result=t,e._state=ae,0!==e._subscribers.length&&K(R,e))}function L(e,t){e._state===oe&&(e._state=se,e._result=t,K(C,e))}function k(e,t,r,n){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+ae]=r,i[o+se]=n,0===o&&e._state&&K(R,e)}function R(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,i,o=e._result,a=0;a<t.length;a+=3)n=t[a],i=t[a+r],n?O(r,n,i,o):i(o);e._subscribers.length=0}}function P(){this.error=null}function D(e,t){try{return e(t)}catch(r){return ce.error=r,ce}}function O(e,t,r,n){var i,o,s,h,c=a(r);if(c){if(i=D(r,n),i===ce?(h=!0,o=i.error,i=null):s=!0,t===i)return void L(t,x())}else i=n,s=!0;t._state!==oe||(c&&s?S(t,i):h?L(t,o):e===ae?T(t,i):e===se&&L(t,i))}function N(e,t){try{t(function(t){S(e,t)},function(t){L(e,t)})}catch(r){L(e,r)}}function I(e){return new me(this,e).promise}function F(e){function t(e){S(i,e)}function r(e){L(i,e)}var n=this,i=new n(y);if(!Y(e))return L(i,new TypeError("You must pass an array to race.")),i;for(var o=e.length,a=0;i._state===oe&&o>a;a++)k(n.resolve(e[a]),void 0,t,r);return i}function V(e){var t=this,r=new t(y);return L(r,e),r}function B(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function U(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function z(e){this._id=pe++,this._state=void 0,this._result=void 0,this._subscribers=[],y!==e&&("function"!=typeof e&&B(),this instanceof z?N(this,e):U())}function j(e,t){this._instanceConstructor=e,this.promise=new e(y),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?T(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&T(this.promise,this._result))):L(this.promise,this._validationError())}function G(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=fe)}var H;H=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var W,q,X,Y=H,Q=0,K=function(e,t){re[Q]=e,re[Q+1]=t,Q+=2,2===Q&&(q?q(f):X())},$="undefined"!=typeof window?window:void 0,Z=$||{},J=Z.MutationObserver||Z.WebKitMutationObserver,ee="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),te="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,re=new Array(1e3);X=ee?c():J?u():te?d():void 0===$&&"function"==typeof e?m():p();var ne=v,ie=g,oe=void 0,ae=1,se=2,he=new P,ce=new P,le=I,ue=F,de=V,pe=0,fe=z;z.all=le,z.race=ue,z.resolve=ie,z.reject=de,z._setScheduler=s,z._setAsap=h,z._asap=K,z.prototype={constructor:z,then:ne,"catch":function(e){return this.then(null,e)}};var me=j;j.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},j.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===oe&&e>r;r++)this._eachEntry(t[r],r)},j.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===ie){var i=w(e);if(i===ne&&e._state!==oe)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(r===fe){var o=new r(y);A(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new r(function(t){t(e)}),t)}else this._willSettleAt(n(e),t)},j.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===oe&&(this._remaining--,e===se?L(n,r):this._result[t]=r),0===this._remaining&&T(n,this._result)},j.prototype._willSettleAt=function(e,t){var r=this;k(e,void 0,function(e){r._settledAt(ae,t,e)},function(e){r._settledAt(se,t,e)})};var ve=G,ge={Promise:fe,polyfill:ve};"function"==typeof t&&t.amd?t(function(){return ge}):"undefined"!=typeof r&&r.exports?r.exports=ge:"undefined"!=typeof this&&(this.ES6Promise=ge),ve()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:78}],84:[function(e,t){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(e){for(var t,o,a=r(e),s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var h in t)n.call(t,h)&&(a[h]=t[h]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(t);for(var c=0;c<o.length;c++)i.call(t,o[c])&&(a[o[c]]=t[o[c]])}}return a}},{}],85:[function(e,t){(function(e){var r=e.performance||{},n=function(){for(var e=["now","webkitNow","msNow","mozNow","oNow"];e.length;){var t=e.shift();if(t in r)return r[t].bind(r)}var n=Date.now||function(){return(new Date).getTime()},i=(r.timing||{}).navigationStart||n();return function(){return n()-i}}();n.performanceNow=r.now,n.noConflict=function(){r.now=n.performanceNow},n.conflict=function(){r.now=n},n.conflict(),t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],86:[function(e,t,r){"use strict";function n(e,t,r){function n(){s.id=o(n),a()-i>=e&&(t.call(r),i=a())}var i=a(),s=Object.create(null);return s.id=o(n),s}function i(e){o.cancel(e.id)}var o=e("raf"),a=e("time-now");r=t.exports=n,r.clear=i},{raf:87,"time-now":88}],87:[function(e,t,r){function n(e){var t=(new Date).getTime(),r=Math.max(0,16-(t-i)),n=setTimeout(e,r);return i=t,n}r=t.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||n;var i=(new Date).getTime(),o=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout;r.cancel=function(e){o.call(window,e)}},{}],88:[function(e,t){"use strict";t.exports=function(){var e=window&&window.performance;return e&&e.now?e.now.bind(e):function(){return(new Date).getTime()}}()},{}],89:[function(e,t){function r(e){var t=function(e){return e.trim()},r={};return n(e).map(t).filter(Boolean).forEach(function(e){var t=e.indexOf(":"),n=e.substr(0,t).trim(),i=e.substr(t+1).trim();r[n]=i}),r}function n(e){for(var t,r=[],n=0,i=";",o=/url\([^\)]+$/,a="";n<e.length;)t=e.indexOf(i,n),-1===t&&(t=e.length),a+=e.substring(n,t),o.test(a)?(a+=";",n=t+1):(r.push(a),a="",n=t+1);return r}function i(e){return Object.keys(e).map(function(t){return t+":"+e[t]}).join(";")}function o(e){return i(r(e))}t.exports.parse=r,t.exports.stringify=i,t.exports.normalize=o},{}],90:[function(e,r,n){!function(e){if("performance"in e==!1&&(e.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in e.performance==!1){var t=e.performance.timing&&e.performance.timing.navigationStart?performance.timing.navigationStart:Date.now();e.performance.now=function(){return Date.now()-t}}}(this);var i=i||function(){var e=[];return{REVISION:"14",getAll:function(){return e},removeAll:function(){e=[]},add:function(t){e.push(t)},remove:function(t){var r=e.indexOf(t);-1!==r&&e.splice(r,1)},update:function(t){if(0===e.length)return!1;var r=0;for(t=void 0!==t?t:window.performance.now();r<e.length;)e[r].update(t)?r++:e.splice(r,1);return!0}}}();i.Tween=function(e){var t=e,r={},n={},o={},a=1e3,s=0,h=!1,c=!1,l=!1,u=0,d=null,p=i.Easing.Linear.None,f=i.Interpolation.Linear,m=[],v=null,g=!1,y=null,b=null,x=null;for(var w in e)r[w]=parseFloat(e[w],10);this.to=function(e,t){return void 0!==t&&(a=t),n=e,this},this.start=function(e){i.add(this),c=!0,g=!1,d=void 0!==e?e:window.performance.now(),d+=u;for(var a in n){if(n[a]instanceof Array){if(0===n[a].length)continue;n[a]=[t[a]].concat(n[a])}r[a]=t[a],r[a]instanceof Array==!1&&(r[a]*=1),o[a]=r[a]||0}return this},this.stop=function(){return c?(i.remove(this),c=!1,null!==x&&x.call(t),this.stopChainedTweens(),this):this},this.stopChainedTweens=function(){for(var e=0,t=m.length;t>e;e++)m[e].stop()},this.delay=function(e){return u=e,this},this.repeat=function(e){return s=e,this},this.yoyo=function(e){return h=e,this},this.easing=function(e){return p=e,this},this.interpolation=function(e){return f=e,this},this.chain=function(){return m=arguments,this},this.onStart=function(e){return v=e,this},this.onUpdate=function(e){return y=e,this},this.onComplete=function(e){return b=e,this},this.onStop=function(e){return x=e,this},this.update=function(e){var i;if(d>e)return!0;g===!1&&(null!==v&&v.call(t),g=!0);var c=(e-d)/a;c=c>1?1:c;var x=p(c);for(i in n){var w=r[i]||0,M=n[i];M instanceof Array?t[i]=f(M,x):("string"==typeof M&&(M=w+parseFloat(M,10)),"number"==typeof M&&(t[i]=w+(M-w)*x))}if(null!==y&&y.call(t,x),1==c){if(s>0){isFinite(s)&&s--;for(i in o){if("string"==typeof n[i]&&(o[i]=o[i]+parseFloat(n[i],10)),h){var _=o[i];o[i]=n[i],n[i]=_}r[i]=o[i]}return h&&(l=!l),d=e+u,!0}null!==b&&b.call(t);for(var E=0,A=m.length;A>E;E++)m[E].start(e);return!1}return!0}},i.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){var t,r=.1,n=.4;return 0===e?0:1===e?1:(!r||1>r?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/n)))},Out:function(e){var t,r=.1,n=.4;return 0===e?0:1===e?1:(!r||1>r?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/n)+1)},InOut:function(e){var t,r=.1,n=.4;return 0===e?0:1===e?1:(!r||1>r?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),(e*=2)<1?-.5*r*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/n):r*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/n)*.5+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-i.Easing.Bounce.Out(1-e)},Out:function(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return.5>e?.5*i.Easing.Bounce.In(2*e):.5*i.Easing.Bounce.Out(2*e-1)+.5}}},i.Interpolation={Linear:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),a=i.Interpolation.Utils.Linear;return 0>t?a(e[0],e[1],n):t>1?a(e[r],e[r-1],r-n):a(e[o],e[o+1>r?r:o+1],n-o)},Bezier:function(e,t){var r,n=0,o=e.length-1,a=Math.pow,s=i.Interpolation.Utils.Bernstein;for(r=0;o>=r;r++)n+=a(1-t,o-r)*a(t,r)*e[r]*s(o,r);return n},CatmullRom:function(e,t){var r=e.length-1,n=r*t,o=Math.floor(n),a=i.Interpolation.Utils.CatmullRom;return e[0]===e[r]?(0>t&&(o=Math.floor(n=r*(1+t))),a(e[(o-1+r)%r],e[o],e[(o+1)%r],e[(o+2)%r],n-o)):0>t?e[0]-(a(e[0],e[0],e[1],e[1],-n)-e[0]):t>1?e[r]-(a(e[r],e[r],e[r-1],e[r-1],n-r)-e[r]):a(e[o?o-1:0],e[o],e[o+1>r?r:o+1],e[o+2>r?r:o+2],n-o)},Utils:{Linear:function(e,t,r){return(t-e)*r+e},Bernstein:function(e,t){var r=i.Interpolation.Utils.Factorial;return r(e)/r(t)/r(e-t)},Factorial:function(){var e=[1];return function(t){var r,n=1;if(e[t])return e[t];for(r=t;r>1;r--)n*=r;return e[t]=n}}(),CatmullRom:function(e,t,r,n,i){var o=.5*(r-e),a=.5*(n-t),s=i*i,h=i*s;return(2*t-2*r+o+a)*h+(-3*t+3*r-2*o-a)*s+o*i+t}}},function(e){"function"==typeof t&&t.amd?t([],function(){return i}):"object"==typeof n?r.exports=i:e.TWEEN=i}(this)},{}],91:[function(e,t){t.exports={name:"aframe",version:"0.1.3",description:"Building blocks for the VR Web",main:"index.js",scripts:{start:"npm run dev",dev:"npm run build && node ./scripts/budo",browserify:"browserify ./index.js -s 'AFRAME'",build:"mkdir -p build/ && npm run browserify -- --debug -o build/aframe.js",dist:"mkdir -p dist/ && npm run browserify -s -- --debug | exorcist dist/aframe.js.map > dist/aframe.js && uglifyjs dist/aframe.js -c warnings=false -m -o dist/aframe.min.js",preghpages:"npm run dist && rm -rf gh-pages && mkdir -p gh-pages && cp -r {.nojekyll,dist,lib,examples,index.html,style} gh-pages/. 2>/dev/null || : && git checkout dist/ && replace 'build/aframe.js' 'dist/aframe.min.js' gh-pages/ -r --silent",ghpages:"node ./scripts/gh-pages","gh-pages":"npm run ghpages",version:"npm run dist","release:bump":"npm version patch --preminor && git commit -a -C HEAD --amend","release:push":"npm login && npm publish && git push --follow-tags",lint:"semistandard -v $(git ls-files '*.js') | snazzy",precommit:"npm run lint"},repository:"aframevr/aframe",license:"MIT",devDependencies:{budo:"^7.0.2",exorcist:"^0.4.0","gh-pages":"^0.4.0","html-minifier":"^0.8.0",husky:"^0.10.1",replace:"^0.3.0",semistandard:"^7.0.2",snazzy:"^2.0.1",uglifyjs:"^2.4.10"},dependencies:{"aframe-core":"^0.1.6",browserify:"^11.0.1","browserify-css":"^0.8.2",polymerize:"^1.0.0"},link:!0,browserify:{transform:[["polymerize",{match:".*.html$"}]]},semistandard:{ignore:["build/**","dist/**","lib/vendor/**","examples/_js/**"]},keywords:["aframe","aframe-core","vr","webvr","3d","three","components","elements"]}},{}]},{},[28])(28)});