UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

5 lines 648 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[2],{545:function(e,t,n){"use strict";n.d(t,"i",(function(){return i})),n.d(t,"j",(function(){return r})),n.d(t,"f",(function(){return a})),n.d(t,"g",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return c})),n.d(t,"e",(function(){return l})),n.d(t,"h",(function(){return h})),n.d(t,"k",(function(){return u})),n.d(t,"c",(function(){return d})),n.d(t,"a",(function(){return p}));const i="static/images/3d-viewer/1x.svg",r="static/images/3d-viewer/2x.svg",a="static/images/3d-viewer/pause.svg",o="static/images/3d-viewer/play.svg",s="static/images/3d-viewer/front.svg",c="static/images/3d-viewer/back.svg",l="static/images/3d-viewer/left.svg",h="static/images/3d-viewer/right.svg",u="static/images/3d-viewer/top.svg",d="static/images/3d-viewer/bottom.svg",p="#f5f5f5"},736:function(e,t){e.exports='<style>\n    body {\n        background: #fff;\n        padding: 0;\n        margin: 0;\n        overflow: hidden;\n    }\n\n    #divControls {\n        top: 6px;\n        left: 6px;\n        opacity: 0.9;\n        display: flex;\n        flex-direction: column;\n        width: 80px;\n        padding-left: 20px;\n        padding-top: 2px;\n\n    }\n    @media (max-width: 769px){\n        #divControls {\n            flex-direction: column !important;\n            width: fit-content !important;\n        }\n        #cameraButtons{\n            width: fit-content !important;\n        }\n        #animationControls{\n            width: fit-content !important;\n        }\n        #progress {\n            width: 100% !important;\n        }\n    }\n\n    .icon {\n        outline: none;\n        height: 40px;\n        background: none;\n        border-radius: 4px;\n        width: 40px;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        margin-bottom: 5px;\n        border: 2px solid white;\n        cursor: pointer;\n    }\n\n    .icon:hover {\n        background-color: #f5f5f5;\n    }\n\n    .icon.selected {\n        border: 2px solid var(--primary-color);\n    }\n\n    i {\n        display: inline-block;\n        width: 24px;\n        height: 24px;\n        background-size: contain;\n        background-repeat: no-repeat;\n    }\n\n    #divContainer {\n        width: calc(100% - 100px);\n        height: 100%;\n    }\n\n    canvas {\n        background-color: #f5f5f5 !important;\n    }\n\n    .shell {\n        width: 100%;\n        height: 100%;\n        display: flex;\n        flex-direction: row;\n    }\n\n    #animationControls {\n        display: inline-block;\n    }\n\n    .slider {\n        overflow: hidden;\n        width: 280px;\n        display: inline-block;\n        -webkit-appearance: none;\n        background-color: #d3d3d3;\n        position: relative;\n        cursor: pointer;\n        top: -10px;\n        height: 8px;\n        outline: none;\n        margin: 0px 8px;\n    }\n\n    .slider::-webkit-slider-runnable-track {\n        height: 5px;\n        -webkit-appearance: none;\n        color: var(--primary-color);\n        margin-top: -1px;\n    }\n\n    .slider::-webkit-slider-thumb {\n        width: 1px;\n        -webkit-appearance: none;\n        height: 10px;\n        cursor: pointer;\n        background: #d3d3d3;\n        box-shadow: -280px 0 0 280px var(--primary-color);\n    }\n\n    .slider::-moz-range-progress {\n        background-color: var(--primary-color);\n    }\n\n    .slider::-moz-range-track {\n        background-color: #d3d3d3;\n    }\n\n    .slider::-ms-fill-lower {\n        background-color: var(--primary-color);\n    }\n\n    .slider::-ms-fill-upper {\n        background-color: #d3d3d3;\n    }\n</style>\n\n<div class="shell">\n    <div id="divControls" style="display:none;">\n\n        <div id="cameraButtons" style="display: initial;">\n            <div tabindex="1" role="menuitemradio" id="cameraFront" title="Front" class="selected icon">\n                <i></i>\n            </div>\n            <div tabindex="1" role="menuitemradio" id="cameraTop" title="Top" class="icon">\n                <i></i>\n            </div>\n            <div tabindex="1" role="menuitemradio" id="cameraBack" title="Back" class="icon">\n                <i></i>\n            </div>\n            <div tabindex="1" role="menuitemradio" id="cameraLeft" title="Left" class="icon">\n                <i></i>\n            </div>\n            <div tabindex="1" role="menuitemradio" id="cameraBottom" title="Bottom" class="icon">\n                <i></i>\n            </div>\n            <div tabindex="1" role="menuitemradio" id="cameraRight" title="Right" class="icon">\n                <i></i>\n            </div>\n        </div>\n\n        <div id="divMultipleElements" style="display: none;">\n            <div tabindex="1" role="menuitemradio" id="btnAction" title="Action" class="icon">\n                <i></i>\n            </div>\n        </div>\n\n        <div id="animationControls" style="display: none; align-items: baseline;">\n            <div role="button" id="playpause" title="Pause" class="icon">\n                <i></i>\n            </div>\n            <input type="range" id="progress" value="0" class="slider">\n            <div role="button" id="speedDiv" title="1x speed" class="icon">\n                <i></i>\n            </div>\n        </div>\n\n    </div>\n\n    <div id="divContainer"></div>\n</div>\n'},737:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var i=n(0),r=n(1),a=n(160),o=n(2),s=n(545);n(856);class c extends a.c{constructor(){super(...arguments),this.inited=!1,this._isOpened=!1,this.speed=1,this.paused=!1,this.__animTimeKoef=100,this.__intervalValue=null}connectedCallback(){super.connectedCallback(),this.inited||(this.inited=!0,this._initCameraButtons(),this._initAnimationButtons(),this._initAnimationControls())}_initCameraButtons(){const e=window.Aurigma.Origami.Camera.positions,t={cameraFront:{position:e.FRONT,image:s.d},cameraBack:{position:e.BACK,image:s.b},cameraLeft:{position:e.LEFT,image:s.e},cameraRight:{position:e.RIGHT,image:s.h},cameraTop:{position:e.TOP,image:s.k},cameraBottom:{position:e.BOTTOM,image:s.c}};for(const n in t){const e=t[n],i=this.querySelectorShadow(`#${n}`);i.addEventListener("click",(()=>{Array.from(i.parentElement.children).forEach((e=>e.classList.remove("selected"))),i.classList.add("selected"),this._moveCamera(e.position,!0)}));let a=i.firstElementChild,o=r.a.getPatchedUrl(e.image);a.style.backgroundImage=`url('${o}')`}}_initAnimationButtons(){const e=this.querySelectorShadow("#btnAction");e.addEventListener("click",(()=>{this._isOpened?this.closeBox():this.openBox(),this._isOpened=!this._isOpened}));const t=e.firstElementChild,n=r.a.getPatchedUrl("static/images/3d-viewer/action.svg");t.style.backgroundImage=`url('${n}')`}_initAnimationControls(){const e=this.querySelectorShadow("#playpause"),t=e.firstElementChild;let n=r.a.getPatchedUrl(s.f);t.style.backgroundImage=`url('${n}')`,e.addEventListener("click",(()=>{this.paused=!this.paused,this.paused?this.PauseAnimation():this.PlayAnimation(),this.__changePlayPauseIcon()}));const i=this.querySelectorShadow("#speedDiv");i.firstElementChild.style.backgroundImage=`url('${r.a.getPatchedUrl(s.i)}')`,i.addEventListener("click",(()=>{this.SetAnimationSpeed(1===this.speed?2:1)}))}_moveCamera(e,t){let n;if(this.params.saveDistanceWhenMoveCamera){const e=new window.THREE.Spherical,t=this.origamiViewer.camera.position;e.setFromVector3(new window.THREE.Vector3(t.y,t.z,t.x)),n=e.radius}this.origamiViewer.moveCamera(e,t,n)}applyInterfaceParams(e){const t=this.querySelectorShadow("#divControls");if(!0===e.showCameraButtons?t.style.display="flex":t.style.display="none",e.cameraButtons){const t=this.querySelectorAllShadow("div#cameraButtons div");Array.from(t).forEach((e=>e.style.display="none"));for(const[n,i]of Object.keys(e.cameraButtons).entries()){const e=i[0].toUpperCase()+i.toLowerCase().slice(1),t=this.querySelectorShadow(`div#cameraButtons [title='${e}']`);t.style.display="flex",0===n&&(this.querySelectorShadow("#cameraFront").classList.remove("selected"),t.classList.add("selected"),this._moveCamera(window.Aurigma.Origami.Camera.positions[i],!0)),t.style.order=`${n}`}}const n=this.querySelectorShadow("#divMultipleElements");!0===e.showAnimationButtons?n.style.display="block":n.style.display="none";const i=this.querySelectorShadow("#animationControls");!0===e.showAnimationControls?(i.style.display="flex",this.__initAnimationControls()):i.style.display="none",void 0===e.buttonsPosition||"left"===e.buttonsPosition?(t.style.order="0",n.style.marginTop="10px"):"right"===e.buttonsPosition?t.style.order="11":"top"===e.buttonsPosition&&(t.style.flexDirection="row",t.style.width="auto",t.style.justifyContent="space-between",n.style.marginLeft="10px",n.style.marginRight="10px",this.querySelectorShadow("#cameraButtons").style.display="inherit",this.querySelectorShadow("#divContainer").style.width="100%",t.style.paddingLeft="0px",t.style.paddingTop="0px",this.querySelectorShadow(".shell").style.flexDirection="column")}__initAnimationControls(){setTimeout((()=>{const e=this.querySelectorShadow("#progress");e.min=0,e.value=0,e.max=this.GetAnimationDuration()*this.__animTimeKoef,e.oninput=()=>{this.PauseAnimation(),this.SetAnimationAt(Number(e.value)/this.__animTimeKoef)},null!==this.__intervalValue&&clearInterval(this.__intervalValue),this.__intervalValue=setInterval((()=>{const t=this.origamiViewer.GetAnimationTime();0!==e.max&&"0"!==e.max||(e.max=this.GetAnimationDuration()*this.__animTimeKoef),0!==t&&t===e.max/this.__animTimeKoef&&this.params.pauseAtEnd&&(this.PauseAnimation(),e.value=e.max),!1===this.paused&&(e.value=t*this.__animTimeKoef)}),500)}),250)}openBox(){this.origamiViewer.animate()}closeBox(){this.origamiViewer.animate(!0)}GetAnimationDuration(){return this.origamiViewer.GetAnimationDuration()}SetAnimationAt(e){this.origamiViewer.SetAnimationAt(e),this.querySelectorShadow("#progress").value=e*this.__animTimeKoef}PlayAnimation(){!0===this.paused&&(this.paused=!1),this.origamiViewer.StartAnimation(),this.__changePlayPauseIcon()}PauseAnimation(){!1===this.paused&&(this.paused=!0),this.origamiViewer.PauseAnimation(),this.__changePlayPauseIcon()}__changePlayPauseIcon(){const e=this.querySelectorShadow("#playpause"),t=e.firstElementChild;let n=r.a.getPatchedUrl(this.paused?s.g:s.f);t.style.backgroundImage=`url('${n}')`,e.title=this.paused?"Play":"Pause"}SetAnimationSpeed(e){this.speed=e,this.origamiViewer.SetAnimationSpeed(e);const t=this.querySelectorShadow("#speedDiv"),n=t.firstElementChild,i=r.a.getPatchedUrl(1===this.speed?s.i:s.j);n.style.backgroundImage=`url('${i}')`,t.title=this.speed+"x speed"}}Object(i.a)([Object(o.c)(),Object(i.b)("design:type",String)],c.prototype,"image",void 0)},856:function(e,t){!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){!function(e){"use strict";function t(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}),Object.assign(t.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[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[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});var n,i,r,a,o,s,c,l,h,u=301,d=302,p=304,f=306,m=307,g=1e3,v=1001,y=1002,x=1003,b=1004,w=1005,_=1006,E=1007,T=1008,M=1009,S=1012,A=1014,R=1015,C=1016,L=1020,P=1022,N=1023,O=1026,I=1027,U=2001,D=2002,F=2003,B=2004,k=2100,H=2101,z=2102,G=2103,V=2400,j=3e3,W=3007,X={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var e=[],t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16).toUpperCase();return function(){var t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&i|128]+e[i>>8&255]+"-"+e[i>>16&255]+e[i>>24&255]+e[255&r]+e[r>>8&255]+e[r>>16&255]+e[r>>24&255]}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},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(e){return e*X.DEG2RAD},radToDeg:function(e){return e*X.RAD2DEG},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function q(e,t){this.x=e||0,this.y=t||0}function Y(){this.elements=[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.")}function Z(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}function J(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function K(){this.elements=[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.")}Object.defineProperties(q.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(q.prototype,{isVector2:!0,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)}return this},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 this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},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:(l=new q,h=new q,function(e,t){return l.set(e,e),h.set(t,t),this.clamp(l,h)}),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},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},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}}),Object.assign(Y.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,c,l,h,u,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[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 Y).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:(c=new J,function(e){var t=this.elements,n=e.elements,i=1/c.setFromMatrixColumn(e,0).length(),r=1/c.setFromMatrixColumn(e,1).length(),a=1/c.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=a*l,d=a*h,p=o*l,f=o*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=d+p*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=p+d*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,g=s*h,v=c*l,y=c*h;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*h,t[5]=a*l,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order)m=s*l,g=s*h,v=c*l,y=c*h,t[0]=m-y*o,t[4]=-a*h,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s;else if("ZYX"===e.order)u=a*l,d=a*h,p=o*l,f=o*h,t[0]=s*l,t[4]=p*c-d,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=d*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s;else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*h+w,t[10]=x-_*h}else"XZY"===e.order&&(x=a*s,b=a*c,w=o*s,_=o*c,t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+_,t[5]=a*l,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*l,t[10]=_*h+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,n=e._x,i=e._y,r=e._z,a=e._w,o=n+n,s=i+i,c=r+r,l=n*o,h=n*s,u=n*c,d=i*s,p=i*c,f=r*c,m=a*o,g=a*s,v=a*c;return t[0]=1-(d+f),t[4]=h-v,t[8]=u+g,t[1]=h+v,t[5]=1-(l+f),t[9]=p-m,t[2]=u-g,t[6]=p+m,t[10]=1-(l+d),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:(a=new J,o=new J,s=new J,function(e,t,n){var i=this.elements;return s.subVectors(e,t),0===s.lengthSq()&&(s.z=1),s.normalize(),a.crossVectors(n,s),0===a.lengthSq()&&(1===Math.abs(n.z)?s.x+=1e-4:s.z+=1e-4,s.normalize(),a.crossVectors(n,s)),a.normalize(),o.crossVectors(s,a),i[0]=a.x,i[4]=o.x,i[8]=s.x,i[1]=a.y,i[5]=o.y,i[9]=s.y,i[2]=a.z,i[6]=o.z,i[10]=s.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)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],E=i[8],T=i[12],M=i[1],S=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],N=i[14],O=i[3],I=i[7],U=i[11],D=i[15];return r[0]=a*w+o*M+s*C+c*O,r[4]=a*_+o*S+s*L+c*I,r[8]=a*E+o*A+s*P+c*U,r[12]=a*T+o*R+s*N+c*D,r[1]=l*w+h*M+u*C+d*O,r[5]=l*_+h*S+u*L+d*I,r[9]=l*E+h*A+u*P+d*U,r[13]=l*T+h*R+u*N+d*D,r[2]=p*w+f*M+m*C+g*O,r[6]=p*_+f*S+m*L+g*I,r[10]=p*E+f*A+m*P+g*U,r[14]=p*T+f*R+m*N+g*D,r[3]=v*w+y*M+x*C+b*O,r[7]=v*_+y*S+x*L+b*I,r[11]=v*E+y*A+x*P+b*U,r[15]=v*T+y*R+x*N+b*D,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},applyToBufferAttribute:function(){var e=new J;return function(t){for(var n=0,i=t.count;n<i;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix4(this),t.setXYZ(n,e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(+r*s*h-i*c*h-r*o*u+n*c*u+i*o*d-n*s*d)+e[7]*(+t*s*d-t*c*u+r*a*u-i*a*d+i*c*l-r*s*l)+e[11]*(+t*c*h-t*o*d-r*a*h+n*a*d+r*o*l-n*c*l)+e[15]*(-i*o*l-t*s*h+t*o*u+i*a*h-n*a*u+n*s*l)},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},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 n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],b=p*y*u-v*f*u+v*h*m-l*y*m-p*h*x+l*f*x,w=g*f*u-d*y*u-g*h*m+c*y*m+d*h*x-c*f*x,_=d*v*u-g*p*u+g*l*m-c*v*m-d*l*x+c*p*x,E=g*p*h-d*v*h-g*l*f+c*v*f+d*l*y-c*p*y,T=r*b+a*w+o*_+s*E;if(0===T){var M="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(M);return console.warn(M),this.identity()}var S=1/T;return n[0]=b*S,n[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*S,n[2]=(l*y*s-v*h*s+v*o*u-a*y*u-l*o*x+a*h*x)*S,n[3]=(p*h*s-l*f*s-p*o*u+a*f*u+l*o*m-a*h*m)*S,n[4]=w*S,n[5]=(d*y*s-g*f*s+g*o*m-r*y*m-d*o*x+r*f*x)*S,n[6]=(g*h*s-c*y*s-g*o*u+r*y*u+c*o*x-r*h*x)*S,n[7]=(c*f*s-d*h*s+d*o*u-r*f*u-c*o*m+r*h*m)*S,n[8]=_*S,n[9]=(g*p*s-d*v*s-g*a*m+r*v*m+d*a*x-r*p*x)*S,n[10]=(c*v*s-g*l*s+g*a*u-r*v*u-c*a*x+r*l*x)*S,n[11]=(d*l*s-c*p*s-d*a*u+r*p*u+c*a*m-r*l*m)*S,n[12]=E*S,n[13]=(d*v*o-g*p*o+g*a*f-r*v*f-d*a*y+r*p*y)*S,n[14]=(g*l*o-c*v*o-g*a*h+r*v*h+c*a*y-r*l*y)*S,n[15]=(c*p*o-d*l*o+d*a*h-r*p*h-c*a*f+r*l*f)*S,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,c=r*a,l=r*o;return this.set(c*a+n,c*o-i*s,c*s+i*o,0,c*o+i*s,l*o+n,l*s-i*a,0,c*s-i*o,l*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){return this.makeRotationFromQuaternion(t),this.scale(n),this.setPosition(e),this},decompose:(i=new J,r=new Y,function(e,t,n){var a=this.elements,o=i.set(a[0],a[1],a[2]).length(),s=i.set(a[4],a[5],a[6]).length(),c=i.set(a[8],a[9],a[10]).length();this.determinant()<0&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14],r.copy(this);var l=1/o,h=1/s,u=1/c;return r.elements[0]*=l,r.elements[1]*=l,r.elements[2]*=l,r.elements[4]*=h,r.elements[5]*=h,r.elements[6]*=h,r.elements[8]*=u,r.elements[9]*=u,r.elements[10]*=u,t.setFromRotationMatrix(r),n.x=o,n.y=s,n.z=c,this}),makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),h=(n+i)/(n-i),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),c=1/(n-i),l=1/(a-r),h=(t+e)*s,u=(n+i)*c,d=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}),Object.assign(Z,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],c=n[i+1],l=n[i+2],h=n[i+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(h!==f||s!==u||c!==d||l!==p){var m=1-o,g=s*u+c*d+l*p+h*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,c=c*m+d*w,l=l*m+p*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=_,c*=_,l*=_,h*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),Object.defineProperties(Z.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(Z.prototype,{set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(i/2),h=o(r/2),u=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===a?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"YXZ"===a?(this._x=u*l*h+c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"ZXY"===a?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h-u*d*p):"ZYX"===a?(this._x=u*l*h-c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h+u*d*p):"YZX"===a?(this._x=u*l*h+c*d*p,this._y=c*d*h+u*l*p,this._z=c*l*p-u*d*h,this._w=c*l*h-u*d*p):"XZY"===a&&(this._x=u*l*h-c*d*p,this._y=c*d*h-u*l*p,this._z=c*l*p+u*d*h,this._w=c*l*h+u*d*p),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],h=n[6],u=n[10],d=i+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-c)*t,this._y=(a-l)*t,this._z=(o-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-c)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+l)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(a-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(c+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(o-r)/t,this._x=(a+l)/t,this._y=(c+h)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new J;return function(n,i){return void 0===t&&(t=new J),(e=n.dot(i)+1)<1e-6?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},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)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+i*c-r*s,this._y=i*l+a*s+r*o-n*c,this._z=r*l+a*c+n*s-i*o,this._w=a*l-n*o-i*s-r*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,o),l=Math.sin((1-t)*c)/s,h=Math.sin(t*c)/s;return this._w=a*l+this._w*h,this._x=n*l+this._x*h,this._y=i*l+this._y*h,this._z=r*l+this._z*h,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(J.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,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)}return this},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 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:(n=new Z,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(n.setFromEuler(e))}),applyAxisAngle:function(){var e=new Z;return function(t,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*i-o*n,l=s*n+o*t-r*i,h=s*i+r*n-a*t,u=-r*t-a*n-o*i;return this.x=c*s+u*-r+l*-o-h*-a,this.y=l*s+u*-a+h*-r-c*-o,this.z=h*s+u*-o+c*-a-l*-r,this},project:function(){var e=new Y;return function(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new Y;return function(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},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=new J,t=new J;return function(n,i){return e.set(n,n,n),t.set(i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},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,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new J;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new J;return function(t){return 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(X.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},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},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(K.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=i,l[2]=o,l[3]=t,l[4]=r,l[5]=s,l[6]=n,l[7]=a,l[8]=c,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=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e=new J;return function(t){for(var n=0,i=t.count;n<i;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix3(this),t.setXYZ(n,e.x,e.y,e.z);return t}}(),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*w,r[6]=a*g+o*x+s*_,r[1]=c*f+l*v+h*b,r[4]=c*m+l*y+h*w,r[7]=c*g+l*x+h*_,r[2]=u*f+d*v+p*b,r[5]=u*m+d*y+p*w,r[8]=u*g+d*x+p*_,this},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],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*r*l+n*o*s+i*r*c-i*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],p=d*c-l*u,f=l*h-d*s,m=u*s-c*h,g=r*p+a*f+o*m;if(0===g){var v="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return i[0]=p*y,i[1]=(o*u-d*a)*y,i[2]=(l*a-o*c)*y,i[3]=f*y,i[4]=(d*r-o*h)*y,i[5]=(o*s-l*r)*y,i[6]=m*y,i[7]=(a*h-u*r)*y,i[8]=(c*r-a*s)*y,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},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},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},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-i*c,i*s,-i*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],c=i[4],l=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*c,i[6]=t*o+n*l,i[1]=-n*r+t*s,i[4]=-n*a+t*c,i[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Q=0;function $(e,t,n,i,r,a,o,s,c,l){Object.defineProperty(this,"id",{value:Q++}),this.uuid=X.generateUUID(),this.name="",this.image=void 0!==e?e:$.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:$.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:v,this.wrapT=void 0!==i?i:v,this.magFilter=void 0!==r?r:_,this.minFilter=void 0!==a?a:T,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:N,this.type=void 0!==s?s:M,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new K,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:j,this.version=0,this.onUpdate=null}function ee(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function te(e,t,n){this.uuid=X.generateUUID(),this.width=e,this.height=t,this.scissor=new ee(0,0,e,t),this.scissorTest=!1,this.viewport=new ee(0,0,e,t),void 0===(n=n||{}).minFilter&&(n.minFilter=_),this.texture=new $(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function ne(e,t,n){te.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function ie(e,t,n,i,r,a,o,s,c,l,h,u){$.call(this,null,a,o,s,c,l,i,r,h,u),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:x,this.minFilter=void 0!==l?l:x,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function re(e,t,n,i,r,a,o,s,c,l){e=void 0!==e?e:[],t=void 0!==t?t:u,$.call(this,e,t,n,i,r,a,o,s,c,l),this.flipY=!1}$.DEFAULT_IMAGE=void 0,$.DEFAULT_MAPPING=300,$.prototype=Object.assign(Object.create(t.prototype),{constructor:$,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,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.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,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],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=X.generateUUID()),t||void 0!==e.images[i.uuid]||(e.images[i.uuid]={uuid:i.uuid,url:function(e){var t;if(e instanceof HTMLCanvasElement)t=e;else{(t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).width=e.width,t.height=e.height;var n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height)}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(i)}),n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case g:e.x=e.x-Math.floor(e.x);break;case v:e.x=e.x<0?0:1;break;case y:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case g:e.y=e.y-Math.floor(e.y);break;case v:e.y=e.y<0?0:1;break;case y:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.defineProperty($.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(ee.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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)}return this},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 this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,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 t<1e-4?(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,n,i,r,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(u+p)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+l)/4,x=(c+d)/4,b=(u+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=b/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=b/r),this.set(n,i,r,t),this}var w=Math.sqrt((p-u)*(p-u)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(w)<.001&&(w=1),this.x=(p-u)/w,this.y=(c-d)/w,this.z=(l-s)/w,this.w=Math.acos((o+h+f-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(n,i){return void 0===e&&(e=new ee,t=new ee),e.set(n,n,n,n),t.set(i,i,i,i),this.clamp(e,t)}}(),clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},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)},manhattanLength: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()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},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,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},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},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),te.prototype=Object.assign(Object.create(t.prototype),{constructor:te,isWebGLRenderTarget:!0,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.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),ne.prototype=Object.create(te.prototype),ne.prototype.constructor=ne,ne.prototype.isWebGLRenderTargetCube=!0,ie.prototype=Object.create($.prototype),ie.prototype.constructor=ie,ie.prototype.isDataTexture=!0,re.prototype=Object.create($.prototype),re.prototype.constructor=re,re.prototype.isCubeTexture=!0,Object.defineProperty(re.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var ae=new $,oe=new re;function se(){this.seq=[],this.map={}}var ce=[],le=[],he=new Float32Array(16),ue=new Float32Array(9);function de(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=ce[r];if(void 0===a&&(a=new Float32Array(r),ce[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function pe(e,t){var n=le[t];void 0===n&&(n=new Int32Array(t),le[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocTextureUnit();return n}function fe(e,t){e.uniform1f(this.addr,t)}function me(e,t){e.uniform1i(this.addr,t)}function ge(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function ve(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function ye(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function xe(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function be(e,t){void 0===t.elements?e.uniformMatrix3fv(this.addr,!1,t):(ue.set(t.elements),e.uniformMatrix3fv(this.addr,!1,ue))}function we(e,t){void 0===t.elements?e.uniformMatrix4fv(this.addr,!1,t):(he.set(t.elements),e.uniformMatrix4fv(this.addr,!1,he))}function _e(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTexture2D(t||ae,i)}function Ee(e,t,n){var i=n.allocTextureUnit();e.uniform1i(this.addr,i),n.setTextureCube(t||oe,i)}function Te(e,t){e.uniform2iv(this.addr,t)}function Me(e,t){e.uniform3iv(this.addr,t)}function Se(e,t){e.uniform4iv(this.addr,t)}function Ae(e,t){e.uniform1fv(this.addr,t)}function Re(e,t){e.uniform1iv(this.addr,t)}function Ce(e,t){e.uniform2fv(this.addr,de(t,this.size,2))}function Le(e,t){e.uniform3fv(this.addr,de(t,this.size,3))}function Pe(e,t){e.uniform4fv(this.addr,de(t,this.size,4))}function Ne(e,t){e.uniformMatrix2fv(this.addr,!1,de(t,this.size,4))}function Oe(e,t){e.uniformMatrix3fv(this.addr,!1,de(t,this.size,9))}function Ie(e,t){e.uniformMatrix4fv(this.addr,!1,de(t,this.size,16))}function Ue(e,t,n){var i=t.length,r=pe(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTexture2D(t[a]||ae,r[a])}function De(e,t,n){var i=t.length,r=pe(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.setTextureCube(t[a]||oe,r[a])}function Fe(e,t,n){this.id=e,this.addr=n,this.setValue=function(e){switch(e){case 5126:return fe;case 35664:return ge;case 35665:return ve;case 35666:return ye;case 35674:return xe;case 35675:return be;case 35676:return we;case 35678:case 36198:return _e;case 35680:return Ee;case 5124:case 35670:return me;case 35667:case 35671:return Te;case 35668:case 35672:return Me;case 35669:case 35673:return Se}}(t.type)}function Be(e,t,n){this.id=e,this.addr=n,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ae;case 35664:return Ce;case 35665:return Le;case 35666:return Pe;case 35674:return Ne;case 35675:return Oe;case 35676:return Ie;case 35678:return Ue;case 35680:return De;case 5124:case 35670:return Re;case 35667:case 35671:return Te;case 35668:case 35672:return Me;case 35669:case 35673:return Se}}(t.type)}function ke(e){this.id=e,se.call(this)}ke.prototype.setValue=function(e,t){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var a=n[i];a.setValue(e,t[a.id])}};var He=/([\w\d_]+)(\])?(\[|\.)?/g;function ze(e,t){e.seq.push(t),e.map[t.id]=t}function Ge(e,t,n){var i=e.name,r=i.length;for(He.lastIndex=0;;){var a=He.exec(i),o=He.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===r){ze(n,void 0===l?new Fe(s,e,t):new Be(s,e,t));break}var h=n.map[s];void 0===h&&ze(n,h=new ke(s)),n=h}}function Ve(e,t,n){se.call(this),this.renderer=n;for(var i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=0;r<i;++r){var a=e.getActiveUniform(t,r),o=a.name;Ge(a,e.getUniformLocation(t,o),this)}}Ve.prototype.setValue=function(e,t,n){var i=this.map[t];void 0!==i&&i.setValue(e,n,this.renderer)},Ve.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},Ve.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},Ve.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var je={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function We(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Object.assign(We.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},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,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(){function e(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}return function(t,n,i){if(t=X.euclideanModulo(t,1),n=X.clamp(n,0,1),i=X.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,a=2*i-r;this.r=e(a,r,t+1/3),this.g=e(a,r,t),this.b=e(a,r,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 n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l,h=(l=n[1]).length;if(3===h)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===h)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}return e&&e.length>0&&(void 0!==(l=je[e])?this.setHex(l):console.warn("THREE.Color: Unknown color "+e)),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 n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,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},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,i=e||{h:0,s:0,l:0},r=this.r,a=this.g,o=this.b,s=Math.max(r,a,o),c=Math.min(r,a,o),l=(c+s)/2;if(c===s)t=0,n=0;else{var h=s-c;switch(n=l<=.5?h/(s+c):h/(2-s-c),s){case r:t=(a-o)/h+(a<o?6:0);break;case a:t=(o-r)/h+2;break;case o:t=(r-a)/h+4}t/=6}return i.h=t,i.s=n,i.l=l,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=n,this.setHSL(i.h,i.s,i.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},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),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},toJSON:function(){return this.getHex()}});var Xe={common:{diffuse:{value:new We(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new K},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new q(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new We(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new We(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new K}}},qe={merge:function(e){for(var t={},n=0;n<e.length;n++){var i=this.clone(e[n]);for(var r in i)t[r]=i[r]}return t},clone:function(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}},Ye={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale =  bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:"  gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M      = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM            = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D      = max( maxRange / maxRGB, 1.0 );\n\tD            = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n  varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3(   1,   0, t.y ),\n\t\t\tvec3(   0, t.z,   0 ),\n\t\t\tvec3( t.w,   0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n  gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",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\tvarying vec2 vUv;\n#endif",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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",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\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n"},Ze={basic:{uniforms:qe.merge([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:qe.merge([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.fog,Xe.lights,{emissive:{value:new We(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:qe.merge([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.gradientmap,Xe.fog,Xe.lights,{emissive:{value:new We(0)},specular:{value:new We(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:qe.merge([Xe.common,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.roughnessmap,Xe.metalnessmap,Xe.fog,Xe.lights,{emissive:{value:new We(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},points:{uniforms:qe.merge([Xe.points,Xe.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:qe.merge([Xe.common,Xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:qe.merge([Xe.common,Xe.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:qe.merge([Xe.common,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.normal_vert,fragmentShader:Ye.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:qe.merge([Xe.common,Xe.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:qe.merge([Xe.lights,Xe.fog,{color:{value:new We(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};function Je(e,t){this.min=void 0!==e?e:new q(1/0,1/0),this.max=void 0!==t?t:new q(-1/0,-1/0)}function Ke(e,t,n,i,r){var a,o,s,c,l,h,u,d;function p(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),i=new Uint16Array([0,1,2,0,2,3]);a=t.createBuffer(),o=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.STATIC_DRAW),u=t.createTexture(),d=t.createTexture(),n.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),n.bindTexture(t.TEXTURE_2D,d),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),s={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() {","\tvUV = uv;","\tvec2 pos = position;","\tif ( renderType == 2 ) {","\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","\t\tvVisibility =        visibility.r / 9.0;","\t\tvVisibility *= 1.0 - visibility.g / 9.0;","\t\tvVisibility *=       visibility.b / 9.0;","\t\tvVisibility *= 1.0 - visibility.a / 9.0;","\t\tpos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","\t\tpos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","\t}","\tgl_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() {","\tif ( renderType == 0 ) {","\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","\t} else if ( renderType == 1 ) {","\t\tgl_FragColor = texture2D( map, vUV );","\t} else {","\t\tvec4 texture = texture2D( map, vUV );","\t\ttexture.a *= opacity * vVisibility;","\t\tgl_FragColor = texture;","\t\tgl_FragColor.rgb *= color;","\t}","}"].join("\n")},c=function(e){var n=t.createProgram(),i=t.createShader(t.FRAGMENT_SHADER),a=t.createShader(t.VERTEX_SHADER),o="precision "+r.precision+" float;\n";return t.shaderSource(i,o+e.fragmentShader),t.shaderSource(a,o+e.vertexShader),t.compileShader(i),t.compileShader(a),t.attachShader(n,i),t.attachShader(n,a),t.linkProgram(n),n}(s),l={vertex:t.getAttribLocation(c,"position"),uv:t.getAttribLocation(c,"uv")},h={renderType:t.getUniformLocation(c,"renderType"),map:t.getUniformLocation(c,"map"),occlusionMap:t.getUniformLocation(c,"occlusionMap"),opacity:t.getUniformLocation(c,"opacity"),color:t.getUniformLocation(c,"color"),scale:t.getUniformLocation(c,"scale"),rotation:t.getUniformLocation(c,"rotation"),screenPosition:t.getUniformLocation(c,"screenPosition")}}this.render=function(e,r,s,f){if(0!==e.length){var m=new J,g=f.w/f.z,v=.5*f.z,y=.5*f.w,x=16/f.w,b=new q(x*g,x),w=new J(1,1,0),_=new q(1,1),E=new Je;E.min.set(f.x,f.y),E.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===c&&p(),n.useProgram(c),n.initAttributes(),n.enableAttribute(l.vertex),n.enableAttribute(l.uv),n.disableUnusedAttributes(),t.uniform1i(h.occlusionMap,0),t.uniform1i(h.map,1),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(l.vertex,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(l.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),n.disable(t.CULL_FACE),n.buffers.depth.setMask(!1);for(var T=0,M=e.length;T<M;T++){x=16/f.w,b.set(x*g,x);var S=e[T];if(m.set(S.matrixWorld.elements[12],S.matrixWorld.elements[13],S.matrixWorld.elements[14]),m.applyMatrix4(s.matrixWorldInverse),m.applyMatrix4(s.projectionMatrix),w.copy(m),_.x=f.x+w.x*v+v-8,_.y=f.y+w.y*y+y-8,!0===E.containsPoint(_)){n.activeTexture(t.TEXTURE0),n.bindTexture(t.TEXTURE_2D,null),n.activeTexture(t.TEXTURE1),n.bindTexture(t.TEXTURE_2D,u),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGB,_.x,_.y,16,16,0),t.uniform1i(h.renderType,0),t.uniform2f(h.scale,b.x,b.y),t.uniform3f(h.screenPosition,w.x,w.y,w.z),n.disable(t.BLEND),n.enable(t.DEPTH_TEST),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),n.activeTexture(t.TEXTURE0),n.bindTexture(t.TEXTURE_2D,d),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,_.x,_.y,16,16,0),t.uniform1i(h.renderType,1),n.disable(t.DEPTH_TEST),n.activeTexture(t.TEXTURE1),n.bindTexture(t.TEXTURE_2D,u),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),S.positionScreen.copy(w),S.customUpdateCallback?S.customUpdateCallback(S):S.updateLensFlares(),t.uniform1i(h.renderType,2),n.enable(t.BLEND);for(var A=0,R=S.lensFlares.length;A<R;A++){var C=S.lensFlares[A];C.opacity>.001&&C.scale>.001&&(w.x=C.x,w.y=C.y,w.z=C.z,x=C.size*C.scale/f.w,b.x=x*g,b.y=x,t.uniform3f(h.screenPosition,w.x,w.y,w.z),t.uniform2f(h.scale,b.x,b.y),t.uniform1f(h.rotation,C.rotation),t.uniform1f(h.opacity,C.opacity),t.uniform3f(h.color,C.color.r,C.color.g,C.color.b),n.setBlending(C.blending,C.blendEquation,C.blendSrc,C.blendDst),i.setTexture2D(C.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}n.enable(t.CULL_FACE),n.enable(t.DEPTH_TEST),n.buffers.depth.setMask(!0),n.reset()}}}function Qe(e,t,n,i,r,a,o,s,c){$.call(this,e,t,n,i,r,a,o,s,c),this.needsUpdate=!0}function $e(e,t,n,i,r){var a,o,s,c,l,h,u=new J,d=new Z,p=new J;function f(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);a=t.createBuffer(),o=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW),s=function(){var e=t.createProgram(),n=t.createShader(t.VERTEX_SHADER),i=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(n,["precision "+r.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = position * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),t.shaderSource(i,["precision "+r.precision+" float;","#define SHADER_NAME SpriteMaterial","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;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),t.compileShader(n),t.compileShader(i),t.attachShader(e,n),t.attachShader(e,i),t.linkProgram(e),e}(),c={position:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},l={uvOffset:t.getUniformLocation(s,"uvOffset"),uvScale:t.getUniformLocation(s,"uvScale"),rotation:t.getUniformLocation(s,"rotation"),scale:t.getUniformLocation(s,"scale"),color:t.getUniformLocation(s,"color"),map:t.getUniformLocation(s,"map"),opacity:t.getUniformLocation(s,"opacity"),modelViewMatrix:t.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(s,"projectionMatrix"),fogType:t.getUniformLocation(s,"fogType"),fogDensity:t.getUniformLocation(s,"fogDensity"),fogNear:t.getUniformLocation(s,"fogNear"),fogFar:t.getUniformLocation(s,"fogFar"),fogColor:t.getUniformLocation(s,"fogColor"),fogDepth:t.getUniformLocation(s,"fogDepth"),alphaTest:t.getUniformLocation(s,"alphaTest")};var i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=8,i.height=8;var u=i.getContext("2d");u.fillStyle="white",u.fillRect(0,0,8,8),h=new Qe(i)}function m(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(r,g,v){if(0!==r.length){void 0===s&&f(),n.useProgram(s),n.initAttributes(),n.enableAttribute(c.position),n.enableAttribute(c.uv),n.disableUnusedAttributes(),n.disable(t.CULL_FACE),n.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(c.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(c.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,o),t.uniformMatrix4fv(l.projectionMatrix,!1,v.projectionMatrix.elements),n.activeTexture(t.TEXTURE0),t.uniform1i(l.map,0);var y=0,x=0,b=g.fog;b?(t.uniform3f(l.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(t.uniform1f(l.fogNear,b.near),t.uniform1f(l.fogFar,b.far),t.uniform1i(l.fogType,1),y=1,x=1):b.isFogExp2&&(t.uniform1f(l.fogDensity,b.density),t.uniform1i(l.fogType,2),y=2,x=2)):(t.uniform1i(l.fogType,0),y=0,x=0);for(var w=0,_=r.length;w<_;w++)(T=r[w]).modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,T.matrixWorld),T.z=-T.modelViewMatrix.elements[14];r.sort(m);var E=[];for(w=0,_=r.length;w<_;w++){var T,M=(T=r[w]).material;if(!1!==M.visible){T.onBeforeRender(e,g,v,void 0,M,void 0),t.uniform1f(l.alphaTest,M.alphaTest),t.uniformMatrix4fv(l.modelViewMatrix,!1,T.modelViewMatrix.elements),T.matrixWorld.decompose(u,d,p),E[0]=p.x,E[1]=p.y;var S=0;g.fog&&M.fog&&(S=x),y!==S&&(t.uniform1i(l.fogType,S),y=S),null!==M.map?(t.uniform2f(l.uvOffset,M.map.offset.x,M.map.offset.y),t.uniform2f(l.uvScale,M.map.repeat.x,M.map.repeat.y)):(t.uniform2f(l.uvOffset,0,0),t.uniform2f(l.uvScale,1,1)),t.uniform1f(l.opacity,M.opacity),t.uniform3f(l.color,M.color.r,M.color.g,M.color.b),t.uniform1f(l.rotation,M.rotation),t.uniform2fv(l.scale,E),n.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst,M.blendEquationAlpha,M.blendSrcAlpha,M.blendDstAlpha,M.premultipliedAlpha),n.buffers.depth.setTest(M.depthTest),n.buffers.depth.setMask(M.depthWrite),n.buffers.color.setMask(M.colorWrite),i.setTexture2D(M.map||h,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),T.onAfterRender(e,g,v,void 0,M,void 0)}}n.enable(t.CULL_FACE),n.reset()}}}Ze.physical={uniforms:qe.merge([Ze.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},Object.assign(Je.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new q;return function(t,n){var i=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),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},getCenter:function(e){var t=e||new q;return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new q;return this.isEmpty()?t.set(0,0):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)},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},getParameter:function(e,t){return(t||new q).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)},clampPoint:function(e,t){return(t||new q).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new q;return function(t){return e.copy(t).clamp(this.min,this.max).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)}}),Qe.prototype=Object.create($.prototype),Qe.prototype.constructor=Qe;var et,tt,nt,it,rt,at,ot,st=0;function ct(){Object.defineProperty(this,"id",{value:st++}),this.uuid=X.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function lt(e){ct.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}function ht(e){ct.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new J,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ut(e,t){this.min=void 0!==e?e:new J(1/0,1/0,1/0),this.max=void 0!==t?t:new J(-1/0,-1/0,-1/0)}function dt(e,t){this.center=void 0!==e?e:new J,this.radius=void 0!==t?t:0}function pt(e,t){this.normal=void 0!==e?e:new J(1,0,0),this.constant=void 0!==t?t:0}function ft(e,t,n,i,r,a){this.planes=[void 0!==e?e:new pt,void 0!==t?t:new pt,void 0!==n?n:new pt,void 0!==i?i:new pt,void 0!==r?r:new pt,void 0!==a?a:new pt]}function mt(e,t,n){for(var i=new ft,r=new Y,a=new q,o=new q(n,n),s=new J,c=new J,l=new Array(4),h=new Array(4),u={},d=[new J(1,0,0),new J(-1,0,0),new J(0,0,1),new J(0,0,-1),new J(0,1,0),new J(0,-1,0)],p=[new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,0,1),new J(0,0,-1)],f=[new ee,new ee,new ee,new ee,new ee,new ee],m=0;4!==m;++m){var g=!!(1&m),v=!!(2&m),y=new lt({depthPacking:3201,morphTargets:g,skinning:v});l[m]=y;var b=new ht({morphTargets:g,skinning:v});h[m]=b}var w=this;function _(t,n,i,r,a,o){var s=t.geometry,c=null,d=l,p=t.customDepthMaterial;if(i&&(d=h,p=t.customDistanceMaterial),p)c=p;else{var f=!1;n.morphTargets&&(s&&s.isBufferGeometry?f=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(f=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var m=0;f&&(m|=1),t.isSkinnedMesh&&n.skinning&&(m|=2),c=d[m]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var g=c.uuid,v=n.uuid,y=u[g];void 0===y&&(y={},u[g]=y);var x=y[v];void 0===x&&(x=c.clone(),y[v]=x),c=x}c.visible=n.visible,c.wireframe=n.wireframe;var b=n.side;return w.renderSingleSided&&2==b&&(b=0),w.renderReverseSided&&(0===b?b=1:1===b&&(b=0)),c.side=b,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,i&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(r),c.nearDistance=a,c.farDistance=o),c}function E(n,r,a,o){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var s=t.update(n),l=n.material;if(Array.isArray(l))for(var h=s.groups,u=0,d=h.length;u<d;u++){var p=h[u],f=l[p.materialIndex];if(f&&f.visible){var m=_(n,f,o,c,a.near,a.far);e.renderBufferDirect(a,null,s,m,n,p)}}else l.visible&&(m=_(n,l,o,c,a.near,a.far),e.renderBufferDirect(a,null,s,m,n,null))}for(var g=n.children,v=0,y=g.length;v<y;v++)E(g[v],r,a,o)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(t,n,l){if(!1!==w.enabled&&(!1!==w.autoUpdate||!1!==w.needsUpdate)&&0!==t.length){var h,u=e.context,m=e.state;m.disable(u.BLEND),m.buffers.color.setClear(1,1,1,1),m.buffers.depth.setTest(!0),m.setScissorTest(!1);for(var g=0,v=t.length;g<v;g++){var y=t[g],b=y.shadow,_=y&&y.isPointLight;if(void 0!==b){var T=b.camera;if(a.copy(b.mapSize),a.min(o),_){var M=a.x,S=a.y;f[0].set(2*M,S,M,S),f[1].set(0,S,M,S),f[2].set(3*M,S,M,S),f[3].set(M,S,M,S),f[4].set(3*M,0,M,S),f[5].set(M,0,M,S),a.x*=4,a.y*=2}if(null===b.map){var A={minFilter:x,magFilter:x,format:N};b.map=new te(a.x,a.y,A),b.map.texture.name=y.name+".shadowMap",T.updateProjectionMatrix()}b.isSpotLightShadow&&b.update(y);var R=b.map,C=b.matrix;c.setFromMatrixPosition(y.matrixWorld),T.position.copy(c),_?(h=6,C.makeTranslation(-c.x,-c.y,-c.z)):(h=1,s.setFromMatrixPosition(y.target.matrixWorld),T.lookAt(s),T.updateMatrixWorld(),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(T.projectionMatrix),C.multiply(T.matrixWorldInverse)),e.setRenderTarget(R),e.clear();for(var L=0;L<h;L++){if(_){s.copy(T.position),s.add(d[L]),T.up.copy(p[L]),T.lookAt(s),T.updateMatrixWorld();var P=f[L];m.viewport(P)}r.multiplyMatrices(T.projectionMatrix,T.matrixWorldInverse),i.setFromMatrix(r),E(n,l,T,_)}}else console.warn("THREE.WebGLShadowMap:",y,"has no shadow.")}w.needsUpdate=!1}}}function gt(e){var t={};return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t[e.uuid]},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=t[n.uuid];i&&(e.deleteBuffer(i.buffer),delete t[n.uuid])},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=t[n.uuid];void 0===r?t[n.uuid]=function(t,n){var i=t.array,r=t.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=e.FLOAT;return i instanceof Float32Array?o=e.FLOAT:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=e.UNSIGNED_SHORT:i instanceof Int16Array?o=e.SHORT:i instanceof Uint32Array?o=e.UNSIGNED_INT:i instanceof Int32Array?o=e.INT:i instanceof Int8Array?o=e.BYTE:i instanceof Uint8Array&&(o=e.UNSIGNED_BYTE),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(n,i):r.version<n.version&&(function(t,n,i){var r=n.array,a=n.updateRange;e.bindBuffer(i,t),!1===n.dynamic?e.bufferData(i,r,e.STATIC_DRAW):-1===a.count?e.bufferSubData(i,0,r):0===a.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(i,a.offset*r.BYTES_PER_ELEMENT,r.subarray(a.offset,a.offset+a.count)),a.count=-1)}(r.buffer,n,i),r.version=n.version)}}}function vt(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||vt.DefaultOrder}function yt(){this.mask=1}ct.prototype=Object.assign(Object.create(t.prototype),{constructor:ct,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]="overdraw"===t?Number(n):n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearCoat&&(n.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),0!==this.vertexColors&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,0!==this.rotation&&(n.rotation=this.rotation),1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,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.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),lt.prototype=Object.create(ct.prototype),lt.prototype.constructor=lt,lt.prototype.isMeshDepthMaterial=!0,lt.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},ht.prototype=Object.create(ct.prototype),ht.prototype.constructor=ht,ht.prototype.isMeshDistanceMaterial=!0,ht.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Object.assign(ut.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<n&&(n=h),u<i&&(i=u),l>r&&(r=l),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<n&&(n=h),u<i&&(i=u),l>r&&(r=l),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new J;return function(t,n){var i=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},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},getCenter:function(e){var t=e||new J;return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){var t=e||new J;return this.isEmpty()?t.set(0,0,0):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},expandByObject:function(){var e,t,n,i=new J;function r(r){var a=r.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(t=0,n=o.length;t<n;t++)i.copy(o[t]),i.applyMatrix4(r.matrixWorld),e.expandByPoint(i)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(t=0,n=s.count;t<n;t++)i.fromBufferAttribute(s,t).applyMatrix4(r.matrixWorld),e.expandByPoint(i)}}return function(t){return e=this,t.updateMatrixWorld(!0),t.traverse(r),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)},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},getParameter:function(e,t){return(t||new J).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)},intersectsSphere:(ot=new J,function(e){return this.clampPoint(e.center,ot),ot.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=e.constant&&n>=e.constant},clampPoint:function(e,t){return(t||new J).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new J;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new J;return function(t){var n=t||new dt;return this.getCenter(n.center),n.radius=.5*this.getSize(e).length(),n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(at=[new J,new J,new J,new J,new J,new J,new J,new J],function(e){return this.isEmpty()||(at[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),at[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),at[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),at[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),at[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),at[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),at[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),at[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(at)),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)}}),Object.assign(dt.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(rt=new ut,function(e,t){var n=this.center;void 0!==t?n.copy(t):rt.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));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(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e),i=t||new J;return i.copy(e),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new ut;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}}),Object.assign(pt.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new J,t=new J;return function(n,i,r){var a=e.subVectors(r,i).cross(t.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),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(t||new J).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new J;return function(t,n){var i=n||new J,r=t.delta(e),a=this.normal.dot(r);if(0===a)return 0===this.distanceToPoint(t.start)?i.copy(t.start):void 0;var o=-(t.start.dot(this.normal)+this.constant)/a;return o<0||o>1?void 0:i.copy(r).multiplyScalar(o).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new J).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new J,t=new K;return function(n,i){var r=i||t.getNormalMatrix(n),a=this.coplanarPoint(e).applyMatrix4(n),o=this.normal.applyMatrix3(r).normalize();return this.constant=-a.dot(o),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(ft.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,h-s,f-u,y-m).normalize(),t[1].setComponents(o+i,h+s,f+u,y+m).normalize(),t[2].setComponents(o+r,h+c,f+d,y+g).normalize(),t[3].setComponents(o-r,h-c,f-d,y-g).normalize(),t[4].setComponents(o-a,h-l,f-p,y-v).normalize(),t[5].setComponents(o+a,h+l,f+p,y+v).normalize(),this},intersectsObject:(it=new dt,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),it.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(it)}),intersectsSprite:function(){var e=new dt;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0},intersectsBox:(tt=new J,nt=new J,function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];tt.x=i.normal.x>0?e.min.x:e.max.x,nt.x=i.normal.x>0?e.max.x:e.min.x,tt.y=i.normal.y>0?e.min.y:e.max.y,nt.y=i.normal.y>0?e.max.y:e.min.y,tt.z=i.normal.z>0?e.min.z:e.max.z,nt.z=i.normal.z>0?e.max.z:e.min.z;var r=i.distanceToPoint(tt),a=i.distanceToPoint(nt);if(r<0&&a<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}}),vt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],vt.DefaultOrder="XYZ",Object.defineProperties(vt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(vt.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||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,n){var i=X.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],c=r[1],l=r[5],h=r[9],u=r[2],d=r[6],p=r[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===t?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new Y;return function(t,n,i){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,i)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(et=new Z,function(e){return et.setFromEuler(this),this.setFromQuaternion(et,e)}),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 J(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(yt.prototype,{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!!(this.mask&e.mask)}});var xt,bt,wt,_t,Et=0;function Tt(){Object.defineProperty(this,"id",{value:Et++}),this.uuid=X.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tt.DefaultUp.clone();var e=new J,t=new vt,n=new Z,i=new J(1,1,1);t.onChange((function(){n.setFromEuler(t,!1)})),n.onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:n},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new Y},normalMatrix:{value:new K}}),this.matrix=new Y,this.matrixWorld=new Y,this.matrixAutoUpdate=Tt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new yt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Mt(){Tt.call(this),this.type="Camera",this.matrixWorldInverse=new Y,this.projectionMatrix=new Y}function St(e,t,n,i,r,a){Mt.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function At(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new J,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new We,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Tt.DefaultUp=new J(0,1,0),Tt.DefaultMatrixAutoUpdate=!0,Tt.prototype=Object.assign(Object.create(t.prototype),{constructor:Tt,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},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:(_t=new Z,function(e,t){return _t.setFromAxisAngle(e,t),this.quaternion.multiply(_t),this}),rotateOnWorldAxis:function(){var e=new Z;return function(t,n){return e.setFromAxisAngle(t,n),this.quaternion.premultiply(e),this}}(),rotateX:function(){var e=new J(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new J(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new J(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new J;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new J(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new J(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new J(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(wt=new Y,function(e){return e.applyMatrix4(wt.getInverse(this.matrixWorld))}),lookAt:function(){var e=new Y,t=new J;return function(n,i,r){n.isVector3?t.copy(n):t.set(n,i,r),this.isCamera?e.lookAt(this.position,t,this.up):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&&e.isObject3D?(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]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,e.dispatchEvent({type:"removed"}),this.children.splice(n,1)),this},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 n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){var t=e||new J;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:(xt=new J,bt=new J,function(e){var t=e||new Z;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(xt,t,bt),t}),getWorldRotation:function(){var e=new Z;return function(t){var n=t||new vt;return this.getWorldQuaternion(e),n.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new J,t=new Z;return function(n){var i=n||new J;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(){var e=new Z;return function(t){var n=t||new J;return this.getWorldQuaternion(e),n.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].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&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.matrix=this.matrix.toArray(),void 0!==this.geometry){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];r(e.shapes,l)}else r(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,c=this.material.length;s<c;s++)h.push(r(e.materials,this.material[s]));i.material=h}else i.material=r(e.materials,this.material);if(this.children.length>0)for(i.children=[],s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object);if(t){var u=m(e.geometries),d=m(e.materials),p=m(e.textures),f=m(e.images);o=m(e.shapes),u.length>0&&(n.geometries=u),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},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.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,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)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),Mt.prototype=Object.assign(Object.create(Tt.prototype),{constructor:Mt,isCamera:!0,copy:function(e,t){return Tt.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},getWorldDirection:function(){var e=new Z;return function(t){var n=t||new J;return this.getWorldQuaternion(e),n.set(0,0,-1).applyQuaternion(e)}}(),updateMatrixWorld:function(e){Tt.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),St.prototype=Object.assign(Object.create(Mt.prototype),{constructor:St,isOrthographicCamera:!0,copy:function(e,t){return Mt.prototype.copy.call(this,e,t),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.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;a=(r+=h*(this.view.offsetX/c))+h*(this.view.width/c),s=(o-=u*(this.view.offsetY/l))-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far)},toJSON:function(e){var t=Tt.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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),Object.assign(At.prototype,{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,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Rt,Ct=0;function Lt(){Object.defineProperty(this,"id",{value:Ct+=2}),this.uuid=X.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.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Pt(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=X.generateUUID(),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Nt(e,t,n){Pt.call(this,new Int8Array(e),t,n)}function Ot(e,t,n){Pt.call(this,new Uint8Array(e),t,n)}function It(e,t,n){Pt.call(this,new Uint8ClampedArray(e),t,n)}function Ut(e,t,n){Pt.call(this,new Int16Array(e),t,n)}function Dt(e,t,n){Pt.call(this,new Uint16Array(e),t,n)}function Ft(e,t,n){Pt.call(this,new Int32Array(e),t,n)}function Bt(e,t,n){Pt.call(this,new Uint32Array(e),t,n)}function kt(e,t,n){Pt.call(this,new Float32Array(e),t,n)}function Ht(e,t,n){Pt.call(this,new Float64Array(e),t,n)}function zt(){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}function Gt(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Lt.prototype=Object.assign(Object.create(t.prototype),{constructor:Lt,isGeometry:!0,applyMatrix:function(e){for(var t=(new K).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(e);for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e=new Y;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new Y;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new Y;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new Y;return function(t,n,i){return e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e=new Y;return function(t,n,i){return e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:(Rt=new Tt,function(e){Rt.lookAt(e),Rt.updateMatrix(),this.applyMatrix(Rt.matrix)}),fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,i=e.attributes,r=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,o=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,c=void 0!==i.uv2?i.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=[],h=[],u=[],d=0,p=0;d<r.length;d+=3,p+=2)t.vertices.push(new J(r[d],r[d+1],r[d+2])),void 0!==a&&l.push(new J(a[d],a[d+1],a[d+2])),void 0!==o&&t.colors.push(new We(o[d],o[d+1],o[d+2])),void 0!==s&&h.push(new q(s[p],s[p+1])),void 0!==c&&u.push(new q(c[p],c[p+1]));function f(e,n,i,r){var d=new At(e,n,i,void 0!==a?[l[e].clone(),l[n].clone(),l[i].clone()]:[],void 0!==o?[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()]:[],r);t.faces.push(d),void 0!==s&&t.faceVertexUvs[0].push([h[e].clone(),h[n].clone(),h[i].clone()]),void 0!==c&&t.faceVertexUvs[1].push([u[e].clone(),u[n].clone(),u[i].clone()])}var m=e.groups;if(m.length>0)for(d=0;d<m.length;d++)for(var g=m[d],v=g.start,y=(p=v,v+g.count);p<y;p+=3)void 0!==n?f(n[p],n[p+1],n[p+2],g.materialIndex):f(p,p+1,p+2,g.materialIndex);else if(void 0!==n)for(d=0;d<n.length;d+=3)f(n[d],n[d+1],n[d+2]);else for(d=0;d<r.length/3;d+=3)f(d,d+1,d+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.getCenter().negate();return this.translate(e.x,e.y,e.z),e},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new Y;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var e=new J,t=new J,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new J;if(e){var s,c,l,h=new J,u=new J;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],h.subVectors(l,c),u.subVectors(s,c),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var d=(a=this.faces[i]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Lt;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)c=new J,l={a:new J,b:new J,c:new J},o.push(c),s.push(l)}var c,l,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],c=h.faceNormals[n],l=h.vertexNormals[n],c.copy(r.normal),l.a.copy(r.vertexNormals[0]),l.b.copy(r.vertexNormals[1]),l.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var e=0,t=this.vertices,n=0,i=t.length;n<i;n++)n>0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ut),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new dt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],h=e.faceVertexUvs[0],u=this.colors,d=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new K).getNormalMatrix(t));for(var p=0,f=o.length;p<f;p++){var m=o[p].clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,f=d.length;p<f;p++)u.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,v,y,x=c[p],b=x.vertexNormals,w=x.vertexColors;(g=new At(x.a+r,x.b+r,x.c+r)).normal.copy(x.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var _=0,E=b.length;_<E;_++)v=b[_].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);for(g.color.copy(x.color),_=0,E=w.length;_<E;_++)y=w[_],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+n,s.push(g)}for(p=0,f=h.length;p<f;p++){var T=h[p],M=[];if(void 0!==T){for(_=0,E=T.length;_<E;_++)M.push(T[_].clone());l.push(M)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,a,o,s,c={},l=[],h=[],u=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===c[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(c[t]=n,l.push(this.vertices[n]),h[n]=l.length-1):h[n]=h[c[t]];var d=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],a=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new J(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];for(a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]),n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.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 n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],h={},u=[],d={};for(r=0;r<this.faces.length;r++){var p=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=E(x,0,0),x=E(x,1,!0),x=E(x,2,!1),x=E(x,3,f),x=E(x,4,m),x=E(x,5,g),x=E(x,6,v),x=E(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&o.push(T(p.normal)),g){var w=p.vertexNormals;o.push(T(w[0]),T(w[1]),T(w[2]))}if(v&&o.push(M(p.color)),y){var _=p.vertexColors;o.push(M(_[0]),M(_[1]),M(_[2]))}}function E(e,t,n){return n?e|1<<t:e&~(1<<t)}function T(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function M(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=l.length,l.push(e.getHex())),h[t]}function S(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=u.length/2,u.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=i,e.data.normals=s,l.length>0&&(e.data.colors=l),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new Lt).copy(this)},copy:function(e){var t,n,i,r,a,o;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.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=h.length;i<r;i++){var u=h[i],d=[];for(a=0,o=u.length;a<o;a++){var p=u[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],i=0,r=f[t].vertices.length;i<r;i++)m.vertices.push(f[t].vertices[i].clone());if(void 0!==f[t].normals)for(m.normals=[],i=0,r=f[t].normals.length;i<r;i++)m.normals.push(f[t].normals[i].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],i=0,r=g[t].vertexNormals.length;i<r;i++){var y=g[t].vertexNormals[i],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],i=0,r=g[t].faceNormals.length;i<r;i++)v.faceNormals.push(g[t].faceNormals[i].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[t]);var E=e.boundingBox;null!==E&&(this.boundingBox=E.clone());var T=e.boundingSphere;return null!==T&&(this.boundingSphere=T.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Pt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Pt.prototype,{isBufferAttribute:!0,setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.itemSize:0,this.array=e},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.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new We),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];t[n++]=a.a,t[n++]=a.b,t[n++]=a.c}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new q),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new J),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new ee),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=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,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),Nt.prototype=Object.create(Pt.prototype),Nt.prototype.constructor=Nt,Ot.prototype=Object.create(Pt.prototype),Ot.prototype.constructor=Ot,It.prototype=Object.create(Pt.prototype),It.prototype.constructor=It,Ut.prototype=Object.create(Pt.prototype),Ut.prototype.constructor=Ut,Dt.prototype=Object.create(Pt.prototype),Dt.prototype.constructor=Dt,Ft.prototype=Object.create(Pt.prototype),Ft.prototype.constructor=Ft,Bt.prototype=Object.create(Pt.prototype),Bt.prototype.constructor=Bt,kt.prototype=Object.create(Pt.prototype),kt.prototype.constructor=kt,Ht.prototype=Object.create(Pt.prototype),Ht.prototype.constructor=Ht,Object.assign(zt.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]=[];this.morphTargets.position=t}var h,u=e.morphNormals,d=u.length;if(d>0){for(h=[],l=0;l<d;l++)h[l]=[];this.morphTargets.normal=h}var p=e.skinIndices,f=e.skinWeights,m=p.length===i.length,g=f.length===i.length;for(l=0;l<n.length;l++){var v=n[l];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,w=v.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=v.color;this.colors.push(_,_,_)}!0===a&&(void 0!==(b=r[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new q,new q,new q))),!0===o&&(void 0!==(b=r[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new q,new q,new q)));for(var E=0;E<c;E++){var T=s[E].vertices;t[E].push(T[v.a],T[v.b],T[v.c])}for(E=0;E<d;E++){var M=u[E].vertexNormals[l];h[E].push(M.a,M.b,M.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.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}});var Vt,jt,Wt,Xt,qt,Yt,Zt,Jt=1;function Kt(){Object.defineProperty(this,"id",{value:Jt+=2}),this.uuid=X.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}}function Qt(e,t,n,i,r,a){Lt.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new $t(e,t,n,i,r,a)),this.mergeVertices()}function $t(e,t,n,i,r,a){Kt.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};var o=this;e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var s=[],c=[],l=[],h=[],u=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){var y,x,b=a/m,w=p/g,_=a/2,E=p/2,T=f/2,M=m+1,S=g+1,A=0,R=0,C=new J;for(x=0;x<S;x++){var L=x*w-E;for(y=0;y<M;y++){var P=y*b-_;C[e]=P*i,C[t]=L*r,C[n]=T,c.push(C.x,C.y,C.z),C[e]=0,C[t]=0,C[n]=f>0?1:-1,l.push(C.x,C.y,C.z),h.push(y/m),h.push(1-x/g),A+=1}}for(x=0;x<g;x++)for(y=0;y<m;y++){var N=u+y+M*x,O=u+y+M*(x+1),I=u+(y+1)+M*(x+1),U=u+(y+1)+M*x;s.push(N,O,U),s.push(O,I,U),R+=6}o.addGroup(d,R,v),d+=R,u+=A}p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.addAttribute("position",new kt(c,3)),this.addAttribute("normal",new kt(l,3)),this.addAttribute("uv",new kt(h,2))}function en(e,t,n,i){Lt.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new tn(e,t,n,i)),this.mergeVertices()}function tn(e,t,n,i){Kt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,l=Math.floor(i)||1,h=c+1,u=l+1,d=e/c,p=t/l,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*p-s;for(r=0;r<h;r++){var x=r*d-o;m.push(x,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-a/l)}}for(a=0;a<l;a++)for(r=0;r<c;r++){var b=r+h*a,w=r+h*(a+1),_=r+1+h*(a+1),E=r+1+h*a;f.push(b,w,E),f.push(w,_,E)}this.setIndex(f),this.addAttribute("position",new kt(m,3)),this.addAttribute("normal",new kt(g,3)),this.addAttribute("uv",new kt(v,2))}function nn(e){ct.call(this),this.type="MeshBasicMaterial",this.color=new We(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function rn(e){ct.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,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))}function an(e,t){this.origin=void 0!==e?e:new J,this.direction=void 0!==t?t:new J}function on(e,t){this.start=void 0!==e?e:new J,this.end=void 0!==t?t:new J}function sn(e,t,n){this.a=void 0!==e?e:new J,this.b=void 0!==t?t:new J,this.c=void 0!==n?n:new J}function cn(e,t){Tt.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Kt,this.material=void 0!==t?t:new nn({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function ln(e,t,n,i){var r,a,o,s=new We(0),c=0;function l(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,i)}return{getClearColor:function(){return s},setClearColor:function(e,t){s.set(e),l(s,c=void 0!==t?t:1)},getClearAlpha:function(){return c},setClearAlpha:function(e){l(s,c=e)},render:function(t,i,h,u){var d=i.background;null===d?l(s,c):d&&d.isColor&&(l(d,1),u=!0),(e.autoClear||u)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),d&&d.isCubeTexture?(void 0===o&&((o=new cn(new $t(1,1,1),new rn({uniforms:Ze.cube.uniforms,vertexShader:Ze.cube.vertexShader,fragmentShader:Ze.cube.fragmentShader,side:1,depthTest:!0,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),o.geometry.removeAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},n.update(o.geometry)),o.material.uniforms.tCube.value=d,t.push(o,o.geometry,o.material,0,null)):d&&d.isTexture&&(void 0===r&&(r=new St(-1,1,1,-1,0,1),a=new cn(new tn(2,2),new nn({depthTest:!1,depthWrite:!1,fog:!1})),n.update(a.geometry)),a.material.map=d,e.renderBufferDirect(r,null,a.geometry,a.material,a,null))}}}function hn(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program&&t.program&&e.program!==t.program?e.program.id-t.program.id: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 un(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function dn(){var e=[],t=0,n=[],i=[];return{opaque:n,transparent:i,init:function(){t=0,n.length=0,i.length=0},push:function(r,a,o,s,c){var l=e[t];void 0===l?(l={id:r.id,object:r,geometry:a,material:o,program:o.program,renderOrder:r.renderOrder,z:s,group:c},e[t]=l):(l.id=r.id,l.object=r,l.geometry=a,l.material=o,l.program=o.program,l.renderOrder=r.renderOrder,l.z=s,l.group=c),(!0===o.transparent?i:n).push(l),t++},sort:function(){n.length>1&&n.sort(hn),i.length>1&&i.sort(un)}}}function pn(){var e={};return{get:function(t,n){var i=t.id+","+n.id,r=e[i];return void 0===r&&(r=new dn,e[i]=r),r},dispose:function(){e={}}}}function fn(e,t){return Math.abs(t[1])-Math.abs(e[1])}function mn(e){var t={},n=new Float32Array(8);return{update:function(i,r,a,o){var s=i.morphTargetInfluences,c=s.length,l=t[r.id];if(void 0===l){l=[];for(var h=0;h<c;h++)l[h]=[h,0];t[r.id]=l}var u=a.morphTargets&&r.morphAttributes.position,d=a.morphNormals&&r.morphAttributes.normal;for(h=0;h<c;h++)0!==(p=l[h])[1]&&(u&&r.removeAttribute("morphTarget"+h),d&&r.removeAttribute("morphNormal"+h));for(h=0;h<c;h++)(p=l[h])[0]=h,p[1]=s[h];for(l.sort(fn),h=0;h<8;h++){var p;if(p=l[h]){var f=p[0],m=p[1];if(m){u&&r.addAttribute("morphTarget"+h,u[f]),d&&r.addAttribute("morphNormal"+h,d[f]),n[h]=m;continue}}n[h]=0}o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function gn(e,t,n){var i,r,a;this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*a),n.calls++,n.vertices+=o,i===e.TRIANGLES?n.faces+=o/3:i===e.POINTS&&(n.points+=o)},this.renderInstances=function(o,s,c){var l=t.get("ANGLE_instanced_arrays");null!==l?(l.drawElementsInstancedANGLE(i,c,r,s*a,o.maxInstancedCount),n.calls++,n.vertices+=c*o.maxInstancedCount,i===e.TRIANGLES?n.faces+=o.maxInstancedCount*c/3:i===e.POINTS&&(n.points+=o.maxInstancedCount*c)):console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function vn(e,t,n){var i;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.calls++,n.vertices+=r,i===e.TRIANGLES?n.faces+=r/3:i===e.POINTS&&(n.points+=r)},this.renderInstances=function(r,a,o){var s=t.get("ANGLE_instanced_arrays");if(null!==s){var c=r.attributes.position;c.isInterleavedBufferAttribute?(o=c.data.count,s.drawArraysInstancedANGLE(i,0,o,r.maxInstancedCount)):s.drawArraysInstancedANGLE(i,a,o,r.maxInstancedCount),n.calls++,n.vertices+=o*r.maxInstancedCount,i===e.TRIANGLES?n.faces+=r.maxInstancedCount*o/3:i===e.POINTS&&(n.points+=r.maxInstancedCount*o)}else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.")}}function yn(e,t,n){var i={},r={};function a(e){var o=e.target,s=i[o.id];for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener("dispose",a),delete i[o.id];var l=r[o.id];l&&(t.remove(l),delete r[o.id]),(l=r[s.id])&&(t.remove(l),delete r[s.id]),n.geometries--}return{get:function(e,t){var r=i[t.id];return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Kt).setFromObject(e)),r=t._bufferGeometry),i[t.id]=r,n.geometries++,r)},update:function(n){var i=n.index,r=n.attributes;for(var a in null!==i&&t.update(i,e.ELEMENT_ARRAY_BUFFER),r)t.update(r[a],e.ARRAY_BUFFER);var o=n.morphAttributes;for(var a in o)for(var s=o[a],c=0,l=s.length;c<l;c++)t.update(s[c],e.ARRAY_BUFFER)},getWireframeAttribute:function(n){var i=r[n.id];if(i)return i;var a,o=[],s=n.index,c=n.attributes;if(null!==s)for(var l=0,h=(a=s.array).length;l<h;l+=3){var u=a[l+0],d=a[l+1],p=a[l+2];o.push(u,d,d,p,p,u)}else for(l=0,h=(a=c.position.array).length/3-1;l<h;l+=3)u=l+0,d=l+1,p=l+2,o.push(u,d,d,p,p,u);return i=new(Gt(o)>65535?Bt:Dt)(o,1),t.update(i,e.ELEMENT_ARRAY_BUFFER),r[n.id]=i,i}}}function xn(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new J,color:new We,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new q};break;case"SpotLight":n={position:new J,direction:new J,color:new We,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new q};break;case"PointLight":n={position:new J,color:new We,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new q,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new J,skyColor:new We,groundColor:new We};break;case"RectAreaLight":n={color:new We,position:new J,halfWidth:new J,halfHeight:new J}}return e[t.id]=n,n}}}function bn(){var e=new xn,t={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=new J,i=new Y,r=new Y;return{setup:function(a,o,s){for(var c=0,l=0,h=0,u=0,d=0,p=0,f=0,m=0,g=s.matrixWorldInverse,v=0,y=a.length;v<y;v++){var x=a[v],b=x.color,w=x.intensity,_=x.distance,E=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)c+=b.r*w,l+=b.g*w,h+=b.b*w;else if(x.isDirectionalLight){if((M=e.get(x)).color.copy(x.color).multiplyScalar(x.intensity),M.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(n),M.direction.transformDirection(g),M.shadow=x.castShadow,x.castShadow){var T=x.shadow;M.shadowBias=T.bias,M.shadowRadius=T.radius,M.shadowMapSize=T.mapSize}t.directionalShadowMap[u]=E,t.directionalShadowMatrix[u]=x.shadow.matrix,t.directional[u]=M,u++}else if(x.isSpotLight)(M=e.get(x)).position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),M.color.copy(b).multiplyScalar(w),M.distance=_,M.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(n),M.direction.transformDirection(g),M.coneCos=Math.cos(x.angle),M.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),M.decay=0===x.distance?0:x.decay,M.shadow=x.castShadow,x.castShadow&&(T=x.shadow,M.shadowBias=T.bias,M.shadowRadius=T.radius,M.shadowMapSize=T.mapSize),t.spotShadowMap[p]=E,t.spotShadowMatrix[p]=x.shadow.matrix,t.spot[p]=M,p++;else if(x.isRectAreaLight)(M=e.get(x)).color.copy(b).multiplyScalar(w/(x.width*x.height)),M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),r.identity(),i.copy(x.matrixWorld),i.premultiply(g),r.extractRotation(i),M.halfWidth.set(.5*x.width,0,0),M.halfHeight.set(0,.5*x.height,0),M.halfWidth.applyMatrix4(r),M.halfHeight.applyMatrix4(r),t.rectArea[f]=M,f++;else if(x.isPointLight)(M=e.get(x)).position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),M.color.copy(x.color).multiplyScalar(x.intensity),M.distance=x.distance,M.decay=0===x.distance?0:x.decay,M.shadow=x.castShadow,x.castShadow&&(T=x.shadow,M.shadowBias=T.bias,M.shadowRadius=T.radius,M.shadowMapSize=T.mapSize,M.shadowCameraNear=T.camera.near,M.shadowCameraFar=T.camera.far),t.pointShadowMap[d]=E,t.pointShadowMatrix[d]=x.shadow.matrix,t.point[d]=M,d++;else if(x.isHemisphereLight){var M;(M=e.get(x)).direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(g),M.direction.normalize(),M.skyColor.copy(x.color).multiplyScalar(w),M.groundColor.copy(x.groundColor).multiplyScalar(w),t.hemi[m]=M,m++}}t.ambient[0]=c,t.ambient[1]=l,t.ambient[2]=h,t.directional.length=u,t.spot.length=p,t.rectArea.length=f,t.point.length=d,t.hemi.length=m,t.hash=u+","+d+","+p+","+f+","+m+","+o.length},state:t}}function wn(e,t){var n={};return{update:function(i){var r=t.frame,a=i.geometry,o=e.get(i,a);return n[o.id]!==r&&(a.isGeometry&&o.updateFromObject(i),e.update(o),n[o.id]=r),o},clear:function(){n={}}}}function _n(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),!1===e.getShaderParameter(i,e.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",t===e.VERTEX_SHADER?"vertex":"fragment",e.getShaderInfoLog(i),function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(n)),i}Kt.prototype=Object.assign(Object.create(t.prototype),{constructor:Kt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Gt(e)>65535?Bt:Dt)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new Pt(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n: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.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;return void 0!==n&&((new K).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new Y;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new Y;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new Y;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new Y;return function(t,n,i){return e.makeTranslation(t,n,i),this.applyMatrix(e),this}}(),scale:function(){var e=new Y;return function(t,n,i){return e.makeScale(t,n,i),this.applyMatrix(e),this}}(),lookAt:function(){var e=new Tt;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new kt(3*t.vertices.length,3),i=new kt(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new kt(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new kt(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new zt).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Pt(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Pt(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new Pt(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Pt(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Pt(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var o=new(Gt(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new Pt(o,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var c=[],l=e.morphTargets[s],h=0,u=l.length;h<u;h++){var d=l[h],p=new kt(3*d.length,3);c.push(p.copyVector3sArray(d))}this.morphAttributes[s]=c}if(e.skinIndices.length>0){var f=new kt(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new kt(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new ut);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(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 ut,t=new J;return function(){null===this.boundingSphere&&(this.boundingSphere=new dt);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(i);for(var r=0,a=0,o=n.count;a<o;a++)t.x=n.getX(a),t.y=n.getY(a),t.z=n.getZ(a),r=Math.max(r,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,n=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new Pt(new Float32Array(i.length),3));else for(var r=t.normal.array,a=0,o=r.length;a<o;a++)r[a]=0;var s,c,l,h=t.normal.array,u=new J,d=new J,p=new J,f=new J,m=new J;if(e){var g=e.array;0===n.length&&this.addGroup(0,g.length);for(var v=0,y=n.length;v<y;++v){var x=n[v],b=x.start;for(a=b,o=b+x.count;a<o;a+=3)s=3*g[a+0],c=3*g[a+1],l=3*g[a+2],u.fromArray(i,s),d.fromArray(i,c),p.fromArray(i,l),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),h[s]+=f.x,h[s+1]+=f.y,h[s+2]+=f.z,h[c]+=f.x,h[c+1]+=f.y,h[c+2]+=f.z,h[l]+=f.x,h[l+1]+=f.y,h[l+2]+=f.z}}else for(a=0,o=i.length;a<o;a+=9)u.fromArray(i,a),d.fromArray(i,a+3),p.fromArray(i,a+6),f.subVectors(p,d),m.subVectors(u,d),f.cross(m),h[a]=f.x,h[a+1]=f.y,h[a+2]=f.z,h[a+3]=f.x,h[a+4]=f.y,h[a+5]=f.z,h[a+6]=f.x,h[a+7]=f.y,h[a+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0);var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=0,c=a.itemSize*t;s<o.length;s++,c++)r[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){var e=new J;return function(){for(var t=this.attributes.normal,n=0,i=t.count;n<i;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.normalize(),t.setXYZ(n,e.x,e.y,e.z)}}(),toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Kt,t=this.index.array,n=this.attributes;for(var i in n){for(var r=n[i],a=r.array,o=r.itemSize,s=new a.constructor(t.length*o),c=0,l=0,h=0,u=t.length;h<u;h++){c=t[h]*o;for(var d=0;d<o;d++)s[l++]=a[c++]}e.addAttribute(i,new Pt(s,o))}return e},toJSON:function(){var e={metadata:{version:4.5,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 n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:r}}var a=this.attributes;for(var n in a){var o=a[n];r=Array.prototype.slice.call(o.array),e.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:r,normalized:o.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new Kt).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,i=l.length;n<i;n++)c.push(l[n].clone());this.morphAttributes[t]=c}var h=e.groups;for(n=0,i=h.length;n<i;n++){var u=h[n];this.addGroup(u.start,u.count,u.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Qt.prototype=Object.create(Lt.prototype),Qt.prototype.constructor=Qt,$t.prototype=Object.create(Kt.prototype),$t.prototype.constructor=$t,en.prototype=Object.create(Lt.prototype),en.prototype.constructor=en,tn.prototype=Object.create(Kt.prototype),tn.prototype.constructor=tn,nn.prototype=Object.create(ct.prototype),nn.prototype.constructor=nn,nn.prototype.isMeshBasicMaterial=!0,nn.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},rn.prototype=Object.create(ct.prototype),rn.prototype.constructor=rn,rn.prototype.isShaderMaterial=!0,rn.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=qe.clone(e.uniforms),this.defines=e.defines,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},rn.prototype.toJSON=function(e){var t=ct.prototype.toJSON.call(this,e);return t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t},Object.assign(an.prototype,{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){return(t||new J).copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new J;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var n=t||new J;n.subVectors(e,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new J;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:(qt=new J,Yt=new J,Zt=new J,function(e,t,n,i){qt.copy(e).add(t).multiplyScalar(.5),Yt.copy(t).sub(e).normalize(),Zt.copy(this.origin).sub(qt);var r,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(Yt),h=Zt.dot(this.direction),u=-Zt.dot(Yt),d=Zt.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*h-u,s=c*p,(r=l*u-h)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*h)+a*(l*r+a+2*u)+d}else a=c,o=-(r=Math.max(0,-(l*a+h)))*r+a*(a+2*u)+d;else a=-c,o=-(r=Math.max(0,-(l*a+h)))*r+a*(a+2*u)+d;else a<=-s?o=-(r=Math.max(0,-(-l*c+h)))*r+(a=r>0?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+d):o=-(r=Math.max(0,-(l*c+h)))*r+(a=r>0?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+d;else a=l>0?-c:c,o=-(r=Math.max(0,-(l*a+h)))*r+a*(a+2*u)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Yt).multiplyScalar(a).add(qt),o}),intersectSphere:function(){var e=new J;return function(t,n){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),r=e.dot(e)-i*i,a=t.radius*t.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=i-o,c=i+o;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),l>=0?(r=(e.min.y-u.y)*l,a=(e.max.y-u.y)*l):(r=(e.max.y-u.y)*l,a=(e.min.y-u.y)*l),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))},intersectsBox:(Xt=new J,function(e){return null!==this.intersectBox(e,Xt)}),intersectTriangle:function(){var e=new J,t=new J,n=new J,i=new J;return function(r,a,o,s,c){t.subVectors(a,r),n.subVectors(o,r),i.crossVectors(t,n);var l,h=this.direction.dot(i);if(h>0){if(s)return null;l=1}else{if(!(h<0))return null;l=-1,h=-h}e.subVectors(this.origin,r);var u=l*this.direction.dot(n.crossVectors(e,n));if(u<0)return null;var d=l*this.direction.dot(t.cross(e));if(d<0)return null;if(u+d>h)return null;var p=-l*e.dot(i);return p<0?null:this.at(p/h,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(on.prototype,{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},getCenter:function(e){return(e||new J).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new J).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 n=t||new J;return this.delta(n).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(jt=new J,Wt=new J,function(e,t){jt.subVectors(e,this.start),Wt.subVectors(this.end,this.start);var n=Wt.dot(Wt),i=Wt.dot(jt)/n;return t&&(i=X.clamp(i,0,1)),i}),closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t),r=n||new J;return this.delta(r).multiplyScalar(i).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)}}),Object.assign(sn,{normal:(Vt=new J,function(e,t,n,i){var r=i||new J;r.subVectors(n,t),Vt.subVectors(e,t),r.cross(Vt);var a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}),barycoordFromPoint:function(){var e=new J,t=new J,n=new J;return function(i,r,a,o,s){e.subVectors(o,r),t.subVectors(a,r),n.subVectors(i,r);var c=e.dot(e),l=e.dot(t),h=e.dot(n),u=t.dot(t),d=t.dot(n),p=c*u-l*l,f=s||new J;if(0===p)return f.set(-2,-1,-1);var m=1/p,g=(u*h-l*d)*m,v=(c*d-l*h)*m;return f.set(1-g-v,v,g)}}(),containsPoint:function(){var e=new J;return function(t,n,i,r){var a=sn.barycoordFromPoint(t,n,i,r,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}()}),Object.assign(sn.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),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 J,t=new J;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new J).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return sn.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new pt).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return sn.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return sn.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e=new pt,t=[new on,new on,new on],n=new J,i=new J;return function(r,a){var o=a||new J,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(r,n),!0===this.containsPoint(n))o.copy(n);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c<t.length;c++){t[c].closestPointToPoint(n,!0,i);var l=n.distanceToSquared(i);l<s&&(s=l,o.copy(i))}}return o}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),cn.prototype=Object.assign(Object.create(Tt.prototype),{constructor:cn,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return Tt.prototype.copy.call(this,e),this.drawMode=e.drawMode,void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;if(void 0!==s&&s.length>0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;e<t;e++)n=s[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}},raycast:function(){var e=new Y,t=new an,n=new dt,i=new J,r=new J,a=new J,o=new J,s=new J,c=new J,l=new q,h=new q,u=new q,d=new J,p=new J,f=new J;function m(e,t,n,i,r,a,o){return sn.barycoordFromPoint(e,t,n,i,d),r.multiplyScalar(d.x),a.multiplyScalar(d.y),o.multiplyScalar(d.z),r.add(a).add(o),r.clone()}function g(e,t,n,i,r,a,o,s){if(null===(1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,2!==t.side,s)))return null;f.copy(s),f.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(f);return c<n.near||c>n.far?null:{distance:c,point:f.clone(),object:e}}function v(e,t,n,o,s,c,d,f){i.fromBufferAttribute(o,c),r.fromBufferAttribute(o,d),a.fromBufferAttribute(o,f);var v=g(e,e.material,t,n,i,r,a,p);return v&&(s&&(l.fromBufferAttribute(s,c),h.fromBufferAttribute(s,d),u.fromBufferAttribute(s,f),v.uv=m(p,i,r,a,l,h,u)),v.face=new At(c,d,f,sn.normal(i,r,a)),v.faceIndex=c),v}return function(d,f){var y,x=this.geometry,b=this.material,w=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),n.copy(x.boundingSphere),n.applyMatrix4(w),!1!==d.ray.intersectsSphere(n)&&(e.getInverse(w),t.copy(d.ray).applyMatrix4(e),null===x.boundingBox||!1!==t.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var _,E,T,M,S,A=x.index,R=x.attributes.position,C=x.attributes.uv;if(null!==A)for(M=0,S=A.count;M<S;M+=3)_=A.getX(M),E=A.getX(M+1),T=A.getX(M+2),(y=v(this,d,t,R,C,_,E,T))&&(y.faceIndex=Math.floor(M/3),f.push(y));else if(void 0!==R)for(M=0,S=R.count;M<S;M+=3)(y=v(this,d,t,R,C,_=M,E=M+1,T=M+2))&&(y.index=_,f.push(y))}else if(x.isGeometry){var L,P,N,O,I=Array.isArray(b),U=x.vertices,D=x.faces,F=x.faceVertexUvs[0];F.length>0&&(O=F);for(var B=0,k=D.length;B<k;B++){var H=D[B],z=I?b[H.materialIndex]:b;if(void 0!==z){if(L=U[H.a],P=U[H.b],N=U[H.c],!0===z.morphTargets){var G=x.morphTargets,V=this.morphTargetInfluences;i.set(0,0,0),r.set(0,0,0),a.set(0,0,0);for(var j=0,W=G.length;j<W;j++){var X=V[j];if(0!==X){var q=G[j].vertices;i.addScaledVector(o.subVectors(q[H.a],L),X),r.addScaledVector(s.subVectors(q[H.b],P),X),a.addScaledVector(c.subVectors(q[H.c],N),X)}}i.add(L),r.add(P),a.add(N),L=i,P=r,N=a}if(y=g(this,z,d,t,L,P,N,p)){if(O&&O[B]){var Y=O[B];l.copy(Y[0]),h.copy(Y[1]),u.copy(Y[2]),y.uv=m(p,L,P,N,l,h,u)}y.face=H,y.faceIndex=B,f.push(y)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var En,Tn,Mn,Sn,An,Rn,Cn=0;function Ln(e){switch(e){case j:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case W:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function Pn(e,t){var n=Ln(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Nn(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Uncharted2";break;case 4:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function On(e){return""!==e}function In(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function Un(e){return e.replace(/^[ \t]*#include +<([\w\d.]+)>/gm,(function(e,t){var n=Ye[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Un(n)}))}function Dn(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,(function(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]");return r}))}function Fn(e,t,n,i,r,a){var o=e.context,s=i.defines,c=r.vertexShader,l=r.fragmentShader,h="SHADOWMAP_TYPE_BASIC";1===a.shadowMapType?h="SHADOWMAP_TYPE_PCF":2===a.shadowMapType&&(h="SHADOWMAP_TYPE_PCF_SOFT");var g="ENVMAP_TYPE_CUBE",v="ENVMAP_MODE_REFLECTION",y="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(i.envMap.mapping){case u:case d:g="ENVMAP_TYPE_CUBE";break;case f:case m:g="ENVMAP_TYPE_CUBE_UV";break;case 303:case p:g="ENVMAP_TYPE_EQUIREC";break;case 305:g="ENVMAP_TYPE_SPHERE"}switch(i.envMap.mapping){case d:case p:v="ENVMAP_MODE_REFRACTION"}switch(i.combine){case 0:y="ENVMAP_BLENDING_MULTIPLY";break;case 1:y="ENVMAP_BLENDING_MIX";break;case 2:y="ENVMAP_BLENDING_ADD"}}var x,b,w,_,E=e.gammaFactor>0?e.gammaFactor:1,T=function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(On).join("\n")}(i.extensions,a,t),M=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),S=o.createProgram();i.isRawShaderMaterial?((x=[M].filter(On).join("\n")).length>0&&(x+="\n"),(b=[T,M].filter(On).join("\n")).length>0&&(b+="\n")):(x=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,M,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+E,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+v:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.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","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(On).join("\n"),b=[T,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,M,a.alphaTest?"#define ALPHATEST "+a.alphaTest:"","#define GAMMA_FACTOR "+E,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+g:"",a.envMap?"#define "+v:"",a.envMap?"#define "+y:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+a.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(a.numClippingPlanes-a.numClipIntersection),a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&t.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==a.toneMapping?"#define TONE_MAPPING":"",0!==a.toneMapping?Ye.tonemapping_pars_fragment:"",0!==a.toneMapping?Nn("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Ye.encodings_pars_fragment:"",a.mapEncoding?Pn("mapTexelToLinear",a.mapEncoding):"",a.envMapEncoding?Pn("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Pn("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(w=a.outputEncoding,_=Ln(w),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+_[0]+_[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(On).join("\n")),c=In(c=Un(c),a),l=In(l=Un(l),a),i.isShaderMaterial||(c=Dn(c),l=Dn(l));var A=x+c,R=b+l,C=_n(o,o.VERTEX_SHADER,A),L=_n(o,o.FRAGMENT_SHADER,R);o.attachShader(S,C),o.attachShader(S,L),void 0!==i.index0AttributeName?o.bindAttribLocation(S,0,i.index0AttributeName):!0===a.morphTargets&&o.bindAttribLocation(S,0,"position"),o.linkProgram(S);var P,N,O=o.getProgramInfoLog(S),I=o.getShaderInfoLog(C),U=o.getShaderInfoLog(L),D=!0,F=!0;return!1===o.getProgramParameter(S,o.LINK_STATUS)?(D=!1,console.error("THREE.WebGLProgram: shader error: ",o.getError(),"gl.VALIDATE_STATUS",o.getProgramParameter(S,o.VALIDATE_STATUS),"gl.getProgramInfoLog",O,I,U)):""!==O?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",O):""!==I&&""!==U||(F=!1),F&&(this.diagnostics={runnable:D,material:i,programLog:O,vertexShader:{log:I,prefix:x},fragmentShader:{log:U,prefix:b}}),o.deleteShader(C),o.deleteShader(L),this.getUniforms=function(){return void 0===P&&(P=new Ve(o,S,e)),P},this.getAttributes=function(){return void 0===N&&(N=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(o,S)),N},this.destroy=function(){o.deleteProgram(S),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=Cn++,this.code=n,this.usedTimes=1,this.program=S,this.vertexShader=C,this.fragmentShader=L,this}function Bn(e,t,n){var i=[],r={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(e,t){var n;return e?e.isTexture?n=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=e.texture.encoding):n=j,n===j&&t&&(n=W),n}this.getParameters=function(t,i,a,s,c,l,h){var u=r[t.type],d=h.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(n.floatVertexTextures)return 1024;var i=n.maxVertexUniforms,r=Math.floor((i-20)/4),a=Math.min(r,t.length);return a<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+a+"."),0):a}(h):0,p=n.precision;null!==t.precision&&(p=n.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",p,"instead.");var g=e.getRenderTarget();return{shaderID:u,precision:p,supportsVertexTextures:n.vertexTextures,outputEncoding:o(g?g.texture:null,e.gammaOutput),map:!!t.map,mapEncoding:o(t.map,e.gammaInput),envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,envMapEncoding:o(t.envMap,e.gammaInput),envMapCubeUV:!!t.envMap&&(t.envMap.mapping===f||t.envMap.mapping===m),lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:o(t.emissiveMap,e.gammaInput),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,combine:t.combine,vertexColors:t.vertexColors,fog:!!s,useFog:t.fog,fogExp:s&&s.isFogExp2,flatShading:t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:n.logarithmicDepthBuffer,skinning:t.skinning&&d>0,maxBones:d,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numClippingPlanes:c,numClipIntersection:l,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.receiveShadow&&a.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:2===t.side,flipSided:1===t.side,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var o=0;o<a.length;o++)i.push(n[a[o]]);return i.push(t.onBeforeCompile.toString()),i.push(e.gammaOutput),i.join()},this.acquireProgram=function(n,r,a,o){for(var s,c=0,l=i.length;c<l;c++){var h=i[c];if(h.code===o){++(s=h).usedTimes;break}}return void 0===s&&(s=new Fn(e,t,o,n,r,a),i.push(s)),s},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i}function kn(e,t,n,i,r,a,o){var s="undefined"!=typeof WebGL2RenderingContext&&e instanceof window.WebGL2RenderingContext,c={};function l(e,t){if(e.width>t||e.height>t){var n=t/Math.max(e.width,e.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.width=Math.floor(e.width*n),i.height=Math.floor(e.height*n),i.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function h(e){return X.isPowerOfTwo(e.width)&&X.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&e.minFilter!==x&&e.minFilter!==_}function d(t){return t===x||t===b||t===w?e.NEAREST:e.LINEAR}function p(t){var n=t.target;n.removeEventListener("dispose",p),function(t){var n=i.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}i.remove(t)}(n),n.isVideoTexture&&delete c[n.id],o.textures--}function f(t){var n=t.target;n.removeEventListener("dispose",f),function(t){var n=i.get(t),r=i.get(t.texture);if(t){if(void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(t.texture),i.remove(t)}}(n),o.textures--}function m(t,d){var f=i.get(t);if(t.version>0&&f.__version!==t.version){var m=t.image;if(void 0===m)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==m.complete)return void function(t,i,d){void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",p),t.__webglTexture=e.createTexture(),i.isVideoTexture&&(c[i.id]=i),o.textures++),n.activeTexture(e.TEXTURE0+d),n.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment);var f=l(i.image,r.maxTextureSize);(function(e){return e.wrapS!==v||e.wrapT!==v||e.minFilter!==x&&e.minFilter!==_})(i)&&!1===h(f)&&(f=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=X.floorPowerOfTwo(e.width),t.height=X.floorPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),t}return e}(f));var m=h(f),y=a.convert(i.format),b=a.convert(i.type);g(e.TEXTURE_2D,i,m);var w,E=i.mipmaps;if(i.isDepthTexture){var T=e.DEPTH_COMPONENT;if(i.type===R){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");T=e.DEPTH_COMPONENT32F}else s&&(T=e.DEPTH_COMPONENT16);i.format===O&&T===e.DEPTH_COMPONENT&&i.type!==S&&i.type!==A&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=S,b=a.convert(i.type)),i.format===I&&(T=e.DEPTH_STENCIL,i.type!==L&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=L,b=a.convert(i.type))),n.texImage2D(e.TEXTURE_2D,0,T,f.width,f.height,0,y,b,null)}else if(i.isDataTexture)if(E.length>0&&m){for(var M=0,C=E.length;M<C;M++)w=E[M],n.texImage2D(e.TEXTURE_2D,M,y,w.width,w.height,0,y,b,w.data);i.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,y,f.width,f.height,0,y,b,f.data);else if(i.isCompressedTexture)for(M=0,C=E.length;M<C;M++)w=E[M],i.format!==N&&i.format!==P?n.getCompressedTextureFormats().indexOf(y)>-1?n.compressedTexImage2D(e.TEXTURE_2D,M,y,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(e.TEXTURE_2D,M,y,w.width,w.height,0,y,b,w.data);else if(E.length>0&&m){for(M=0,C=E.length;M<C;M++)w=E[M],n.texImage2D(e.TEXTURE_2D,M,y,y,b,w);i.generateMipmaps=!1}else n.texImage2D(e.TEXTURE_2D,0,y,y,b,f);u(i,m)&&e.generateMipmap(e.TEXTURE_2D),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}(f,t,d);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",t)}}n.activeTexture(e.TEXTURE0+d),n.bindTexture(e.TEXTURE_2D,f.__webglTexture)}function g(n,o,s){var c;if(s?(e.texParameteri(n,e.TEXTURE_WRAP_S,a.convert(o.wrapS)),e.texParameteri(n,e.TEXTURE_WRAP_T,a.convert(o.wrapT)),e.texParameteri(n,e.TEXTURE_MAG_FILTER,a.convert(o.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,a.convert(o.minFilter))):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),o.wrapS===v&&o.wrapT===v||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",o),e.texParameteri(n,e.TEXTURE_MAG_FILTER,d(o.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,d(o.minFilter)),o.minFilter!==x&&o.minFilter!==_&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",o)),c=t.get("EXT_texture_filter_anisotropic")){if(o.type===R&&null===t.get("OES_texture_float_linear"))return;if(o.type===C&&null===t.get("OES_texture_half_float_linear"))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function y(t,r,o,s){var c=a.convert(r.texture.format),l=a.convert(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,l,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function E(t,n){e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):n.depthBuffer&&n.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}this.setTexture2D=m,this.setTextureCube=function(t,s){var c=i.get(t);if(6===t.image.length)if(t.version>0&&c.__version!==t.version){c.__image__webglTextureCube||(t.addEventListener("dispose",p),c.__image__webglTextureCube=e.createTexture(),o.textures++),n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var d=t&&t.isCompressedTexture,f=t.image[0]&&t.image[0].isDataTexture,m=[],v=0;v<6;v++)m[v]=d||f?f?t.image[v].image:t.image[v]:l(t.image[v],r.maxCubemapSize);var y=h(m[0]),x=a.convert(t.format),b=a.convert(t.type);for(g(e.TEXTURE_CUBE_MAP,t,y),v=0;v<6;v++)if(d)for(var w,_=m[v].mipmaps,E=0,T=_.length;E<T;E++)w=_[E],t.format!==N&&t.format!==P?n.getCompressedTextureFormats().indexOf(x)>-1?n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,E,x,w.width,w.height,0,x,b,w.data);else f?n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,x,m[v].width,m[v].height,0,x,b,m[v].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+v,0,x,x,b,m[v]);u(t,y)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),c.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(e.TEXTURE0+s),n.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,r){n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,i.get(t).__webglTexture)},this.setupRenderTarget=function(t){var r=i.get(t),a=i.get(t.texture);t.addEventListener("dispose",f),a.__webglTexture=e.createTexture(),o.textures++;var s=!0===t.isWebGLRenderTargetCube,c=h(t);if(s){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=e.createFramebuffer()}else r.__webglFramebuffer=e.createFramebuffer();if(s){for(n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture),g(e.TEXTURE_CUBE_MAP,t.texture,c),l=0;l<6;l++)y(r.__webglFramebuffer[l],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+l);u(t.texture,c)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),n.bindTexture(e.TEXTURE_CUBE_MAP,null)}else n.bindTexture(e.TEXTURE_2D,a.__webglTexture),g(e.TEXTURE_2D,t.texture,c),y(r.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,c)&&e.generateMipmap(e.TEXTURE_2D),n.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&function(t){var n=i.get(t),r=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),m(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===O)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==I)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),E(n.__webglDepthbuffer[a],t)}else e.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),E(n.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}(t)},this.updateRenderTargetMipmap=function(t){var r=t.texture;if(u(r,h(t))){var a=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,o=i.get(r).__webglTexture;n.bindTexture(a,o),e.generateMipmap(a),n.bindTexture(a,null)}},this.updateVideoTextures=function(){for(var e in c)c[e].update()}}function Hn(){var e={};return{get:function(t){var n=t.uuid,i=e[n];return void 0===i&&(i={},e[n]=i),i},remove:function(t){delete e[t.uuid]},clear:function(){e={}}}}function zn(e,t,n){var i=new function(){var t=!1,n=new ee,i=null,r=new ee(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},r=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(t){t?U(e.DEPTH_TEST):D(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}else e.depthFunc(e.LEQUAL);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},a=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(t){t?U(e.STENCIL_TEST):D(e.STENCIL_TEST)},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&c===i||(e.stencilOp(t,n,i),o=t,s=n,c=i)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,c=null,l=null}}},o=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(o),c=new Uint8Array(o),l=new Uint8Array(o),h={},u=null,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=null,b=!1,w=null,_=null,E=null,T=null,M=null,S=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),A=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),R=parseFloat(A)>=1,C=null,L={},P=new ee,N=new ee;function O(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var o=0;o<i;o++)e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,r);return a}var I={};function U(t){!0!==h[t]&&(e.enable(t),h[t]=!0)}function D(t){!1!==h[t]&&(e.disable(t),h[t]=!1)}function F(t,i,r,a,o,s,c,l){if(0!==t?U(e.BLEND):D(e.BLEND),5!==t){if(t!==p||l!==b)switch(t){case 2:l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE));break;case 3:l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ONE_MINUS_SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR));break;case 4:l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA)):(e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR));break;default:l?(e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)):(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))}f=null,m=null,g=null,v=null,y=null,x=null}else o=o||i,s=s||r,c=c||a,i===f&&o===v||(e.blendEquationSeparate(n.convert(i),n.convert(o)),f=i,v=o),r===m&&a===g&&s===y&&c===x||(e.blendFuncSeparate(n.convert(r),n.convert(a),n.convert(s),n.convert(c)),m=r,g=a,y=s,x=c);p=t,b=l}function B(t){w!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),w=t)}function k(t){0!==t?(U(e.CULL_FACE),t!==_&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):D(e.CULL_FACE),_=t}function H(t,n,i){t?(U(e.POLYGON_OFFSET_FILL),T===n&&M===i||(e.polygonOffset(n,i),T=n,M=i)):D(e.POLYGON_OFFSET_FILL)}function z(t){void 0===t&&(t=e.TEXTURE0+S-1),C!==t&&(e.activeTexture(t),C=t)}return I[e.TEXTURE_2D]=O(e.TEXTURE_2D,e.TEXTURE_2D,1),I[e.TEXTURE_CUBE_MAP]=O(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),i.setClear(0,0,0,1),r.setClear(1),a.setClear(0),U(e.DEPTH_TEST),r.setFunc(3),B(!1),k(1),U(e.CULL_FACE),U(e.BLEND),F(1),{buffers:{color:i,depth:r,stencil:a},initAttributes:function(){for(var e=0,t=s.length;e<t;e++)s[e]=0},enableAttribute:function(n){s[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),0!==l[n]&&(t.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),l[n]=0)},enableAttributeAndDivisor:function(n,i){s[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),l[n]!==i&&(t.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,i),l[n]=i)},disableUnusedAttributes:function(){for(var t=0,n=c.length;t!==n;++t)c[t]!==s[t]&&(e.disableVertexAttribArray(t),c[t]=0)},enable:U,disable:D,getCompressedTextureFormats:function(){if(null===u&&(u=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")))for(var n=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i<n.length;i++)u.push(n[i]);return u},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:F,setMaterial:function(t,n){2===t.side?D(e.CULL_FACE):U(e.CULL_FACE);var a=1===t.side;n&&(a=!a),B(a),!0===t.transparent?F(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):F(0),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),i.setMask(t.colorWrite),H(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:B,setCullFace:k,setLineWidth:function(t){t!==E&&(R&&e.lineWidth(t),E=t)},setPolygonOffset:H,setScissorTest:function(t){t?U(e.SCISSOR_TEST):D(e.SCISSOR_TEST)},activeTexture:z,bindTexture:function(t,n){null===C&&z();var i=L[C];void 0===i&&(i={type:void 0,texture:void 0},L[C]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||I[t]),i.type=t,i.texture=n)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===P.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),P.copy(t))},viewport:function(t){!1===N.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){for(var t=0;t<c.length;t++)1===c[t]&&(e.disableVertexAttribArray(t),c[t]=0);h={},u=null,C=null,L={},d=null,p=null,w=null,_=null,i.reset(),r.reset(),a.reset()}}}function Gn(e,t,n){var i;function r(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"}var a=void 0!==n.precision?n.precision:"highp",o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);var s=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),p=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),g=l>0,v=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:u,maxAttributes:d,maxVertexUniforms:p,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:g,floatFragmentTextures:v,floatVertexTextures:g&&v}}function Vn(e,t,n,i){Mt.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function jn(e){Vn.call(this),this.cameras=e||[]}function Wn(e){var t=this,n=null,i=null,r=null;"undefined"!=typeof window&&"VRFrameData"in window&&(i=new window.VRFrameData);var a=new Y,o=new Vn;o.bounds=new ee(0,0,.5,1),o.layers.enable(1);var s=new Vn;s.bounds=new ee(.5,0,.5,1),s.layers.enable(2);var c,l,h=new jn([o,s]);function u(){if(null!==n&&n.isPresenting){var i=n.getEyeParameters("left"),r=i.renderWidth,a=i.renderHeight;l=e.getPixelRatio(),c=e.getSize(),e.setDrawingBufferSize(2*r,a,1)}else t.enabled&&e.setDrawingBufferSize(c.width,c.height,l)}h.layers.enable(1),h.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",u,!1),this.enabled=!1,this.getDevice=function(){return n},this.setDevice=function(e){void 0!==e&&(n=e)},this.setPoseTarget=function(e){void 0!==e&&(r=e)},this.getCamera=function(e){if(null===n)return e;n.depthNear=e.near,n.depthFar=e.far,n.getFrameData(i);var t=i.pose,c=null!==r?r:e;if(null!==t.position?c.position.fromArray(t.position):c.position.set(0,0,0),null!==t.orientation&&c.quaternion.fromArray(t.orientation),c.updateMatrixWorld(),!1===n.isPresenting)return e;o.near=e.near,s.near=e.near,o.far=e.far,s.far=e.far,h.matrixWorld.copy(e.matrixWorld),h.matrixWorldInverse.copy(e.matrixWorldInverse),o.matrixWorldInverse.fromArray(i.leftViewMatrix),s.matrixWorldInverse.fromArray(i.rightViewMatrix);var l=c.parent;null!==l&&(a.getInverse(l.matrixWorld),o.matrixWorldInverse.multiply(a),s.matrixWorldInverse.multiply(a)),o.matrixWorld.getInverse(o.matrixWorldInverse),s.matrixWorld.getInverse(s.matrixWorldInverse),o.projectionMatrix.fromArray(i.leftProjectionMatrix),s.projectionMatrix.fromArray(i.rightProjectionMatrix),h.projectionMatrix.copy(o.projectionMatrix);var u=n.getLayers();if(u.length){var d=u[0];null!==d.leftBounds&&4===d.leftBounds.length&&o.bounds.fromArray(d.leftBounds),null!==d.rightBounds&&4===d.rightBounds.length&&s.bounds.fromArray(d.rightBounds)}return h},this.submitFrame=function(){n&&n.isPresenting&&n.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",u)}}function Xn(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=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":i=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":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=e.getExtension("WEBGL_compressed_texture_etc1");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function qn(){var e=this,t=null,n=0,i=!1,r=!1,a=new pt,o=new K,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,i,r){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==r||null===l){var h=i+4*c,u=n.matrixWorldInverse;o.getNormalMatrix(u),(null===l||l.length<h)&&(l=new Float32Array(h));for(var d=0,p=i;d!==c;++d,p+=4)a.copy(t[d]).applyMatrix4(u,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,a){var o=0!==e.length||r||0!==n||i;return i=r,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){r=!0,l(null)},this.endShadows=function(){r=!1,c()},this.setState=function(e,a,o,h,u,d){if(!i||null===e||0===e.length||r&&!o)r?l(null):c();else{var p=r?0:n,f=4*p,m=u.clippingState||null;s.value=m,m=l(e,h,f,d);for(var g=0;g!==f;++g)m[g]=t[g];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function Yn(e,t){return{convert:function(n){var i;if(n===g)return e.REPEAT;if(n===v)return e.CLAMP_TO_EDGE;if(n===y)return e.MIRRORED_REPEAT;if(n===x)return e.NEAREST;if(n===b)return e.NEAREST_MIPMAP_NEAREST;if(n===w)return e.NEAREST_MIPMAP_LINEAR;if(n===_)return e.LINEAR;if(n===E)return e.LINEAR_MIPMAP_NEAREST;if(n===T)return e.LINEAR_MIPMAP_LINEAR;if(n===M)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(1019===n)return e.UNSIGNED_SHORT_5_6_5;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(n===S)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(n===A)return e.UNSIGNED_INT;if(n===R)return e.FLOAT;if(n===C&&null!==(i=t.get("OES_texture_half_float")))return i.HALF_FLOAT_OES;if(1021===n)return e.ALPHA;if(n===P)return e.RGB;if(n===N)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===O)return e.DEPTH_COMPONENT;if(n===I)return e.DEPTH_STENCIL;if(100===n)return e.FUNC_ADD;if(101===n)return e.FUNC_SUBTRACT;if(102===n)return e.FUNC_REVERSE_SUBTRACT;if(200===n)return e.ZERO;if(201===n)return e.ONE;if(202===n)return e.SRC_COLOR;if(203===n)return e.ONE_MINUS_SRC_COLOR;if(204===n)return e.SRC_ALPHA;if(205===n)return e.ONE_MINUS_SRC_ALPHA;if(206===n)return e.DST_ALPHA;if(207===n)return e.ONE_MINUS_DST_ALPHA;if(208===n)return e.DST_COLOR;if(209===n)return e.ONE_MINUS_DST_COLOR;if(210===n)return e.SRC_ALPHA_SATURATE;if((n===U||n===D||n===F||n===B)&&null!==(i=t.get("WEBGL_compressed_texture_s3tc"))){if(n===U)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===D)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===F)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===B)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((n===k||n===H||n===z||n===G)&&null!==(i=t.get("WEBGL_compressed_texture_pvrtc"))){if(n===k)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===H)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===z)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===G)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===n&&null!==(i=t.get("WEBGL_compressed_texture_etc1")))return i.COMPRESSED_RGB_ETC1_WEBGL;if((103===n||104===n)&&null!==(i=t.get("EXT_blend_minmax"))){if(103===n)return i.MIN_EXT;if(104===n)return i.MAX_EXT}return n===L&&null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:0}}}function Zn(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",h=[],u=[],d=null,p=[],f=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=1,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var m,g,v,y,x,b,w,_,E,T,S,A,L,P,O,I,U,D,F,B=this,k=!1,H=null,z=null,G=-1,V="",j=null,W=null,q=new ee,Z=new ee,K=null,Q=0,$=t.width,te=t.height,ne=1,re=new ee(0,0,$,te),ae=new ee(0,0,$,te),oe=!1,se=new ft,ce=new qn,le=!1,he=!1,ue=new Y,de=new J,pe={geometries:0,textures:0},fe={frame:0,calls:0,vertices:0,faces:0,points:0};function me(){return null===H?ne:1}this.info={render:fe,memory:pe,programs:null};try{var ge={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l};if(t.addEventListener("webglcontextlost",be,!1),t.addEventListener("webglcontextrestored",we,!1),null===(m=n||t.getContext("webgl",ge)||t.getContext("experimental-webgl",ge)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){console.error("THREE.WebGLRenderer: "+e.message)}function ve(){(g=new Xn(m)).get("WEBGL_depth_texture"),g.get("OES_texture_float"),g.get("OES_texture_float_linear"),g.get("OES_texture_half_float"),g.get("OES_texture_half_float_linear"),g.get("OES_standard_derivatives"),g.get("OES_element_index_uint"),g.get("ANGLE_instanced_arrays"),F=new Yn(m,g),v=new Gn(m,g,e),(y=new zn(m,g,F)).scissor(Z.copy(ae).multiplyScalar(ne)),y.viewport(q.copy(re).multiplyScalar(ne)),x=new Hn,b=new kn(m,g,y,x,v,F,pe),w=new gt(m),_=new yn(m,w,pe),E=new wn(_,fe),P=new mn(m),S=new Bn(B,g,v),T=new bn,A=new pn,L=new ln(B,y,_,s),O=new vn(m,g,fe),I=new gn(m,g,fe),U=new Ke(B,m,y,b,v),D=new $e(B,m,y,b,v),B.info.programs=S.programs,B.context=m,B.capabilities=v,B.extensions=g,B.properties=x,B.renderLists=A,B.state=y}ve();var ye=new Wn(B);this.vr=ye;var xe=new mt(B,E,v.maxTextureSize);function be(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),k=!0}function we(){console.log("THREE.WebGLRenderer: Context Restored."),k=!1,ve()}function _e(e){var t=e.target;t.removeEventListener("dispose",_e),function(e){Ee(e),x.remove(e)}(t)}function Ee(e){var t=x.get(e).program;e.program=void 0,void 0!==t&&S.releaseProgram(t)}this.shadowMap=xe,this.getContext=function(){return m},this.getContextAttributes=function(){return m.getContextAttributes()},this.forceContextLoss=function(){var e=g.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=g.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ne},this.setPixelRatio=function(e){void 0!==e&&(ne=e,this.setSize($,te,!1))},this.getSize=function(){return{width:$,height:te}},this.setSize=function(e,n,i){var r=ye.getDevice();r&&r.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):($=e,te=n,t.width=e*ne,t.height=n*ne,!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(){return{width:$*ne,height:te*ne}},this.setDrawingBufferSize=function(e,n,i){$=e,te=n,ne=i,t.width=e*i,t.height=n*i,this.setViewport(0,0,e,n)},this.setViewport=function(e,t,n,i){re.set(e,te-t-i,n,i),y.viewport(q.copy(re).multiplyScalar(ne))},this.setScissor=function(e,t,n,i){ae.set(e,te-t-i,n,i),y.scissor(Z.copy(ae).multiplyScalar(ne))},this.setScissorTest=function(e){y.setScissorTest(oe=e)},this.getClearColor=function(){return L.getClearColor()},this.setClearColor=function(){L.setClearColor.apply(L,arguments)},this.getClearAlpha=function(){return L.getClearAlpha()},this.setClearAlpha=function(){L.setClearAlpha.apply(L,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=m.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=m.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=m.STENCIL_BUFFER_BIT),m.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(e,t,n,i){this.setRenderTarget(e),this.clear(t,n,i)},this.dispose=function(){t.removeEventListener("webglcontextlost",be,!1),t.removeEventListener("webglcontextrestored",we,!1),A.dispose(),ye.dispose()},this.renderBufferImmediate=function(e,t,n){y.initAttributes();var i=x.get(e);e.hasPositions&&!i.position&&(i.position=m.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=m.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=m.createBuffer()),e.hasColors&&!i.color&&(i.color=m.createBuffer());var r=t.getAttributes();if(e.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,i.position),m.bufferData(m.ARRAY_BUFFER,e.positionArray,m.DYNAMIC_DRAW),y.enableAttribute(r.position),m.vertexAttribPointer(r.position,3,m.FLOAT,!1,0,0)),e.hasNormals){if(m.bindBuffer(m.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&!0===n.flatShading)for(var a=0,o=3*e.count;a<o;a+=9){var s=e.normalArray,c=(s[a+0]+s[a+3]+s[a+6])/3,l=(s[a+1]+s[a+4]+s[a+7])/3,h=(s[a+2]+s[a+5]+s[a+8])/3;s[a+0]=c,s[a+1]=l,s[a+2]=h,s[a+3]=c,s[a+4]=l,s[a+5]=h,s[a+6]=c,s[a+7]=l,s[a+8]=h}m.bufferData(m.ARRAY_BUFFER,e.normalArray,m.DYNAMIC_DRAW),y.enableAttribute(r.normal),m.vertexAttribPointer(r.normal,3,m.FLOAT,!1,0,0)}e.hasUvs&&n.map&&(m.bindBuffer(m.ARRAY_BUFFER,i.uv),m.bufferData(m.ARRAY_BUFFER,e.uvArray,m.DYNAMIC_DRAW),y.enableAttribute(r.uv),m.vertexAttribPointer(r.uv,2,m.FLOAT,!1,0,0)),e.hasColors&&0!==n.vertexColors&&(m.bindBuffer(m.ARRAY_BUFFER,i.color),m.bufferData(m.ARRAY_BUFFER,e.colorArray,m.DYNAMIC_DRAW),y.enableAttribute(r.color),m.vertexAttribPointer(r.color,3,m.FLOAT,!1,0,0)),y.disableUnusedAttributes(),m.drawArrays(m.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,i,r,a){var o=r.isMesh&&r.matrixWorld.determinant()<0;y.setMaterial(i,o);var s=Pe(e,t,i,r),c=n.id+"_"+s.id+"_"+(!0===i.wireframe),l=!1;c!==V&&(V=c,l=!0),r.morphTargetInfluences&&(P.update(r,n,i,s),l=!0);var h,u=n.index,d=n.attributes.position,p=1;!0===i.wireframe&&(u=_.getWireframeAttribute(n),p=2);var f=O;null!==u&&(h=w.get(u),(f=I).setIndex(h)),l&&(function(e,t,n,i){if(n&&n.isInstancedBufferGeometry&&null===g.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===i&&(i=0),y.initAttributes();var r=n.attributes,a=t.getAttributes(),o=e.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=r[s];if(void 0!==l){var h=l.normalized,u=l.itemSize,d=w.get(l);if(void 0===d)continue;var p=d.buffer,f=d.type,v=d.bytesPerElement;if(l.isInterleavedBufferAttribute){var x=l.data,b=x.stride,_=l.offset;x&&x.isInstancedInterleavedBuffer?(y.enableAttributeAndDivisor(c,x.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=x.meshPerAttribute*x.count)):y.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,u,f,h,b*v,(i*b+_)*v)}else l.isInstancedBufferAttribute?(y.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=l.meshPerAttribute*l.count)):y.enableAttribute(c),m.bindBuffer(m.ARRAY_BUFFER,p),m.vertexAttribPointer(c,u,f,h,0,i*u*v)}else if(void 0!==o){var E=o[s];if(void 0!==E)switch(E.length){case 2:m.vertexAttrib2fv(c,E);break;case 3:m.vertexAttrib3fv(c,E);break;case 4:m.vertexAttrib4fv(c,E);break;default:m.vertexAttrib1fv(c,E)}}}}y.disableUnusedAttributes()}}(i,s,n),null!==u&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer));var v=0;null!==u?v=u.count:void 0!==d&&(v=d.count);var x=n.drawRange.start*p,b=n.drawRange.count*p,E=null!==a?a.start*p:0,T=null!==a?a.count*p:1/0,M=Math.max(x,E),S=Math.min(v,x+b,E+T)-1,A=Math.max(0,S-M+1);if(0!==A){if(r.isMesh)if(!0===i.wireframe)y.setLineWidth(i.wireframeLinewidth*me()),f.setMode(m.LINES);else switch(r.drawMode){case 0:f.setMode(m.TRIANGLES);break;case 1:f.setMode(m.TRIANGLE_STRIP);break;case 2:f.setMode(m.TRIANGLE_FAN)}else if(r.isLine){var R=i.linewidth;void 0===R&&(R=1),y.setLineWidth(R*me()),r.isLineSegments?f.setMode(m.LINES):r.isLineLoop?f.setMode(m.LINE_LOOP):f.setMode(m.LINE_STRIP)}else r.isPoints&&f.setMode(m.POINTS);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&f.renderInstances(n,M,A):f.render(M,A)}},this.compile=function(e,t){h.length=0,u.length=0,e.traverse((function(e){e.isLight&&(h.push(e),e.castShadow&&u.push(e))})),T.setup(h,u,t),e.traverse((function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n<t.material.length;n++)Le(t.material[n],e.fog,t);else Le(t.material,e.fog,t)}))};var Te,Me=!1,Se=null;function Ae(e){null!==Se&&Se(e);var t=ye.getDevice();t&&t.isPresenting?t.requestAnimationFrame(Ae):window.requestAnimationFrame(Ae)}function Re(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,c=o.geometry,l=void 0===i?o.material:i,h=o.group;if(n.isArrayCamera){W=n;for(var u=n.cameras,d=0,p=u.length;d<p;d++){var f=u[d];if(s.layers.test(f.layers)){var m=f.bounds,g=m.x*$,v=m.y*te,x=m.z*$,b=m.w*te;y.viewport(q.set(g,v,x,b).multiplyScalar(ne)),Ce(s,t,f,c,l,h)}}}else W=null,Ce(s,t,n,c,l,h)}}function Ce(e,t,n,i,r,a){if(e.onBeforeRender(B,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=e.isMesh&&e.matrixWorld.determinant()<0;y.setMaterial(r,o);var s=Pe(n,t.fog,r,e);V="",function(e,t,n){e.render((function(e){B.renderBufferImmediate(e,t,n)}))}(e,s,r)}else B.renderBufferDirect(n,t.fog,i,r,e,a);e.onAfterRender(B,t,n,i,r,a)}function Le(e,t,n){var i=x.get(e),r=S.getParameters(e,T.state,u,t,ce.numPlanes,ce.numIntersection,n),a=S.getProgramCode(e,r),o=i.program,s=!0;if(void 0===o)e.addEventListener("dispose",_e);else if(o.code!==a)Ee(e);else{if(void 0!==r.shaderID)return;s=!1}if(s){if(r.shaderID){var c=Ze[r.shaderID];i.shader={name:e.type,uniforms:qe.clone(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader}}else i.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(i.shader),o=S.acquireProgram(e,i.shader,r,a),i.program=o,e.program=o}var l=o.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var h=0;h<B.maxMorphTargets;h++)l["morphTarget"+h]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals)for(e.numSupportedMorphNormals=0,h=0;h<B.maxMorphNormals;h++)l["morphNormal"+h]>=0&&e.numSupportedMorphNormals++;var d=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=ce.numPlanes,i.numIntersection=ce.numIntersection,d.clippingPlanes=ce.uniform),i.fog=t,i.lightsHash=T.state.hash,e.lights&&(d.ambientLightColor.value=T.state.ambient,d.directionalLights.value=T.state.directional,d.spotLights.value=T.state.spot,d.rectAreaLights.value=T.state.rectArea,d.pointLights.value=T.state.point,d.hemisphereLights.value=T.state.hemi,d.directionalShadowMap.value=T.state.directionalShadowMap,d.directionalShadowMatrix.value=T.state.directionalShadowMatrix,d.spotShadowMap.value=T.state.spotShadowMap,d.spotShadowMatrix.value=T.state.spotShadowMatrix,d.pointShadowMap.value=T.state.pointShadowMap,d.pointShadowMatrix.value=T.state.pointShadowMatrix);var p=i.program.getUniforms(),f=Ve.seqWithValue(p.seq,d);i.uniformsList=f}function Pe(e,t,n,i){Q=0;var r=x.get(n);if(le&&(he||e!==j)){var a=e===j&&n.id===G;ce.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,a)}!1===n.needsUpdate&&(void 0===r.program||n.fog&&r.fog!==t||n.lights&&r.lightsHash!==T.state.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===ce.numPlanes&&r.numIntersection===ce.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(Le(n,t,i),n.needsUpdate=!1);var o,s,c=!1,l=!1,h=!1,u=r.program,d=u.getUniforms(),p=r.shader.uniforms;if(y.useProgram(u.program)&&(c=!0,l=!0,h=!0),n.id!==G&&(G=n.id,l=!0),c||e!==j){if(d.setValue(m,"projectionMatrix",e.projectionMatrix),v.logarithmicDepthBuffer&&d.setValue(m,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),j!==(W||e)&&(j=W||e,l=!0,h=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var f=d.map.cameraPosition;void 0!==f&&f.setValue(m,de.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&d.setValue(m,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){d.setOptional(m,i,"bindMatrix"),d.setOptional(m,i,"bindMatrixInverse");var g=i.skeleton;if(g){var b=g.bones;if(v.floatVertexTextures){if(void 0===g.boneTexture){var w=Math.sqrt(4*b.length);w=X.ceilPowerOfTwo(w),w=Math.max(w,4);var _=new Float32Array(w*w*4);_.set(g.boneMatrices);var E=new ie(_,w,w,N,R);g.boneMatrices=_,g.boneTexture=E,g.boneTextureSize=w}d.setValue(m,"boneTexture",g.boneTexture),d.setValue(m,"boneTextureSize",g.boneTextureSize)}else d.setOptional(m,g,"boneMatrices")}}return l&&(d.setValue(m,"toneMappingExposure",B.toneMappingExposure),d.setValue(m,"toneMappingWhitePoint",B.toneMappingWhitePoint),n.lights&&(s=h,(o=p).ambientLightColor.needsUpdate=s,o.directionalLights.needsUpdate=s,o.pointLights.needsUpdate=s,o.spotLights.needsUpdate=s,o.rectAreaLights.needsUpdate=s,o.hemisphereLights.needsUpdate=s),t&&n.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(p,t),n.isMeshBasicMaterial?Ne(p,n):n.isMeshLambertMaterial?(Ne(p,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(p,n)):n.isMeshPhongMaterial?(Ne(p,n),n.isMeshToonMaterial?function(e,t){Oe(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(p,n):Oe(p,n)):n.isMeshStandardMaterial?(Ne(p,n),n.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,Ie(e,t)}(p,n):Ie(p,n)):n.isMeshDepthMaterial?(Ne(p,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(p,n)):n.isMeshDistanceMaterial?(Ne(p,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(p,n)):n.isMeshNormalMaterial?(Ne(p,n),function(e,t){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)}(p,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}(p,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(p,n)):n.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*ne,e.scale.value=.5*te,e.map.value=t.map,null!==t.map){if(!0===t.map.matrixAutoUpdate){var n=t.map.offset,i=t.map.repeat,r=t.map.rotation,a=t.map.center;t.map.matrix.setUvTransform(n.x,n.y,i.x,i.y,r,a.x,a.y)}e.uvTransform.value.copy(t.map.matrix)}}(p,n):n.isShadowMaterial&&(p.color.value=n.color,p.opacity.value=n.opacity),void 0!==p.ltcMat&&(p.ltcMat.value=Xe.LTC_MAT_TEXTURE),void 0!==p.ltcMag&&(p.ltcMag.value=Xe.LTC_MAG_TEXTURE),Ve.upload(m,r.uniformsList,p,B)),d.setValue(m,"modelViewMatrix",i.modelViewMatrix),d.setValue(m,"normalMatrix",i.normalMatrix),d.setValue(m,"modelMatrix",i.matrixWorld),u}function Ne(e,t){var n;if(e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n){if(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate){var i=n.offset,r=n.repeat,a=n.rotation,o=n.center;n.matrix.setUvTransform(i.x,i.y,r.x,r.y,a,o.x,o.y)}e.uvTransform.value.copy(n.matrix)}}function Oe(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),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 Ie(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.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)}this.animate=function(e){Se=e,function(){if(!Me){var e=ye.getDevice();e&&e.isPresenting?e.requestAnimationFrame(Ae):window.requestAnimationFrame(Ae),Me=!0}}()},this.render=function(e,t,n,i){if(t&&t.isCamera){if(!k){V="",G=-1,j=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ye.enabled&&(t=ye.getCamera(t)),ue.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),se.setFromMatrix(ue),h.length=0,u.length=0,p.length=0,f.length=0,he=this.localClippingEnabled,le=ce.init(this.clippingPlanes,he,t),(d=A.get(e,t)).init(),function e(t,n,i){if(!1!==t.visible){if(t.layers.test(n.layers))if(t.isLight)h.push(t),t.castShadow&&u.push(t);else if(t.isSprite)t.frustumCulled&&!se.intersectsSprite(t)||p.push(t);else if(t.isLensFlare)f.push(t);else if(t.isImmediateRenderObject)i&&de.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ue),d.push(t,null,t.material,de.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||se.intersectsObject(t))){i&&de.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ue);var r=E.update(t),a=t.material;if(Array.isArray(a))for(var o=r.groups,s=0,c=o.length;s<c;s++){var l=o[s],m=a[l.materialIndex];m&&m.visible&&d.push(t,r,m,de.z,l)}else a.visible&&d.push(t,r,a,de.z,null)}var g=t.children;for(s=0,c=g.length;s<c;s++)e(g[s],n,i)}}(e,t,B.sortObjects),!0===B.sortObjects&&d.sort(),b.updateVideoTextures(),le&&ce.beginShadows(),xe.render(u,e,t),T.setup(h,u,t),le&&ce.endShadows(),fe.frame++,fe.calls=0,fe.vertices=0,fe.faces=0,fe.points=0,void 0===n&&(n=null),this.setRenderTarget(n),L.render(d,e,t,i);var r=d.opaque,a=d.transparent;if(e.overrideMaterial){var o=e.overrideMaterial;r.length&&Re(r,e,t,o),a.length&&Re(a,e,t,o)}else r.length&&Re(r,e,t),a.length&&Re(a,e,t);D.render(p,e,t),U.render(f,e,t,q),n&&b.updateRenderTargetMipmap(n),y.buffers.depth.setTest(!0),y.buffers.depth.setMask(!0),y.buffers.color.setMask(!0),y.setPolygonOffset(!1),ye.enabled&&ye.submitFrame()}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFaceCulling=function(e,t){y.setCullFace(e),y.setFlipSided(0===t)},this.allocTextureUnit=function(){var e=Q;return e>=v.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+v.maxTextures),Q+=1,e},this.setTexture2D=(Te=!1,function(e,t){e&&e.isWebGLRenderTarget&&(Te||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Te=!0),e=e.texture),b.setTexture2D(e,t)}),this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),b.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?b.setTextureCube(t,n):b.setTextureCubeDynamic(t,n)}}(),this.getRenderTarget=function(){return H},this.setRenderTarget=function(e){H=e,e&&void 0===x.get(e).__webglFramebuffer&&b.setupRenderTarget(e);var t=null,n=!1;if(e){var i=x.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=i[e.activeCubeFace],n=!0):t=i,q.copy(e.viewport),Z.copy(e.scissor),K=e.scissorTest}else q.copy(re).multiplyScalar(ne),Z.copy(ae).multiplyScalar(ne),K=oe;if(z!==t&&(m.bindFramebuffer(m.FRAMEBUFFER,t),z=t),y.viewport(q),y.scissor(Z),y.setScissorTest(K),n){var r=x.get(e.texture);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,r.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,i,r,a){if(e&&e.isWebGLRenderTarget){var o=x.get(e).__webglFramebuffer;if(o){var s=!1;o!==z&&(m.bindFramebuffer(m.FRAMEBUFFER,o),s=!0);try{var c=e.texture,l=c.format,h=c.type;if(l!==N&&F.convert(l)!==m.getParameter(m.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===M||F.convert(h)===m.getParameter(m.IMPLEMENTATION_COLOR_READ_TYPE)||h===R&&(g.get("OES_texture_float")||g.get("WEBGL_color_buffer_float"))||h===C&&g.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");m.checkFramebufferStatus(m.FRAMEBUFFER)===m.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&m.readPixels(t,n,i,r,F.convert(l),F.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&m.bindFramebuffer(m.FRAMEBUFFER,z)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function Jn(e,t){this.name="",this.color=new We(e),this.density=void 0!==t?t:25e-5}function Kn(e,t,n){this.name="",this.color=new We(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Qn(){Tt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function $n(e,t,n,i,r){Tt.call(this),this.lensFlares=[],this.positionScreen=new J,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,n,i,r)}function ei(e){ct.call(this),this.type="SpriteMaterial",this.color=new We(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function ti(e){Tt.call(this),this.type="Sprite",this.material=void 0!==e?e:new ei}function ni(){Tt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function ii(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Y)}}function ri(){Tt.call(this),this.type="Bone"}function ai(e,t){cn.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Y,this.bindMatrixInverse=new Y;var n=new ii(this.initBones());this.bind(n,this.matrixWorld),this.normalizeSkinWeights()}function oi(e){ct.call(this),this.type="LineBasicMaterial",this.color=new We(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function si(e,t,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new ci(e,t);Tt.call(this),this.type="Line",this.geometry=void 0!==e?e:new Kt,this.material=void 0!==t?t:new oi({color:16777215*Math.random()})}function ci(e,t){si.call(this,e,t),this.type="LineSegments"}function li(e,t){si.call(this,e,t),this.type="LineLoop"}function hi(e){ct.call(this),this.type="PointsMaterial",this.color=new We(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(e)}function ui(e,t){Tt.call(this),this.type="Points",this.geometry=void 0!==e?e:new Kt,this.material=void 0!==t?t:new hi({color:16777215*Math.random()})}function di(){Tt.call(this),this.type="Group"}function pi(e,t,n,i,r,a,o,s,c){$.call(this,e,t,n,i,r,a,o,s,c),this.generateMipmaps=!1;var l=this;e.addEventListener("loadeddata",(function t(){e.removeEventListener("loadeddata",t,!1),l.needsUpdate=!0}),!1)}function fi(e,t,n,i,r,a,o,s,c,l,h,u){$.call(this,null,a,o,s,c,l,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function mi(e,t,n,i,r,a,o,s,c,l){if((l=void 0!==l?l:O)!==O&&l!==I)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===O&&(n=S),void 0===n&&l===I&&(n=L),$.call(this,null,i,r,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:x,this.minFilter=void 0!==s?s:x,this.flipY=!1,this.generateMipmaps=!1}function gi(e){Kt.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,c,l,h,u=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var g=m[t];for(n=0;n<3;n++)s=g[f[n]],c=g[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)o=p[l],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var v,y,x,b,w,_,E;if(h=new J,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(t=w=(b=x[r]).start,i=w+b.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)o=p[l],h.fromBufferAttribute(v,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(v,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,i=(v=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)_=3*t+n,h.fromBufferAttribute(v,_),u.push(h.x,h.y,h.z),E=3*t+(n+1)%3,h.fromBufferAttribute(v,E),u.push(h.x,h.y,h.z)}this.addAttribute("position",new kt(u,3))}function vi(e,t,n){Lt.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new yi(e,t,n)),this.mergeVertices()}function yi(e,t,n){Kt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,a=[],o=[],s=[],c=[],l=new J,h=new J,u=new J,d=new J,p=new J,f=t+1;for(i=0;i<=n;i++){var m=i/n;for(r=0;r<=t;r++){var g=r/t;h=e(g,m,h),o.push(h.x,h.y,h.z),g-1e-5>=0?(u=e(g-1e-5,m,u),d.subVectors(h,u)):(u=e(g+1e-5,m,u),d.subVectors(u,h)),m-1e-5>=0?(u=e(g,m-1e-5,u),p.subVectors(h,u)):(u=e(g,m+1e-5,u),p.subVectors(u,h)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),c.push(g,m)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var v=i*f+r,y=i*f+r+1,x=(i+1)*f+r+1,b=(i+1)*f+r;a.push(v,y,b),a.push(y,x,b)}this.setIndex(a),this.addAttribute("position",new kt(o,3)),this.addAttribute("normal",new kt(s,3)),this.addAttribute("uv",new kt(c,2))}function xi(e,t,n,i){Lt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new bi(e,t,n,i)),this.mergeVertices()}function bi(e,t,n,i){Kt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var r=[],a=[];function o(e,t,n,i){var r,a,o=Math.pow(2,i),c=[];for(r=0;r<=o;r++){c[r]=[];var l=e.clone().lerp(n,r/o),h=t.clone().lerp(n,r/o),u=o-r;for(a=0;a<=u;a++)c[r][a]=0===a&&r===o?l:l.clone().lerp(h,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var d=Math.floor(a/2);a%2==0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function s(e){r.push(e.x,e.y,e.z)}function c(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function l(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}!function(e){for(var n=new J,i=new J,r=new J,a=0;a<t.length;a+=3)c(t[a+0],n),c(t[a+1],i),c(t[a+2],r),o(n,i,r,e)}(i=i||0),function(e){for(var t=new J,n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){for(var e=new J,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var n=h(e)/2/Math.PI+.5,i=(o=e,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(n,1-i)}var o;(function(){for(var e=new J,t=new J,n=new J,i=new J,o=new q,s=new q,c=new q,u=0,d=0;u<r.length;u+=9,d+=6){e.set(r[u+0],r[u+1],r[u+2]),t.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),i.copy(e).add(t).add(n).divideScalar(3);var p=h(i);l(o,d+0,e,p),l(s,d+2,t,p),l(c,d+4,n,p)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.addAttribute("position",new kt(r,3)),this.addAttribute("normal",new kt(r.slice(),3)),this.addAttribute("uv",new kt(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function wi(e,t){Lt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new _i(e,t)),this.mergeVertices()}function _i(e,t){bi.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ei(e,t){Lt.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ti(e,t)),this.mergeVertices()}function Ti(e,t){bi.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Mi(e,t){Lt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Si(e,t)),this.mergeVertices()}function Si(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];bi.call(this,i,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ai(e,t){Lt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ri(e,t)),this.mergeVertices()}function Ri(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];bi.call(this,r,[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Ci(e,t,n,i,r,a){Lt.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Li(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Li(e,t,n,i,r){Kt.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new J,l=new J,h=new q,u=new J,d=[],p=[],f=[],m=[];function g(r){u=e.getPointAt(r/t,u);var o=a.normals[r],h=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*o.x+m*h.x,l.y=g*o.y+m*h.y,l.z=g*o.z+m*h.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=u.x+n*l.x,c.y=u.y+n*l.y,c.z=u.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(o=0;o<t;o++)g(o);g(!1===r?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=i;s++)h.x=o/t,h.y=s/i,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=i;o++){var e=(i+1)*(s-1)+(o-1),n=(i+1)*s+(o-1),r=(i+1)*s+o,a=(i+1)*(s-1)+o;m.push(e,n,a),m.push(n,r,a)}}()}(),this.setIndex(m),this.addAttribute("position",new kt(d,3)),this.addAttribute("normal",new kt(p,3)),this.addAttribute("uv",new kt(f,2))}function Pi(e,t,n,i,r,a,o){Lt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ni(e,t,n,i,r,a)),this.mergeVertices()}function Ni(e,t,n,i,r,a){Kt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o,s,c=[],l=[],h=[],u=[],d=new J,p=new J,f=new J,m=new J,g=new J,v=new J,y=new J;for(o=0;o<=n;++o){var x=o/n*r*Math.PI*2;for(A(x,r,a,e,f),A(x+.01,r,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=i;++s){var b=s/i*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);d.x=f.x+(w*y.x+_*g.x),d.y=f.y+(w*y.y+_*g.y),d.z=f.z+(w*y.z+_*g.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),h.push(p.x,p.y,p.z),u.push(o/n),u.push(s/i)}}for(s=1;s<=n;s++)for(o=1;o<=i;o++){var E=(i+1)*(s-1)+(o-1),T=(i+1)*s+(o-1),M=(i+1)*s+o,S=(i+1)*(s-1)+o;c.push(E,T,S),c.push(T,M,S)}function A(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);r.x=i*(2+c)*.5*a,r.y=i*(2+c)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new kt(l,3)),this.addAttribute("normal",new kt(h,3)),this.addAttribute("uv",new kt(u,2))}function Oi(e,t,n,i,r){Lt.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new Ii(e,t,n,i,r)),this.mergeVertices()}function Ii(e,t,n,i,r){Kt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,o,s=[],c=[],l=[],h=[],u=new J,d=new J,p=new J;for(a=0;a<=n;a++)for(o=0;o<=i;o++){var f=o/i*r,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),c.push(d.x,d.y,d.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),p.subVectors(d,u).normalize(),l.push(p.x,p.y,p.z),h.push(o/i),h.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=i;o++){var g=(i+1)*a+o-1,v=(i+1)*(a-1)+o-1,y=(i+1)*(a-1)+o,x=(i+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.addAttribute("position",new kt(c,3)),this.addAttribute("normal",new kt(l,3)),this.addAttribute("uv",new kt(h,2))}Vn.prototype=Object.assign(Object.create(Mt.prototype),{constructor:Vn,isPerspectiveCamera:!0,copy:function(e,t){return Mt.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*X.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*X.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*X.RAD2DEG*Math.atan(Math.tan(.5*X.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*X.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(r+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far)},toJSON:function(e){var t=Tt.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),jn.prototype=Object.assign(Object.create(Vn.prototype),{constructor:jn,isArrayCamera:!0}),Jn.prototype.isFogExp2=!0,Jn.prototype.clone=function(){return new Jn(this.color.getHex(),this.density)},Jn.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Kn.prototype.isFog=!0,Kn.prototype.clone=function(){return new Kn(this.color.getHex(),this.near,this.far)},Kn.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Qn.prototype=Object.assign(Object.create(Tt.prototype),{constructor:Qn,copy:function(e,t){return Tt.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),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},toJSON:function(e){var t=Tt.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}),$n.prototype=Object.assign(Object.create(Tt.prototype),{constructor:$n,isLensFlare:!0,copy:function(e){Tt.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,n=e.lensFlares.length;t<n;t++)this.lensFlares.push(e.lensFlares[t]);return this},add:function(e,t,n,i,r,a){void 0===t&&(t=-1),void 0===n&&(n=0),void 0===a&&(a=1),void 0===r&&(r=new We(16777215)),void 0===i&&(i=1),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:r,blending:i})},updateLensFlares:function(){var e,t,n=this.lensFlares.length,i=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(e=0;e<n;e++)(t=this.lensFlares[e]).x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+r*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)}}),ei.prototype=Object.create(ct.prototype),ei.prototype.constructor=ei,ei.prototype.isSpriteMaterial=!0,ei.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this},ti.prototype=Object.assign(Object.create(Tt.prototype),{constructor:ti,isSprite:!0,raycast:(Sn=new J,An=new J,Rn=new J,function(e,t){An.setFromMatrixPosition(this.matrixWorld),e.ray.closestPointToPoint(An,Sn),Rn.setFromMatrixScale(this.matrixWorld);var n=Rn.x*Rn.y/4;if(!(An.distanceToSquared(Sn)>n)){var i=e.ray.origin.distanceTo(Sn);i<e.near||i>e.far||t.push({distance:i,point:Sn.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),ni.prototype=Object.assign(Object.create(Tt.prototype),{constructor:ni,copy:function(e){Tt.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);n.splice(i,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object},raycast:(Mn=new J,function(e,t){Mn.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Mn);this.getObjectForDistance(n).raycast(e,t)}),update:function(){var e=new J,t=new J;return function(n){var i=this.levels;if(i.length>1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var r=e.distanceTo(t);i[0].object.visible=!0;for(var a=1,o=i.length;a<o&&r>=i[a].distance;a++)i[a-1].object.visible=!1,i[a].object.visible=!0;for(;a<o;a++)i[a].object.visible=!1}}}(),toJSON:function(e){var t=Tt.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Object.assign(ii.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Y;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(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))},update:(En=new Y,Tn=new Y,function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:Tn;En.multiplyMatrices(o,t[r]),En.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)}),clone:function(){return new ii(this.bones,this.boneInverses)}}),ri.prototype=Object.assign(Object.create(Tt.prototype),{constructor:ri,isBone:!0}),ai.prototype=Object.assign(Object.create(cn.prototype),{constructor:ai,isSkinnedMesh:!0,initBones:function(){var e,t,n,i,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,i=this.geometry.bones.length;n<i;n++)t=this.geometry.bones[n],e=new ri,r.push(e),e.name=t.name,e.position.fromArray(t.pos),e.quaternion.fromArray(t.rotq),void 0!==t.scl&&e.scale.fromArray(t.scl);for(n=0,i=this.geometry.bones.length;n<i;n++)-1!==(t=this.geometry.bones[n]).parent&&null!==t.parent&&void 0!==r[t.parent]?r[t.parent].add(r[n]):this.add(r[n])}return this.updateMatrixWorld(!0),r},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)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var e,t;if(this.geometry&&this.geometry.isGeometry)for(t=0;t<this.geometry.skinWeights.length;t++){var n=this.geometry.skinWeights[t];(e=1/n.manhattanLength())!=1/0?n.multiplyScalar(e):n.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var i=new ee,r=this.geometry.attributes.skinWeight;for(t=0;t<r.count;t++)i.x=r.getX(t),i.y=r.getY(t),i.z=r.getZ(t),i.w=r.getW(t),(e=1/i.manhattanLength())!=1/0?i.multiplyScalar(e):i.set(1,0,0,0),r.setXYZW(t,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(e){cn.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),oi.prototype=Object.create(ct.prototype),oi.prototype.constructor=oi,oi.prototype.isLineBasicMaterial=!0,oi.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},si.prototype=Object.assign(Object.create(Tt.prototype),{constructor:si,isLine:!0,raycast:function(){var e=new Y,t=new an,n=new dt;return function(i,r){var a=i.linePrecision,o=a*a,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){e.getInverse(c),t.copy(i.ray).applyMatrix4(e);var l=new J,h=new J,u=new J,d=new J,p=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var f=s.index,m=s.attributes.position.array;if(null!==f)for(var g=f.array,v=0,y=g.length-1;v<y;v+=p){var x=g[v],b=g[v+1];l.fromArray(m,3*x),h.fromArray(m,3*b),t.distanceSqToSegment(l,h,d,u)>o||(d.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(d))<i.near||E>i.far||r.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}else for(v=0,y=m.length/3-1;v<y;v+=p)l.fromArray(m,3*v),h.fromArray(m,3*v+3),t.distanceSqToSegment(l,h,d,u)>o||(d.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(d))<i.near||E>i.far||r.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}else if(s.isGeometry){var w=s.vertices,_=w.length;for(v=0;v<_-1;v+=p){var E;t.distanceSqToSegment(w[v],w[v+1],d,u)>o||(d.applyMatrix4(this.matrixWorld),(E=i.ray.origin.distanceTo(d))<i.near||E>i.far||r.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ci.prototype=Object.assign(Object.create(si.prototype),{constructor:ci,isLineSegments:!0}),li.prototype=Object.assign(Object.create(si.prototype),{constructor:li,isLineLoop:!0}),hi.prototype=Object.create(ct.prototype),hi.prototype.constructor=hi,hi.prototype.isPointsMaterial=!0,hi.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},ui.prototype=Object.assign(Object.create(Tt.prototype),{constructor:ui,isPoints:!0,raycast:function(){var e=new Y,t=new an,n=new dt;return function(i,r){var a=this,o=this.geometry,s=this.matrixWorld,c=i.params.Points.threshold;if(null===o.boundingSphere&&o.computeBoundingSphere(),n.copy(o.boundingSphere),n.applyMatrix4(s),n.radius+=c,!1!==i.ray.intersectsSphere(n)){e.getInverse(s),t.copy(i.ray).applyMatrix4(e);var l=c/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l,u=new J;if(o.isBufferGeometry){var d=o.index,p=o.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length;m<g;m++){var v=f[m];u.fromArray(p,3*v),b(u,v)}else{m=0;for(var y=p.length/3;m<y;m++)u.fromArray(p,3*m),b(u,m)}}else{var x=o.vertices;for(m=0,y=x.length;m<y;m++)b(x[m],m)}}function b(e,n){var o=t.distanceSqToPoint(e);if(o<h){var c=t.closestPointToPoint(e);c.applyMatrix4(s);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:c.clone(),index:n,face:null,object:a})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),di.prototype=Object.assign(Object.create(Tt.prototype),{constructor:di,isGroup:!0}),pi.prototype=Object.assign(Object.create($.prototype),{constructor:pi,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),fi.prototype=Object.create($.prototype),fi.prototype.constructor=fi,fi.prototype.isCompressedTexture=!0,mi.prototype=Object.create($.prototype),mi.prototype.constructor=mi,mi.prototype.isDepthTexture=!0,gi.prototype=Object.create(Kt.prototype),gi.prototype.constructor=gi,vi.prototype=Object.create(Lt.prototype),vi.prototype.constructor=vi,yi.prototype=Object.create(Kt.prototype),yi.prototype.constructor=yi,xi.prototype=Object.create(Lt.prototype),xi.prototype.constructor=xi,bi.prototype=Object.create(Kt.prototype),bi.prototype.constructor=bi,wi.prototype=Object.create(Lt.prototype),wi.prototype.constructor=wi,_i.prototype=Object.create(bi.prototype),_i.prototype.constructor=_i,Ei.prototype=Object.create(Lt.prototype),Ei.prototype.constructor=Ei,Ti.prototype=Object.create(bi.prototype),Ti.prototype.constructor=Ti,Mi.prototype=Object.create(Lt.prototype),Mi.prototype.constructor=Mi,Si.prototype=Object.create(bi.prototype),Si.prototype.constructor=Si,Ai.prototype=Object.create(Lt.prototype),Ai.prototype.constructor=Ai,Ri.prototype=Object.create(bi.prototype),Ri.prototype.constructor=Ri,Ci.prototype=Object.create(Lt.prototype),Ci.prototype.constructor=Ci,Li.prototype=Object.create(Kt.prototype),Li.prototype.constructor=Li,Pi.prototype=Object.create(Lt.prototype),Pi.prototype.constructor=Pi,Ni.prototype=Object.create(Kt.prototype),Ni.prototype.constructor=Ni,Oi.prototype=Object.create(Lt.prototype),Oi.prototype.constructor=Oi,Ii.prototype=Object.create(Kt.prototype),Ii.prototype.constructor=Ii;function Ui(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=$i(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=$i(a,e[a],e[a+1],o);return o&&Zi(o,o.next)&&(er(o),o=o.next),o}function Di(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!Zi(i,i.next)&&0!==Yi(i.prev,i,i.next))i=i.next;else{if(er(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Fi(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=ji(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<l&&(s++,i=i.nextZ);t++);for(c=l;s>0||c>0&&i;)0!==s&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,l*=2}while(o>1)}(r)}(e,i,r,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?ki(e,i,r,a):Bi(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),er(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?Fi(e=Hi(e,t,n),t,n,i,r,a,2):2===o&&zi(e,t,n,i,r,a):Fi(Di(e),t,n,i,r,a,1);break}}}function Bi(e){var t=e.prev,n=e,i=e.next;if(Yi(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(Xi(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ki(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Yi(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,c=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,l=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,h=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=ji(s,c,t,n,i),d=ji(l,h,t,n,i),p=e.nextZ;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&Xi(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Yi(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=e.prevZ;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Xi(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Yi(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function Hi(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Zi(r,a)&&Ji(r,i,i.next,a)&&Ki(r,a)&&Ki(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),er(i),er(i.next),i=e=a),i=i.next}while(i!==e);return i}function zi(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&qi(o,s)){var c=Qi(o,s);return o=Di(o,o.next),c=Di(c,c.next),Fi(o,t,n,i,r,a),void Fi(c,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function Gi(e,t){return e.x-t.x}function Vi(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n.prev;var c,l=n,h=n.x,u=n.y,d=1/0;for(i=n.next;i!==l;)r>=i.x&&i.x>=h&&r!==i.x&&Xi(a<u?r:o,a,h,u,a<u?o:r,a,i.x,i.y)&&((c=Math.abs(a-i.y)/(r-i.x))<d||c===d&&i.x>n.x)&&Ki(i,e)&&(n=i,d=c),i=i.next;return n}(e,t)){var n=Qi(t,e);Di(n,n.next)}}function ji(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wi(e){var t=e,n=e;do{t.x<n.x&&(n=t),t=t.next}while(t!==e);return n}function Xi(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function qi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ji(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&Ki(e,t)&&Ki(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)}function Yi(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Zi(e,t){return e.x===t.x&&e.y===t.y}function Ji(e,t,n,i){return!!(Zi(e,t)&&Zi(n,i)||Zi(e,i)&&Zi(n,t))||Yi(e,t,n)>0!=Yi(e,t,i)>0&&Yi(n,i,e)>0!=Yi(n,i,t)>0}function Ki(e,t){return Yi(e.prev,e,e.next)<0?Yi(e,t,e.next)>=0&&Yi(e,e.prev,t)>=0:Yi(e,t,e.prev)<0||Yi(e,e.next,t)<0}function Qi(e,t){var n=new tr(e.i,e.x,e.y),i=new tr(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function $i(e,t,n,i){var r=new tr(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function er(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function tr(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var nr={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return nr.area(e)<0},triangulateShape:function(e,t){function n(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function i(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var r=[],a=[],o=[];n(e),i(r,e);var s=e.length;for(t.forEach(n),l=0;l<t.length;l++)a.push(s),s+=t[l].length,i(r,t[l]);for(var c=function(e,t,n){n=n||2;var i,r,a,o,s,c,l,h=t&&t.length,u=h?t[0]*n:e.length,d=Ui(e,0,u,n,!0),p=[];if(!d)return p;if(h&&(d=function(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r<a;r++)(o=Ui(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),s.push(Wi(o));for(s.sort(Gi),r=0;r<s.length;r++)Vi(s[r],n),n=Di(n,n.next);return n}(e,t,d,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<u;f+=n)(s=e[f])<i&&(i=s),(c=e[f+1])<r&&(r=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-i,o-r))?1/l:0}return Fi(d,p,n,i,r,l),p}(r,a),l=0;l<c.length;l+=3)o.push(c.slice(l,l+3));return o}};function ir(e,t){Lt.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new rr(e,t)),this.mergeVertices()}function rr(e,t){void 0!==e&&(Kt.call(this),this.type="ExtrudeBufferGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),this.computeVertexNormals())}function ar(e,t){Lt.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new or(e,t)),this.mergeVertices()}function or(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Lt;var i=n.generateShapes(e,t.size,t.curveSegments);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),rr.call(this,i,t),this.type="TextBufferGeometry"}function sr(e,t,n,i,r,a,o){Lt.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new cr(e,t,n,i,r,a,o)),this.mergeVertices()}function cr(e,t,n,i,r,a,o){Kt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var s,c,l=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),h=0,u=[],d=new J,p=new J,f=[],m=[],g=[],v=[];for(c=0;c<=n;c++){var y=[],x=c/n;for(s=0;s<=t;s++){var b=s/t;d.x=-e*Math.cos(i+b*r)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(i+b*r)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),g.push(p.x,p.y,p.z),v.push(b,1-x),y.push(h++)}u.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var w=u[c][s+1],_=u[c][s],E=u[c+1][s],T=u[c+1][s+1];(0!==c||a>0)&&f.push(w,_,T),(c!==n-1||l<Math.PI)&&f.push(_,E,T)}this.setIndex(f),this.addAttribute("position",new kt(m,3)),this.addAttribute("normal",new kt(g,3)),this.addAttribute("uv",new kt(v,2))}function lr(e,t,n,i,r,a){Lt.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new hr(e,t,n,i,r,a)),this.mergeVertices()}function hr(e,t,n,i,r,a){Kt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],h=[],u=[],d=[],p=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new J,g=new q;for(s=0;s<=i;s++){for(c=0;c<=n;c++)o=r+c/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<i;s++){var v=s*(n+1);for(c=0;c<n;c++){var y=o=c+v,x=o+n+1,b=o+n+2,w=o+1;l.push(y,x,w),l.push(x,b,w)}}this.setIndex(l),this.addAttribute("position",new kt(h,3)),this.addAttribute("normal",new kt(u,3)),this.addAttribute("uv",new kt(d,2))}function ur(e,t,n,i){Lt.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new dr(e,t,n,i)),this.mergeVertices()}function dr(e,t,n,i){Kt.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=X.clamp(i,0,2*Math.PI);var r,a,o,s=[],c=[],l=[],h=1/t,u=new J,d=new q;for(a=0;a<=t;a++){var p=n+a*h*i,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,c.push(u.x,u.y,u.z),d.x=a/t,d.y=o/(e.length-1),l.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=r=o+a*e.length,v=r+e.length,y=r+e.length+1,x=r+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.addAttribute("position",new kt(c,3)),this.addAttribute("uv",new kt(l,2)),this.computeVertexNormals(),i===2*Math.PI){var b=this.attributes.normal.array,w=new J,_=new J,E=new J;for(r=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[r+o+0],_.y=b[r+o+1],_.z=b[r+o+2],E.addVectors(w,_).normalize(),b[o+0]=b[r+o+0]=E.x,b[o+1]=b[r+o+1]=E.y,b[o+2]=b[r+o+2]=E.z}}function pr(e,t){Lt.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new fr(e,t)),this.mergeVertices()}function fr(e,t){Kt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){var o,c,l,h=i.length/3,u=e.extractPoints(t),d=u.shape,p=u.holes;if(!1===nr.isClockWise(d))for(d=d.reverse(),o=0,c=p.length;o<c;o++)l=p[o],!0===nr.isClockWise(l)&&(p[o]=l.reverse());var f=nr.triangulateShape(d,p);for(o=0,c=p.length;o<c;o++)l=p[o],d=d.concat(l);for(o=0,c=d.length;o<c;o++){var m=d[o];i.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var g=f[o],v=g[0]+h,y=g[1]+h,x=g[2]+h;n.push(v,y,x),s+=3}}this.setIndex(n),this.addAttribute("position",new kt(i,3)),this.addAttribute("normal",new kt(r,3)),this.addAttribute("uv",new kt(a,2))}function mr(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function gr(e,t){Kt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(X.DEG2RAD*t),c=[0,0],l={},h=["a","b","c"];e.isBufferGeometry?(a=new Lt).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[h[g]],i=m[h[(g+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),void 0===l[r=c[0]+","+c[1]]?l[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[r].face2=p;for(r in l){var v=l[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=u[v.index1];o.push(y.x,y.y,y.z),y=u[v.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new kt(o,3))}function vr(e,t,n,i,r,a,o,s){Lt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new yr(e,t,n,i,r,a,o,s)),this.mergeVertices()}function yr(e,t,n,i,r,a,o,s){Kt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],h=[],u=[],d=[],p=0,f=[],m=n/2,g=0;function v(n){var r,a,f,v=new q,y=new J,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(a=p,r=1;r<=i;r++)h.push(0,m*w,0),u.push(0,w,0),d.push(.5,.5),p++;for(f=p,r=0;r<=i;r++){var _=r/i*s+o,E=Math.cos(_),T=Math.sin(_);y.x=b*T,y.y=m*w,y.z=b*E,h.push(y.x,y.y,y.z),u.push(0,w,0),v.x=.5*E+.5,v.y=.5*T*w+.5,d.push(v.x,v.y),p++}for(r=0;r<i;r++){var M=a+r,S=f+r;!0===n?l.push(S,S+1,M):l.push(S+1,S,M),x+=3}c.addGroup(g,x,!0===n?1:2),g+=x}!function(){var a,v,y=new J,x=new J,b=0,w=(t-e)/n;for(v=0;v<=r;v++){var _=[],E=v/r,T=E*(t-e)+e;for(a=0;a<=i;a++){var M=a/i,S=M*s+o,A=Math.sin(S),R=Math.cos(S);x.x=T*A,x.y=-E*n+m,x.z=T*R,h.push(x.x,x.y,x.z),y.set(A,w,R).normalize(),u.push(y.x,y.y,y.z),d.push(M,1-E),_.push(p++)}f.push(_)}for(a=0;a<i;a++)for(v=0;v<r;v++){var C=f[v][a],L=f[v+1][a],P=f[v+1][a+1],N=f[v][a+1];l.push(C,L,N),l.push(L,P,N),b+=6}c.addGroup(g,b,0),g+=b}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.addAttribute("position",new kt(h,3)),this.addAttribute("normal",new kt(u,3)),this.addAttribute("uv",new kt(d,2))}function xr(e,t,n,i,r,a,o){vr.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function br(e,t,n,i,r,a,o){yr.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function wr(e,t,n,i){Lt.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new _r(e,t,n,i)),this.mergeVertices()}function _r(e,t,n,i){Kt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],c=[],l=[],h=new J,u=new q;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;h.x=e*Math.cos(d),h.y=e*Math.sin(d),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,l.push(u.x,u.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new kt(s,3)),this.addAttribute("normal",new kt(c,3)),this.addAttribute("uv",new kt(l,2))}ir.prototype=Object.create(Lt.prototype),ir.prototype.constructor=ir,rr.prototype=Object.create(Kt.prototype),rr.prototype.constructor=rr,rr.prototype.getArrays=function(){var e=this.getAttribute("position"),t=e?Array.prototype.slice.call(e.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:t,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},rr.prototype.addShapeList=function(e,t){var n=e.length;t.arrays=this.getArrays();for(var i=0;i<n;i++){var r=e[i];this.addShape(r,t)}this.setIndex(t.arrays.index),this.addAttribute("position",new kt(t.arrays.position,3)),this.addAttribute("uv",new kt(t.arrays.uv,2))},rr.prototype.addShape=function(e,t){var n,i,r,a,o,s,c,l,h=t.arrays?t.arrays:this.getArrays(),u=h.position,d=h.index,p=h.uv,f=[],m=void 0!==t.amount?t.amount:100,g=void 0!==t.bevelThickness?t.bevelThickness:6,v=void 0!==t.bevelSize?t.bevelSize:g-2,y=void 0!==t.bevelSegments?t.bevelSegments:3,x=void 0===t.bevelEnabled||t.bevelEnabled,b=void 0!==t.curveSegments?t.curveSegments:12,w=void 0!==t.steps?t.steps:1,_=t.extrudePath,E=!1,T=void 0!==t.UVGenerator?t.UVGenerator:ir.WorldUVGenerator;_&&(n=_.getSpacedPoints(w),E=!0,x=!1,i=void 0!==t.frames?t.frames:_.computeFrenetFrames(w,!1),r=new J,a=new J,o=new J),x||(y=0,g=0,v=0);var M=this,S=e.extractPoints(b),A=S.shape,R=S.holes;if(!nr.isClockWise(A))for(A=A.reverse(),c=0,l=R.length;c<l;c++)s=R[c],nr.isClockWise(s)&&(R[c]=s.reverse());var C=nr.triangulateShape(A,R),L=A;for(c=0,l=R.length;c<l;c++)s=R[c],A=A.concat(s);function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var N,O,I,U,D,F,B=A.length,k=C.length;function H(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,h=o*o+s*s,u=o*l-s*c;if(Math.abs(u)>Number.EPSILON){var d=Math.sqrt(h),p=Math.sqrt(c*c+l*l),f=t.x-s/d,m=t.y+o/d,g=((n.x-l/p-f)*l-(n.y+c/p-m)*c)/(o*l-s*c),v=(i=f+o*g-e.x)*i+(r=m+s*g-e.y)*r;if(v<=2)return new q(i,r);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(h)):(i=o,r=s,a=Math.sqrt(h/2))}return new q(i/a,r/a)}for(var z=[],G=0,V=L.length,j=V-1,W=G+1;G<V;G++,j++,W++)j===V&&(j=0),W===V&&(W=0),z[G]=H(L[G],L[j],L[W]);var X,Y,Z=[],K=z.concat();for(c=0,l=R.length;c<l;c++){for(s=R[c],X=[],G=0,j=(V=s.length)-1,W=G+1;G<V;G++,j++,W++)j===V&&(j=0),W===V&&(W=0),X[G]=H(s[G],s[j],s[W]);Z.push(X),K=K.concat(X)}for(N=0;N<y;N++){for(I=N/y,U=g*Math.cos(I*Math.PI/2),O=v*Math.sin(I*Math.PI/2),G=0,V=L.length;G<V;G++)$((D=P(L[G],z[G],O)).x,D.y,-U);for(c=0,l=R.length;c<l;c++)for(s=R[c],X=Z[c],G=0,V=s.length;G<V;G++)$((D=P(s[G],X[G],O)).x,D.y,-U)}for(O=v,G=0;G<B;G++)D=x?P(A[G],K[G],O):A[G],E?(a.copy(i.normals[0]).multiplyScalar(D.x),r.copy(i.binormals[0]).multiplyScalar(D.y),o.copy(n[0]).add(a).add(r),$(o.x,o.y,o.z)):$(D.x,D.y,0);for(Y=1;Y<=w;Y++)for(G=0;G<B;G++)D=x?P(A[G],K[G],O):A[G],E?(a.copy(i.normals[Y]).multiplyScalar(D.x),r.copy(i.binormals[Y]).multiplyScalar(D.y),o.copy(n[Y]).add(a).add(r),$(o.x,o.y,o.z)):$(D.x,D.y,m/w*Y);for(N=y-1;N>=0;N--){for(I=N/y,U=g*Math.cos(I*Math.PI/2),O=v*Math.sin(I*Math.PI/2),G=0,V=L.length;G<V;G++)$((D=P(L[G],z[G],O)).x,D.y,m+U);for(c=0,l=R.length;c<l;c++)for(s=R[c],X=Z[c],G=0,V=s.length;G<V;G++)D=P(s[G],X[G],O),E?$(D.x,D.y+n[w-1].y,n[w-1].x+U):$(D.x,D.y,m+U)}function Q(e,t){var n,i;for(G=e.length;--G>=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,a=w+2*y;for(r=0;r<a;r++){var o=B*r,s=B*(r+1);te(t+n+o,t+i+o,t+i+s,t+n+s)}}}function $(e,t,n){f.push(e),f.push(t),f.push(n)}function ee(e,t,n){ne(e),ne(t),ne(n);var i=u.length/3,r=T.generateTopUV(M,u,i-3,i-2,i-1);ie(r[0]),ie(r[1]),ie(r[2])}function te(e,t,n,i){ne(e),ne(t),ne(i),ne(t),ne(n),ne(i);var r=u.length/3,a=T.generateSideWallUV(M,u,r-6,r-3,r-2,r-1);ie(a[0]),ie(a[1]),ie(a[3]),ie(a[1]),ie(a[2]),ie(a[3])}function ne(e){d.push(u.length/3),u.push(f[3*e+0]),u.push(f[3*e+1]),u.push(f[3*e+2])}function ie(e){p.push(e.x),p.push(e.y)}!function(){var e=u.length/3;if(x){var n=0,i=B*n;for(G=0;G<k;G++)ee((F=C[G])[2]+i,F[1]+i,F[0]+i);for(i=B*(n=w+2*y),G=0;G<k;G++)ee((F=C[G])[0]+i,F[1]+i,F[2]+i)}else{for(G=0;G<k;G++)ee((F=C[G])[2],F[1],F[0]);for(G=0;G<k;G++)ee((F=C[G])[0]+B*w,F[1]+B*w,F[2]+B*w)}M.addGroup(e,u.length/3-e,void 0!==t.material?t.material:0)}(),function(){var e=u.length/3,n=0;for(Q(L,n),n+=L.length,c=0,l=R.length;c<l;c++)Q(s=R[c],n),n+=s.length;M.addGroup(e,u.length/3-e,void 0!==t.extrudeMaterial?t.extrudeMaterial:1)}(),t.arrays||(this.setIndex(d),this.addAttribute("position",new kt(u,3)),this.addAttribute("uv",new kt(p,2)))},ir.WorldUVGenerator={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],c=t[3*i+1],l=t[3*r],h=t[3*r+1];return[new q(a,o),new q(s,c),new q(l,h)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*i],h=t[3*i+1],u=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-h)<.01?[new q(o,1-c),new q(l,1-u),new q(d,1-f),new q(m,1-v)]:[new q(s,1-c),new q(h,1-u),new q(p,1-f),new q(g,1-v)]}},ar.prototype=Object.create(Lt.prototype),ar.prototype.constructor=ar,or.prototype=Object.create(rr.prototype),or.prototype.constructor=or,sr.prototype=Object.create(Lt.prototype),sr.prototype.constructor=sr,cr.prototype=Object.create(Kt.prototype),cr.prototype.constructor=cr,lr.prototype=Object.create(Lt.prototype),lr.prototype.constructor=lr,hr.prototype=Object.create(Kt.prototype),hr.prototype.constructor=hr,ur.prototype=Object.create(Lt.prototype),ur.prototype.constructor=ur,dr.prototype=Object.create(Kt.prototype),dr.prototype.constructor=dr,pr.prototype=Object.create(Lt.prototype),pr.prototype.constructor=pr,pr.prototype.toJSON=function(){var e=Lt.prototype.toJSON.call(this);return mr(this.parameters.shapes,e)},fr.prototype=Object.create(Kt.prototype),fr.prototype.constructor=fr,fr.prototype.toJSON=function(){var e=Kt.prototype.toJSON.call(this);return mr(this.parameters.shapes,e)},gr.prototype=Object.create(Kt.prototype),gr.prototype.constructor=gr,vr.prototype=Object.create(Lt.prototype),vr.prototype.constructor=vr,yr.prototype=Object.create(Kt.prototype),yr.prototype.constructor=yr,xr.prototype=Object.create(vr.prototype),xr.prototype.constructor=xr,br.prototype=Object.create(yr.prototype),br.prototype.constructor=br,wr.prototype=Object.create(Lt.prototype),wr.prototype.constructor=wr,_r.prototype=Object.create(Kt.prototype),_r.prototype.constructor=_r;var Er=Object.freeze({WireframeGeometry:gi,ParametricGeometry:vi,ParametricBufferGeometry:yi,TetrahedronGeometry:wi,TetrahedronBufferGeometry:_i,OctahedronGeometry:Ei,OctahedronBufferGeometry:Ti,IcosahedronGeometry:Mi,IcosahedronBufferGeometry:Si,DodecahedronGeometry:Ai,DodecahedronBufferGeometry:Ri,PolyhedronGeometry:xi,PolyhedronBufferGeometry:bi,TubeGeometry:Ci,TubeBufferGeometry:Li,TorusKnotGeometry:Pi,TorusKnotBufferGeometry:Ni,TorusGeometry:Oi,TorusBufferGeometry:Ii,TextGeometry:ar,TextBufferGeometry:or,SphereGeometry:sr,SphereBufferGeometry:cr,RingGeometry:lr,RingBufferGeometry:hr,PlaneGeometry:en,PlaneBufferGeometry:tn,LatheGeometry:ur,LatheBufferGeometry:dr,ShapeGeometry:pr,ShapeBufferGeometry:fr,ExtrudeGeometry:ir,ExtrudeBufferGeometry:rr,EdgesGeometry:gr,ConeGeometry:xr,ConeBufferGeometry:br,CylinderGeometry:vr,CylinderBufferGeometry:yr,CircleGeometry:wr,CircleBufferGeometry:_r,BoxGeometry:Qt,BoxBufferGeometry:$t});function Tr(e){ct.call(this),this.type="ShadowMaterial",this.color=new We(0),this.opacity=1,this.lights=!0,this.transparent=!0,this.setValues(e)}function Mr(e){rn.call(this,e),this.type="RawShaderMaterial"}function Sr(e){ct.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new We(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new We(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new q(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ar(e){Sr.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function Rr(e){ct.call(this),this.type="MeshPhongMaterial",this.color=new We(16777215),this.specular=new We(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new We(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Cr(e){Rr.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function Lr(e){ct.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Pr(e){ct.call(this),this.type="MeshLambertMaterial",this.color=new We(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new We(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Nr(e){oi.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Tr.prototype=Object.create(ct.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isShadowMaterial=!0,Mr.prototype=Object.create(rn.prototype),Mr.prototype.constructor=Mr,Mr.prototype.isRawShaderMaterial=!0,Sr.prototype=Object.create(ct.prototype),Sr.prototype.constructor=Sr,Sr.prototype.isMeshStandardMaterial=!0,Sr.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ar.prototype=Object.create(Sr.prototype),Ar.prototype.constructor=Ar,Ar.prototype.isMeshPhysicalMaterial=!0,Ar.prototype.copy=function(e){return Sr.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},Rr.prototype=Object.create(ct.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isMeshPhongMaterial=!0,Rr.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Cr.prototype=Object.create(Rr.prototype),Cr.prototype.constructor=Cr,Cr.prototype.isMeshToonMaterial=!0,Cr.prototype.copy=function(e){return Rr.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},Lr.prototype=Object.create(ct.prototype),Lr.prototype.constructor=Lr,Lr.prototype.isMeshNormalMaterial=!0,Lr.prototype.copy=function(e){return ct.prototype.copy.call(this,e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Pr.prototype=Object.create(ct.prototype),Pr.prototype.constructor=Pr,Pr.prototype.isMeshLambertMaterial=!0,Pr.prototype.copy=function(e){return ct.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Nr.prototype=Object.create(oi.prototype),Nr.prototype.constructor=Nr,Nr.prototype.isLineDashedMaterial=!0,Nr.prototype.copy=function(e){return oi.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Or=Object.freeze({ShadowMaterial:Tr,SpriteMaterial:ei,RawShaderMaterial:Mr,ShaderMaterial:rn,PointsMaterial:hi,MeshPhysicalMaterial:Ar,MeshStandardMaterial:Sr,MeshPhongMaterial:Rr,MeshToonMaterial:Cr,MeshNormalMaterial:Lr,MeshLambertMaterial:Pr,MeshDepthMaterial:lt,MeshDistanceMaterial:ht,MeshBasicMaterial:nn,LineDashedMaterial:Nr,LineBasicMaterial:oi,Material:ct}),Ir={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Ur(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}var Dr=new Ur,Fr={};function Br(e){this.manager=void 0!==e?e:Dr}function kr(e){this.manager=void 0!==e?e:Dr,this._parser=null}function Hr(e){this.manager=void 0!==e?e:Dr,this._parser=null}function zr(e){this.manager=void 0!==e?e:Dr}function Gr(e){this.manager=void 0!==e?e:Dr}function Vr(e){this.manager=void 0!==e?e:Dr}function jr(){this.type="Curve",this.arcLengthDivisions=200}function Wr(e,t,n,i,r,a,o,s){jr.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Xr(e,t,n,i,r,a){Wr.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function qr(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,c*=o,l*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}Object.assign(Br.prototype,{load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ir.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===Fr[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=window.decodeURIComponent(l),c&&(l=window.atob(l));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);h="blob"===u?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(l,s);break;case"json":h=JSON.parse(l);break;default:h=l}window.setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(t){window.setTimeout((function(){i&&i(t),r.manager.itemEnd(e),r.manager.itemError(e)}),0)}}else{Fr[e]=[],Fr[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response;Ir.add(e,n);var i=Fr[e];if(delete Fr[e],200===this.status){for(var a=0,o=i.length;a<o;a++)(s=i[a]).onLoad&&s.onLoad(n);r.manager.itemEnd(e)}else if(0===this.status){for(console.warn("THREE.FileLoader: HTTP Status 0 received."),a=0,o=i.length;a<o;a++)(s=i[a]).onLoad&&s.onLoad(n);r.manager.itemEnd(e)}else{for(a=0,o=i.length;a<o;a++){var s;(s=i[a]).onError&&s.onError(t)}r.manager.itemEnd(e),r.manager.itemError(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=Fr[e],i=0,r=n.length;i<r;i++){var a=n[i];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=Fr[e];delete Fr[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemEnd(e),r.manager.itemError(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m}Fr[e].push({onLoad:t,onProgress:n,onError:i})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(kr.prototype,{load:function(e,t,n,i){var r=this,a=[],o=new fi;o.image=a;var s=new Br(this.manager);function c(c){s.load(e[c],(function(e){var n=r._parser(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=_),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,h=0,u=e.length;h<u;++h)c(h);else s.load(e,(function(e){var n=r._parser(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=_),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o},setPath:function(e){return this.path=e,this}}),Object.assign(Hr.prototype,{load:function(e,t,n,i){var r=this,a=new ie,o=new Br(this.manager);return o.setResponseType("arraybuffer"),o.load(e,(function(e){var n=r._parser(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:v,a.wrapT=void 0!==n.wrapT?n.wrapT:v,a.magFilter=void 0!==n.magFilter?n.magFilter:_,a.minFilter=void 0!==n.minFilter?n.minFilter:T,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps),1===n.mipmapCount&&(a.minFilter=_),a.needsUpdate=!0,t&&t(a,n))}),n,i),a}}),Object.assign(zr.prototype,{crossOrigin:"Anonymous",load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ir.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");return o.addEventListener("load",(function(){Ir.add(e,this),t&&t(this),r.manager.itemEnd(e)}),!1),o.addEventListener("error",(function(t){i&&i(t),r.manager.itemEnd(e),r.manager.itemError(e)}),!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Gr.prototype,{crossOrigin:"Anonymous",load:function(e,t,n,i){var r=new re,a=new zr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){r.images[n]=e,6==++o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(var c=0;c<e.length;++c)s(c);return r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Vr.prototype,{crossOrigin:"Anonymous",load:function(e,t,n,i){var r=new $,a=new zr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){r.image=n;var i=e.search(/\.(jpg|jpeg)$/)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?P:N,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(jr.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=i[r=Math.floor(s+(c-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(i[r=c]===n)return r/(a-1);var l=i[r];return(r+(n-l)/(i[r+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,a=new J,o=[],s=[],c=[],l=new J,h=new Y;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i),o[n].normalize();s[0]=new J,c[0]=new J;var u=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=u&&(u=d,a.set(1,0,0)),p<=u&&(u=p,a.set(0,1,0)),f<=u&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(o[n-1],o[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(X.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(l,r))),c[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(X.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(l.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(o[n],r*n)),c[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Wr.prototype=Object.create(jr.prototype),Wr.prototype.constructor=Wr,Wr.prototype.isEllipseCurve=!0,Wr.prototype.getPoint=function(e,t){for(var n=t||new q,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,d=c-this.aY;s=u*l-d*h+this.aX,c=u*h+d*l+this.aY}return n.set(s,c)},Wr.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Wr.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Wr.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Xr.prototype=Object.create(Wr.prototype),Xr.prototype.constructor=Xr,Xr.prototype.isArcCurve=!0;var Yr=new J,Zr=new qr,Jr=new qr,Kr=new qr;function Qr(e,t,n,i){jr.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function $r(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function ea(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function ta(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function na(e,t,n,i){jr.call(this),this.type="CubicBezierCurve",this.v0=e||new q,this.v1=t||new q,this.v2=n||new q,this.v3=i||new q}function ia(e,t,n,i){jr.call(this),this.type="CubicBezierCurve3",this.v0=e||new J,this.v1=t||new J,this.v2=n||new J,this.v3=i||new J}function ra(e,t){jr.call(this),this.type="LineCurve",this.v1=e||new q,this.v2=t||new q}function aa(e,t){jr.call(this),this.type="LineCurve3",this.v1=e||new J,this.v2=t||new J}function oa(e,t,n){jr.call(this),this.type="QuadraticBezierCurve",this.v0=e||new q,this.v1=t||new q,this.v2=n||new q}function sa(e,t,n){jr.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new J,this.v1=t||new J,this.v2=n||new J}function ca(e){jr.call(this),this.type="SplineCurve",this.points=e||[]}Qr.prototype=Object.create(jr.prototype),Qr.prototype.constructor=Qr,Qr.prototype.isCatmullRomCurve3=!0,Qr.prototype.getPoint=function(e,t){var n,i,r,a,o=t||new J,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,h=Math.floor(l),u=l-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/s.length)+1)*s.length:0===u&&h===c-1&&(h=c-2,u=1),this.closed||h>0?n=s[(h-1)%c]:(Yr.subVectors(s[0],s[1]).add(s[0]),n=Yr),i=s[h%c],r=s[(h+1)%c],this.closed||h+2<c?a=s[(h+2)%c]:(Yr.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Yr),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(i),d),f=Math.pow(i.distanceToSquared(r),d),m=Math.pow(r.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Zr.initNonuniformCatmullRom(n.x,i.x,r.x,a.x,p,f,m),Jr.initNonuniformCatmullRom(n.y,i.y,r.y,a.y,p,f,m),Kr.initNonuniformCatmullRom(n.z,i.z,r.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(Zr.initCatmullRom(n.x,i.x,r.x,a.x,this.tension),Jr.initCatmullRom(n.y,i.y,r.y,a.y,this.tension),Kr.initCatmullRom(n.z,i.z,r.z,a.z,this.tension));return o.set(Zr.calc(u),Jr.calc(u),Kr.calc(u)),o},Qr.prototype.copy=function(e){jr.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Qr.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Qr.prototype.fromJSON=function(e){jr.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new J).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},na.prototype=Object.create(jr.prototype),na.prototype.constructor=na,na.prototype.isCubicBezierCurve=!0,na.prototype.getPoint=function(e,t){var n=t||new q,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(ta(e,i.x,r.x,a.x,o.x),ta(e,i.y,r.y,a.y,o.y)),n},na.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},na.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},na.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},ia.prototype=Object.create(jr.prototype),ia.prototype.constructor=ia,ia.prototype.isCubicBezierCurve3=!0,ia.prototype.getPoint=function(e,t){var n=t||new J,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(ta(e,i.x,r.x,a.x,o.x),ta(e,i.y,r.y,a.y,o.y),ta(e,i.z,r.z,a.z,o.z)),n},ia.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},ia.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},ia.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},ra.prototype=Object.create(jr.prototype),ra.prototype.constructor=ra,ra.prototype.isLineCurve=!0,ra.prototype.getPoint=function(e,t){var n=t||new q;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ra.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ra.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},ra.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ra.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ra.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},aa.prototype=Object.create(jr.prototype),aa.prototype.constructor=aa,aa.prototype.isLineCurve3=!0,aa.prototype.getPoint=function(e,t){var n=t||new J;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},aa.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},aa.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},aa.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},aa.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},oa.prototype=Object.create(jr.prototype),oa.prototype.constructor=oa,oa.prototype.isQuadraticBezierCurve=!0,oa.prototype.getPoint=function(e,t){var n=t||new q,i=this.v0,r=this.v1,a=this.v2;return n.set(ea(e,i.x,r.x,a.x),ea(e,i.y,r.y,a.y)),n},oa.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},oa.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},oa.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},sa.prototype=Object.create(jr.prototype),sa.prototype.constructor=sa,sa.prototype.isQuadraticBezierCurve3=!0,sa.prototype.getPoint=function(e,t){var n=t||new J,i=this.v0,r=this.v1,a=this.v2;return n.set(ea(e,i.x,r.x,a.x),ea(e,i.y,r.y,a.y),ea(e,i.z,r.z,a.z)),n},sa.prototype.copy=function(e){return jr.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},sa.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},sa.prototype.fromJSON=function(e){return jr.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ca.prototype=Object.create(jr.prototype),ca.prototype.constructor=ca,ca.prototype.isSplineCurve=!0,ca.prototype.getPoint=function(e,t){var n=t||new q,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],c=i[a],l=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set($r(o,s.x,c.x,l.x,h.x),$r(o,s.y,c.y,l.y,h.y)),n},ca.prototype.copy=function(e){jr.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},ca.prototype.toJSON=function(){var e=jr.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},ca.prototype.fromJSON=function(e){jr.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new q).fromArray(i))}return this};var la=Object.freeze({ArcCurve:Xr,CatmullRomCurve3:Qr,CubicBezierCurve:na,CubicBezierCurve3:ia,EllipseCurve:Wr,LineCurve:ra,LineCurve3:aa,QuadraticBezierCurve:oa,QuadraticBezierCurve3:sa,SplineCurve:ca});function ha(){jr.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ua(e){ha.call(this),this.type="Path",this.currentPoint=new q,e&&this.setFromPoints(e)}function da(e){ua.call(this,e),this.uuid=X.generateUUID(),this.type="Shape",this.holes=[]}function pa(e,t){Tt.call(this),this.type="Light",this.color=new We(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function fa(e,t,n){pa.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.groundColor=new We(t)}function ma(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new q(512,512),this.map=null,this.matrix=new Y}function ga(){ma.call(this,new Vn(50,1,.5,500))}function va(e,t,n,i,r,a){pa.call(this,e,t),this.type="SpotLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new ga}function ya(e,t,n,i){pa.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new ma(new Vn(90,1,.5,500))}function xa(){ma.call(this,new St(-5,5,5,-5,.5,500))}function ba(e,t){pa.call(this,e,t),this.type="DirectionalLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,this.shadow=new xa}function wa(e,t){pa.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function _a(e,t,n,i){pa.call(this,e,t),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function Ea(e,t,n,i){Ia.call(this,e,t,n,i)}function Ta(e,t,n){Ia.call(this,e,t,n)}function Ma(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Sa(e,t,n,i){Ma.call(this,e,t,n,i)}function Aa(e,t,n,i){Ia.call(this,e,t,n,i)}function Ra(e,t,n,i){Ia.call(this,e,t,n,i)}function Ca(e,t,n,i){Ia.call(this,e,t,n,i)}function La(e,t,n,i){Ma.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Pa(e,t,n,i){Ma.call(this,e,t,n,i)}function Na(e,t,n,i){Ma.call(this,e,t,n,i)}ha.prototype=Object.assign(Object.create(jr.prototype),{constructor:ha,add:function(e){this.curves.push(e)},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 ra(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&a.isLineCurve?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(n.push(l),t=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){jr.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=jr.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){jr.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new la[i.type]).fromJSON(i))}return this}}),ua.prototype=Object.assign(Object.create(ha.prototype),{constructor:ua,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new ra(this.currentPoint.clone(),new q(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,i){var r=new oa(this.currentPoint.clone(),new q(e,t),new q(n,i));this.curves.push(r),this.currentPoint.set(n,i)},bezierCurveTo:function(e,t,n,i,r,a){var o=new na(this.currentPoint.clone(),new q(e,t),new q(n,i),new q(r,a));this.curves.push(o),this.currentPoint.set(r,a)},splineThru:function(e){var t=new ca([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,i,r,a)},absarc:function(e,t,n,i,r,a){this.absellipse(e,t,n,n,i,r,a)},ellipse:function(e,t,n,i,r,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,n,i,r,a,o,s)},absellipse:function(e,t,n,i,r,a,o,s){var c=new Wr(e,t,n,i,r,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)},copy:function(e){return ha.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ha.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ha.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),da.prototype=Object.assign(Object.create(ua.prototype),{constructor:da,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){ua.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=ua.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){ua.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new ua).fromJSON(i))}return this}}),pa.prototype=Object.assign(Object.create(Tt.prototype),{constructor:pa,isLight:!0,copy:function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Tt.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.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),fa.prototype=Object.assign(Object.create(pa.prototype),{constructor:fa,isHemisphereLight:!0,copy:function(e){return pa.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(ma.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),ga.prototype=Object.assign(Object.create(ma.prototype),{constructor:ga,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*X.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix())}}),va.prototype=Object.assign(Object.create(pa.prototype),{constructor:va,isSpotLight:!0,copy:function(e){return pa.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),ya.prototype=Object.assign(Object.create(pa.prototype),{constructor:ya,isPointLight:!0,copy:function(e){return pa.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),xa.prototype=Object.assign(Object.create(ma.prototype),{constructor:xa}),ba.prototype=Object.assign(Object.create(pa.prototype),{constructor:ba,isDirectionalLight:!0,copy:function(e){return pa.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),wa.prototype=Object.assign(Object.create(pa.prototype),{constructor:wa,isAmbientLight:!0}),_a.prototype=Object.assign(Object.create(pa.prototype),{constructor:_a,isRectAreaLight:!0,copy:function(e){return pa.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=pa.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Ea.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Ea,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ta.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Ta,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Object.assign(Ma.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];for(e<s&&(n=2,r=s),o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Ma.prototype,{beforeStart_:Ma.prototype.copySampleValue_,afterEnd_:Ma.prototype.copySampleValue_}),Sa.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Sa,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(i-t),l=s+o;s!==l;s+=4)Z.slerpFlat(r,0,a,s-o,a,s,c);return r}}),Aa.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Aa,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Sa(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ra.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Ra,ValueTypeName:"color"}),Ca.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Ca,ValueTypeName:"number"}),La.prototype=Object.assign(Object.create(Ma.prototype),{constructor:La,DefaultSettings_:{endingStart:V,endingEnd:V},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=a*l},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)r[b]=g*a[l+b]+v*a[c+b]+y*a[s+b]+x*a[h+b];return r}}),Pa.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Pa,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(i-t),h=1-l,u=0;u!==o;++u)r[u]=a[c+u]*h+a[s+u]*l;return r}}),Na.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Na,interpolate_:function(e){return this.copySampleValue_(e-1)}});var Oa={arraySlice:function(e,t,n){return Oa.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&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){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,c=0;c!==t;++c)r[o++]=e[s+c];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}};function Ia(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Oa.convertArray(t,this.TimeBufferType),this.values=Oa.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Ua(e,t,n,i){Ia.call(this,e,t,n,i)}function Da(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=X.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function Fa(e){this.manager=void 0!==e?e:Dr,this.textures={}}function Ba(e){this.manager=void 0!==e?e:Dr}Object.assign(Ia,{parse:function(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Ia._getTrackTypeForValueTypeName(e.type);if(void 0===e.times){var n=[],i=[];Oa.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)},toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Oa.convertArray(e.times,Array),values:Oa.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t},_getTrackTypeForValueTypeName:function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ca;case"vector":case"vector2":case"vector3":case"vector4":return Ua;case"color":return Ra;case"quaternion":return Aa;case"bool":case"boolean":return Ta;case"string":return Ea}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}}),Object.assign(Ia.prototype,{constructor:Ia,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new Na(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Pa(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new La(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)this.createInterpolant=t;else{var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}console.warn("THREE.KeyframeTrack:",n)}},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Oa.arraySlice(n,r,a),this.values=Oa.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&Oa.isTypedArray(i)){o=0;for(var c=i.length;o!==c;++o){var l=i[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(i)s=!0;else for(var l=o*n,h=l-n,u=l+n,d=0;d!==n;++d){var p=t[l+d];if(p!==t[h+d]||p!==t[u+d]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];var f=o*n,m=r*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++r}}if(a>0){for(e[r]=e[a],f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length&&(this.times=Oa.arraySlice(e,0,r),this.values=Oa.arraySlice(t,0,r*n)),this}}),Ua.prototype=Object.assign(Object.create(Ia.prototype),{constructor:Ua,ValueTypeName:"vector"}),Object.assign(Da,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Ia.parse(n[r]).scale(i));return new Da(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t},r=0,a=n.length;r!==a;++r)t.push(Ia.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],c=[];s.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);var l=Oa.getKeyframeOrder(s);s=Oa.sortedArray(s,1,l),c=Oa.sortedArray(c,1,l),i||0!==s[0]||(s.push(r),c.push(c[0])),a.push(new Ca(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new Da(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(r);if(c&&c.length>1){var l=i[u=c[1]];l||(i[u]=l=[]),l.push(s)}}var h=[];for(var u in i)h.push(Da.CreateFromMorphTargetSequence(u,i[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Oa.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var d=0;d<l[u].morphTargets.length;d++)h[l[u].morphTargets[d]]=-1;for(var p in h){var f=[],m=[];for(d=0;d!==l[u].morphTargets.length;++d){var g=l[u];f.push(g.time),m.push(g.morphTarget===p?1:0)}i.push(new Ca(".morphTargetInfluence["+p+"]",f,m))}a=h.length*(o||1)}else{var v=".bones["+t[c].name+"]";n(Ua,v+".position",l,"pos",i),n(Aa,v+".quaternion",l,"rot",i),n(Ua,v+".scale",l,"scl",i)}}return 0===i.length?null:new Da(r,a,i)}}),Object.assign(Da.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}this.duration=e},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(Fa.prototype,{load:function(e,t,n,i){var r=this;new Br(r.manager).load(e,(function(e){t(r.parse(JSON.parse(e)))}),n,i)},setTextures:function(e){this.textures=e},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new Or[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearCoat&&(i.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(i.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.uniforms&&(i.uniforms=e.uniforms),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(i.vertexColors=e.vertexColors),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap),i.transparent=!0),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalScale){var r=e.normalScale;!1===Array.isArray(r)&&(r=[r,r]),i.normalScale=(new q).fromArray(r)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),i}}),Object.assign(Ba.prototype,{load:function(e,t,n,i){var r=this;new Br(r.manager).load(e,(function(e){t(r.parse(JSON.parse(e)))}),n,i)},parse:function(e){var t=new Kt,n=e.data.index;if(void 0!==n){var i=new Va[n.type](n.array);t.setIndex(new Pt(i,1))}var r=e.data.attributes;for(var a in r){var o=r[a];i=new Va[o.type](o.array),t.addAttribute(a,new Pt(i,o.itemSize,o.normalized))}var s=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==s)for(var c=0,l=s.length;c!==l;++c){var h=s[c];t.addGroup(h.start,h.count,h.materialIndex)}var u=e.data.boundingSphere;if(void 0!==u){var d=new J;void 0!==u.center&&d.fromArray(u.center),t.boundingSphere=new dt(d,u.radius)}return t}});var ka,Ha,za,Ga,Va={Int8Array,Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ja(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}ja.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,i=t.length;n<i;n+=2){var r=t[n],a=t[n+1];if(r.test(e))return a}return null}},Object.assign(ja.prototype,{crossOrigin:void 0,initMaterials:function(e,t,n){for(var i=[],r=0;r<e.length;++r)i[r]=this.createMaterial(e[r],t,n);return i},createMaterial:(ka={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Ha=new We,za=new Vr,Ga=new Fa,function(e,t,n){var i={};function r(e,r,a,o,s){var c,l=t+e,h=ja.Handlers.get(l);null!==h?c=h.load(l):(za.setCrossOrigin(n),c=za.load(l)),void 0!==r&&(c.repeat.fromArray(r),1!==r[0]&&(c.wrapS=g),1!==r[1]&&(c.wrapT=g)),void 0!==a&&c.offset.fromArray(a),void 0!==o&&("repeat"===o[0]&&(c.wrapS=g),"mirror"===o[0]&&(c.wrapS=y),"repeat"===o[1]&&(c.wrapT=g),"mirror"===o[1]&&(c.wrapT=y)),void 0!==s&&(c.anisotropy=s);var u=X.generateUUID();return i[u]=c,u}var a={uuid:X.generateUUID(),type:"MeshLambertMaterial"};for(var o in e){var s=e[o];switch(o){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"DbgName":a.name=s;break;case"blending":a.blending=ka[s];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",o,"is no longer supported.");break;case"colorDiffuse":a.color=Ha.fromArray(s).getHex();break;case"colorSpecular":a.specular=Ha.fromArray(s).getHex();break;case"colorEmissive":a.emissive=Ha.fromArray(s).getHex();break;case"specularCoef":a.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(a.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(a.type="MeshPhongMaterial"),"standard"===s.toLowerCase()&&(a.type="MeshStandardMaterial");break;case"mapDiffuse":a.map=r(s,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapEmissive":a.emissiveMap=r(s,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapLight":a.lightMap=r(s,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapAO":a.aoMap=r(s,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapBump":a.bumpMap=r(s,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":a.bumpScale=s;break;case"mapNormal":a.normalMap=r(s,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":a.normalScale=[s,s];break;case"mapSpecular":a.specularMap=r(s,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapMetalness":a.metalnessMap=r(s,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapRoughness":a.roughnessMap=r(s,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapAlpha":a.alphaMap=r(s,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"flipSided":a.side=1;break;case"doubleSided":a.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),a.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":a[o]=s;break;case"vertexColors":!0===s&&(a.vertexColors=2),"face"===s&&(a.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",o,s)}}return"MeshBasicMaterial"===a.type&&delete a.emissive,"MeshPhongMaterial"!==a.type&&delete a.specular,a.opacity<1&&(a.transparent=!0),Ga.setTextures(i),Ga.parse(a)})});var Wa={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);return t},extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")}};function Xa(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:Dr,this.withCredentials=!1}function qa(e){this.manager=void 0!==e?e:Dr,this.texturePath=""}Object.assign(Xa.prototype,{load:function(e,t,n,i){var r=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Wa.extractUrlBase(e),o=new Br(this.manager);o.setWithCredentials(this.withCredentials),o.load(e,(function(n){var i=JSON.parse(n),o=i.metadata;if(void 0!==o){var s=o.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 c=r.parse(i,a);t(c.geometry,c.materials)}),n,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),void 0!==e.scale?e.scale=1/e.scale:e.scale=1;var n=new Lt;return function(e,t){function n(e,t){return e&1<<t}var i,r,a,o,s,c,l,h,u,d,p,f,m,g,v,y,x,b,w,_,E,T,M,S,A,R=e.faces,C=e.vertices,L=e.normals,P=e.colors,N=e.scale,O=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&O++;for(i=0;i<O;i++)t.faceVertexUvs[i]=[]}for(o=0,s=C.length;o<s;)(b=new J).x=C[o++]*N,b.y=C[o++]*N,b.z=C[o++]*N,t.vertices.push(b);for(o=0,s=R.length;o<s;)if(p=n(d=R[o++],0),f=n(d,1),m=n(d,3),g=n(d,4),v=n(d,5),y=n(d,6),x=n(d,7),p){if((_=new At).a=R[o],_.b=R[o+1],_.c=R[o+3],(E=new At).a=R[o+1],E.b=R[o+2],E.c=R[o+3],o+=4,f&&(u=R[o++],_.materialIndex=u,E.materialIndex=u),a=t.faces.length,m)for(i=0;i<O;i++)for(S=e.uvs[i],t.faceVertexUvs[i][a]=[],t.faceVertexUvs[i][a+1]=[],r=0;r<4;r++)A=new q(S[2*(h=R[o++])],S[2*h+1]),2!==r&&t.faceVertexUvs[i][a].push(A),0!==r&&t.faceVertexUvs[i][a+1].push(A);if(g&&(l=3*R[o++],_.normal.set(L[l++],L[l++],L[l]),E.normal.copy(_.normal)),v)for(i=0;i<4;i++)l=3*R[o++],M=new J(L[l++],L[l++],L[l]),2!==i&&_.vertexNormals.push(M),0!==i&&E.vertexNormals.push(M);if(y&&(T=P[c=R[o++]],_.color.setHex(T),E.color.setHex(T)),x)for(i=0;i<4;i++)T=P[c=R[o++]],2!==i&&_.vertexColors.push(new We(T)),0!==i&&E.vertexColors.push(new We(T));t.faces.push(_),t.faces.push(E)}else{if((w=new At).a=R[o++],w.b=R[o++],w.c=R[o++],f&&(u=R[o++],w.materialIndex=u),a=t.faces.length,m)for(i=0;i<O;i++)for(S=e.uvs[i],t.faceVertexUvs[i][a]=[],r=0;r<3;r++)A=new q(S[2*(h=R[o++])],S[2*h+1]),t.faceVertexUvs[i][a].push(A);if(g&&(l=3*R[o++],w.normal.set(L[l++],L[l++],L[l])),v)for(i=0;i<3;i++)l=3*R[o++],M=new J(L[l++],L[l++],L[l]),w.vertexNormals.push(M);if(y&&(c=R[o++],w.color.setHex(P[c])),x)for(i=0;i<3;i++)c=R[o++],w.vertexColors.push(new We(P[c]));t.faces.push(w)}}(e,n),function(e,t){var n=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var i=0,r=e.skinWeights.length;i<r;i+=n){var a=e.skinWeights[i],o=n>1?e.skinWeights[i+1]:0,s=n>2?e.skinWeights[i+2]:0,c=n>3?e.skinWeights[i+3]:0;t.skinWeights.push(new ee(a,o,s,c))}if(e.skinIndices)for(i=0,r=e.skinIndices.length;i<r;i+=n){var l=e.skinIndices[i],h=n>1?e.skinIndices[i+1]:0,u=n>2?e.skinIndices[i+2]:0,d=n>3?e.skinIndices[i+3]:0;t.skinIndices.push(new ee(l,h,u,d))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,n),function(e,t){var n=e.scale;if(void 0!==e.morphTargets)for(var i=0,r=e.morphTargets.length;i<r;i++){t.morphTargets[i]={},t.morphTargets[i].name=e.morphTargets[i].name,t.morphTargets[i].vertices=[];for(var a=t.morphTargets[i].vertices,o=e.morphTargets[i].vertices,s=0,c=o.length;s<c;s+=3){var l=new J;l.x=o[s]*n,l.y=o[s+1]*n,l.z=o[s+2]*n,a.push(l)}}if(void 0!==e.morphColors&&e.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var h=t.faces,u=e.morphColors[0].colors;for(i=0,r=h.length;i<r;i++)h[i].color.fromArray(u,3*i)}}(e,n),function(e,t){var n=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var r=0;r<i.length;r++){var a=Da.parseAnimation(i[r],t.bones);a&&n.push(a)}if(t.morphTargets){var o=Da.CreateClipsFromMorphTargetSequences(t.morphTargets,10);n=n.concat(o)}n.length>0&&(t.animations=n)}(e,n),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:n}:{geometry:n,materials:ja.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}),Object.assign(qa.prototype,{load:function(e,t,n,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var r=this;new Br(r.manager).load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")}),n,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new da).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new Xa,r=new Ba,a=0,o=e.length;a<o;a++){var s,c=e[a];switch(c.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new Er[c.type](c.width,c.height,c.widthSegments,c.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":s=new Er[c.type](c.width,c.height,c.depth,c.widthSegments,c.heightSegments,c.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":s=new Er[c.type](c.radius,c.segments,c.thetaStart,c.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":s=new Er[c.type](c.radiusTop,c.radiusBottom,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":s=new Er[c.type](c.radius,c.height,c.radialSegments,c.heightSegments,c.openEnded,c.thetaStart,c.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":s=new Er[c.type](c.radius,c.widthSegments,c.heightSegments,c.phiStart,c.phiLength,c.thetaStart,c.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":s=new Er[c.type](c.radius,c.detail);break;case"RingGeometry":case"RingBufferGeometry":s=new Er[c.type](c.innerRadius,c.outerRadius,c.thetaSegments,c.phiSegments,c.thetaStart,c.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":s=new Er[c.type](c.radius,c.tube,c.radialSegments,c.tubularSegments,c.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":s=new Er[c.type](c.radius,c.tube,c.tubularSegments,c.radialSegments,c.p,c.q);break;case"LatheGeometry":case"LatheBufferGeometry":s=new Er[c.type](c.points,c.segments,c.phiStart,c.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":s=new Er[c.type](c.vertices,c.indices,c.radius,c.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":var l=[];for(a=0,o=c.shapes.length;a<o;a++){var h=t[c.shapes[a]];l.push(h)}s=new Er[c.type](l,c.curveSegments);break;case"BufferGeometry":s=r.parse(c);break;case"Geometry":s=i.parse(c,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+c.type+'"');continue}s.uuid=c.uuid,void 0!==c.name&&(s.name=c.name),n[c.uuid]=s}return n},parseMaterials:function(e,t){var n={};if(void 0!==e){var i=new Fa;i.setTextures(t);for(var r=0,a=e.length;r<a;r++){var o=e[r];if("MultiMaterial"===o.type){for(var s=[],c=0;c<o.materials.length;c++)s.push(i.parse(o.materials[c]));n[o.uuid]=s}else n[o.uuid]=i.parse(o)}}return n},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=Da.parse(e[n]);t.push(i)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),a.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemEnd(e),n.manager.itemError(e)}))}if(void 0!==e&&e.length>0){var a=new zr(new Ur(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=r(l)}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o=e[r];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=new $(t[o.image]);s.needsUpdate=!0,s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,Za)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],Ja),s.wrapT=n(o.wrap[1],Ja)),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,Ka)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,Ka)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),i[o.uuid]=s}return i},parseObject:function(){var e=new Y;return function(t,n,i){var r;function a(e){return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),n[e]}function o(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,r=e.length;n<r;n++){var a=e[n];void 0===i[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(i[a])}return t}return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]}}switch(t.type){case"Scene":r=new Qn,void 0!==t.background&&Number.isInteger(t.background)&&(r.background=new We(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new Kn(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Jn(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":r=new Vn(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new St(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":r=new wa(t.color,t.intensity);break;case"DirectionalLight":r=new ba(t.color,t.intensity);break;case"PointLight":r=new ya(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new _a(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new va(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new fa(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=a(t.geometry),c=o(t.material);r=s.bones&&s.bones.length>0?new ai(s,c):new cn(s,c);break;case"LOD":r=new ni;break;case"Line":r=new si(a(t.geometry),o(t.material),t.mode);break;case"LineLoop":r=new li(a(t.geometry),o(t.material));break;case"LineSegments":r=new ci(a(t.geometry),o(t.material));break;case"PointCloud":case"Points":r=new ui(a(t.geometry),o(t.material));break;case"Sprite":r=new ti(o(t.material));break;case"Group":r=new di;break;default:r=new Tt}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.children)for(var l=t.children,h=0;h<l.length;h++)r.add(this.parseObject(l[h],n,i));if("LOD"===t.type)for(var u=t.levels,d=0;d<u.length;d++){var p=u[d],f=r.getObjectByProperty("uuid",p.object);void 0!==f&&r.addLevel(f,p.distance)}return r}}()});var Ya,Za={UVMapping:300,CubeReflectionMapping:u,CubeRefractionMapping:d,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:p,SphericalReflectionMapping:305,CubeUVReflectionMapping:f,CubeUVRefractionMapping:m},Ja={RepeatWrapping:g,ClampToEdgeWrapping:v,MirroredRepeatWrapping:y},Ka={NearestFilter:x,NearestMipMapNearestFilter:b,NearestMipMapLinearFilter:w,LinearFilter:_,LinearMipMapNearestFilter:E,LinearMipMapLinearFilter:T};function Qa(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=void 0!==e?e:Dr,this.options=void 0}function $a(){this.type="ShapePath",this.subPaths=[],this.currentPath=null}function eo(e){this.type="Font",this.data=e}function to(e){this.manager=void 0!==e?e:Dr}Qa.prototype={constructor:Qa,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e);var r=this,a=Ir.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,r.options)})).then((function(n){Ir.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemEnd(e),r.manager.itemError(e)}))},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}},Object.assign($a.prototype,{moveTo:function(e,t){this.currentPath=new ua,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,i){this.currentPath.quadraticCurveTo(e,t,n,i)},bezierCurveTo:function(e,t,n,i,r,a){this.currentPath.bezierCurveTo(e,t,n,i,r,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new da;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[r],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=l*(e.x-o.x)-c*(e.y-o.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=nr.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new da).curves=s.curves,l.push(c),l;var h=!r(a[0].getPoints());h=e?!h:h;var u,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=r(u=(s=a[v]).getPoints()),(o=e?!o:o)?(!h&&f[g]&&g++,f[g]={s:new da,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var E=m[w],T=0;T<E.length;T++){for(var M=E[T],S=!0,A=0;A<f.length;A++)i(M.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:T}),S?(S=!1,p[A].push(M)):x=!0);S&&p[w].push(M)}b.length>0&&(x||(m=p))}v=0;for(var R=f.length;v<R;v++){c=f[v].s,l.push(c);for(var C=0,L=(d=m[v]).length;C<L;C++)c.holes.push(d[C].h)}return l}}),Object.assign(eo.prototype,{isFont:!0,generateShapes:function(e,t,n){function i(e,t,n,i){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,c,l,h,u,d,p,f,m=new $a,g=[];if(a.o)for(var v=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),y=0,x=v.length;y<x;)switch(v[y++]){case"m":o=v[y++]*t+n,s=v[y++]*t+i,m.moveTo(o,s);break;case"l":o=v[y++]*t+n,s=v[y++]*t+i,m.lineTo(o,s);break;case"q":c=v[y++]*t+n,l=v[y++]*t+i,h=v[y++]*t+n,u=v[y++]*t+i,m.quadraticCurveTo(h,u,c,l),(f=g[g.length-1])&&(f.x,f.y);break;case"b":c=v[y++]*t+n,l=v[y++]*t+i,h=v[y++]*t+n,u=v[y++]*t+i,d=v[y++]*t+n,p=v[y++]*t+i,m.bezierCurveTo(h,u,d,p,c,l),(f=g[g.length-1])&&(f.x,f.y)}return{offsetX:a.ha*t,path:m}}}void 0===t&&(t=100),void 0===n&&(n=4);for(var r=this.data,a=function(e){for(var n=String(e).split(""),a=t/r.resolution,o=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,s=0,c=0,l=[],h=0;h<n.length;h++){var u=n[h];if("\n"===u)s=0,c-=o;else{var d=i(u,a,s,c);s+=d.offsetX,l.push(d.path)}}return l}(e),o=[],s=0,c=a.length;s<c;s++)Array.prototype.push.apply(o,a[s].toShapes());return o}}),Object.assign(to.prototype,{load:function(e,t,n,i){var r=this,a=new Br(this.manager);a.setPath(this.path),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)}),n,i)},parse:function(e){return new eo(e)},setPath:function(e){return this.path=e,this}});var no,io,ro,ao,oo,so,co,lo,ho,uo,po,fo,mo,go,vo,yo,xo={getContext:function(){return void 0===Ya&&(Ya=new(window.AudioContext||window.webkitAudioContext)),Ya},setContext:function(e){Ya=e}};function bo(e){this.manager=void 0!==e?e:Dr}function wo(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Vn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Vn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function _o(e,t,n){Tt.call(this),this.type="CubeCamera";var i=new Vn(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new J(1,0,0)),this.add(i);var r=new Vn(90,1,e,t);r.up.set(0,-1,0),r.lookAt(new J(-1,0,0)),this.add(r);var a=new Vn(90,1,e,t);a.up.set(0,0,1),a.lookAt(new J(0,1,0)),this.add(a);var o=new Vn(90,1,e,t);o.up.set(0,0,-1),o.lookAt(new J(0,-1,0)),this.add(o);var s=new Vn(90,1,e,t);s.up.set(0,-1,0),s.lookAt(new J(0,0,1)),this.add(s);var c=new Vn(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new J(0,0,-1)),this.add(c);var l={format:P,magFilter:_,minFilter:_};this.renderTarget=new ne(n,n,l),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,l=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,i,n),n.activeCubeFace=1,e.render(t,r,n),n.activeCubeFace=2,e.render(t,a,n),n.activeCubeFace=3,e.render(t,o,n),n.activeCubeFace=4,e.render(t,s,n),n.texture.generateMipmaps=l,n.activeCubeFace=5,e.render(t,c,n),e.setRenderTarget(null)},this.clear=function(e,t,n,i){for(var r=this.renderTarget,a=0;a<6;a++)r.activeCubeFace=a,e.setRenderTarget(r),e.clear(t,n,i);e.setRenderTarget(null)}}function Eo(){Tt.call(this),this.type="AudioListener",this.context=xo.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function To(e){Tt.call(this),this.type="Audio",this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Mo(e){To.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function So(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)}function Ao(e,t,n){this.binding=e,this.valueSize=n;var i,r=Float64Array;switch(t){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Ro(e,t,n){var i=n||Co.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function Co(e,t,n){this.path=t,this.parsedPath=n||Co.parseTrackName(t),this.node=Co.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function Lo(){this.uuid=X.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function Po(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:V,endingEnd:V},s=0;s!==r;++s){var c=i[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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}function No(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Oo(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Io(){Kt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Uo(e,t,n,i){this.uuid=X.generateUUID(),this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Do(e,t){this.uuid=X.generateUUID(),this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Fo(e,t,n){Do.call(this,e,t),this.meshPerAttribute=n||1}function Bo(e,t,n){Pt.call(this,e,t),this.meshPerAttribute=n||1}function ko(e,t,n,i){this.ray=new an(e,t),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}}})}function Ho(e,t){return e.distance-t.distance}function zo(e,t,n,i){if(!1!==e.visible&&(e.raycast(t,n),!0===i))for(var r=e.children,a=0,o=r.length;a<o;a++)zo(r[a],t,n,!0)}function Go(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Vo(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function jo(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}function Wo(e){Tt.call(this),this.material=e,this.render=function(){}}function Xo(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==n?n:16711680,a=void 0!==i?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Kt,l=new kt(2*o*3,3);c.addAttribute("position",l),ci.call(this,c,new oi({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function qo(e,t){Tt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Kt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.addAttribute("position",new kt(i,3));var c=new oi({fog:!1});this.cone=new ci(n,c),this.add(this.cone),this.update()}function Yo(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new Kt,i=[],r=[],a=new We(0,0,1),o=new We(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.addAttribute("position",new kt(i,3)),n.addAttribute("color",new kt(r,3));var l=new oi({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0});ci.call(this,n,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Zo(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new cr(t,4,2),r=new nn({wireframe:!0,fog:!1});cn.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Jo(e,t){Tt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;var n=new oi({fog:!1}),i=new Kt;i.addAttribute("position",new Pt(new Float32Array(15),3)),this.line=new si(i,n),this.add(this.line),this.update()}function Ko(e,t,n){Tt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new Ti(t);i.rotateY(.5*Math.PI),this.material=new nn({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=2);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.addAttribute("color",new Pt(a,3)),this.add(new cn(i,this.material)),this.update()}function Qo(e,t,n,i){e=e||10,t=t||10,n=new We(void 0!==n?n:4473924),i=new We(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],c=[],l=0,h=0,u=-o;l<=t;l++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=l===r?n:i;d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3,d.toArray(c,h),h+=3}var p=new Kt;p.addAttribute("position",new kt(s,3)),p.addAttribute("color",new kt(c,3));var f=new oi({vertexColors:2});ci.call(this,p,f)}function $o(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new We(void 0!==r?r:4473924),a=new We(void 0!==a?a:8947848);var o,s,c,l,h,u,d,p=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,p.push(0,0,0),p.push(o,0,s),d=1&l?r:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?r:a,u=e-e/n*l,h=0;h<i;h++)c=h/i*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(h+1)/i*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Kt;m.addAttribute("position",new kt(p,3)),m.addAttribute("color",new kt(f,3));var g=new oi({vertexColors:2});ci.call(this,m,g)}function es(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==n?n:16776960,a=void 0!==i?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Kt,l=new kt(2*o*3,3);c.addAttribute("position",l),ci.call(this,c,new oi({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function ts(e,t,n){Tt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new Kt;i.addAttribute("position",new kt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new oi({fog:!1});this.lightPlane=new si(i,r),this.add(this.lightPlane),(i=new Kt).addAttribute("position",new kt([0,0,0,0,0,1],3)),this.targetLine=new si(i,r),this.add(this.targetLine),this.update()}function ns(e){var t=new Kt,n=new oi({color:16777215,vertexColors:1}),i=[],r=[],a={},o=new We(16755200),s=new We(16711680),c=new We(43775),l=new We(16777215),h=new We(3355443);function u(e,t,n){d(e,n),d(t,n)}function d(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c),u("c","t",l),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.addAttribute("position",new kt(i,3)),t.addAttribute("color",new kt(r,3)),ci.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function is(e,t){this.object=e,void 0===t&&(t=16776960);var n=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]),i=new Float32Array(24),r=new Kt;r.setIndex(new Pt(n,1)),r.addAttribute("position",new Pt(i,3)),ci.call(this,r,new oi({color:t})),this.matrixAutoUpdate=!1,this.update()}function rs(e,t){this.type="Box3Helper",this.box=e;var n=void 0!==t?t:16776960,i=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 Kt;r.setIndex(new Pt(i,1)),r.addAttribute("position",new kt([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),ci.call(this,r,new oi({color:n})),this.geometry.computeBoundingSphere()}function as(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new Kt;r.addAttribute("position",new kt([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,0,1,0,0,0],3)),r.computeBoundingSphere(),si.call(this,r,new oi({color:i}));var a=new Kt;a.addAttribute("position",new kt([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new cn(a,new nn({color:i,opacity:.2,transparent:!0,depthWrite:!1})))}function os(e,t,n,i,r,a){Tt.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===no&&((no=new Kt).addAttribute("position",new kt([0,0,0,0,1,0],3)),(io=new yr(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new si(no,new oi({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new cn(io,new nn({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function ss(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Kt;n.addAttribute("position",new kt(t,3)),n.addAttribute("color",new kt([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new oi({vertexColors:2});ci.call(this,n,i)}Object.assign(bo.prototype,{load:function(e,t,n,i){var r=new Br(this.manager);r.setResponseType("arraybuffer"),r.load(e,(function(e){xo.getContext().decodeAudioData(e,(function(e){t(e)}))}),n,i)}}),Object.assign(wo.prototype,{update:(vo=new Y,yo=new Y,function(e){if(co!==this||lo!==e.focus||ho!==e.fov||uo!==e.aspect*this.aspect||po!==e.near||fo!==e.far||mo!==e.zoom||go!==this.eyeSep){co=this,lo=e.focus,ho=e.fov,uo=e.aspect*this.aspect,po=e.near,fo=e.far,mo=e.zoom;var t,n,i=e.projectionMatrix.clone(),r=(go=this.eyeSep/2)*po/lo,a=po*Math.tan(X.DEG2RAD*ho*.5)/mo;yo.elements[12]=-go,vo.elements[12]=go,t=-a*uo+r,n=a*uo+r,i.elements[0]=2*po/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(i),t=-a*uo-r,n=a*uo-r,i.elements[0]=2*po/(n-t),i.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yo),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(vo)})}),_o.prototype=Object.create(Tt.prototype),_o.prototype.constructor=_o,Eo.prototype=Object.assign(Object.create(Tt.prototype),{constructor:Eo,getInput:function(){return this.gain},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)},getFilter:function(){return this.filter},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)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){this.gain.gain.value=e},updateMatrixWorld:function(){var e=new J,t=new Z,n=new J,i=new J;return function(r){Tt.prototype.updateMatrixWorld.call(this,r);var a=this.context.listener,o=this.up;this.matrixWorld.decompose(e,t,n),i.set(0,0,-1).applyQuaternion(t),a.positionX?(a.positionX.setValueAtTime(e.x,this.context.currentTime),a.positionY.setValueAtTime(e.y,this.context.currentTime),a.positionZ.setValueAtTime(e.z,this.context.currentTime),a.forwardX.setValueAtTime(i.x,this.context.currentTime),a.forwardY.setValueAtTime(i.y,this.context.currentTime),a.forwardZ.setValueAtTime(i.z,this.context.currentTime),a.upX.setValueAtTime(o.x,this.context.currentTime),a.upY.setValueAtTime(o.y,this.context.currentTime),a.upZ.setValueAtTime(o.z,this.context.currentTime)):(a.setPosition(e.x,e.y,e.z),a.setOrientation(i.x,i.y,i.z,o.x,o.y,o.z))}}()}),To.prototype=Object.assign(Object.create(Tt.prototype),{constructor:To,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),e.playbackRate.setValueAtTime(this.playbackRate,this.startTime),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this.source.stop(),this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.offset=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.value=e,this}}),Mo.prototype=Object.assign(Object.create(To.prototype),{constructor:Mo,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){this.panner.refDistance=e},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){this.panner.rolloffFactor=e},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){this.panner.distanceModel=e},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){this.panner.maxDistance=e},updateMatrixWorld:function(){var e=new J;return function(t){Tt.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}()}),Object.assign(So.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Ao.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=3*t;this._mixBufferRegion(n,i,o,1-r,t)}for(var s=t,c=t+t;s!==c;++s)if(n[s]!==n[s+t]){a.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=3*n;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){Z.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}}),Object.assign(Ro.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(Co,{Composite:Ro,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Co.Composite(e,t,n):new Co(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(oo=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),so=["material","materials","bones"],function(e){var t=oo.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==so.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=function(e){for(var n=0;n<e.bones.length;n++){var i=e.bones[n];if(i.name===t)return i}return null}(e.skeleton);if(n)return n}if(e.children){var i=function(e){for(var n=0;n<e.length;n++){var r=e[n];if(r.name===t||r.uuid===t)return r;var a=i(r.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}}),Object.assign(Co.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},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 n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=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}]],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,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=Co.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: 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("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var c=this.Versioning.None;void 0!==e.needsUpdate?(c=this.Versioning.NeedsUpdate,this.targetObject=e):void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=e);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Co.prototype,{_getValue_unbound:Co.prototype.getValue,_setValue_unbound:Co.prototype.setValue}),Object.assign(Lo.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=0,l=arguments.length;c!==l;++c){var h=arguments[c],u=h.uuid,d=i[u],p=void 0;if(void 0===d){d=t++,i[u]=d,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new Co(h,r[f],a[f]))}else if(d<n){p=e[d];var g=--n,v=e[g];for(i[v.uuid]=d,e[d]=v,i[u]=g,e[g]=h,f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new Co(h,r[f],a[f])),y[g]=b}}else e[d]!==p&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&l>=t){var h=t++,u=e[h];n[u.uuid]=l,e[l]=u,n[c]=h,e[h]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[h],g=f[l];f[l]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=i[c];if(void 0!==l)if(delete i[c],l<n){var h=--n,u=e[h],d=e[v=--t];i[u.uuid]=l,e[l]=u,i[d.uuid]=h,e[h]=d,e.pop();for(var p=0,f=a;p!==f;++p){var m=(y=r[p])[h],g=y[v];y[l]=m,y[h]=g,y.pop()}}else{var v;for(i[(d=e[v=--t]).uuid]=l,e[l]=d,e.pop(),p=0,f=a;p!==f;++p){var y;(y=r[p])[l]=y[v],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(h);for(var u=l,d=s.length;u!==d;++u){var p=s[u];h[u]=new Co(p,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}),Object.assign(Po.prototype,{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(){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,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},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._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=r,s[1]=r+n,c[0]=e/o,c[1]=t/o,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,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var a=2202===i;if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&!(1&~r))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:V:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:V:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),No.prototype=Object.assign(Object.create(t.prototype),{constructor:No,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=i[h],d=u.name,p=l[d];if(void 0!==p)a[h]=p;else{if(void 0!==(p=a[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(p=new Ao(Co.create(n,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[h]=p}o[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}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,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(r={},i[t]=r),r[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[r];e:{for(var l in o)break e;delete a[i]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new Pa(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Da.findByName(n,e):e,a=null!==r?r.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[i];if(void 0!==c)return c;s=o.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var l=new Po(this,r,t);return this._bindAction(l,s),this._addInactiveAction(l,a,i),l},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Da.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(i,e,r,a);var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,t[l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Oo.prototype.clone=function(){return new Oo(void 0===this.value.clone?this.value:this.value.clone())},Io.prototype=Object.assign(Object.create(Kt.prototype),{constructor:Io,isInstancedBufferGeometry:!0,copy:function(e){return Kt.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Object.defineProperties(Uo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Uo.prototype,{isInterleavedBufferAttribute:!0,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,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}}),Object.defineProperty(Do.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Do.prototype,{isInterleavedBuffer:!0,setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==e?e.length/this.stride:0,this.array=e},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];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)},onUpload:function(e){return this.onUploadCallback=e,this}}),Fo.prototype=Object.assign(Object.create(Do.prototype),{constructor:Fo,isInstancedInterleavedBuffer:!0,copy:function(e){return Do.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Bo.prototype=Object.assign(Object.create(Pt.prototype),{constructor:Bo,isInstancedBufferAttribute:!0,copy:function(e){return Pt.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(ko.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize()):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t){var n=[];return zo(e,this,n,t),n.sort(Ho),n},intersectObjects:function(e,t){var n=[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,r=e.length;i<r;i++)zo(e[i],this,n,t);return n.sort(Ho),n}}),Object.assign(Go.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}),Object.assign(Vo.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.radius=e.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e.x,e.z),this.phi=Math.acos(X.clamp(e.y/this.radius,-1,1))),this}}),Object.assign(jo.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.radius=Math.sqrt(e.x*e.x+e.z*e.z),this.theta=Math.atan2(e.x,e.z),this.y=e.y,this}}),Wo.prototype=Object.create(Tt.prototype),Wo.prototype.constructor=Wo,Wo.prototype.isImmediateRenderObject=!0,Xo.prototype=Object.create(ci.prototype),Xo.prototype.constructor=Xo,Xo.prototype.update=function(){var e=new J,t=new J,n=new K;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,l=0,h=0,u=c.length;h<u;h++)for(var d=c[h],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[i[p]]],g=d.vertexNormals[p];e.copy(m).applyMatrix4(r),t.copy(g).applyMatrix3(n).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(o&&o.isBufferGeometry){var v=o.attributes.position,y=o.attributes.normal;for(l=0,p=0,f=v.count;p<f;p++)e.set(v.getX(p),v.getY(p),v.getZ(p)).applyMatrix4(r),t.set(y.getX(p),y.getY(p),y.getZ(p)),t.applyMatrix3(n).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}a.needsUpdate=!0}}(),qo.prototype=Object.create(Tt.prototype),qo.prototype.constructor=qo,qo.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},qo.prototype.update=function(){var e=new J,t=new J;return function(){this.light.updateMatrixWorld();var n=this.light.distance?this.light.distance:1e3,i=n*Math.tan(this.light.angle);this.cone.scale.set(i,i,n),e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(t.sub(e)),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}(),Yo.prototype=Object.create(ci.prototype),Yo.prototype.constructor=Yo,Yo.prototype.updateMatrixWorld=function(){var e=new J,t=new Y,n=new Y;return function(i){var r=this.bones,a=this.geometry,o=a.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var s=0,c=0;s<r.length;s++){var l=r[s];l.parent&&l.parent.isBone&&(t.multiplyMatrices(n,l.matrixWorld),e.setFromMatrixPosition(t),o.setXYZ(c,e.x,e.y,e.z),t.multiplyMatrices(n,l.parent.matrixWorld),e.setFromMatrixPosition(t),o.setXYZ(c+1,e.x,e.y,e.z),c+=2)}a.getAttribute("position").needsUpdate=!0,Tt.prototype.updateMatrixWorld.call(this,i)}}(),Zo.prototype=Object.create(cn.prototype),Zo.prototype.constructor=Zo,Zo.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Zo.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},Jo.prototype=Object.create(Tt.prototype),Jo.prototype.constructor=Jo,Jo.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Jo.prototype.update=function(){var e=.5*this.light.width,t=.5*this.light.height,n=this.line.geometry.attributes.position,i=n.array;i[0]=e,i[1]=-t,i[2]=0,i[3]=e,i[4]=t,i[5]=0,i[6]=-e,i[7]=t,i[8]=0,i[9]=-e,i[10]=-t,i[11]=0,i[12]=e,i[13]=-t,i[14]=0,n.needsUpdate=!0,void 0!==this.color?this.line.material.color.set(this.color):this.line.material.color.copy(this.light.color)},Ko.prototype=Object.create(Tt.prototype),Ko.prototype.constructor=Ko,Ko.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Ko.prototype.update=function(){var e=new J,t=new We,n=new We;return function(){var i=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=i.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var a=0,o=r.count;a<o;a++){var s=a<o/2?t:n;r.setXYZ(a,s.r,s.g,s.b)}r.needsUpdate=!0}i.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate())}}(),Qo.prototype=Object.create(ci.prototype),Qo.prototype.constructor=Qo,$o.prototype=Object.create(ci.prototype),$o.prototype.constructor=$o,es.prototype=Object.create(ci.prototype),es.prototype.constructor=es,es.prototype.update=function(){var e=new J,t=new J,n=new K;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,r=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,l=0,h=s.length;l<h;l++){var u=s[l],d=u.normal;e.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(i),t.copy(d).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),r.setXYZ(c,e.x,e.y,e.z),c+=1,r.setXYZ(c,t.x,t.y,t.z),c+=1}r.needsUpdate=!0}}(),ts.prototype=Object.create(Tt.prototype),ts.prototype.constructor=ts,ts.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},ts.prototype.update=function(){var e=new J,t=new J,n=new J;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(t,e),this.lightPlane.lookAt(n),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(n),this.targetLine.scale.z=n.length()}}(),ns.prototype=Object.create(ci.prototype),ns.prototype.constructor=ns,ns.prototype.update=function(){var e,t,n=new J,i=new Mt;function r(r,a,o,s){n.set(a,o,s).unproject(i);var c=t[r];if(void 0!==c)for(var l=e.getAttribute("position"),h=0,u=c.length;h<u;h++)l.setXYZ(c[h],n.x,n.y,n.z)}return function(){e=this.geometry,t=this.pointMap,i.projectionMatrix.copy(this.camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-1,-1,-1),r("n2",1,-1,-1),r("n3",-1,1,-1),r("n4",1,1,-1),r("f1",-1,-1,1),r("f2",1,-1,1),r("f3",-1,1,1),r("f4",1,1,1),r("u1",.7,1.1,-1),r("u2",-.7,1.1,-1),r("u3",0,2,-1),r("cf1",-1,0,1),r("cf2",1,0,1),r("cf3",0,-1,1),r("cf4",0,1,1),r("cn1",-1,0,-1),r("cn2",1,0,-1),r("cn3",0,-1,-1),r("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),is.prototype=Object.create(ci.prototype),is.prototype.constructor=is,is.prototype.update=function(){var e=new ut;return function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&e.setFromObject(this.object),!e.isEmpty()){var n=e.min,i=e.max,r=this.geometry.attributes.position,a=r.array;a[0]=i.x,a[1]=i.y,a[2]=i.z,a[3]=n.x,a[4]=i.y,a[5]=i.z,a[6]=n.x,a[7]=n.y,a[8]=i.z,a[9]=i.x,a[10]=n.y,a[11]=i.z,a[12]=i.x,a[13]=i.y,a[14]=n.z,a[15]=n.x,a[16]=i.y,a[17]=n.z,a[18]=n.x,a[19]=n.y,a[20]=n.z,a[21]=i.x,a[22]=n.y,a[23]=n.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),is.prototype.setFromObject=function(e){return this.object=e,this.update(),this},rs.prototype=Object.create(ci.prototype),rs.prototype.constructor=rs,rs.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Tt.prototype.updateMatrixWorld.call(this,e))},as.prototype=Object.create(si.prototype),as.prototype.constructor=as,as.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.lookAt(this.plane.normal),Tt.prototype.updateMatrixWorld.call(this,e)},os.prototype=Object.create(Tt.prototype),os.prototype.constructor=os,os.prototype.setDirection=(ao=new J,function(e){e.y>.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(ao.set(e.z,0,-e.x).normalize(),ro=Math.acos(e.y),this.quaternion.setFromAxisAngle(ao,ro))}),os.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},os.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},ss.prototype=Object.create(ci.prototype),ss.prototype.constructor=ss;var cs={createMultiMaterialObject:function(e,t){for(var n=new di,i=0,r=t.length;i<r;i++)n.add(new cn(e,t[i]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){e.applyMatrix((new Y).getInverse(n.matrixWorld)),t.remove(e),n.add(e)}};function ls(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Qr.call(this,e),this.type="catmullrom",this.closed=!0}function hs(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Qr.call(this,e),this.type="catmullrom"}function us(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Qr.call(this,e),this.type="catmullrom"}jr.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(jr.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(ha.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Lt,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new J(r.x,r.y,r.z||0))}return t}}),Object.assign(ua.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),ls.prototype=Object.create(Qr.prototype),hs.prototype=Object.create(Qr.prototype),us.prototype=Object.create(Qr.prototype),Object.assign(us.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Qo.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Yo.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(ja.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Wa.extractUrlBase(e)}}),Object.assign(Je.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(ut.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),on.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(X,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),X.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),X.ceilPowerOfTwo(e)}}),Object.assign(K.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Y.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return void 0===e&&(e=new J),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),pt.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Z.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(an.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(da.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ir(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new pr(this,e)}}),Object.assign(q.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(J.prototype,{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(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ee.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Lt.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(Tt.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)}}),Object.defineProperties(Tt.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}},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(ni.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ii.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(jr.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Vn.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(pa.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),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){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Pt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Kt.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Kt.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}}}),Object.defineProperties(Oo.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(ct.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new We}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}}}),Object.defineProperties(Rr.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(rn.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.assign(Zn.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(Zn.prototype,{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}}}),Object.defineProperties(mt.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(e){var t=1!==e;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+t+"."),this.renderReverseSided=t}}}),Object.defineProperties(te.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}}}),Object.assign(Wn.prototype,{getStandingMatrix:function(){console.warn("THREE.WebVRManager: .getStandingMatrix() has been removed.")}}),Object.defineProperties(Wn.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}}}),To.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new bo).load(e,(function(e){t.setBuffer(e)})),this},So.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_o.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var ds={merge:function(e,t,n){var i;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},ps={crossOrigin:void 0,loadTexture:function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Vr;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},loadTextureCube:function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Gr;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);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.")}};e.WebGLRenderTargetCube=ne,e.WebGLRenderTarget=te,e.WebGLRenderer=Zn,e.ShaderLib=Ze,e.UniformsLib=Xe,e.UniformsUtils=qe,e.ShaderChunk=Ye,e.FogExp2=Jn,e.Fog=Kn,e.Scene=Qn,e.LensFlare=$n,e.Sprite=ti,e.LOD=ni,e.SkinnedMesh=ai,e.Skeleton=ii,e.Bone=ri,e.Mesh=cn,e.LineSegments=ci,e.LineLoop=li,e.Line=si,e.Points=ui,e.Group=di,e.VideoTexture=pi,e.DataTexture=ie,e.CompressedTexture=fi,e.CubeTexture=re,e.CanvasTexture=Qe,e.DepthTexture=mi,e.Texture=$,e.CompressedTextureLoader=kr,e.DataTextureLoader=Hr,e.CubeTextureLoader=Gr,e.TextureLoader=Vr,e.ObjectLoader=qa,e.MaterialLoader=Fa,e.BufferGeometryLoader=Ba,e.DefaultLoadingManager=Dr,e.LoadingManager=Ur,e.JSONLoader=Xa,e.ImageLoader=zr,e.ImageBitmapLoader=Qa,e.FontLoader=to,e.FileLoader=Br,e.Loader=ja,e.LoaderUtils=Wa,e.Cache=Ir,e.AudioLoader=bo,e.SpotLightShadow=ga,e.SpotLight=va,e.PointLight=ya,e.RectAreaLight=_a,e.HemisphereLight=fa,e.DirectionalLightShadow=xa,e.DirectionalLight=ba,e.AmbientLight=wa,e.LightShadow=ma,e.Light=pa,e.StereoCamera=wo,e.PerspectiveCamera=Vn,e.OrthographicCamera=St,e.CubeCamera=_o,e.ArrayCamera=jn,e.OrigamiCamera=Mt,e.AudioListener=Eo,e.PositionalAudio=Mo,e.AudioContext=xo,e.AudioAnalyser=So,e.Audio=To,e.VectorKeyframeTrack=Ua,e.StringKeyframeTrack=Ea,e.QuaternionKeyframeTrack=Aa,e.NumberKeyframeTrack=Ca,e.ColorKeyframeTrack=Ra,e.BooleanKeyframeTrack=Ta,e.PropertyMixer=Ao,e.PropertyBinding=Co,e.KeyframeTrack=Ia,e.AnimationUtils=Oa,e.AnimationObjectGroup=Lo,e.AnimationMixer=No,e.AnimationClip=Da,e.Uniform=Oo,e.InstancedBufferGeometry=Io,e.BufferGeometry=Kt,e.Geometry=Lt,e.InterleavedBufferAttribute=Uo,e.InstancedInterleavedBuffer=Fo,e.InterleavedBuffer=Do,e.InstancedBufferAttribute=Bo,e.Face3=At,e.Object3D=Tt,e.Raycaster=ko,e.Layers=yt,e.EventDispatcher=t,e.Clock=Go,e.QuaternionLinearInterpolant=Sa,e.LinearInterpolant=Pa,e.DiscreteInterpolant=Na,e.CubicInterpolant=La,e.Interpolant=Ma,e.Triangle=sn,e.Math=X,e.Spherical=Vo,e.Cylindrical=jo,e.Plane=pt,e.Frustum=ft,e.Sphere=dt,e.Ray=an,e.Matrix4=Y,e.Matrix3=K,e.Box3=ut,e.Box2=Je,e.Line3=on,e.Euler=vt,e.Vector4=ee,e.Vector3=J,e.Vector2=q,e.Quaternion=Z,e.Color=We,e.ImmediateRenderObject=Wo,e.VertexNormalsHelper=Xo,e.SpotLightHelper=qo,e.SkeletonHelper=Yo,e.PointLightHelper=Zo,e.RectAreaLightHelper=Jo,e.HemisphereLightHelper=Ko,e.GridHelper=Qo,e.PolarGridHelper=$o,e.FaceNormalsHelper=es,e.DirectionalLightHelper=ts,e.CameraHelper=ns,e.BoxHelper=is,e.Box3Helper=rs,e.PlaneHelper=as,e.ArrowHelper=os,e.AxesHelper=ss,e.Shape=da,e.Path=ua,e.ShapePath=$a,e.Font=eo,e.CurvePath=ha,e.Curve=jr,e.ShapeUtils=nr,e.SceneUtils=cs,e.WebGLUtils=Yn,e.WireframeGeometry=gi,e.ParametricGeometry=vi,e.ParametricBufferGeometry=yi,e.TetrahedronGeometry=wi,e.TetrahedronBufferGeometry=_i,e.OctahedronGeometry=Ei,e.OctahedronBufferGeometry=Ti,e.IcosahedronGeometry=Mi,e.IcosahedronBufferGeometry=Si,e.DodecahedronGeometry=Ai,e.DodecahedronBufferGeometry=Ri,e.PolyhedronGeometry=xi,e.PolyhedronBufferGeometry=bi,e.TubeGeometry=Ci,e.TubeBufferGeometry=Li,e.TorusKnotGeometry=Pi,e.TorusKnotBufferGeometry=Ni,e.TorusGeometry=Oi,e.TorusBufferGeometry=Ii,e.TextGeometry=ar,e.TextBufferGeometry=or,e.SphereGeometry=sr,e.SphereBufferGeometry=cr,e.RingGeometry=lr,e.RingBufferGeometry=hr,e.PlaneGeometry=en,e.PlaneBufferGeometry=tn,e.LatheGeometry=ur,e.LatheBufferGeometry=dr,e.ShapeGeometry=pr,e.ShapeBufferGeometry=fr,e.ExtrudeGeometry=ir,e.ExtrudeBufferGeometry=rr,e.EdgesGeometry=gr,e.ConeGeometry=xr,e.ConeBufferGeometry=br,e.CylinderGeometry=vr,e.CylinderBufferGeometry=yr,e.CircleGeometry=wr,e.CircleBufferGeometry=_r,e.BoxGeometry=Qt,e.BoxBufferGeometry=$t,e.ShadowMaterial=Tr,e.SpriteMaterial=ei,e.RawShaderMaterial=Mr,e.ShaderMaterial=rn,e.PointsMaterial=hi,e.MeshPhysicalMaterial=Ar,e.MeshStandardMaterial=Sr,e.MeshPhongMaterial=Rr,e.MeshToonMaterial=Cr,e.MeshNormalMaterial=Lr,e.MeshLambertMaterial=Pr,e.MeshDepthMaterial=lt,e.MeshDistanceMaterial=ht,e.MeshBasicMaterial=nn,e.LineDashedMaterial=Nr,e.LineBasicMaterial=oi,e.Material=ct,e.Float64BufferAttribute=Ht,e.Float32BufferAttribute=kt,e.Uint32BufferAttribute=Bt,e.Int32BufferAttribute=Ft,e.Uint16BufferAttribute=Dt,e.Int16BufferAttribute=Ut,e.Uint8ClampedBufferAttribute=It,e.Uint8BufferAttribute=Ot,e.Int8BufferAttribute=Nt,e.BufferAttribute=Pt,e.ArcCurve=Xr,e.CatmullRomCurve3=Qr,e.CubicBezierCurve=na,e.CubicBezierCurve3=ia,e.EllipseCurve=Wr,e.LineCurve=ra,e.LineCurve3=aa,e.QuadraticBezierCurve=oa,e.QuadraticBezierCurve3=sa,e.SplineCurve=ca,e.REVISION="89",e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.CullFaceNone=0,e.CullFaceBack=1,e.CullFaceFront=2,e.CullFaceFrontBack=3,e.FrontFaceDirectionCW=0,e.FrontFaceDirectionCCW=1,e.BasicShadowMap=0,e.PCFShadowMap=1,e.PCFSoftShadowMap=2,e.FrontSide=0,e.BackSide=1,e.DoubleSide=2,e.FlatShading=1,e.SmoothShading=2,e.NoColors=0,e.FaceColors=1,e.VertexColors=2,e.NoBlending=0,e.NormalBlending=1,e.AdditiveBlending=2,e.SubtractiveBlending=3,e.MultiplyBlending=4,e.CustomBlending=5,e.AddEquation=100,e.SubtractEquation=101,e.ReverseSubtractEquation=102,e.MinEquation=103,e.MaxEquation=104,e.ZeroFactor=200,e.OneFactor=201,e.SrcColorFactor=202,e.OneMinusSrcColorFactor=203,e.SrcAlphaFactor=204,e.OneMinusSrcAlphaFactor=205,e.DstAlphaFactor=206,e.OneMinusDstAlphaFactor=207,e.DstColorFactor=208,e.OneMinusDstColorFactor=209,e.SrcAlphaSaturateFactor=210,e.NeverDepth=0,e.AlwaysDepth=1,e.LessDepth=2,e.LessEqualDepth=3,e.EqualDepth=4,e.GreaterEqualDepth=5,e.GreaterDepth=6,e.NotEqualDepth=7,e.MultiplyOperation=0,e.MixOperation=1,e.AddOperation=2,e.NoToneMapping=0,e.LinearToneMapping=1,e.ReinhardToneMapping=2,e.Uncharted2ToneMapping=3,e.CineonToneMapping=4,e.UVMapping=300,e.CubeReflectionMapping=u,e.CubeRefractionMapping=d,e.EquirectangularReflectionMapping=303,e.EquirectangularRefractionMapping=p,e.SphericalReflectionMapping=305,e.CubeUVReflectionMapping=f,e.CubeUVRefractionMapping=m,e.RepeatWrapping=g,e.ClampToEdgeWrapping=v,e.MirroredRepeatWrapping=y,e.NearestFilter=x,e.NearestMipMapNearestFilter=b,e.NearestMipMapLinearFilter=w,e.LinearFilter=_,e.LinearMipMapNearestFilter=E,e.LinearMipMapLinearFilter=T,e.UnsignedByteType=M,e.ByteType=1010,e.ShortType=1011,e.UnsignedShortType=S,e.IntType=1013,e.UnsignedIntType=A,e.FloatType=R,e.HalfFloatType=C,e.UnsignedShort4444Type=1017,e.UnsignedShort5551Type=1018,e.UnsignedShort565Type=1019,e.UnsignedInt248Type=L,e.AlphaFormat=1021,e.RGBFormat=P,e.RGBAFormat=N,e.LuminanceFormat=1024,e.LuminanceAlphaFormat=1025,e.RGBEFormat=1023,e.DepthFormat=O,e.DepthStencilFormat=I,e.RGB_S3TC_DXT1_Format=U,e.RGBA_S3TC_DXT1_Format=D,e.RGBA_S3TC_DXT3_Format=F,e.RGBA_S3TC_DXT5_Format=B,e.RGB_PVRTC_4BPPV1_Format=k,e.RGB_PVRTC_2BPPV1_Format=H,e.RGBA_PVRTC_4BPPV1_Format=z,e.RGBA_PVRTC_2BPPV1_Format=G,e.RGB_ETC1_Format=2151,e.LoopOnce=2200,e.LoopRepeat=2201,e.LoopPingPong=2202,e.InterpolateDiscrete=2300,e.InterpolateLinear=2301,e.InterpolateSmooth=2302,e.ZeroCurvatureEnding=V,e.ZeroSlopeEnding=2401,e.WrapAroundEnding=2402,e.TrianglesDrawMode=0,e.TriangleStripDrawMode=1,e.TriangleFanDrawMode=2,e.LinearEncoding=j,e.sRGBEncoding=3001,e.GammaEncoding=W,e.RGBEEncoding=3002,e.LogLuvEncoding=3003,e.RGBM7Encoding=3004,e.RGBM16Encoding=3005,e.RGBDEncoding=3006,e.BasicDepthPacking=3200,e.RGBADepthPacking=3201,e.CubeGeometry=Qt,e.Face4=function(e,t,n,i,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new At(e,t,n,r,a,o)},e.LineStrip=0,e.LinePieces=1,e.MeshFaceMaterial=function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},e.MultiMaterial=function(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e},e.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ui(e,t)},e.Particle=function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ti(e)},e.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ui(e,t)},e.PointCloudMaterial=function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new hi(e)},e.ParticleBasicMaterial=function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new hi(e)},e.ParticleSystemMaterial=function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new hi(e)},e.Vertex=function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new J(e,t,n)},e.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new Pt(e,t).setDynamic(!0)},e.Int8Attribute=function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Nt(e,t)},e.Uint8Attribute=function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ot(e,t)},e.Uint8ClampedAttribute=function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new It(e,t)},e.Int16Attribute=function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ut(e,t)},e.Uint16Attribute=function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Dt(e,t)},e.Int32Attribute=function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ft(e,t)},e.Uint32Attribute=function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Bt(e,t)},e.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new kt(e,t)},e.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Ht(e,t)},e.ClosedSplineCurve3=ls,e.SplineCurve3=hs,e.Spline=us,e.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new ss(e)},e.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new is(e,t)},e.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new ci(new gr(e.geometry),new oi({color:void 0!==t?t:16777215}))},e.WireframeHelper=function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new ci(new gi(e.geometry),new oi({color:void 0!==t?t:16777215}))},e.XHRLoader=function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Br(e)},e.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Hr(e)},e.GeometryUtils=ds,e.ImageUtils=ps,e.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().")}},e.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},window.THREE=e,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){(function(n){var i,r=function(){this._tweens={},this._tweensAddedDuringUpdate={}};r.prototype={getAll:function(){return Object.keys(this._tweens).map(function(e){return this._tweens[e]}.bind(this))},removeAll:function(){this._tweens={}},add:function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},remove:function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},update:function(e,t){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(e=void 0!==e?e:o.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]];r&&!1===r.update(e)&&(r._isPlaying=!1,t||delete this._tweens[n[i]])}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var a,o=new r;o.Group=r,o._nextId=0,o.nextId=function(){return o._nextId++},"undefined"==typeof window&&void 0!==n?o.now=function(){var e=n.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?o.now=window.performance.now.bind(window.performance):void 0!==Date.now?o.now=Date.now:o.now=function(){return(new Date).getTime()},o.Tween=function(e,t){this._object=e,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=o.Easing.Linear.None,this._interpolationFunction=o.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=t||o,this._id=o.nextId()},o.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(e,t){return this._valuesEnd=e,void 0!==t&&(this._duration=t),this},start:function(e){for(var t in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==e?"string"==typeof e?o.now()+parseFloat(e):e:o.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[t]instanceof Array){if(0===this._valuesEnd[t].length)continue;this._valuesEnd[t]=[this._object[t]].concat(this._valuesEnd[t])}void 0!==this._object[t]&&(this._valuesStart[t]=this._object[t],this._valuesStart[t]instanceof Array==0&&(this._valuesStart[t]*=1),this._valuesStartRepeat[t]=this._valuesStart[t]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,null!==this._onStopCallback&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(this._startTime+this._duration),this},stopChainedTweens:function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop()},group:function(e){return this._group=e,this},delay:function(e){return this._delayTime=e,this},repeat:function(e){return this._repeat=e,this},repeatDelay:function(e){return this._repeatDelayTime=e,this},yoyo:function(e){return this._yoyo=e,this},easing:function(e){return this._easingFunction=e,this},interpolation:function(e){return this._interpolationFunction=e,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(e){return this._onStartCallback=e,this},onUpdate:function(e){return this._onUpdateCallback=e,this},onComplete:function(e){return this._onCompleteCallback=e,this},onStop:function(e){return this._onStopCallback=e,this},update:function(e){var t,n,i;if(e<this._startTime)return!0;for(t in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(e-this._startTime)/this._duration,n=0===this._duration||n>1?1:n,i=this._easingFunction(n),this._valuesEnd)if(void 0!==this._valuesStart[t]){var r=this._valuesStart[t]||0,a=this._valuesEnd[t];a instanceof Array?this._object[t]=this._interpolationFunction(a,i):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[t]=r+(a-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1===n){if(this._repeat>0){for(t in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var o=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=o}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var s=0,c=this._chainedTweens.length;s<c;s++)this._chainedTweens[s].start(this._startTime+this._duration);return!1}return!0}},o.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*(2-Math.pow(2,-10*(e-1)))}},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){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){return e*e*(2.70158*e-1.70158)},Out:function(e){return--e*e*(2.70158*e+1.70158)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-o.Easing.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*o.Easing.Bounce.In(2*e):.5*o.Easing.Bounce.Out(2*e-1)+.5}}},o.Interpolation={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),a=o.Interpolation.Utils.Linear;return t<0?a(e[0],e[1],i):t>1?a(e[n],e[n-1],n-i):a(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,a=o.Interpolation.Utils.Bernstein,s=0;s<=i;s++)n+=r(1-t,i-s)*r(t,s)*e[s]*a(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),a=o.Interpolation.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),a(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):a(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=o.Interpolation.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(a=[1],function(e){var t=1;if(a[e])return a[e];for(var n=e;n>1;n--)t*=n;return a[e]=t,t}),CatmullRom:function(e,t,n,i,r){var a=.5*(n-e),o=.5*(i-t),s=r*r;return(2*t-2*n+a+o)*(r*s)+(-3*t+3*n-2*a-o)*s+a*r+t}}},void 0===(i=function(){return o}.apply(t,[]))||(e.exports=i)}).call(this,n(9))},function(e,t){var n={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),e},addGetWebGLMessage:function(e){var t,i,r;t=void 0!==(e=e||{}).parent?e.parent:document.body,i=void 0!==e.id?e.id:"oldie",(r=n.getWebGLErrorMessage()).id=i,t.appendChild(r)}};e.exports=n},function(e,t){e.exports='<div class="preloader">\r\n    <div class="cube-wrapper">\r\n        <div class="cube-folding">\r\n            <span class="leaf1"></span>\r\n            <span class="leaf2"></span>\r\n            <span class="leaf3"></span>\r\n            <span class="leaf4"></span>\r\n        </div>\r\n        <span class="processing">Processing...</span>\r\n    </div>\r\n</div>'},function(e,t){e.exports="<style id=\"preloaderStyles\">\r\n    .preloader {\r\n        position: relative;\r\n        left: 0;\r\n        right: 0;\r\n        top: 0;\r\n        bottom: 0;\r\n        background-color: #fff;\r\n        z-index: 9999;\r\n        opacity: 1;\r\n    }\r\n\r\n    .cube-folding {\r\n        width: 50px;\r\n        height: 50px;\r\n        display: inline-block;\r\n        -moz-transform: rotate(45deg);\r\n        -ms-transform: rotate(45deg);\r\n        -webkit-transform: rotate(45deg);\r\n        transform: rotate(45deg);\r\n        font-size: 0;\r\n    }\r\n\r\n    .cube-folding span {\r\n        position: relative;\r\n        width: 25px;\r\n        height: 25px;\r\n        -moz-transform: scale(1.1);\r\n        -ms-transform: scale(1.1);\r\n        -webkit-transform: scale(1.1);\r\n        transform: scale(1.1);\r\n        display: inline-block;\r\n    }\r\n\r\n    .cube-folding span::before {\r\n        content: '';\r\n        background-color: #30c2ff;\r\n        position: absolute;\r\n        left: 0;\r\n        top: 0;\r\n        display: block;\r\n        width: 25px;\r\n        height: 25px;\r\n        -moz-transform-origin: 100% 100%;\r\n        -ms-transform-origin: 100% 100%;\r\n        -webkit-transform-origin: 100% 100%;\r\n        transform-origin: 100% 100%;\r\n        -moz-animation: folding 2.5s infinite linear both;\r\n        -webkit-animation: folding 2.5s infinite linear both;\r\n        animation: folding 2.5s infinite linear both;\r\n    }\r\n\r\n    .cube-folding .leaf2 {\r\n        -moz-transform: rotateZ(90deg) scale(1.1);\r\n        -ms-transform: rotateZ(90deg) scale(1.1);\r\n        -webkit-transform: rotateZ(90deg) scale(1.1);\r\n        transform: rotateZ(90deg) scale(1.1);\r\n    }\r\n\r\n    .cube-folding .leaf2::before {\r\n        -moz-animation-delay: 0.3s;\r\n        -webkit-animation-delay: 0.3s;\r\n        animation-delay: 0.3s;\r\n        background-color: #17baff;\r\n    }\r\n\r\n    .cube-folding .leaf3 {\r\n        -moz-transform: rotateZ(270deg) scale(1.1);\r\n        -ms-transform: rotateZ(270deg) scale(1.1);\r\n        -webkit-transform: rotateZ(270deg) scale(1.1);\r\n        transform: rotateZ(270deg) scale(1.1);\r\n    }\r\n\r\n    .cube-folding .leaf3::before {\r\n        -moz-animation-delay: 0.9s;\r\n        -webkit-animation-delay: 0.9s;\r\n        animation-delay: 0.9s;\r\n        background-color: #17baff;\r\n    }\r\n\r\n    .cube-folding .leaf4 {\r\n        -moz-transform: rotateZ(180deg) scale(1.1);\r\n        -ms-transform: rotateZ(180deg) scale(1.1);\r\n        -webkit-transform: rotateZ(180deg) scale(1.1);\r\n        transform: rotateZ(180deg) scale(1.1);\r\n    }\r\n\r\n    .cube-folding .leaf4::before {\r\n        -moz-animation-delay: 0.6s;\r\n        -webkit-animation-delay: 0.6s;\r\n        animation-delay: 0.6s;\r\n        background-color: #00b2fc;\r\n    }\r\n\r\n    @-moz-keyframes folding {\r\n\r\n        0%,\r\n        10% {\r\n            -moz-transform: perspective(140px) rotateX(-180deg);\r\n            transform: perspective(140px) rotateX(-180deg);\r\n            opacity: 0;\r\n        }\r\n\r\n        25%,\r\n        75% {\r\n            -moz-transform: perspective(140px) rotateX(0deg);\r\n            transform: perspective(140px) rotateX(0deg);\r\n            opacity: 1;\r\n        }\r\n\r\n        90%,\r\n        100% {\r\n            -moz-transform: perspective(140px) rotateY(180deg);\r\n            transform: perspective(140px) rotateY(180deg);\r\n            opacity: 0;\r\n        }\r\n    }\r\n\r\n    @-webkit-keyframes folding {\r\n\r\n        0%,\r\n        10% {\r\n            -webkit-transform: perspective(140px) rotateX(-180deg);\r\n            transform: perspective(140px) rotateX(-180deg);\r\n            opacity: 0;\r\n        }\r\n\r\n        25%,\r\n        75% {\r\n            -webkit-transform: perspective(140px) rotateX(0deg);\r\n            transform: perspective(140px) rotateX(0deg);\r\n            opacity: 1;\r\n        }\r\n\r\n        90%,\r\n        100% {\r\n            -webkit-transform: perspective(140px) rotateY(180deg);\r\n            transform: perspective(140px) rotateY(180deg);\r\n            opacity: 0;\r\n        }\r\n    }\r\n\r\n    @keyframes folding {\r\n\r\n        0%,\r\n        10% {\r\n            -moz-transform: perspective(140px) rotateX(-180deg);\r\n            -ms-transform: perspective(140px) rotateX(-180deg);\r\n            -webkit-transform: perspective(140px) rotateX(-180deg);\r\n            transform: perspective(140px) rotateX(-180deg);\r\n            opacity: 0;\r\n        }\r\n\r\n        25%,\r\n        75% {\r\n            -moz-transform: perspective(140px) rotateX(0deg);\r\n            -ms-transform: perspective(140px) rotateX(0deg);\r\n            -webkit-transform: perspective(140px) rotateX(0deg);\r\n            transform: perspective(140px) rotateX(0deg);\r\n            opacity: 1;\r\n        }\r\n\r\n        90%,\r\n        100% {\r\n            -moz-transform: perspective(140px) rotateY(180deg);\r\n            -ms-transform: perspective(140px) rotateY(180deg);\r\n            -webkit-transform: perspective(140px) rotateY(180deg);\r\n            transform: perspective(140px) rotateY(180deg);\r\n            opacity: 0;\r\n        }\r\n    }\r\n\r\n    .cube-wrapper {\r\n        width: 100px;\r\n        height: 100px;\r\n        text-align: center;\r\n    }\r\n\r\n    .cube-wrapper .processing {\r\n        display: block;\r\n        margin-top: 26px;\r\n        font-size: 16px;\r\n        line-height: 19px;\r\n    }\r\n</style>"},function(e,t){e.exports='<style id="containerStyles">\r\n    .canvasContainer {\r\n        width: 100%;\r\n        height: 100%;\r\n        display: block;\r\n    }\r\n\r\n    .preloadContainer {\r\n        position: relative;\r\n        width: 100%;\r\n        height: 100%;\r\n        display: flex;\r\n        justify-content: center;\r\n        align-items: center;\r\n    }\r\n\r\n    .mainContainer {\r\n        width: 100%;\r\n        height: 100%;\r\n        display: flex;\r\n        justify-content: center;\r\n        align-items: center;\r\n    }\r\n\r\n    .canvasContainer>canvas {\r\n        height: 100% !important;\r\n        width: 100% !important;\r\n    }\r\n</style>'},function(e,t){THREE.BlenderColladaLoader=function(e){THREE.Loader.call(this,e)},THREE.BlenderColladaLoader.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:THREE.BlenderColladaLoader,load:function(e,t,n,i){var r=this,a=""===r.path?THREE.LoaderUtils.extractUrlBase(e):r.path,o=new THREE.FileLoader(r.manager);o.setPath(r.path),o.load(e,(function(e){t(r.parse(e,a))}),n,i)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},parse:function(e,t){function n(e,t){for(var n=[],i=e.childNodes,r=0,a=i.length;r<a;r++){var o=i[r];o.nodeName===t&&n.push(o)}return n}function i(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=t[i];return n}function r(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseFloat(t[i]);return n}function a(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseInt(t[i]);return n}function o(e){return e.substring(1)}function s(e){return 0===Object.keys(e).length}function c(e){return void 0!==e&&!0===e.hasAttribute("meter")?parseFloat(e.getAttribute("meter")):1}function l(e){return void 0!==e?e.textContent:"Y_UP"}function h(e,t,i,r){var a=n(e,t)[0];if(void 0!==a)for(var o=n(a,i),s=0;s<o.length;s++)r(o[s])}function u(e,t){for(var n in e)e[n].build=t(e[n])}function d(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function p(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){var a=o(r.getAttribute("source")),s=r.getAttribute("semantic");t.inputs[s]=a}}return t}function f(e){var t={},n=e.getAttribute("target").split("/"),i=n.shift(),r=n.shift(),a=-1!==r.indexOf("("),s=-1!==r.indexOf(".");if(s)n=r.split("."),r=n.shift(),t.member=n.shift();else if(a){var c=r.split("(");r=c.shift();for(var l=0;l<c.length;l++)c[l]=parseInt(c[l].replace(/\)/,""));t.indices=c}return t.id=i,t.sid=r,t.arraySyntax=a,t.memberSyntax=s,t.sampler=o(e.getAttribute("source")),t}function m(e){var t=[],n=e.channels,i=e.samplers,r=e.sources;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a],s=i[o.sampler],c=s.inputs.INPUT,l=s.inputs.OUTPUT;w(v(o,r[c],r[l]),t)}return t}function g(e){return d(Je.animations[e],m)}function v(e,t,n){var i,r,a,o,s,c,l=Je.nodes[e.id],h=Ue(l.id),u=l.transforms[e.sid],d=l.matrix.clone().transpose(),p={};switch(u){case"matrix":for(a=0,o=t.array.length;a<o;a++)if(i=t.array[a],r=a*n.stride,void 0===p[i]&&(p[i]={}),!0===e.arraySyntax){var f=n.array[r],m=e.indices[0]+4*e.indices[1];p[i][m]=f}else for(s=0,c=n.stride;s<c;s++)p[i][s]=n.array[r+s];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',u)}var g=function(e,t){var n=[];for(var i in e)n.push({time:parseFloat(i),value:e[i]});n.sort((function(e,t){return e.time-t.time}));for(var r=0;r<16;r++)_(n,r,t.elements[r]);return n}(p,d);return{name:h.uuid,keyframes:g}}var y=new THREE.Vector3,x=new THREE.Vector3,b=new THREE.Quaternion;function w(e,t){for(var n=e.keyframes,i=e.name,r=[],a=[],o=[],s=[],c=0,l=n.length;c<l;c++){var h=n[c],u=h.time,d=h.value;Te.fromArray(d).transpose(),Te.decompose(y,b,x),r.push(u),a.push(y.x,y.y,y.z),o.push(b.x,b.y,b.z,b.w),s.push(x.x,x.y,x.z)}return a.length>0&&t.push(new THREE.VectorKeyframeTrack(i+".position",r,a)),o.length>0&&t.push(new THREE.QuaternionKeyframeTrack(i+".quaternion",r,o)),s.length>0&&t.push(new THREE.VectorKeyframeTrack(i+".scale",r,s)),t}function _(e,t,n){var i,r,a,o=!0;for(r=0,a=e.length;r<a;r++)void 0===(i=e[r]).value[t]?i.value[t]=null:o=!1;if(!0===o)for(r=0,a=e.length;r<a;r++)(i=e[r]).value[t]=n;else!function(e,t){for(var n,i,r=0,a=e.length;r<a;r++){var o=e[r];if(null===o.value[t]){if(n=E(e,r,t),i=T(e,r,t),null===n){o.value[t]=i.value[t];continue}if(null===i){o.value[t]=n.value[t];continue}M(o,n,i,t)}}}(e,t)}function E(e,t,n){for(;t>=0;){var i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t<e.length;){var i=e[t];if(null!==i.value[n])return i;t++}return null}function M(e,t,n,i){n.time-t.time!=0?e.value[i]=(e.time-t.time)*(n.value[i]-t.value[i])/(n.time-t.time)+t.value[i]:e.value[i]=t.value[i]}function S(e){for(var t=[],n=e.name,i=e.end-e.start||-1,r=e.animations,a=0,o=r.length;a<o;a++)for(var s=g(r[a]),c=0,l=s.length;c<l;c++)t.push(s[c]);return new THREE.AnimationClip(n,i,t)}function A(e){return d(Je.clips[e],S)}function R(e){for(var t={sources:{}},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=r(a.textContent);break;case"source":var o=a.getAttribute("id");t.sources[o]=re(a);break;case"joints":t.joints=C(a);break;case"vertex_weights":t.vertexWeights=L(a)}}return t}function C(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){var a=r.getAttribute("semantic"),s=o(r.getAttribute("source"));t.inputs[a]=s}}return t}function L(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var s=r.getAttribute("semantic"),c=o(r.getAttribute("source")),l=parseInt(r.getAttribute("offset"));t.inputs[s]={id:c,offset:l};break;case"vcount":t.vcount=a(r.textContent);break;case"v":t.v=a(r.textContent)}}return t}function P(e){var t={id:e.id},n=Je.geometries[t.id];return void 0!==e.skin&&(t.skin=function(e){var t,n,i,r={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},a=e.sources,o=e.vertexWeights,s=o.vcount,c=o.v,l=o.inputs.JOINT.offset,h=o.inputs.WEIGHT.offset,u=e.sources[e.joints.inputs.JOINT],d=e.sources[e.joints.inputs.INV_BIND_MATRIX],p=a[o.inputs.WEIGHT.id].array,f=0;for(t=0,i=s.length;t<i;t++){var m=s[t],g=[];for(n=0;n<m;n++){var v=c[f+l],y=p[c[f+h]];g.push({index:v,weight:y}),f+=2}for(g.sort(_),n=0;n<4;n++){var x=g[n];void 0!==x?(r.indices.array.push(x.index),r.weights.array.push(x.weight)):(r.indices.array.push(0),r.weights.array.push(0))}}for(e.bindShapeMatrix?r.bindMatrix=(new THREE.Matrix4).fromArray(e.bindShapeMatrix).transpose():r.bindMatrix=(new THREE.Matrix4).identity(),t=0,i=u.array.length;t<i;t++){var b=u.array[t],w=(new THREE.Matrix4).fromArray(d.array,t*d.stride).transpose();r.joints.push({name:b,boneInverse:w})}return r;function _(e,t){return t.weight-e.weight}}(e.skin),n.sources.skinIndices=t.skin.indices,n.sources.skinWeights=t.skin.weights),t}function N(e){return void 0!==e.build?e.build:e.init_from}function O(e){var t=Je.images[e];return void 0!==t?d(t,N):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",e),null)}function I(e){for(var t={surfaces:{},samplers:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":U(r,t);break;case"technique":t.technique=B(r);break;case"extra":t.extra=j(r)}}return t}function U(e,t){for(var n=e.getAttribute("sid"),i=0,r=e.childNodes.length;i<r;i++){var a=e.childNodes[i];if(1===a.nodeType)switch(a.nodeName){case"surface":t.surfaces[n]=D(a);break;case"sampler2D":t.samplers[n]=F(a)}}}function D(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"init_from"===r.nodeName&&(t.init_from=r.textContent)}return t}function F(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"source"===r.nodeName&&(t.source=r.textContent)}return t}function B(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=k(r)}}return t}function k(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":t[r.nodeName]=H(r);break;case"transparent":t[r.nodeName]={opaque:r.getAttribute("opaque"),data:H(r)}}}return t}function H(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"color":t[a.nodeName]=r(a.textContent);break;case"float":t[a.nodeName]=parseFloat(a.textContent);break;case"texture":t[a.nodeName]={id:a.getAttribute("texture"),extra:z(a)}}}return t}function z(e){for(var t={technique:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"extra"===r.nodeName&&G(r,t)}return t}function G(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique"===r.nodeName&&V(r,t)}}function V(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent)}}}function j(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique"===r.nodeName&&(t.technique=W(r))}return t}function W(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"double_sided"===r.nodeName&&(t[r.nodeName]=parseInt(r.textContent))}return t}function X(e){return e}function q(e){var t,n,i=(t=e.url,d(Je.effects[t],X)),r=i.profile.technique,a=i.profile.extra;switch(r.type){case"phong":case"blinn":n=new THREE.MeshPhongMaterial;break;case"lambert":n=new THREE.MeshLambertMaterial;break;default:n=new THREE.MeshBasicMaterial}function o(e){var t=i.profile.samplers[e.id],n=null;if(void 0!==t?n=O(i.profile.surfaces[t.source].init_from):(console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),n=O(e.id)),null!==n){var r=function(e){var t=e.slice(2+(e.lastIndexOf(".")-1>>>0));return"tga"===(t=t.toLowerCase())?je:Xe}(n);if(void 0!==r){var a=r.load(n),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===s(o.technique)){var c=o.technique;a.wrapS=c.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,a.wrapT=c.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,a.offset.set(c.offsetU||0,c.offsetV||0),a.repeat.set(c.repeatU||1,c.repeatV||1)}else a.wrapS=THREE.RepeatWrapping,a.wrapT=THREE.RepeatWrapping;return a}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}n.name=e.name||"";var c=r.parameters;for(var l in c){var h=c[l];switch(l){case"diffuse":h.color&&n.color.fromArray(h.color),h.texture&&(n.map=o(h.texture));break;case"specular":h.color&&n.specular&&n.specular.fromArray(h.color),h.texture&&(n.specularMap=o(h.texture));break;case"bump":h.texture&&(n.normalMap=o(h.texture));break;case"ambient":h.texture&&(n.lightMap=o(h.texture));break;case"shininess":h.float&&n.shininess&&(n.shininess=h.float);break;case"emission":h.color&&n.emissive&&n.emissive.fromArray(h.color),h.texture&&(n.emissiveMap=o(h.texture))}}var u=c.transparent,p=c.transparency;if(void 0===p&&u&&(p={float:1}),void 0===u&&p&&(u={opaque:"A_ONE",data:{color:[1,1,1,1]}}),u&&p)if(u.data.texture)n.transparent=!0;else{var f=u.data.color;switch(u.opaque){case"A_ONE":n.opacity=f[3]*p.float;break;case"RGB_ZERO":n.opacity=1-f[0]*p.float;break;case"A_ZERO":n.opacity=1-f[3]*p.float;break;case"RGB_ONE":n.opacity=f[0]*p.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',u.opaque)}n.opacity<1&&(n.transparent=!0)}return void 0!==a&&void 0!==a.technique&&1===a.technique.double_sided&&(n.side=THREE.DoubleSide),n}function Y(e){return d(Je.materials[e],q)}function Z(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if("technique_common"===n.nodeName)return J(n)}return{}}function J(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"perspective":case"orthographic":t.technique=i.nodeName,t.parameters=K(i)}}return t}function K(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t}function Q(e){var t;switch(e.optics.technique){case"perspective":t=new THREE.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":var n=e.optics.parameters.ymag,i=e.optics.parameters.xmag,r=e.optics.parameters.aspect_ratio;i=void 0===i?n*r:i,n=void 0===n?i/r:n,i*=.5,n*=.5,t=new THREE.OrthographicCamera(-i,i,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new THREE.PerspectiveCamera}return t.name=e.name||"",t}function $(e){var t=Je.cameras[e];return void 0!==t?d(t,Q):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",e),null)}function ee(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=te(r)}}return t}function te(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"color":var o=r(a.textContent);t.color=(new THREE.Color).fromArray(o);break;case"falloff_angle":t.falloffAngle=parseFloat(a.textContent);break;case"quadratic_attenuation":var s=parseFloat(a.textContent);t.distance=s?Math.sqrt(1/s):0}}return t}function ne(e){var t;switch(e.technique){case"directional":t=new THREE.DirectionalLight;break;case"point":t=new THREE.PointLight;break;case"spot":t=new THREE.SpotLight;break;case"ambient":t=new THREE.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function ie(e){var t=Je.lights[e];return void 0!==t?d(t,ne):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",e),null)}function re(e){for(var t={array:[],stride:3},a=0;a<e.childNodes.length;a++){var o=e.childNodes[a];if(1===o.nodeType)switch(o.nodeName){case"float_array":t.array=r(o.textContent);break;case"Name_array":t.array=i(o.textContent);break;case"technique_common":var s=n(o,"accessor")[0];void 0!==s&&(t.stride=parseInt(s.getAttribute("stride")))}}return t}function ae(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&(t[i.getAttribute("semantic")]=o(i.getAttribute("source")))}return t}function oe(e){for(var t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0,hasUV:!1},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var s=o(r.getAttribute("source")),c=r.getAttribute("semantic"),l=parseInt(r.getAttribute("offset")),h=parseInt(r.getAttribute("set")),u=h>0?c+h:c;t.inputs[u]={id:s,offset:l},t.stride=Math.max(t.stride,l+1),"TEXCOORD"===c&&(t.hasUV=!0);break;case"vcount":t.vcount=a(r.textContent);break;case"p":t.p=a(r.textContent)}}return t}function se(e){for(var t=0,n=0,i=e.length;n<i;n++)!0===e[n].hasUV&&t++;t>0&&t<e.length&&(e.uvsNeedsFix=!0)}function ce(e){var t={},n=e.sources,i=e.vertices,r=e.primitives;if(0===r.length)return{};var a=function(e){for(var t={},n=0;n<e.length;n++){var i=e[n];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t}(r);for(var o in a){var s=a[o];se(s),t[o]=le(s,n,i)}return t}function le(e,t,n){for(var i={},r={array:[],stride:0},a={array:[],stride:0},o={array:[],stride:0},s={array:[],stride:0},c={array:[],stride:0},l=[],h=[],u=new THREE.BufferGeometry,d=[],p=0,f=0;f<e.length;f++){var m=e[f],g=m.inputs,v=0;switch(m.type){case"lines":case"linestrips":v=2*m.count;break;case"triangles":v=3*m.count;break;case"polylist":for(var y=0;y<m.count;y++){var x=m.vcount[y];switch(x){case 3:v+=3;break;case 4:v+=6;break;default:v+=3*(x-2)}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",m.type)}for(var b in u.addGroup(p,v,f),p+=v,m.material&&d.push(m.material),g){var w=g[b];switch(b){case"VERTEX":for(var _ in n){var E=n[_];switch(_){case"POSITION":var T=r.array.length;if(he(m,t[E],w.offset,r.array),r.stride=t[E].stride,t.skinWeights&&t.skinIndices&&(he(m,t.skinIndices,w.offset,l),he(m,t.skinWeights,w.offset,h)),!1===m.hasUV&&!0===e.uvsNeedsFix){v=(r.array.length-T)/r.stride;for(var M=0;M<v;M++)o.array.push(0,0)}break;case"NORMAL":he(m,t[E],w.offset,a.array),a.stride=t[E].stride;break;case"COLOR":he(m,t[E],w.offset,c.array),c.stride=t[E].stride;break;case"TEXCOORD":he(m,t[E],w.offset,o.array),o.stride=t[E].stride;break;case"TEXCOORD1":he(m,t[E],w.offset,s.array),o.stride=t[E].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',_)}}break;case"NORMAL":he(m,t[w.id],w.offset,a.array),a.stride=t[w.id].stride;break;case"COLOR":he(m,t[w.id],w.offset,c.array),c.stride=t[w.id].stride;break;case"TEXCOORD":he(m,t[w.id],w.offset,o.array),o.stride=t[w.id].stride;break;case"TEXCOORD1":he(m,t[w.id],w.offset,s.array),s.stride=t[w.id].stride}}}return r.array.length>0&&(u.attributes.position=new THREE.Float32BufferAttribute(r.array,r.stride)),a.array.length>0&&(u.attributes.normal=new THREE.Float32BufferAttribute(a.array,a.stride)),c.array.length>0&&(u.attributes.color=new THREE.Float32BufferAttribute(c.array,c.stride)),o.array.length>0&&(u.attributes.uv=new THREE.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&(u.attributes.uv2=new THREE.Float32BufferAttribute(s.array,s.stride)),l.length>0&&(u.attributes.skinIndex=new THREE.Float32BufferAttribute(l,4)),h.length>0&&(u.attributes.skinWeight=new THREE.Float32BufferAttribute(h,4)),i.data=u,i.type=e[0].type,i.materialKeys=d,i}function he(e,t,n,i){var r=e.p,a=e.stride,o=e.vcount;function s(e){for(var t=r[e+n]*l,a=t+l;t<a;t++)i.push(c[t])}var c=t.array,l=t.stride;if(void 0!==e.vcount)for(var h=0,u=0,d=o.length;u<d;u++){var p=o[u];if(4===p){var f=h+1*a,m=h+2*a,g=h+3*a;s(h+0*a),s(f),s(g),s(f),s(m),s(g)}else if(3===p)f=h+1*a,m=h+2*a,s(h+0*a),s(f),s(m);else if(p>4)for(var v=1,y=p-2;v<=y;v++)f=h+a*v,m=h+a*(v+1),s(h+0*a),s(f),s(m);h+=a*p}else for(u=0,d=r.length;u<d;u+=a)s(u)}function ue(e){return d(Je.geometries[e],ce)}function de(e){return void 0!==e.build?e.build:e}function pe(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=fe(i);break;case"link":t.links.push(ge(i))}}}function fe(e){for(var t,n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=me(i)}}return t}function me(e,t){t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new THREE.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"axis":var a=r(i.textContent);t.axis.fromArray(a);break;case"limits":var o=i.getElementsByTagName("max")[0],s=i.getElementsByTagName("min")[0];t.limits.max=parseFloat(o.textContent),t.limits.min=parseFloat(s.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ge(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push(ve(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(ye(i))}}return t}function ve(e){for(var t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push(ge(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(ye(i))}}return t}function ye(e){var t={type:e.nodeName},n=r(e.textContent);switch(t.type){case"matrix":t.obj=new THREE.Matrix4,t.obj.fromArray(n).transpose();break;case"translate":t.obj=new THREE.Vector3,t.obj.fromArray(n);break;case"rotate":t.obj=new THREE.Vector3,t.obj.fromArray(n),t.angle=THREE.MathUtils.degToRad(n[3])}return t}function xe(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"technique_common"===i.nodeName&&be(i,t)}}function be(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"inertia":t.inertia=r(i.textContent);break;case"mass":t.mass=r(i.textContent)[0]}}}function we(e){for(var t={target:e.getAttribute("target").split("/").pop()},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType&&"axis"===i.nodeName){var r=i.getElementsByTagName("param")[0];t.axis=r.textContent;var a=t.axis.split("inst_").pop().split("axis")[0];t.jointIndex=a.substr(0,a.length-1)}}return t}function _e(e){return void 0!==e.build?e.build:e}function Ee(e){for(var t=[],n=ke.querySelector('[id="'+e.id+'"]'),i=0;i<n.childNodes.length;i++){var a=n.childNodes[i];if(1===a.nodeType)switch(a.nodeName){case"matrix":var o=r(a.textContent),s=(new THREE.Matrix4).fromArray(o).transpose();t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:s});break;case"translate":case"scale":o=r(a.textContent);var c=(new THREE.Vector3).fromArray(o);t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:c});break;case"rotate":o=r(a.textContent),c=(new THREE.Vector3).fromArray(o);var l=THREE.MathUtils.degToRad(o[3]);t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:c,angle:l})}}return t}var Te=new THREE.Matrix4,Me=new THREE.Vector3;function Se(e){for(var t={name:e.getAttribute("name")||"",type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new THREE.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"node":t.nodes.push(i.getAttribute("id")),Se(i);break;case"instance_camera":t.instanceCameras.push(o(i.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push(Ae(i));break;case"instance_light":t.instanceLights.push(o(i.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push(Ae(i));break;case"instance_node":t.instanceNodes.push(o(i.getAttribute("url")));break;case"matrix":var a=r(i.textContent);t.matrix.multiply(Te.fromArray(a).transpose()),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"translate":a=r(i.textContent),Me.fromArray(a),t.matrix.multiply(Te.makeTranslation(Me.x,Me.y,Me.z)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"rotate":a=r(i.textContent);var s=THREE.MathUtils.degToRad(a[3]);t.matrix.multiply(Te.makeRotationAxis(Me.fromArray(a),s)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"scale":a=r(i.textContent),t.matrix.scale(Me.fromArray(a)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"extra":break;default:console.log(i)}}return Ie(t.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",t.id):Je.nodes[t.id]=t,t}function Ae(e){for(var t={id:o(e.getAttribute("url")),materials:{},skeletons:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"bind_material":for(var r=i.getElementsByTagName("instance_material"),a=0;a<r.length;a++){var s=r[a],c=s.getAttribute("symbol"),l=s.getAttribute("target");t.materials[c]=o(l)}break;case"skeleton":t.skeletons.push(o(i.textContent))}}return t}function Re(e,t){var n,i,r,a=[],o=[];for(n=0;n<e.length;n++){var s=e[n];if(Ie(s))Ce(Ue(s),t,a);else if(r=s,void 0!==Je.visualScenes[r])for(var c=Je.visualScenes[s].children,l=0;l<c.length;l++){var h=c[l];"JOINT"===h.type&&Ce(Ue(h.id),t,a)}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",s)}for(n=0;n<t.length;n++)for(l=0;l<a.length;l++)if((i=a[l]).bone.name===t[n].name){o[n]=i,i.processed=!0;break}for(n=0;n<a.length;n++)!1===(i=a[n]).processed&&(o.push(i),i.processed=!0);var u=[],d=[];for(n=0;n<o.length;n++)i=o[n],u.push(i.bone),d.push(i.boneInverse);return new THREE.Skeleton(u,d)}function Ce(e,t,n){e.traverse((function(e){if(!0===e.isBone){for(var i,r=0;r<t.length;r++){var a=t[r];if(a.name===e.name){i=a.boneInverse;break}}void 0===i&&(i=new THREE.Matrix4),n.push({bone:e,boneInverse:i,processed:!1})}}))}function Le(e){for(var t,n=[],i=e.matrix,r=e.nodes,a=e.type,o=e.instanceCameras,s=e.instanceControllers,c=e.instanceLights,l=e.instanceGeometries,h=e.instanceNodes,u=0,p=r.length;u<p;u++)n.push(Ue(r[u]));for(u=0,p=o.length;u<p;u++){var f=$(o[u]);null!==f&&n.push(f.clone())}for(u=0,p=s.length;u<p;u++)for(var m=s[u],g=(t=m.id,d(Je.controllers[t],P)),v=Oe(ue(g.id),m.materials),y=Re(m.skeletons,g.skin.joints),x=0,b=v.length;x<b;x++){var w;(w=v[x]).isSkinnedMesh&&(w.bind(y,g.skin.bindMatrix),w.normalizeSkinWeights()),n.push(w)}for(u=0,p=c.length;u<p;u++){var _=ie(c[u]);null!==_&&n.push(_.clone())}for(u=0,p=l.length;u<p;u++)for(x=0,b=(v=Oe(ue((m=l[u]).id),m.materials)).length;x<b;x++)n.push(v[x]);for(u=0,p=h.length;u<p;u++)n.push(Ue(h[u]).clone());if(0===r.length&&1===n.length)w=n[0];else for(w="JOINT"===a?new THREE.Bone:new THREE.Group,u=0;u<n.length;u++)w.add(n[u]);return""===w.name&&(w.name="JOINT"===a?e.sid:e.name),w.matrix.copy(i),w.matrix.decompose(w.position,w.quaternion,w.scale),w}var Pe=new THREE.MeshBasicMaterial({color:16711935});function Ne(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var a=t[e[i]];void 0===a?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",e[i]),n.push(Pe)):n.push(Y(a))}return n}function Oe(e,t){var n=[];for(var i in e){var r=e[i],a=Ne(r.materialKeys,t);0===a.length&&("lines"===i||"linestrips"===i?a.push(new THREE.LineBasicMaterial):a.push(new THREE.MeshPhongMaterial));var o=void 0!==r.data.attributes.skinIndex;if(o)for(var s=0,c=a.length;s<c;s++)a[s].skinning=!0;var l,h=1===a.length?a[0]:a;switch(i){case"lines":l=new THREE.LineSegments(r.data,h);break;case"linestrips":l=new THREE.Line(r.data,h);break;case"triangles":case"polylist":l=o?new THREE.SkinnedMesh(r.data,h):new THREE.Mesh(r.data,h)}n.push(l)}return n}function Ie(e){return void 0!==Je.nodes[e]}function Ue(e){return d(Je.nodes[e],Le)}function De(e){var t=new THREE.Group;t.name=e.name;for(var n=e.children,i=0;i<n.length;i++){var r=n[i];t.add(Ue(r.id))}return t}function Fe(e){return d(Je.visualScenes[e],De)}if(0===e.length)return{scene:new THREE.Scene};var Be=(new DOMParser).parseFromString(e,"application/xml"),ke=n(Be,"COLLADA")[0],He=Be.getElementsByTagName("parsererror")[0];if(void 0!==He){var ze,Ge=n(He,"div")[0];return ze=Ge?Ge.textContent:function(e){for(var t="",n=[e];n.length;){var i=n.shift();i.nodeType===Node.TEXT_NODE?t+=i.textContent:(t+="\n",n.push.apply(n,i.childNodes))}return t.trim()}(He),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",ze),null}var Ve=ke.getAttribute("version");console.log("THREE.ColladaLoader: File version",Ve);var je,We=function(e){return{unit:c(n(e,"unit")[0]),upAxis:l(n(e,"up_axis")[0])}}(n(ke,"asset")[0]),Xe=new THREE.TextureLoader(this.manager);Xe.setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin),Xe.setCrossOrigin("anonymous"),THREE.TGALoader&&(je=new THREE.TGALoader(this.manager)).setPath(this.resourcePath||t);var qe=[],Ye={},Ze=0,Je={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};h(ke,"library_animations","animation",(function(e){for(var t={sources:{},samplers:{},channels:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"source":r=a.getAttribute("id"),t.sources[r]=re(a);break;case"sampler":r=a.getAttribute("id"),t.samplers[r]=p(a);break;case"channel":r=a.getAttribute("target"),t.channels[r]=f(a);break;default:console.log(a)}}Je.animations[e.getAttribute("id")]=t})),h(ke,"library_animation_clips","animation_clip",(function(e){for(var t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_animation"===r.nodeName&&t.animations.push(o(r.getAttribute("url")))}Je.clips[e.getAttribute("id")]=t})),h(ke,"library_controllers","controller",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=o(r.getAttribute("source")),t.skin=R(r);break;case"morph":t.id=o(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}Je.controllers[e.getAttribute("id")]=t})),h(ke,"library_images","image",(function(e){var t={init_from:n(e,"init_from")[0].textContent};Je.images[e.getAttribute("id")]=t})),h(ke,"library_effects","effect",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"profile_COMMON"===r.nodeName&&(t.profile=I(r))}Je.effects[e.getAttribute("id")]=t})),h(ke,"library_materials","material",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_effect"===r.nodeName&&(t.url=o(r.getAttribute("url")))}Je.materials[e.getAttribute("id")]=t})),h(ke,"library_cameras","camera",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"optics"===r.nodeName&&(t.optics=Z(r))}Je.cameras[e.getAttribute("id")]=t})),h(ke,"library_lights","light",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique_common"===r.nodeName&&(t=ee(r))}Je.lights[e.getAttribute("id")]=t})),h(ke,"library_geometries","geometry",(function(e){var t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},i=n(e,"mesh")[0];if(void 0!==i){for(var r=0;r<i.childNodes.length;r++){var a=i.childNodes[r];if(1===a.nodeType){var o=a.getAttribute("id");switch(a.nodeName){case"source":t.sources[o]=re(a);break;case"vertices":t.vertices=ae(a);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",a.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push(oe(a));break;default:console.log(a)}}}Je.geometries[e.getAttribute("id")]=t}})),h(ke,"library_nodes","node",Se),h(ke,"library_visual_scenes","visual_scene",(function(e){var t={name:e.getAttribute("name"),children:[]};!function(e){for(var t=e.getElementsByTagName("node"),n=0;n<t.length;n++){var i=t[n];!1===i.hasAttribute("id")&&i.setAttribute("id","three_default_"+Ze++)}}(e);for(var i=n(e,"node"),r=0;r<i.length;r++)t.children.push(Se(i[r]));Je.visualScenes[e.getAttribute("id")]=t})),h(ke,"library_kinematics_models","kinematics_model",(function(e){for(var t={name:e.getAttribute("name")||"",joints:{},links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"technique_common"===i.nodeName&&pe(i,t)}Je.kinematicsModels[e.getAttribute("id")]=t})),h(ke,"library_physics_models","physics_model",(function(e){for(var t={name:e.getAttribute("name")||"",rigidBodies:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"rigid_body"===i.nodeName&&(t.rigidBodies[i.getAttribute("name")]={},xe(i,t.rigidBodies[i.getAttribute("name")]))}Je.physicsModels[e.getAttribute("id")]=t})),h(ke,"scene","instance_kinematics_scene",(function(e){for(var t={bindJointAxis:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"bind_joint_axis"===i.nodeName&&t.bindJointAxis.push(we(i))}Je.kinematicsScenes[o(e.getAttribute("url"))]=t})),u(Je.animations,m),u(Je.clips,S),u(Je.controllers,P),u(Je.images,N),u(Je.effects,X),u(Je.materials,q),u(Je.cameras,Q),u(Je.lights,ne),u(Je.geometries,ce),u(Je.visualScenes,De),function(){var e=Je.clips;if(!0===s(e)){if(!1===s(Je.animations)){var t=[];for(var n in Je.animations)for(var i=g(n),r=0,a=i.length;r<a;r++)t.push(i[r]);qe.push(new THREE.AnimationClip("default",-1,t))}}else for(var n in e)qe.push(A(n))}(),function(){var e=Object.keys(Je.kinematicsModels)[0],t=Object.keys(Je.kinematicsScenes)[0],n=Object.keys(Je.visualScenes)[0];if(void 0!==e&&void 0!==t){for(var i,r=(i=e,d(Je.kinematicsModels[i],de)),a=function(e){return d(Je.kinematicsScenes[e],_e)}(t),o=Fe(n),s=a.bindJointAxis,c={},l=0,h=s.length;l<h;l++){var u=s[l],p=ke.querySelector('[sid="'+u.target+'"]');if(p){var f=p.parentElement;g(u.jointIndex,f)}}var m=new THREE.Matrix4;Ye={joints:r&&r.joints,getJointValue:function(e){var t=c[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){var n=c[e];if(n){var i=n.joint;if(t>i.limits.max||t<i.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+i.limits.min+", max: "+i.limits.max+").");else if(i.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{var r=n.object,a=i.axis,o=n.transforms;Te.identity();for(var s=0;s<o.length;s++){var l=o[s];if(l.sid&&-1!==l.sid.indexOf(e))switch(i.type){case"revolute":Te.multiply(m.makeRotationAxis(a,THREE.MathUtils.degToRad(t)));break;case"prismatic":Te.multiply(m.makeTranslation(a.x*t,a.y*t,a.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+i.type)}else switch(l.type){case"matrix":Te.multiply(l.obj);break;case"translate":Te.multiply(m.makeTranslation(l.obj.x,l.obj.y,l.obj.z));break;case"scale":Te.scale(l.obj);break;case"rotate":Te.multiply(m.makeRotationAxis(l.obj,l.angle))}}r.matrix.copy(Te),r.matrix.decompose(r.position,r.quaternion,r.scale),c[e].position=t}}else console.log("THREE.ColladaLoader: "+e+" does not exist.")}}}function g(e,t){var n=t.getAttribute("name"),i=r.joints[e];o.traverse((function(r){r.name===n&&(c[e]={object:r,transforms:Ee(t),joint:i,position:i.zeroPosition})}))}}();var Ke=function(e){return Fe(o(n(e,"instance_visual_scene")[0].getAttribute("url")))}(n(ke,"scene")[0]);return"Z_UP"===We.upAxis&&Ke.quaternion.setFromEuler(new THREE.Euler(-Math.PI/2,0,0)),Ke.scale.multiplyScalar(We.unit),{animations:qe,kinematics:Ye,library:Je,scene:Ke}}})},function(e,t){THREE.ColladaLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.ColladaLoader.prototype={constructor:THREE.ColladaLoader,crossOrigin:"Anonymous",load:function(e,t,n,i){var r=this,a=THREE.Loader.prototype.extractUrlBase(e);new THREE.FileLoader(r.manager).load(e,(function(e){t(r.parse(e,a))}),n,i)},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){function n(e,t){for(var n=[],i=e.childNodes,r=0,a=i.length;r<a;r++){var o=i[r];o.nodeName===t&&n.push(o)}return n}function i(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=t[i];return n}function r(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseFloat(t[i]);return n}function a(e){if(0===e.length)return[];for(var t=e.trim().split(/\s+/),n=new Array(t.length),i=0,r=t.length;i<r;i++)n[i]=parseInt(t[i]);return n}function o(e){return e.substring(1)}function s(e){return 0===Object.keys(e).length}function c(e){return void 0!==e?parseFloat(e.getAttribute("meter")):1}function l(e){return void 0!==e?e.textContent:"Y_UP"}function h(e,t,i,r){var a=n(e,t)[0];if(void 0!==a)for(var o=n(a,i),s=0;s<o.length;s++)r(o[s])}function u(e,t){for(var n in e)e[n].build=t(e[n])}function d(e,t){return void 0!==e.build||(e.build=t(e)),e.build}function p(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){var a=o(r.getAttribute("source")),s=r.getAttribute("semantic");t.inputs[s]=a}}return t}function f(e){var t={},n=e.getAttribute("target").split("/"),i=n.shift(),r=n.shift(),a=-1!==r.indexOf("("),s=-1!==r.indexOf(".");if(s)n=r.split("."),r=n.shift(),t.member=n.shift();else if(a){var c=r.split("(");r=c.shift();for(var l=0;l<c.length;l++)c[l]=parseInt(c[l].replace(/\)/,""));t.indices=c}return t.id=i,t.sid=r,t.arraySyntax=a,t.memberSyntax=s,t.sampler=o(e.getAttribute("source")),t}function m(e){var t=[],n=e.channels,i=e.samplers,r=e.sources;for(var a in n)if(n.hasOwnProperty(a)){var o=n[a],s=i[o.sampler],c=s.inputs.INPUT,l=s.inputs.OUTPUT;w(v(o,r[c],r[l]),t)}return t}function g(e){return d(Ue.animations[e],m)}function v(e,t,n){var i,r,a,o,s,c,l=Ue.nodes[e.id],h=Ae(l.id),u=l.transforms[e.sid],d=l.matrix.clone().transpose(),p={};switch(u){case"matrix":for(a=0,o=t.array.length;a<o;a++)if(i=t.array[a],r=a*n.stride,void 0===p[i]&&(p[i]={}),!0===e.arraySyntax){var f=n.array[r],m=e.indices[0]+4*e.indices[1];p[i][m]=f}else for(s=0,c=n.stride;s<c;s++)p[i][s]=n.array[r+s];break;case"translate":case"rotate":case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',u)}var g=function(e,t){var n=[];for(var i in e)n.push({time:parseFloat(i),value:e[i]});n.sort((function(e,t){return e.time-t.time}));for(var r=0;r<16;r++)_(n,r,t.elements[r]);return n}(p,d);return{name:h.uuid,keyframes:g}}var y=new THREE.Vector3,x=new THREE.Vector3,b=new THREE.Quaternion;function w(e,t){for(var n=e.keyframes,i=e.name,r=[],a=[],o=[],s=[],c=0,l=n.length;c<l;c++){var h=n[c],u=h.time,d=h.value;ye.fromArray(d).transpose(),ye.decompose(y,b,x),r.push(u),a.push(y.x,y.y,y.z),o.push(b.x,b.y,b.z,b.w),s.push(x.x,x.y,x.z)}return a.length>0&&t.push(new THREE.VectorKeyframeTrack(i+".position",r,a)),o.length>0&&t.push(new THREE.QuaternionKeyframeTrack(i+".quaternion",r,o)),s.length>0&&t.push(new THREE.VectorKeyframeTrack(i+".scale",r,s)),t}function _(e,t,n){var i,r,a,o=!0;for(r=0,a=e.length;r<a;r++)void 0===(i=e[r]).value[t]?i.value[t]=null:o=!1;if(!0===o)for(r=0,a=e.length;r<a;r++)(i=e[r]).value[t]=n;else!function(e,t){for(var n,i,r=0,a=e.length;r<a;r++){var o=e[r];if(null===o.value[t]){if(n=E(e,r,t),i=T(e,r,t),null===n){o.value[t]=i.value[t];continue}if(null===i){o.value[t]=n.value[t];continue}M(o,n,i,t)}}}(e,t)}function E(e,t,n){for(;t>=0;){var i=e[t];if(null!==i.value[n])return i;t--}return null}function T(e,t,n){for(;t<e.length;){var i=e[t];if(null!==i.value[n])return i;t++}return null}function M(e,t,n,i){n.time-t.time!=0?e.value[i]=(e.time-t.time)*(n.value[i]-t.value[i])/(n.time-t.time)+t.value[i]:e.value[i]=t.value[i]}function S(e){for(var t=[],n=e.name,i=e.end-e.start||-1,r=e.animations,a=0,o=r.length;a<o;a++)for(var s=g(r[a]),c=0,l=s.length;c<l;c++)t.push(s[c]);return new THREE.AnimationClip(n,i,t)}function A(e){return d(Ue.clips[e],S)}function R(e){for(var t={sources:{}},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"bind_shape_matrix":t.bindShapeMatrix=r(a.textContent);break;case"source":var o=a.getAttribute("id");t.sources[o]=te(a);break;case"joints":t.joints=C(a);break;case"vertex_weights":t.vertexWeights=L(a)}}return t}function C(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType&&"input"===r.nodeName){var a=r.getAttribute("semantic"),s=o(r.getAttribute("source"));t.inputs[a]=s}}return t}function L(e){for(var t={inputs:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var s=r.getAttribute("semantic"),c=o(r.getAttribute("source")),l=parseInt(r.getAttribute("offset"));t.inputs[s]={id:c,offset:l};break;case"vcount":t.vcount=a(r.textContent);break;case"v":t.v=a(r.textContent)}}return t}function P(e){var t={id:e.id},n=Ue.geometries[t.id];return void 0!==e.skin&&(t.skin=function(e){var t,n,i,r={joints:[],indices:{array:[],stride:4},weights:{array:[],stride:4}},a=e.sources,o=e.vertexWeights,s=o.vcount,c=o.v,l=o.inputs.JOINT.offset,h=o.inputs.WEIGHT.offset,u=e.sources[e.joints.inputs.JOINT],d=e.sources[e.joints.inputs.INV_BIND_MATRIX],p=a[o.inputs.WEIGHT.id].array,f=0;for(t=0,i=s.length;t<i;t++){var m=s[t],g=[];for(n=0;n<m;n++){var v=c[f+l],y=p[c[f+h]];g.push({index:v,weight:y}),f+=2}for(g.sort(_),n=0;n<4;n++){var x=g[n];void 0!==x?(r.indices.array.push(x.index),r.weights.array.push(x.weight)):(r.indices.array.push(0),r.weights.array.push(0))}}for(r.bindMatrix=(new THREE.Matrix4).fromArray(e.bindShapeMatrix).transpose(),t=0,i=u.array.length;t<i;t++){var b=u.array[t],w=(new THREE.Matrix4).fromArray(d.array,t*d.stride).transpose();r.joints.push({name:b,boneInverse:w})}return r;function _(e,t){return t.weight-e.weight}}(e.skin),n.sources.skinIndices=t.skin.indices,n.sources.skinWeights=t.skin.weights),t}function N(e){return d(Ue.controllers[e],P)}function O(e){return void 0!==e.build?e.build:e.init_from}function I(e){for(var t={surfaces:{},samplers:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":U(r,t);break;case"technique":t.technique=B(r)}}return t}function U(e,t){for(var n=e.getAttribute("sid"),i=0,r=e.childNodes.length;i<r;i++){var a=e.childNodes[i];if(1===a.nodeType)switch(a.nodeName){case"surface":t.surfaces[n]=D(a);break;case"sampler2D":t.samplers[n]=F(a)}}}function D(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"init_from"===r.nodeName&&(t.init_from=r.textContent)}return t}function F(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"source"===r.nodeName&&(t.source=r.textContent)}return t}function B(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":t.type=r.nodeName,t.parameters=k(r)}}return t}function k(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"shininess":case"transparent":case"transparency":t[r.nodeName]=H(r)}}return t}function H(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"color":t[a.nodeName]=r(a.textContent);break;case"float":t[a.nodeName]=parseFloat(a.textContent);break;case"texture":null==t.texture?t.texture={id:a.getAttribute("texture"),extra:z(a)}:(t.texture2={id:a.getAttribute("texture"),extra:z(a)},t.intensity=a.getAttribute("intensity"))}}return t}function z(e){for(var t={technique:{}},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"extra"===r.nodeName&&G(r,t)}return t}function G(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique"===r.nodeName&&V(r,t)}}function V(e,t){for(var n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":t.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?t.technique[r.nodeName]=0:t.technique[r.nodeName]=parseInt(r.textContent)}}}function j(e){return e}function W(e){var t,n,i=(t=e.url,d(Ue.effects[t],j)),r=i.profile.technique;switch(r.type){case"phong":case"blinn":new THREE.Color(255),n=new THREE.MeshPhongMaterial;break;case"lambert":n=new THREE.MeshLambertMaterial;break;default:n=new THREE.MeshBasicMaterial}function a(e){var t,n=i.profile.samplers[e.id];if(void 0!==n){var r=i.profile.surfaces[n.source],a=Ne.load((t=r.init_from,d(Ue.images[t],O))),o=e.extra;if(void 0!==o&&void 0!==o.technique&&!1===s(o.technique)){var c=o.technique;a.wrapS=c.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,a.wrapT=c.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,a.offset.set(c.offsetU||0,c.offsetV||0),a.repeat.set(c.repeatU||1,c.repeatV||1)}else a.wrapS=THREE.RepeatWrapping,a.wrapT=THREE.RepeatWrapping;return a}return console.error("THREE.ColladaLoader: Undefined sampler",e.id),null}n.name=e.name;var o=r.parameters;for(var c in o){var l=o[c];switch(c){case"diffuse":l.color&&n.color.fromArray(l.color),l.texture&&(n.map=a(l.texture)),l.texture2&&(n.lightMap=a(l.texture2),n.lightMapIntensity=l.intensity);break;case"specular":l.color&&n.specular&&n.specular.fromArray(l.color),l.texture&&(n.specularMap=a(l.texture));break;case"shininess":l.float&&n.shininess&&(n.shininess=l.float);break;case"emission":l.color&&n.emissive&&n.emissive.fromArray(l.color);break;case"transparent":n.transparent=!0;break;case"transparency":void 0!==l.float&&(n.opacity=l.float),n.transparent=!0}}return n}function X(e){return d(Ue.materials[e],W)}function q(e){for(var t=0;t<e.childNodes.length;t++){var n=e.childNodes[t];if("technique_common"===n.nodeName)return Y(n)}return{}}function Y(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"perspective":case"orthographic":t.technique=i.nodeName,t.parameters=Z(i)}}return t}function Z(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":t[i.nodeName]=parseFloat(i.textContent)}}return t}function J(e){var t;switch(e.optics.technique){case"perspective":t=new THREE.PerspectiveCamera(e.optics.parameters.yfov,e.optics.parameters.aspect_ratio,e.optics.parameters.znear,e.optics.parameters.zfar);break;case"orthographic":var n=e.optics.parameters.ymag,i=e.optics.parameters.xmag,r=e.optics.parameters.aspect_ratio;i=void 0===i?n*r:i,n=void 0===n?i/r:n,i*=.5,n*=.5,t=new THREE.OrthographicCamera(-i,i,n,-n,e.optics.parameters.znear,e.optics.parameters.zfar);break;default:t=new THREE.PerspectiveCamera}return t.name=e.name,t}function K(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":t.technique=r.nodeName,t.parameters=Q(r)}}return t}function Q(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"color":var o=r(a.textContent);t.color=(new THREE.Color).fromArray(o);break;case"falloff_angle":t.falloffAngle=parseFloat(a.textContent);break;case"quadratic_attenuation":var s=parseFloat(a.textContent);t.distance=s?Math.sqrt(1/s):0}}return t}function $(e){var t;switch(e.technique){case"directional":t=new THREE.DirectionalLight;break;case"point":t=new THREE.PointLight;break;case"spot":t=new THREE.SpotLight;break;case"ambient":t=new THREE.AmbientLight}return e.parameters.color&&t.color.copy(e.parameters.color),e.parameters.distance&&(t.distance=e.parameters.distance),t}function ee(e){return d(Ue.lights[e],$)}function te(e){for(var t={array:[],stride:3},a=0;a<e.childNodes.length;a++){var o=e.childNodes[a];if(1===o.nodeType)switch(o.nodeName){case"float_array":t.array=r(o.textContent);break;case"Name_array":t.array=i(o.textContent);break;case"technique_common":var s=n(o,"accessor")[0];void 0!==s&&(t.stride=parseInt(s.getAttribute("stride")))}}return t}function ne(e){for(var t={},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&(t[i.getAttribute("semantic")]=o(i.getAttribute("source")))}return t}function ie(e){for(var t={type:e.nodeName,material:e.getAttribute("material"),count:parseInt(e.getAttribute("count")),inputs:{},stride:0},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":var s=o(r.getAttribute("source")),c=r.getAttribute("semantic"),l=parseInt(r.getAttribute("offset"));t.inputs[c]={id:s,offset:l},t.stride=Math.max(t.stride,l+1);break;case"vcount":t.vcount=a(r.textContent);break;case"p":t.p=a(r.textContent)}}return t}function re(e){var t={},n=e.sources,i=e.vertices,r=e.primitives;if(0===r.length)return{};var a=function(e){for(var t={},n=0;n<e.length;n++){var i=e[n];void 0===t[i.type]&&(t[i.type]=[]),t[i.type].push(i)}return t}(r);for(var o in a)t[o]=ae(a[o],n,i);return t}function ae(e,t,n){for(var i={},r={array:[],stride:0},a={array:[],stride:0},o={array:[],stride:0},s={array:[],stride:0},c=[],l=[],h=new THREE.BufferGeometry,u=[],d=0,p=0,f=0;f<e.length;f++){var m=e[f],g=m.inputs,v=1;for(var y in m.vcount&&4===m.vcount[0]&&(v=2),p="lines"===m.type||"linestrips"===m.type?2*m.count:3*m.count*v,h.addGroup(d,p,f),d+=p,m.material&&u.push(m.material),g){var x=g[y];switch(y){case"VERTEX":for(var b in n){var w=n[b];switch(b){case"POSITION":oe(m,t[w],x.offset,r.array),r.stride=t[w].stride,t.skinWeights&&t.skinIndices&&(oe(m,t.skinIndices,x.offset,c),oe(m,t.skinWeights,x.offset,l));break;case"NORMAL":oe(m,t[w],x.offset,a.array),a.stride=t[w].stride;break;case"COLOR":oe(m,t[w],x.offset,s.array),s.stride=t[w].stride;break;case"TEXCOORD":oe(m,t[w],x.offset,o.array),o.stride=t[w].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',b)}}break;case"NORMAL":oe(m,t[x.id],x.offset,a.array),a.stride=t[x.id].stride;break;case"COLOR":oe(m,t[x.id],x.offset,s.array),s.stride=t[x.id].stride;break;case"TEXCOORD":oe(m,t[x.id],x.offset,o.array),o.stride=t[x.id].stride}}}return r.array.length>0&&h.addAttribute("position",new THREE.Float32BufferAttribute(r.array,r.stride)),a.array.length>0&&h.addAttribute("normal",new THREE.Float32BufferAttribute(a.array,a.stride)),s.array.length>0&&h.addAttribute("color",new THREE.Float32BufferAttribute(s.array,s.stride)),o.array.length>0&&(h.addAttribute("uv",new THREE.Float32BufferAttribute(o.array,o.stride)),h.addAttribute("uv2",new THREE.Float32BufferAttribute(o.array,o.stride))),c.length>0&&h.addAttribute("skinIndex",new THREE.Float32BufferAttribute(c,4)),l.length>0&&h.addAttribute("skinWeight",new THREE.Float32BufferAttribute(l,4)),i.data=h,i.type=e[0].type,i.materialKeys=u,i}function oe(e,t,n,i){var r=e.p,a=e.stride,o=e.vcount;function s(e){for(var t=r[e+n]*h,a=t+h;t<a;t++)i.push(l[t])}var c=0,l=t.array,h=t.stride;if(void 0!==e.vcount)for(var u=0,d=0,p=o.length;d<p;d++){var f=o[d];if(4===f){var m=u+1*a,g=u+2*a,v=u+3*a;s(u+0*a),s(m),s(v),s(m),s(g),s(v)}else 3===f?(m=u+1*a,g=u+2*a,s(u+0*a),s(m),s(g)):c=Math.max(c,f);u+=a*f}else for(d=0,p=r.length;d<p;d+=a)s(d)}function se(e){return d(Ue.geometries[e],re)}function ce(e){return void 0!==e.build?e.build:e}function le(e,t){for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"joint":t.joints[i.getAttribute("sid")]=he(i);break;case"link":t.links.push(de(i))}}}function he(e){for(var t,n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"prismatic":case"revolute":t=ue(i)}}return t}function ue(e,t){t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",axis:new THREE.Vector3,limits:{min:0,max:0},type:e.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(var n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"axis":var a=r(i.textContent);t.axis.fromArray(a);break;case"limits":var o=i.getElementsByTagName("max")[0],s=i.getElementsByTagName("min")[0];t.limits.max=parseFloat(o.textContent),t.limits.min=parseFloat(s.textContent)}}return t.limits.min>=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function de(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"attachment_full":t.attachments.push(pe(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(fe(i))}}return t}function pe(e){for(var t={joint:e.getAttribute("joint").split("/").pop(),transforms:[],links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"link":t.links.push(de(i));break;case"matrix":case"translate":case"rotate":t.transforms.push(fe(i))}}return t}function fe(e){var t={type:e.nodeName},n=r(e.textContent);switch(t.type){case"matrix":t.obj=new THREE.Matrix4,t.obj.fromArray(n).transpose();break;case"translate":t.obj=new THREE.Vector3,t.obj.fromArray(n);break;case"rotate":t.obj=new THREE.Vector3,t.obj.fromArray(n),t.angle=THREE.Math.degToRad(n[3])}return t}function me(e){for(var t={target:e.getAttribute("target").split("/").pop()},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType&&"axis"===i.nodeName){var r=i.getElementsByTagName("param")[0];t.axis=r.textContent;var a=t.axis.split("inst_").pop().split("axis")[0];t.jointIndex=a.substr(0,a.length-1)}}return t}function ge(e){return void 0!==e.build?e.build:e}function ve(e){for(var t=[],n=Le.querySelector('[id="'+e.id+'"]'),i=0;i<n.childNodes.length;i++){var a=n.childNodes[i];if(1===a.nodeType)switch(a.nodeName){case"matrix":var o=r(a.textContent),s=(new THREE.Matrix4).fromArray(o).transpose();t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:s});break;case"translate":case"scale":o=r(a.textContent);var c=(new THREE.Vector3).fromArray(o);t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:c});break;case"rotate":o=r(a.textContent),c=(new THREE.Vector3).fromArray(o);var l=THREE.Math.degToRad(o[3]);t.push({sid:a.getAttribute("sid"),type:a.nodeName,obj:c,angle:l})}}return t}var ye=new THREE.Matrix4,xe=new THREE.Vector3;function be(e){for(var t={name:e.getAttribute("name"),type:e.getAttribute("type"),id:e.getAttribute("id"),sid:e.getAttribute("sid"),matrix:new THREE.Matrix4,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"node":i.hasAttribute("id")&&(t.nodes.push(i.getAttribute("id")),be(i));break;case"instance_camera":t.instanceCameras.push(o(i.getAttribute("url")));break;case"instance_controller":t.instanceControllers.push(we(i));break;case"instance_light":t.instanceLights.push(o(i.getAttribute("url")));break;case"instance_geometry":t.instanceGeometries.push(we(i));break;case"instance_node":t.instanceNodes.push(o(i.getAttribute("url")));break;case"matrix":var a=r(i.textContent);t.matrix.multiply(ye.fromArray(a).transpose()),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"translate":a=r(i.textContent),xe.fromArray(a),t.matrix.multiply(ye.makeTranslation(xe.x,xe.y,xe.z)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"rotate":a=r(i.textContent);var s=THREE.Math.degToRad(a[3]);t.matrix.multiply(ye.makeRotationAxis(xe.fromArray(a),s)),t.transforms[i.getAttribute("sid")]=i.nodeName;break;case"scale":a=r(i.textContent),t.matrix.scale(xe.fromArray(a)),t.transforms[i.getAttribute("sid")]=i.nodeName}}return e.hasAttribute("id")&&(Ue.nodes[e.getAttribute("id")]=t),t}function we(e){for(var t={id:o(e.getAttribute("url")),materials:{},skeletons:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];switch(i.nodeName){case"bind_material":for(var r=i.getElementsByTagName("instance_material"),a=0;a<r.length;a++){var s=r[a],c=s.getAttribute("symbol"),l=s.getAttribute("target");t.materials[c]=o(l)}break;case"skeleton":t.skeletons.push(o(i.textContent))}}return t}function _e(e,t){var n,i,r,a=[],o=[];for(n=0;n<e.length;n++)Ee(Ae(e[n]),t,a);for(n=0;n<t.length;n++)for(i=0;i<a.length;i++)if((r=a[i]).bone.name===t[n].name){o[n]=r,r.processed=!0;break}for(n=0;n<a.length;n++)!1===(r=a[n]).processed&&(o.push(r),r.processed=!0);var s=[],c=[];for(n=0;n<o.length;n++)r=o[n],s.push(r.bone),c.push(r.boneInverse);return new THREE.Skeleton(s,c)}function Ee(e,t,n){e.traverse((function(e){if(!0===e.isBone){for(var i,r=0;r<t.length;r++){var a=t[r];if(a.name===e.name){i=a.boneInverse;break}}void 0===i&&(i=new THREE.Matrix4),n.push({bone:e,boneInverse:i,processed:!1})}}))}function Te(e){for(var t,n=[],i=e.matrix,r=e.nodes,a=e.type,o=e.instanceCameras,s=e.instanceControllers,c=e.instanceLights,l=e.instanceGeometries,h=e.instanceNodes,u=0,p=r.length;u<p;u++)n.push(Ae(r[u]));for(u=0,p=o.length;u<p;u++)n.push((t=o[u],d(Ue.cameras[t],J)).clone());for(u=0,p=s.length;u<p;u++)for(var f=N((b=s[u]).id),m=Se(se(f.id),b.materials),g=_e(b.skeletons,f.skin.joints),v=0,y=m.length;v<y;v++){var x;(x=m[v]).isSkinnedMesh&&(x.bind(g,f.skin.bindMatrix),x.normalizeSkinWeights()),n.push(x)}for(u=0,p=c.length;u<p;u++)n.push(ee(c[u]).clone());for(u=0,p=l.length;u<p;u++){var b;for(v=0,y=(m=Se(se((b=l[u]).id),b.materials)).length;v<y;v++)n.push(m[v])}for(u=0,p=h.length;u<p;u++)n.push(Ae(h[u]).clone());if(0===r.length&&1===n.length)x=n[0];else for(x="JOINT"===a?new THREE.Bone:new THREE.Group,u=0;u<n.length;u++)x.add(n[u]);return x.name="JOINT"===a?e.sid:e.name,x.matrix.copy(i),x.matrix.decompose(x.position,x.quaternion,x.scale),x}function Me(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var a=t[e[i]];n.push(X(a))}return n}function Se(e,t){var n=[];for(var i in e){var r=e[i],a=Me(r.materialKeys,t);0===a.length&&("lines"===i||"linestrips"===i?a.push(new THREE.LineBasicMaterial):a.push(new THREE.MeshPhongMaterial));var o=void 0!==r.data.attributes.skinIndex;if(o)for(var s=0,c=a.length;s<c;s++)a[s].skinning=!0;var l,h=1===a.length?a[0]:a;switch(i){case"lines":l=new THREE.LineSegments(r.data,h);break;case"linestrips":l=new THREE.Line(r.data,h);break;case"triangles":case"polylist":l=o?new THREE.SkinnedMesh(r.data,h):new THREE.Mesh(r.data,h)}n.push(l)}return n}function Ae(e){return d(Ue.nodes[e],Te)}function Re(e){var t=new THREE.Group;t.name=e.name,t.rotation.x=e.rx,t.rotation.y=e.ry,t.rotation.z=e.rz,t.position.x=e.tx,t.position.y=e.ty,t.position.z=e.tz,t.scale.x=e.sx,t.scale.y=e.sy,t.scale.z=e.sz;for(var n=e.children,i=0;i<n.length;i++){var r=n[i];null===r.id?t.add(Te(r)):t.add(Ae(r.id))}return t}function Ce(e){return d(Ue.visualScenes[e],Re)}if(0===e.length)return{scene:new THREE.Scene};var Le=n((new DOMParser).parseFromString(e,"application/xml"),"COLLADA")[0],Pe=(Le.getAttribute("version"),function(e){return{unit:c(n(e,"unit")[0]),upAxis:l(n(e,"up_axis")[0])}}(n(Le,"asset")[0])),Ne=new THREE.TextureLoader(this.manager);Ne.setPath(t).setCrossOrigin(this.crossOrigin);var Oe=[],Ie={},Ue={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},kinematicsScenes:{}};h(Le,"library_animations","animation",(function(e){for(var t={sources:{},samplers:{},channels:{}},n=0,i=e.childNodes.length;n<i;n++){var r,a=e.childNodes[n];if(1===a.nodeType)switch(a.nodeName){case"source":r=a.getAttribute("id"),t.sources[r]=te(a);break;case"sampler":r=a.getAttribute("id"),t.samplers[r]=p(a);break;case"channel":r=a.getAttribute("target"),t.channels[r]=f(a)}}Ue.animations[e.getAttribute("id")]=t})),h(Le,"library_animation_clips","animation_clip",(function(e){for(var t={name:e.getAttribute("id")||"default",start:parseFloat(e.getAttribute("start")||0),end:parseFloat(e.getAttribute("end")||0),animations:[]},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_animation"===r.nodeName&&t.animations.push(o(r.getAttribute("url")))}Ue.clips[e.getAttribute("id")]=t})),h(Le,"library_controllers","controller",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":t.id=o(r.getAttribute("source")),t.skin=R(r);break;case"morph":t.id=o(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.")}}Ue.controllers[e.getAttribute("id")]=t})),h(Le,"library_images","image",(function(e){var t={init_from:n(e,"init_from")[0].textContent};Ue.images[e.getAttribute("id")]=t})),h(Le,"library_effects","effect",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"profile_COMMON"===r.nodeName&&(t.profile=I(r))}Ue.effects[e.getAttribute("id")]=t})),h(Le,"library_materials","material",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"instance_effect"===r.nodeName&&(t.url=o(r.getAttribute("url")))}Ue.materials[e.getAttribute("id")]=t})),h(Le,"library_cameras","camera",(function(e){for(var t={name:e.getAttribute("name")},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"optics"===r.nodeName&&(t.optics=q(r))}Ue.cameras[e.getAttribute("id")]=t})),h(Le,"library_lights","light",(function(e){for(var t={},n=0,i=e.childNodes.length;n<i;n++){var r=e.childNodes[n];1===r.nodeType&&"technique_common"===r.nodeName&&(t=K(r))}Ue.lights[e.getAttribute("id")]=t})),h(Le,"library_geometries","geometry",(function(e){for(var t={name:e.getAttribute("name"),sources:{},vertices:{},primitives:[]},i=n(e,"mesh")[0],r=0;r<i.childNodes.length;r++){var a=i.childNodes[r];if(1===a.nodeType){var o=a.getAttribute("id");switch(a.nodeName){case"source":t.sources[o]=te(a);break;case"vertices":t.vertices=ne(a);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",a.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":t.primitives.push(ie(a))}}}Ue.geometries[e.getAttribute("id")]=t})),h(Le,"library_nodes","node",be),h(Le,"library_visual_scenes","visual_scene",(function(e){for(var t={name:e.getAttribute("name"),rx:parseFloat(e.getAttribute("rx")),ry:parseFloat(e.getAttribute("ry")),rz:parseFloat(e.getAttribute("rz")),tx:parseFloat(e.getAttribute("tx")),ty:parseFloat(e.getAttribute("ty")),tz:parseFloat(e.getAttribute("tz")),sx:parseFloat(e.getAttribute("sx")),sy:parseFloat(e.getAttribute("sy")),sz:parseFloat(e.getAttribute("sz")),children:[]},i=n(e,"node"),r=0;r<i.length;r++)t.children.push(be(i[r]));Ue.visualScenes[e.getAttribute("id")]=t})),h(Le,"library_kinematics_models","kinematics_model",(function(e){for(var t={name:e.getAttribute("name")||"",joints:{},links:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"technique_common"===i.nodeName&&le(i,t)}Ue.kinematicsModels[e.getAttribute("id")]=t})),h(Le,"scene","instance_kinematics_scene",(function(e){for(var t={bindJointAxis:[]},n=0;n<e.childNodes.length;n++){var i=e.childNodes[n];1===i.nodeType&&"bind_joint_axis"===i.nodeName&&t.bindJointAxis.push(me(i))}Ue.kinematicsScenes[o(e.getAttribute("url"))]=t})),u(Ue.animations,m),u(Ue.clips,S),u(Ue.controllers,P),u(Ue.images,O),u(Ue.effects,j),u(Ue.materials,W),u(Ue.cameras,J),u(Ue.lights,$),u(Ue.geometries,re),u(Ue.visualScenes,Re),function(){var e=Ue.clips;if(!0===s(e)){if(!1===s(Ue.animations)){var t=[];for(var n in Ue.animations)for(var i=g(n),r=0,a=i.length;r<a;r++)t.push(i[r]);Oe.push(new THREE.AnimationClip("default",-1,t))}}else for(var n in e)Oe.push(A(n))}(),function(){var e=Object.keys(Ue.kinematicsModels)[0],t=Object.keys(Ue.kinematicsScenes)[0],n=Object.keys(Ue.visualScenes)[0];if(void 0!==e&&void 0!==t){for(var i,r=(i=e,d(Ue.kinematicsModels[i],ce)),a=function(e){return d(Ue.kinematicsScenes[e],ge)}(t),o=Ce(n),s=a.bindJointAxis,c={},l=0,h=s.length;l<h;l++){var u=s[l],p=Le.querySelector('[sid="'+u.target+'"]');if(p){var f=p.parentElement;g(u.jointIndex,f)}}var m=new THREE.Matrix4;Ie={joints:r&&r.joints,getJointValue:function(e){var t=c[e];if(t)return t.position;console.warn("THREE.ColladaLoader: Joint "+e+" doesn't exist.")},setJointValue:function(e,t){var n=c[e];if(n){var i=n.joint;if(t>i.limits.max||t<i.limits.min)console.warn("THREE.ColladaLoader: Joint "+e+" value "+t+" outside of limits (min: "+i.limits.min+", max: "+i.limits.max+").");else if(i.static)console.warn("THREE.ColladaLoader: Joint "+e+" is static.");else{var r=n.object,a=i.axis,o=n.transforms;ye.identity();for(var s=0;s<o.length;s++){var l=o[s];if(l.sid&&-1!==l.sid.indexOf(e))switch(i.type){case"revolute":ye.multiply(m.makeRotationAxis(a,THREE.Math.degToRad(t)));break;case"prismatic":ye.multiply(m.makeTranslation(a.x*t,a.y*t,a.z*t));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+i.type)}else switch(l.type){case"matrix":ye.multiply(l.obj);break;case"translate":ye.multiply(m.makeTranslation(l.obj.x,l.obj.y,l.obj.z));break;case"scale":ye.scale(l.obj);break;case"rotate":ye.multiply(m.makeRotationAxis(l.obj,l.angle))}}r.matrix.copy(ye),r.matrix.decompose(r.position,r.quaternion,r.scale),c[e].position=t}}}}}function g(e,t){var n=t.getAttribute("name"),i=r.joints[e];o.traverse((function(r){r.name===n&&(c[e]={object:r,transforms:ve(t),joint:i,position:i.zeroPosition})}))}}();var De=function(e){return Ce(o(n(e,"instance_visual_scene")[0].getAttribute("url")))}(n(Le,"scene")[0]);return De.scale.multiplyScalar(Pe.unit),{animations:Oe,kinematics:Ie,library:Ue,scene:De}}},e.exports=THREE.ColladaLoader},function(e,t){THREE.OrbitControls=function(e,t){var n,i,r,a,o;this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return f.phi},this.getAzimuthalAngle=function(){return f.theta},this.saveState=function(){s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=function(){s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(c),s.update(),d=u.NONE},this.update=(n=new THREE.Vector3,i=(new THREE.Quaternion).setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),r=i.clone().inverse(),a=new THREE.Vector3,o=new THREE.Quaternion,function(){var e=s.object.position;return n.copy(e).sub(s.target),n.applyQuaternion(i),f.setFromVector3(n),s.autoRotate&&d===u.NONE&&C(2*Math.PI/60/60*s.autoRotateSpeed),f.theta+=m.theta,f.phi+=m.phi,f.theta=Math.max(s.minAzimuthAngle,Math.min(s.maxAzimuthAngle,f.theta)),f.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,f.phi)),f.makeSafe(),f.radius*=g,f.radius=Math.max(s.minDistance,Math.min(s.maxDistance,f.radius)),s.target.add(v),n.setFromSpherical(f),n.applyQuaternion(r),e.copy(s.target).add(n),s.object.lookAt(s.target),!0===s.enableDamping?(m.theta*=1-s.dampingFactor,m.phi*=1-s.dampingFactor):m.set(0,0,0),g=1,v.set(0,0,0),!!(y||a.distanceToSquared(s.object.position)>p||8*(1-o.dot(s.object.quaternion))>p)&&(s.dispatchEvent(c),a.copy(s.object.position),o.copy(s.object.quaternion),y=!1,!0)}),this.dispose=function(){s.domElement.removeEventListener("contextmenu",W,!1),s.domElement.removeEventListener("mousedown",F,!1),s.domElement.removeEventListener("wheel",H,!1),s.domElement.removeEventListener("touchstart",G,!1),s.domElement.removeEventListener("touchend",j,!1),s.domElement.removeEventListener("touchmove",V,!1),document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",k,!1),window.removeEventListener("keydown",z,!1)};var s=this,c={type:"change"},l={type:"start"},h={type:"end"},u={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},d=u.NONE,p=1e-6,f=new THREE.Spherical,m=new THREE.Spherical,g=1,v=new THREE.Vector3,y=!1,x=new THREE.Vector2,b=new THREE.Vector2,w=new THREE.Vector2,_=new THREE.Vector2,E=new THREE.Vector2,T=new THREE.Vector2,M=new THREE.Vector2,S=new THREE.Vector2,A=new THREE.Vector2;function R(){return Math.pow(.95,s.zoomSpeed)}function C(e){m.theta-=e}function L(e){m.phi-=e}var P,N=(P=new THREE.Vector3,function(e,t){P.setFromMatrixColumn(t,0),P.multiplyScalar(-e),v.add(P)}),O=function(){var e=new THREE.Vector3;return function(t,n){e.setFromMatrixColumn(n,1),e.multiplyScalar(t),v.add(e)}}(),I=function(){var e=new THREE.Vector3;return function(t,n){var i=s.domElement===document?s.domElement.body:s.domElement;if(s.object.isPerspectiveCamera){var r=s.object.position;e.copy(r).sub(s.target);var a=e.length();a*=Math.tan(s.object.fov/2*Math.PI/180),N(2*t*a/i.clientHeight,s.object.matrix),O(2*n*a/i.clientHeight,s.object.matrix)}else s.object.isOrthographicCamera?(N(t*(s.object.right-s.object.left)/s.object.zoom/i.clientWidth,s.object.matrix),O(n*(s.object.top-s.object.bottom)/s.object.zoom/i.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)}}();function U(e){s.object.isPerspectiveCamera?g/=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*e)),s.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function D(e){s.object.isPerspectiveCamera?g*=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/e)),s.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function F(e){if(!1!==s.enabled){switch(e.preventDefault(),e.button){case s.mouseButtons.ORBIT:if(!1===s.enableRotate)return;!function(e){x.set(e.clientX,e.clientY)}(e),d=u.ROTATE;break;case s.mouseButtons.ZOOM:if(!1===s.enableZoom)return;!function(e){M.set(e.clientX,e.clientY)}(e),d=u.DOLLY;break;case s.mouseButtons.PAN:if(!1===s.enablePan)return;!function(e){_.set(e.clientX,e.clientY)}(e),d=u.PAN}d!==u.NONE&&(document.addEventListener("mousemove",B,!1),document.addEventListener("mouseup",k,!1),s.dispatchEvent(l))}}function B(e){if(!1!==s.enabled)switch(e.preventDefault(),d){case u.ROTATE:if(!1===s.enableRotate)return;!function(e){b.set(e.clientX,e.clientY),w.subVectors(b,x);var t=s.domElement===document?s.domElement.body:s.domElement;C(2*Math.PI*w.x/t.clientWidth*s.rotateSpeed),L(2*Math.PI*w.y/t.clientHeight*s.rotateSpeed),x.copy(b),s.update()}(e);break;case u.DOLLY:if(!1===s.enableZoom)return;!function(e){S.set(e.clientX,e.clientY),A.subVectors(S,M),A.y>0?U(R()):A.y<0&&D(R()),M.copy(S),s.update()}(e);break;case u.PAN:if(!1===s.enablePan)return;!function(e){E.set(e.clientX,e.clientY),T.subVectors(E,_),I(T.x,T.y),_.copy(E),s.update()}(e)}}function k(e){!1!==s.enabled&&(document.removeEventListener("mousemove",B,!1),document.removeEventListener("mouseup",k,!1),s.dispatchEvent(h),d=u.NONE)}function H(e){!1===s.enabled||!1===s.enableZoom||d!==u.NONE&&d!==u.ROTATE||(e.preventDefault(),e.stopPropagation(),function(e){e.deltaY<0?D(R()):e.deltaY>0&&U(R()),s.update()}(e),s.dispatchEvent(l),s.dispatchEvent(h))}function z(e){!1!==s.enabled&&!1!==s.enableKeys&&!1!==s.enablePan&&function(e){switch(e.keyCode){case s.keys.UP:I(0,s.keyPanSpeed),s.update();break;case s.keys.BOTTOM:I(0,-s.keyPanSpeed),s.update();break;case s.keys.LEFT:I(s.keyPanSpeed,0),s.update();break;case s.keys.RIGHT:I(-s.keyPanSpeed,0),s.update()}}(e)}function G(e){if(!1!==s.enabled){switch(e.touches.length){case 1:if(!1===s.enableRotate)return;!function(e){x.set(e.touches[0].pageX,e.touches[0].pageY)}(e),d=u.TOUCH_ROTATE;break;case 2:if(!1===s.enableZoom)return;!function(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);M.set(0,i)}(e),d=u.TOUCH_DOLLY;break;case 3:if(!1===s.enablePan)return;!function(e){_.set(e.touches[0].pageX,e.touches[0].pageY)}(e),d=u.TOUCH_PAN;break;default:d=u.NONE}d!==u.NONE&&s.dispatchEvent(l)}}function V(e){if(!1!==s.enabled)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(!1===s.enableRotate)return;if(d!==u.TOUCH_ROTATE)return;!function(e){b.set(e.touches[0].pageX,e.touches[0].pageY),w.subVectors(b,x);var t=s.domElement===document?s.domElement.body:s.domElement;C(2*Math.PI*w.x/t.clientWidth*s.rotateSpeed),L(2*Math.PI*w.y/t.clientHeight*s.rotateSpeed),x.copy(b),s.update()}(e);break;case 2:if(!1===s.enableZoom)return;if(d!==u.TOUCH_DOLLY)return;!function(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+n*n);S.set(0,i),A.subVectors(S,M),A.y>0?D(R()):A.y<0&&U(R()),M.copy(S),s.update()}(e);break;case 3:if(!1===s.enablePan)return;if(d!==u.TOUCH_PAN)return;!function(e){E.set(e.touches[0].pageX,e.touches[0].pageY),T.subVectors(E,_),I(T.x,T.y),_.copy(E),s.update()}(e);break;default:d=u.NONE}}function j(e){!1!==s.enabled&&(s.dispatchEvent(h),d=u.NONE)}function W(e){!1!==s.enabled&&e.preventDefault()}s.domElement.addEventListener("contextmenu",W,!1),s.domElement.addEventListener("mousedown",F,!1),s.domElement.addEventListener("wheel",H,!1),s.domElement.addEventListener("touchstart",G,!1),s.domElement.addEventListener("touchend",j,!1),s.domElement.addEventListener("touchmove",V,!1),window.addEventListener("keydown",z,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrbitControls.prototype.constructor=THREE.OrbitControls,Object.defineProperties(THREE.OrbitControls.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=e}}}),e.exports=THREE.OrbitControls},function(e,t){var n,i,r=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var c,l=[],h=!1,u=-1;function d(){h&&c&&(h=!1,c.length?l=c.concat(l):u=-1,l.length&&p())}function p(){if(!h){var e=s(d);h=!0;for(var t=l.length;t;){for(c=l,l=[];++u<t;)c&&c[u].run();u=-1,t=l.length}c=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||h||s(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var i={};n.r(i),n.d(i,"Camera",(function(){return _})),n.d(i,"Version",(function(){return E})),n.d(i,"Viewer",(function(){return w}));var r=n(0),a=(n(6),n(7),n(8),n(2));(class{static init(){window.THREE=r,window.Detector=a}}).init();const o={FRONT:0,BACK:1,LEFT:2,RIGHT:3,TOP:4,BOTTOM:5};class s{}s.hPhi=Math.PI/2.5,s.hTheta=Math.PI/10,s.vTheta=Math.PI/20;class c{constructor(e,t){this.phi=e,this.theta=t}}const l={backgroundColor:"#f5f5f5",preloader:!1,fullSceneLoad:!1,axesHelperEnabled:!1,orbitsControlEnabled:!0,onLoadCallback:()=>{},aspectRatio:"container",modelType:"default",pauseAtEnd:!1};var h,u,d;!function(e){e.once="once",e.pingPong="pingPong",e.repeat="repeat"}(h||(h={})),function(e){e.default="default",e.blender="blender"}(u||(u={})),function(e){e.window="window",e.container="container"}(d||(d={}));class p{constructor(e=u.default){e===u.blender?(this[o.FRONT]=new c(s.hPhi,0),this[o.BACK]=new c(1.2*s.hPhi,Math.PI),this[o.LEFT]=new c(s.hPhi,-Math.PI/2+s.hTheta/2),this[o.RIGHT]=new c(s.hPhi,Math.PI/2-s.hTheta/2),this[o.TOP]=new c(Math.PI/2-1.2*s.hPhi,0),this[o.BOTTOM]=new c(Math.PI/2+1.2*s.hPhi,Math.PI)):(this[o.FRONT]=new c(s.hPhi,s.hTheta),this[o.BACK]=new c(s.hPhi,Math.PI-s.hTheta),this[o.LEFT]=new c(s.hPhi,-Math.PI/2+s.hTheta),this[o.RIGHT]=new c(s.hPhi,Math.PI/2-s.hTheta),this[o.TOP]=new c(Math.PI/2-s.hPhi,s.vTheta),this[o.BOTTOM]=new c(Math.PI/2+s.hPhi,s.vTheta))}}class f{constructor(){this.promise=new Promise(function(e,t){this._resolve=e,this._reject=t}.bind(this))}then(e){return this.promise.then(e)}catch(e){return this.promise.catch(e)}resolve(e=null){this._resolve(e)}reject(e=null){this._reject(e)}}class m{constructor(e){this.all=e.slice().map((e=>null==e?"":e+(e.indexOf("?")>=0?"&#38;":"?")+"t="+Date.now().toString())),this.front=this.all[0]||"",this.back=this.all[1]||"",this.other=this.all.slice(2)}}class g{constructor(e){this.model=e.model,this.images=new m(e.images),e.animation?this.animation=e.animation:delete this.animation,e.position?this.position=e.position:delete this.position}}var v=n(3),y=n(4),x=n(1),b=n(5);class w{constructor(e,t=!1){this.elementModels=[],this.PauseAnimation=()=>{for(const e of this.mixer._actions)e.paused=!0},this.StopAnimation=()=>{for(const e of this.mixer._actions)e.paused=!0,e.time=0},this.ResetAnimation=()=>{for(const e of this.mixer._actions)e.time=0},this.StartAnimation=()=>{for(const e of this.mixer._actions)e.time===e._clip.duration&&(e.time=0),e.paused=!1},this.SetAnimationAt=e=>{for(const t of this.mixer._actions)t.time=e},this.GetAnimationDuration=()=>{let e=0;for(const t of this.mixer._actions)t._clip.duration>e&&(e=t._clip.duration);return e},this.GetAnimationTime=()=>{let e=0;for(const t of this.mixer._actions)t.time>e&&(e=t.time);return e},this.DecreaseAnimationSpeed=(e=.1)=>{for(const t of this.mixer._actions)t.timeScale>0&&t.timeScale-e>.04&&(t.timeScale-=e),t.timeScale<0&&Math.abs(t.timeScale+e)>Math.abs(.04)&&(t.timeScale-=-1*e)},this.EncreaseAnimationSpeed=(e=.25)=>{for(const t of this.mixer._actions)t.timeScale+=e*(t.timeScale<0?-1:1)},this.SetAnimationSpeed=(e=1)=>{for(const t of this.mixer._actions)t.timeScale=e*(t.timeScale<0?-1:1)},this.RevertAnimation=()=>{for(const e of this.mixer._actions)e.timeScale*=-1},this.PauseAtEnd=e=>{for(const t of this.mixer._actions)t.clampWhenFinished=e};const n=this;let i,a,s;(e=this._validateParams(e)).elements=this._getElementsFromParams(e),this._params=e,this.initContainers(e),this.showPreloader();const c=new f,l=new f;function h(){return n._params.aspectRatio===d.window?window.innerWidth/window.innerHeight:n._params.container.offsetWidth/n._params.container.offsetHeight}function p(e=!1){const t=()=>{if(n._params.aspectRatio===d.container){const e=n._params.container,t=e.offsetWidth,i=e.offsetHeight;n.canvasContainer.style.width=t+"px",n.canvasContainer.style.height=i+"px"}n.camera.aspect=h(),n.camera.updateProjectionMatrix();const e=n._params.aspectRatio===d.window?{width:window.innerWidth,height:window.innerHeight}:{width:n._params.container.offsetWidth,height:n._params.container.offsetHeight};n.renderer.setSize(e.width,e.height)};if(!0===e){const e=setInterval((()=>{t(),"0px"!==n.canvasContainer.style.width&&"0px"!==n.canvasContainer.style.height&&clearInterval(e)}),250)}else t()}function m(){const e=i.getDelta();void 0!==n.mixer&&n.mixer.update(e),n.renderer.render(s,n.camera)}(e.modelType===u.blender?r.BlenderColladaLoader.prototype:r.ColladaLoader.prototype).load=t?function(t,n){t=t.replace("<up_axis>Z_UP</up_axis>","<up_axis>Y_UP</up_axis>");for(let i=0;i<e.elements.length;i++){const n=e.elements[i].images.front,r=e.elements[i].images.back;n&&(t=t.replace("<init_from>{front}.jpg</init_from>","<init_from>"+n+"</init_from>")),r&&(t=t.replace("<init_from>{back}.jpg</init_from>","<init_from>"+r+"</init_from>"))}n(this.parse(t,""))}:function(t,n,i,a){const o=this;new r.FileLoader(o.manager).load(t,(function(i){i=i.replace("<up_axis>Z_UP</up_axis>","<up_axis>Y_UP</up_axis>");for(let n=0;n<e.elements.length;n++)if(-1!=t.indexOf(e.elements[n].model)){const t=e.elements[n].images.front,r=e.elements[n].images.back;t&&(i=i.replace("<init_from>{front}.jpg</init_from>","<init_from>"+t+"</init_from>")),r&&(i=i.replace("<init_from>{back}.jpg</init_from>","<init_from>"+r+"</init_from>"))}n(o.parse(i,""))}),i,a)},r.DefaultLoadingManager.onProgress=function(e,t,n){t===n&&c.resolve()},window.Detector.webgl?(function(){_.settings=new _.settings.constructor(n._params.modelType),n.camera=new r.PerspectiveCamera(45,h(),.05,1e4),n.camera.up.set(0,0,1),n.camera.position.copy(new r.Vector3(60,60,60)),n.camera.lookAt(new r.Vector3(0,0,0)),s=new r.Scene,i=new r.Clock,n.mixer=new r.AnimationMixer;let t=0;if(n.mixer.addEventListener("loop",(function(){++t==e.elements.length&&l.resolve()})),e.axesHelperEnabled){const e=new r.AxesHelper(1e3);s.add(e)}const d=new r.AmbientLight(16777200,.45);s.add(d),s.background=new r.Color(e.backgroundColor);const f=new r.SpotLight(16777215,.07);f.position.set(300,300,300),s.add(f);const g=new r.HemisphereLight(16777200,11184810,.45);g.position.set(0,0,1),s.add(g);const v=[c.promise];e.fullSceneLoad&&v.push(l.promise);const y=n._params.modelType===u.blender?r.BlenderColladaLoader:r.ColladaLoader;for(let i=0;i<e.elements.length;i++){const t=new y;!function(a){v.push(new Promise((function(o){t.load(e.elements[i].model,(function(t){const i=t.animations;if(i.length>0){const e=n.mixer.clipAction(i[0],t.scene);!0===n._params.pauseAtEnd&&(e.clampWhenFinished=!0,e.loop=r.LoopOnce),e.play()}const c=e=>{null!=e.material&&(e.material.flatShading=r.FlatShading),null!=e.children&&e.children.length>0&&e.children.forEach((e=>c(e)))};t.scene.children.forEach((e=>c(e))),e.elements[a].position&&t.scene.position.add(e.elements[a].position),s.add(t.scene),t.scene.visible=!1,n.elementModels[a]=t.scene,o()}))})))}(i)}n.renderer=new r.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0,logarithmicDepthBuffer:!0}),n.renderer.setClearColor(new r.Color(e.backgroundColor)),n.renderer.setPixelRatio(window.devicePixelRatio),p(),n.canvasContainer.innerHTML="",n.canvasContainer.appendChild(n.renderer.domElement),e.orbitsControlEnabled&&((a=new r.OrbitControls(n.camera,n.renderer.domElement)).addEventListener("change",m),a.enableZoom=!0),window.addEventListener("resize",p,!1),Promise.all(v).then((function(){for(let e=0;e<n.elementModels.length;e++)n.elementModels[e].visible=!0;p(!0),n.moveCamera(o.FRONT),n.hidePreloader(),n.ResetAnimation(),"function"==typeof e.onLoadCallback&&setTimeout((()=>{e.onLoadCallback()}),0)}))}(),function e(){x.update(),requestAnimationFrame(e),null!=a&&a.update(),m()}()):window.Detector.addGetWebGLMessage({parent:n.canvasContainer})}moveElement(e,t,n){Array.isArray(t)||(t=[t]);const i=this.elementModels[e];if(void 0===n)i.position.copy(t[t.length-1]);else{const e=new x.Tween(i.position).to(t[0],1e3);let n=e;for(let r=1;r<t.length;r++){const e=new x.Tween(i.position).to(t[r],1e3).easing(x.Easing.Quadratic.InOut);n.chain(e),n=e}e.easing(x.Easing.Quadratic.InOut).start()}}getElementPositions(e,t){Array.isArray(t)||(t=[t]);const n=[];let i=this.elementModels[e].position.clone();n.push(i);for(let r=0;r<t.length;r++){const e=i.clone();e.add(t[r]),n.push(e),i=e}return n}animate(e){void 0===e&&(e=!1);const t=this._params.elements;for(let n=0;n<t.length;n++)if(t[n].animation){if(void 0===t[n].animationPositions){const e=this.getElementPositions(n,t[n].animation);t[n].animationPositions=e.slice(1,e.length),t[n].reverseAnimationPositions=e.slice(0,e.length-1),t[n].reverseAnimationPositions.reverse()}e?this.moveElement(n,t[n].reverseAnimationPositions,!0):this.moveElement(n,t[n].animationPositions,!0)}}toggleElement(e,t){this.elementModels[e].visible=t}moveCamera(e,t,n){void 0===n&&(n=this.getCameraDistance());const i=_.getSphericalPosition(n,e);if(void 0===t)this.camera.position.copy(this.getVector3FromSpherical(i));else{x.removeAll();const e=this.getSphericalFromVector3(this.camera.position),t=this;new x.Tween(e).to(i,1e3).easing(x.Easing.Quadratic.InOut).onUpdate((function(){t.camera.position.copy(t.getVector3FromSpherical(e))})).start()}}getBoundingSize(){const e=new r.Vector3(0,0,0),t=e.clone();if(this._params.modelType===u.blender)this.elementModels.forEach((n=>{const i=(new r.Box3).setFromObject(n);e.min(i.min),t.max(i.max)}));else{function n(i){for(let a=0;a<i.children.length;a++){const o=i.children[a];if(o instanceof r.Bone){const n=o.getWorldPosition();e.min(n),t.max(n)}n(o)}}for(let i=0;i<this.elementModels.length;i++)n(this.elementModels[i])}return e.distanceTo(t)}getCameraDistance(){return 1.5*this.getBoundingSize()}getVector3FromSpherical(e){const t=new r.Vector3;return t.setFromSpherical(e),new r.Vector3(t.z,t.x,t.y)}getSphericalFromVector3(e){const t=new r.Spherical;return t.setFromVector3(new r.Vector3(e.y,e.z,e.x)),t}_getElementsFromParams(e){return e.items.map((e=>new g(e)))}_validateParams(e){return e.aspectRatio=e.aspectRatio||d.container,void 0===e.axesHelperEnabled&&(e.axesHelperEnabled=!1),void 0===e.orbitsControlEnabled&&(e.orbitsControlEnabled=!0),void 0===e.modelType&&(e.modelType=u.default),void 0===(e=Object.assign({},l,e)).preloader&&(e.preloader=!0),e}_htmlToDomElement(e){const t=document.createElement("template");return e=e.trim(),t.innerHTML=e,t.content.firstChild}_initMainContainer(e){const t=document.createElement("div");t.classList.add("mainContainer"),this.mainContainer=t,e.container.append(this.mainContainer)}_initPreloaderContainer(e){const t=document.createElement("div");t.classList.add("preloadContainer"),t.style.display="none",t.appendChild(this._htmlToDomElement(v)),this.preloadContainer=t,this.mainContainer.appendChild(this.preloadContainer);const n=this._htmlToDomElement(y),i=e.container.parentElement||e.container.parentNode;i.querySelector("style[id='preloaderStyles']")||i.prepend(n)}_initCanvasContainer(e){const t=document.createElement("div");t.classList.add("canvasContainer"),this.canvasContainer=t,this.mainContainer.append(this.canvasContainer)}_initContainerStyles(e){const t=this._htmlToDomElement(b),n=e.container.parentElement||e.container.parentNode;n.querySelector("style[id='containerStyles']")||n.prepend(t)}showPreloader(){!1!==this._params.preloader&&(this.preloadContainer.style.display="",this.canvasContainer.style.display="none")}hidePreloader(){!1!==this._params.preloader&&(this.canvasContainer.style.display="",this.preloadContainer.style.display="none")}initContainers(e){e.container.innerHTML="",this._initMainContainer(e),this._initContainerStyles(e),this._initCanvasContainer(e),this._initPreloaderContainer(e)}}const _=new class{constructor(){this.positions=o,this.settings=new p}getSphericalPosition(e,t){const n=this.settings[t];return new r.Spherical(e,n.phi,n.theta)}},E="1.3.2";window.Aurigma=window.Aurigma||{},window.Aurigma.Origami=i}])}}]);