three.min.js 694 KB

1234567
  1. console.warn('Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation'),
  2. /**
  3. * @license
  4. * Copyright 2010-2023 Three.js Authors
  5. * SPDX-License-Identifier: MIT
  6. */
  7. function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE={})}(this,(function(t){"use strict";var e="153",n=1,i=2,r=3,a=0,o=1,s=100,l=0,u=1,c=2,h=0,d=1,p=2,f=3,m=4,v=5,g=300,y=301,_=302,x=303,M=304,S=306,b=1e3,E=1001,w=1002,T=1003,A=1004,R=1005,C=1006,L=1007,P=1008,U=1009,I=1012,N=1013,D=1014,O=1015,B=1016,F=1017,z=1018,G=1020,k=1023,H=1026,V=1027,W=1029,X=1031,j=1033,q=33776,Y=33777,Z=33778,J=33779,K=35840,Q=35841,$=35842,tt=35843,et=37492,nt=37496,it=37808,rt=37809,at=37810,ot=37811,st=37812,lt=37813,ut=37814,ct=37815,ht=37816,dt=37817,pt=37818,ft=37819,mt=37820,vt=37821,gt=36492,yt=36284,_t=36285,xt=36286,Mt=2300,St=2301,bt=2302,Et=2400,wt=2401,Tt=2402,At=2500,Rt=2501,Ct=3e3,Lt=3001,Pt="",Ut="srgb",It="srgb-linear",Nt="display-p3",Dt=7680,Ot=35044,Bt="300 es",Ft=1035,zt=2e3,Gt=2001;function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Ht(t,e,n,i,r,a,o){try{var s=t[a](o),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(i,r)}function Vt(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var a=t.apply(e,n);function o(t){Ht(a,i,r,o,s,"next",t)}function s(t){Ht(a,i,r,o,s,"throw",t)}o(void 0)}))}}function Wt(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Qt(i.key),i)}}function Xt(t,e,n){return e&&Wt(t.prototype,e),n&&Wt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function jt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return kt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}function Yt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Kt(t,e)}function Zt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Zt=function(){return!!t})()}function Jt(){Jt=function(){return e};var t,e={},n=Object.prototype,i=n.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var a=e&&e.prototype instanceof g?e:g,o=Object.create(a.prototype),s=new L(i||[]);return r(o,"_invoke",{value:T(t,n,s)}),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function g(){}function y(){}function _(){}var x={};u(x,o,(function(){return this}));var M=Object.getPrototypeOf,S=M&&M(M(P([])));S&&S!==n&&i.call(S,o)&&(x=S);var b=_.prototype=g.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(r,a,o,s){var l=h(t[r],t,a);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?e.resolve(c.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(c).then((function(t){u.value=t,o(u)}),(function(t){return n("throw",t,o,s)}))}s(l.arg)}var a;r(this,"_invoke",{value:function(t,i){function r(){return new e((function(e,r){n(t,i,e,r)}))}return a=a?a.then(r,r):r()}})}function T(e,n,i){var r=d;return function(a,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===a)throw o;return{value:t,done:!0}}for(i.method=a,i.arg=o;;){var s=i.delegate;if(s){var l=A(s,i);if(l){if(l===v)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===d)throw r=m,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=f;var u=h(e,n,i);if("normal"===u.type){if(r=i.done?m:p,u.arg===v)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(r=m,i.method="throw",i.arg=u.arg)}}}function A(e,n){var i=n.method,r=e.iterator[i];if(r===t)return n.delegate=null,"throw"===i&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),v;var a=h(r,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,v;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,v):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function P(e){if(e||""===e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function n(){for(;++r<e.length;)if(i.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return y.prototype=_,r(b,"constructor",{value:_,configurable:!0}),r(_,"constructor",{value:y,configurable:!0}),y.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,u(t,l,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},E(w.prototype),u(w.prototype,s,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,i,r,a){void 0===a&&(a=Promise);var o=new w(c(t,n,i,r),a);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},E(b),u(b,l,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var i in e)n.push(i);return n.reverse(),function t(){for(;n.length;){var i=n.pop();if(i in e)return t.value=i,t.done=!1,t}return t.done=!0,t}},e.values=P,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(i,r){return s.type="throw",s.arg=e,n.next=i,r&&(n.method="next",n.arg=t),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:P(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),v}},e}function Kt(t,e){return Kt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kt(t,e)}function Qt(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function $t(t){var e="function"==typeof Map?new Map:void 0;return $t=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(Zt())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var r=new(t.bind.apply(t,i));return n&&Kt(r,n.prototype),r}(t,arguments,qt(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Kt(n,t)},$t(t)}var te=function(){function t(){}var e=t.prototype;return e.addEventListener=function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},e.hasEventListener=function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},e.removeEventListener=function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var i=n.indexOf(e);-1!==i&&n.splice(i,1)}}},e.dispatchEvent=function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,t);t.target=null}}},t}(),ee=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],ne=1234567,ie=Math.PI/180,re=180/Math.PI;function ae(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ee[255&t]+ee[t>>8&255]+ee[t>>16&255]+ee[t>>24&255]+"-"+ee[255&e]+ee[e>>8&255]+"-"+ee[e>>16&15|64]+ee[e>>24&255]+"-"+ee[63&n|128]+ee[n>>8&255]+"-"+ee[n>>16&255]+ee[n>>24&255]+ee[255&i]+ee[i>>8&255]+ee[i>>16&255]+ee[i>>24&255]).toLowerCase()}function oe(t,e,n){return Math.max(e,Math.min(n,t))}function se(t,e){return(t%e+e)%e}function le(t,e,n){return(1-n)*t+n*e}function ue(t){return!(t&t-1)&&0!==t}function ce(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function he(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function de(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function pe(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}var fe={DEG2RAD:ie,RAD2DEG:re,generateUUID:ae,clamp:oe,euclideanModulo:se,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:le,damp:function(t,e,n,i){return le(t,e,1-Math.exp(-n*i))},pingpong:function(t,e){return void 0===e&&(e=1),e-Math.abs(se(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(ne=t);var e=ne+=1831565813;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ie},radToDeg:function(t){return t*re},isPowerOfTwo:ue,ceilPowerOfTwo:ce,floorPowerOfTwo:he,setQuaternionFromProperEuler:function(t,e,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((e+i)/2),c=o((e+i)/2),h=a((e-i)/2),d=o((e-i)/2),p=a((i-e)/2),f=o((i-e)/2);switch(r){case"XYX":t.set(s*c,l*h,l*d,s*u);break;case"YZY":t.set(l*d,s*c,l*h,s*u);break;case"ZXZ":t.set(l*h,l*d,s*c,s*u);break;case"XZX":t.set(s*c,l*f,l*p,s*u);break;case"YXY":t.set(l*p,s*c,l*f,s*u);break;case"ZYZ":t.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:pe,denormalize:de},me=function(){function t(e,n){void 0===e&&(e=0),void 0===n&&(n=0),t.prototype.isVector2=!0,this.x=e,this.y=n}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setScalar=function(t){return this.x=t,this.y=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.applyMatrix3=function(t){var e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.lengthSq=function(){return this.x*this.x+this.y*this.y},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},e.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(oe(n,-1,1))},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},e.rotateAround=function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:case"end":return t.stop()}}),t,this)})),Xt(t,[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}}])}(),ve=function(){function t(e,n,i,r,a,o,s,l,u){t.prototype.isMatrix3=!0,this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),void 0!==e&&this.set(e,n,i,r,a,o,s,l,u)}var e=t.prototype;return e.set=function(t,e,n,i,r,a,o,s,l){var u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=r,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},e.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],v=i[6],g=i[1],y=i[4],_=i[7],x=i[2],M=i[5],S=i[8];return r[0]=a*f+o*g+s*x,r[3]=a*m+o*y+s*M,r[6]=a*v+o*_+s*S,r[1]=l*f+u*g+c*x,r[4]=l*m+u*y+c*M,r[7]=l*v+u*_+c*S,r[2]=h*f+d*g+p*x,r[5]=h*m+d*y+p*M,r[8]=h*v+d*_+p*S,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8];return e*a*u-e*o*l-n*r*u+n*o*s+i*r*l-i*a*s},e.invert=function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=u*a-o*l,h=o*s-u*r,d=l*r-a*s,p=e*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=c*f,t[1]=(i*l-u*n)*f,t[2]=(o*n-i*a)*f,t[3]=h*f,t[4]=(u*e-i*s)*f,t[5]=(i*r-o*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(a*e-n*r)*f,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},e.transposeIntoArray=function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},e.setUvTransform=function(t,e,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+t,-i*l,i*s,-i*(-l*a+s*o)+o+e,0,0,1),this},e.scale=function(t,e){return this.premultiply(ge.makeScale(t,e)),this},e.rotate=function(t){return this.premultiply(ge.makeRotation(-t)),this},e.translate=function(t,e){return this.premultiply(ge.makeTranslation(t,e)),this},e.makeTranslation=function(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this},e.makeRotation=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this},e.makeScale=function(t,e){return this.set(t,0,0,0,e,0,0,0,1),this},e.equals=function(t){for(var e=this.elements,n=t.elements,i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t},e.clone=function(){return(new this.constructor).fromArray(this.elements)},t}(),ge=new ve;function ye(t){for(var e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}var _e={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function xe(t,e){return new _e[t](e)}function Me(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}var Se,be,Ee={};function we(t){t in Ee||(Ee[t]=!0,console.warn(t))}function Te(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ae(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var Re=(new ve).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ce=(new ve).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);var Le,Pe=((Se={})[It]=function(t){return t},Se[Ut]=function(t){return t.convertSRGBToLinear()},Se[Nt]=function(t){return t.convertSRGBToLinear().applyMatrix3(Ce)},Se),Ue=((be={})[It]=function(t){return t},be[Ut]=function(t){return t.convertLinearToSRGB()},be[Nt]=function(t){return t.applyMatrix3(Re).convertLinearToSRGB()},be),Ie={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return It},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;var i=Pe[e],r=Ue[n];if(void 0===i||void 0===r)throw new Error('Unsupported color space conversion, "'+e+'" to "'+n+'".');return r(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},Ne=function(){function t(){}return t.getDataURL=function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;var e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Le&&(Le=Me("canvas")),Le.width=t.width,Le.height=t.height;var n=Le.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Le}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")},t.sRGBToLinear=function(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var e=Me("canvas");e.width=t.width,e.height=t.height;var n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);for(var i=n.getImageData(0,0,t.width,t.height),r=i.data,a=0;a<r.length;a++)r[a]=255*Te(r[a]/255);return n.putImageData(i,0,0),e}if(t.data){for(var o=t.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*Te(o[s]/255)):o[s]=Te(o[s]);return{data:o,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t},t}(),De=0,Oe=function(){function t(t){void 0===t&&(t=null),this.isSource=!0,Object.defineProperty(this,"id",{value:De++}),this.uuid=ae(),this.data=t,this.version=0}return t.prototype.toJSON=function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];var n={uuid:this.uuid,url:""},i=this.data;if(null!==i){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(Be(i[a].image)):r.push(Be(i[a]))}else r=Be(i);n.url=r}return e||(t.images[this.uuid]=n),n},Xt(t,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])}();function Be(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ne.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Fe=0,ze=function(t){function e(n,i,r,a,o,s,l,u,c,h){var d;return void 0===n&&(n=e.DEFAULT_IMAGE),void 0===i&&(i=e.DEFAULT_MAPPING),void 0===r&&(r=E),void 0===a&&(a=E),void 0===o&&(o=C),void 0===s&&(s=P),void 0===l&&(l=k),void 0===u&&(u=U),void 0===c&&(c=e.DEFAULT_ANISOTROPY),void 0===h&&(h=Pt),(d=t.call(this)||this).isTexture=!0,Object.defineProperty(d,"id",{value:Fe++}),d.uuid=ae(),d.name="",d.source=new Oe(n),d.mipmaps=[],d.mapping=i,d.channel=0,d.wrapS=r,d.wrapT=a,d.magFilter=o,d.minFilter=s,d.anisotropy=c,d.format=l,d.internalFormat=null,d.type=u,d.offset=new me(0,0),d.repeat=new me(1,1),d.center=new me(0,0),d.rotation=0,d.matrixAutoUpdate=!0,d.matrix=new ve,d.generateMipmaps=!0,d.premultiplyAlpha=!1,d.flipY=!0,d.unpackAlignment=4,"string"==typeof h?d.colorSpace=h:(we("THREE.Texture: Property .encoding has been replaced by .colorSpace."),d.colorSpace=h===Lt?Ut:Pt),d.userData={},d.version=0,d.onUpdate=null,d.isRenderTargetTexture=!1,d.needsPMREMUpdate=!1,d}Yt(e,t);var n=e.prototype;return n.updateMatrix=function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this},n.toJSON=function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n},n.dispose=function(){this.dispatchEvent({type:"dispose"})},n.transformUv=function(t){if(this.mapping!==g)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case b:t.x=t.x-Math.floor(t.x);break;case E:t.x=t.x<0?0:1;break;case w:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case b:t.y=t.y-Math.floor(t.y);break;case E:t.y=t.y<0?0:1;break;case w:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t},Xt(e,[{key:"image",get:function(){return this.source.data},set:function(t){void 0===t&&(t=null),this.source.data=t}},{key:"needsUpdate",set:function(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}},{key:"encoding",get:function(){return we("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Ut?Lt:Ct},set:function(t){we("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===Lt?Ut:Pt}}])}(te);ze.DEFAULT_IMAGE=null,ze.DEFAULT_MAPPING=g,ze.DEFAULT_ANISOTROPY=1;var Ge=function(){function t(e,n,i,r){void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===r&&(r=1),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setW=function(t){return this.w=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.applyMatrix4=function(t){var e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.setAxisAngleFromQuaternion=function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},e.setAxisAngleFromRotationMatrix=function(t){var e,n,i,r,a=.01,o=.1,s=t.elements,l=s[0],u=s[4],c=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(u-h)<a&&Math.abs(c-f)<a&&Math.abs(p-m)<a){if(Math.abs(u+h)<o&&Math.abs(c+f)<o&&Math.abs(p+m)<o&&Math.abs(l+d+v-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var g=(l+1)/2,y=(d+1)/2,_=(v+1)/2,x=(u+h)/4,M=(c+f)/4,S=(p+m)/4;return g>y&&g>_?g<a?(n=0,i=.707106781,r=.707106781):(i=x/(n=Math.sqrt(g)),r=M/n):y>_?y<a?(n=.707106781,i=0,r=.707106781):(n=x/(i=Math.sqrt(y)),r=S/i):_<a?(n=.707106781,i=.707106781,r=0):(n=M/(r=Math.sqrt(_)),i=S/r),this.set(n,i,r,e),this}var b=Math.sqrt((m-p)*(m-p)+(c-f)*(c-f)+(h-u)*(h-u));return Math.abs(b)<.001&&(b=1),this.x=(m-p)/b,this.y=(c-f)/b,this.z=(h-u)/b,this.w=Math.acos((l+d+v-1)/2),this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.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},e.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},e.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},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:return t.next=8,this.w;case 8:case"end":return t.stop()}}),t,this)})),Xt(t,[{key:"width",get:function(){return this.z},set:function(t){this.z=t}},{key:"height",get:function(){return this.w},set:function(t){this.w=t}}])}(),ke=function(t){function e(e,n,i){var r;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i={}),(r=t.call(this)||this).isWebGLRenderTarget=!0,r.width=e,r.height=n,r.depth=1,r.scissor=new Ge(0,0,e,n),r.scissorTest=!1,r.viewport=new Ge(0,0,e,n);var a={width:e,height:n,depth:1};return void 0!==i.encoding&&(we("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Lt?Ut:Pt),r.texture=new ze(a,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),r.texture.isRenderTargetTexture=!0,r.texture.flipY=!1,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:C,r.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,r.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,r.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,r.samples=void 0!==i.samples?i.samples:0,r}Yt(e,t);var n=e.prototype;return n.setSize=function(t,e,n){void 0===n&&(n=1),this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;var e=Object.assign({},t.texture.image);return this.texture.source=new Oe(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(te),He=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=null),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=1),(a=t.call(this,null)||this).isDataArrayTexture=!0,a.image={data:e,width:n,height:i,depth:r},a.magFilter=T,a.minFilter=T,a.wrapR=E,a.generateMipmaps=!1,a.flipY=!1,a.unpackAlignment=1,a}return Yt(e,t),e}(ze),Ve=function(t){function e(e,n,i){var r;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),(r=t.call(this,e,n)||this).isWebGLArrayRenderTarget=!0,r.depth=i,r.texture=new He(null,e,n,i),r.texture.isRenderTargetTexture=!0,r}return Yt(e,t),e}(ke),We=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=null),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=1),(a=t.call(this,null)||this).isData3DTexture=!0,a.image={data:e,width:n,height:i,depth:r},a.magFilter=T,a.minFilter=T,a.wrapR=E,a.generateMipmaps=!1,a.flipY=!1,a.unpackAlignment=1,a}return Yt(e,t),e}(ze),Xe=function(t){function e(e,n,i){var r;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),(r=t.call(this,e,n)||this).isWebGL3DRenderTarget=!0,r.depth=i,r.texture=new We(null,e,n,i),r.texture.isRenderTargetTexture=!0,r}return Yt(e,t),e}(ke),je=function(t){function e(e,n,i,r){var a;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r={}),(a=t.call(this,e,n,r)||this).isWebGLMultipleRenderTargets=!0;var o=a.texture;a.texture=[];for(var s=0;s<i;s++)a.texture[s]=o.clone(),a.texture[s].isRenderTargetTexture=!0;return a}Yt(e,t);var n=e.prototype;return n.setSize=function(t,e,n){if(void 0===n&&(n=1),this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(var i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this},n.copy=function(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.texture.length=0;for(var e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone(),this.texture[e].isRenderTargetTexture=!0;return this},e}(ke),qe=function(){function t(t,e,n,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=1),this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}t.slerpFlat=function(t,e,n,i,r,a,o){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===o)return t[e+0]=s,t[e+1]=l,t[e+2]=u,void(t[e+3]=c);if(1===o)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(c!==f||s!==h||l!==d||u!==p){var m=1-o,v=s*h+l*d+u*p+c*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,v*g);m=Math.sin(m*x)/_,o=Math.sin(o*x)/_}var M=o*g;if(s=s*m+h*M,l=l*m+d*M,u=u*m+p*M,c=c*m+f*M,m===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}t[e]=s,t[e+1]=l,t[e+2]=u,t[e+3]=c},t.multiplyQuaternionsFlat=function(t,e,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return t[e]=o*p+u*c+s*d-l*h,t[e+1]=s*p+u*h+l*c-o*d,t[e+2]=l*p+u*d+o*h-s*c,t[e+3]=u*p-o*c-s*h-l*d,t};var e=t.prototype;return e.set=function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},e.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},e.setFromEuler=function(t,e){var n=t._x,i=t._y,r=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(i/2),c=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this},e.setFromAxisAngle=function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},e.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],o=e[5],s=e[9],l=e[2],u=e[6],c=e[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(r-l)*d,this._z=(a-i)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(u-s)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+l)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(r-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(s+u)/f}else{var m=2*Math.sqrt(1+c-n-o);this._w=(a-i)/m,this._x=(r+l)/m,this._y=(s+u)/m,this._z=.25*m}return this._onChangeCallback(),this},e.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},e.angleTo=function(t){return 2*Math.acos(Math.abs(oe(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var i=Math.min(1,e/n);return this.slerp(t,i),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},e.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},e.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,s=e._y,l=e._z,u=e._w;return this._x=n*u+a*o+i*l-r*s,this._y=i*u+a*s+r*o-n*l,this._z=r*u+a*l+n*s-i*o,this._w=a*u-n*o-i*s-r*l,this._onChangeCallback(),this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-e;return this._w=l*a+e*this._w,this._x=l*n+e*this._x,this._y=l*i+e*this._y,this._z=l*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-e)*c)/u,d=Math.sin(e*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this},e.slerpQuaternions=function(t,e,n){return this.copy(t).slerp(e,n)},e.random=function(){var t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},e.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},e.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this},e.toJSON=function(){return this.toArray()},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._x;case 2:return t.next=4,this._y;case 4:return t.next=6,this._z;case 6:return t.next=8,this._w;case 8:case"end":return t.stop()}}),t,this)})),Xt(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])}(),Ye=function(){function t(e,n,i){void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setComponent=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyEuler=function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Je.setFromEuler(t))},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Je.setFromAxisAngle(t,e))},e.applyMatrix3=function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},e.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},e.applyMatrix4=function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*i-o*n,u=s*n+o*e-r*i,c=s*i+r*n-a*e,h=-r*e-a*n-o*i;return this.x=l*s+h*-r+u*-o-c*-a,this.y=u*s+h*-a+c*-r-l*-o,this.z=c*s+h*-o+l*-a-u*-r,this},e.project=function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},e.unproject=function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},e.transformDirection=function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this},e.cross=function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},e.crossVectors=function(t,e){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},e.projectOnVector=function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},e.projectOnPlane=function(t){return Ze.copy(this).projectOnVector(t),this.sub(Ze)},e.reflect=function(t){return this.sub(Ze.copy(t).multiplyScalar(2*this.dot(t)))},e.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(oe(n,-1,1))},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},e.setFromSpherical=function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},e.setFromSphericalCoords=function(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this},e.setFromCylindrical=function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},e.setFromCylindricalCoords=function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},e.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,4*e)},e.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,3*e)},e.setFromEuler=function(t){return this.x=t._x,this.y=t._y,this.z=t._z,this},e.setFromColor=function(t){return this.x=t.r,this.y=t.g,this.z=t.b,this},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},e.fromBufferAttribute=function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.randomDirection=function(){var t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(t,2));return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:case"end":return t.stop()}}),t,this)})),t}(),Ze=new Ye,Je=new qe,Ke=function(){function t(t,e){void 0===t&&(t=new Ye(1/0,1/0,1/0)),void 0===e&&(e=new Ye(-1/0,-1/0,-1/0)),this.isBox3=!0,this.min=t,this.max=e}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromArray=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e+=3)this.expandByPoint($e.fromArray(t,e));return this},e.setFromBufferAttribute=function(t){this.makeEmpty();for(var e=0,n=t.count;e<n;e++)this.expandByPoint($e.fromBufferAttribute(t,e));return this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=$e.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.setFromObject=function(t,e){return void 0===e&&(e=!1),this.makeEmpty(),this.expandByObject(t,e)},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.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},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Ye),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Ye),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.expandByObject=function(t,e){if(void 0===e&&(e=!1),t.updateWorldMatrix(!1,!1),void 0!==t.boundingBox)null===t.boundingBox&&t.computeBoundingBox(),tn.copy(t.boundingBox),tn.applyMatrix4(t.matrixWorld),this.union(tn);else{var n=t.geometry;if(void 0!==n)if(e&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var i=n.attributes.position,r=0,a=i.count;r<a;r++)$e.fromBufferAttribute(i,r).applyMatrix4(t.matrixWorld),this.expandByPoint($e);else null===n.boundingBox&&n.computeBoundingBox(),tn.copy(n.boundingBox),tn.applyMatrix4(t.matrixWorld),this.union(tn)}for(var o=t.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],e);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Ye),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){return this.clampPoint(t.center,$e),$e.distanceToSquared(t.center)<=t.radius*t.radius},e.intersectsPlane=function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},e.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(ln),un.subVectors(this.max,ln),en.subVectors(t.a,ln),nn.subVectors(t.b,ln),rn.subVectors(t.c,ln),an.subVectors(nn,en),on.subVectors(rn,nn),sn.subVectors(en,rn);var e=[0,-an.z,an.y,0,-on.z,on.y,0,-sn.z,sn.y,an.z,0,-an.x,on.z,0,-on.x,sn.z,0,-sn.x,-an.y,an.x,0,-on.y,on.x,0,-sn.y,sn.x,0];return!!dn(e,en,nn,rn,un)&&(!!dn(e=[1,0,0,0,1,0,0,0,1],en,nn,rn,un)&&(cn.crossVectors(an,on),dn(e=[cn.x,cn.y,cn.z],en,nn,rn,un)))},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Ye),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return this.clampPoint(t,$e).distanceTo(t)},e.getBoundingSphere=function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize($e).length()),t},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t){return this.isEmpty()||(Qe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Qe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Qe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Qe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Qe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Qe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Qe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Qe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Qe)),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),Qe=[new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye],$e=new Ye,tn=new Ke,en=new Ye,nn=new Ye,rn=new Ye,an=new Ye,on=new Ye,sn=new Ye,ln=new Ye,un=new Ye,cn=new Ye,hn=new Ye;function dn(t,e,n,i,r){for(var a=0,o=t.length-3;a<=o;a+=3){hn.fromArray(t,a);var s=r.x*Math.abs(hn.x)+r.y*Math.abs(hn.y)+r.z*Math.abs(hn.z),l=e.dot(hn),u=n.dot(hn),c=i.dot(hn);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var pn=new Ke,fn=new Ye,mn=new Ye,vn=function(){function t(t,e){void 0===t&&(t=new Ye),void 0===e&&(e=-1),this.center=t,this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copy(t),this.radius=e,this},e.setFromPoints=function(t,e){var n=this.center;void 0!==e?n.copy(e):pn.setFromPoints(t).getCenter(n);for(var i=0,r=0,a=t.length;r<a;r++)i=Math.max(i,n.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this},e.copy=function(t){return this.center.copy(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distanceTo(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.intersectsPlane=function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},e.clampPoint=function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Ye),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Ke),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;fn.subVectors(t,this.center);var e=fn.lengthSq();if(e>this.radius*this.radius){var n=Math.sqrt(e),i=.5*(n-this.radius);this.center.addScaledVector(fn,i/n),this.radius+=i}return this},e.union=function(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(mn.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(fn.copy(t.center).add(mn)),this.expandByPoint(fn.copy(t.center).sub(mn))),this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new this.constructor).copy(this)},t}(),gn=new Ye,yn=new Ye,_n=new Ye,xn=new Ye,Mn=new Ye,Sn=new Ye,bn=new Ye,En=function(){function t(t,e){void 0===t&&(t=new Ye),void 0===e&&(e=new Ye(0,0,-1)),this.origin=t,this.direction=e}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.copy=function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Ye),e.copy(this.origin).addScaledVector(this.direction,t)},e.lookAt=function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},e.recast=function(t){return this.origin.copy(this.at(t,gn)),this},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Ye),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)},e.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},e.distanceSqToPoint=function(t){var e=gn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(gn.copy(this.origin).addScaledVector(this.direction,e),gn.distanceToSquared(t))},e.distanceSqToSegment=function(t,e,n,i){yn.copy(t).add(e).multiplyScalar(.5),_n.copy(e).sub(t).normalize(),xn.copy(this.origin).sub(yn);var r,a,o,s,l=.5*t.distanceTo(e),u=-this.direction.dot(_n),c=xn.dot(this.direction),h=-xn.dot(_n),d=xn.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(a=u*c-h,s=l*p,(r=u*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+u*(a*=f)+2*c)+a*(u*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-u*l+c)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(u*l+c)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(yn).addScaledVector(_n,a),o},e.intersectSphere=function(t,e){gn.subVectors(t.center,this.origin);var n=gn.dot(this.direction),i=gn.dot(gn)-n*n,r=t.radius*t.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,e):this.at(o,e)},e.intersectsSphere=function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},e.distanceToPlane=function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},e.intersectPlane=function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},e.intersectsPlane=function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},e.intersectBox=function(t,e){var n,i,r,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),u>=0?(r=(t.min.y-h.y)*u,a=(t.max.y-h.y)*u):(r=(t.max.y-h.y)*u,a=(t.min.y-h.y)*u),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(o=(t.min.z-h.z)*c,s=(t.max.z-h.z)*c):(o=(t.max.z-h.z)*c,s=(t.min.z-h.z)*c),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,e)))},e.intersectsBox=function(t){return null!==this.intersectBox(t,gn)},e.intersectTriangle=function(t,e,n,i,r){Mn.subVectors(e,t),Sn.subVectors(n,t),bn.crossVectors(Mn,Sn);var a,o=this.direction.dot(bn);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}xn.subVectors(this.origin,t);var s=a*this.direction.dot(Sn.crossVectors(xn,Sn));if(s<0)return null;var l=a*this.direction.dot(Mn.cross(xn));if(l<0)return null;if(s+l>o)return null;var u=-a*xn.dot(bn);return u<0?null:this.at(u/o,r)},e.applyMatrix4=function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},e.equals=function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},e.clone=function(){return(new this.constructor).copy(this)},t}(),wn=function(){function t(e,n,i,r,a,o,s,l,u,c,h,d,p,f,m,v){t.prototype.isMatrix4=!0,this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),void 0!==e&&this.set(e,n,i,r,a,o,s,l,u,c,h,d,p,f,m,v)}var e=t.prototype;return e.set=function(t,e,n,i,r,a,o,s,l,u,c,h,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=u,v[10]=c,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},e.clone=function(){return(new t).fromArray(this.elements)},e.copy=function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},e.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this},e.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},e.makeBasis=function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},e.extractRotation=function(t){var e=this.elements,n=t.elements,i=1/Tn.setFromMatrixColumn(t,0).length(),r=1/Tn.setFromMatrixColumn(t,1).length(),a=1/Tn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromEuler=function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){var h=a*u,d=a*c,p=o*u,f=o*c;e[0]=s*u,e[4]=-s*c,e[8]=l,e[1]=d+p*l,e[5]=h-f*l,e[9]=-o*s,e[2]=f-h*l,e[6]=p+d*l,e[10]=a*s}else if("YXZ"===t.order){var m=s*u,v=s*c,g=l*u,y=l*c;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var _=s*u,x=s*c,M=l*u,S=l*c;e[0]=_-S*o,e[4]=-a*c,e[8]=M+x*o,e[1]=x+M*o,e[5]=a*u,e[9]=S-_*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var b=a*u,E=a*c,w=o*u,T=o*c;e[0]=s*u,e[4]=w*l-E,e[8]=b*l+T,e[1]=s*c,e[5]=T*l+b,e[9]=E*l-w,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var A=a*s,R=a*l,C=o*s,L=o*l;e[0]=s*u,e[4]=L-A*c,e[8]=C*c+R,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-l*u,e[6]=R*c+C,e[10]=A-L*c}else if("XZY"===t.order){var P=a*s,U=a*l,I=o*s,N=o*l;e[0]=s*u,e[4]=-c,e[8]=l*u,e[1]=P*c+N,e[5]=a*u,e[9]=U*c-I,e[2]=I*c-U,e[6]=o*u,e[10]=N*c+P}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromQuaternion=function(t){return this.compose(Rn,t,Cn)},e.lookAt=function(t,e,n){var i=this.elements;return Un.subVectors(t,e),0===Un.lengthSq()&&(Un.z=1),Un.normalize(),Ln.crossVectors(n,Un),0===Ln.lengthSq()&&(1===Math.abs(n.z)?Un.x+=1e-4:Un.z+=1e-4,Un.normalize(),Ln.crossVectors(n,Un)),Ln.normalize(),Pn.crossVectors(Un,Ln),i[0]=Ln.x,i[4]=Pn.x,i[8]=Un.x,i[1]=Ln.y,i[5]=Pn.y,i[9]=Un.y,i[2]=Ln.z,i[6]=Pn.z,i[10]=Un.z,this},e.multiply=function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],_=n[11],x=n[15],M=i[0],S=i[4],b=i[8],E=i[12],w=i[1],T=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],U=i[14],I=i[3],N=i[7],D=i[11],O=i[15];return r[0]=a*M+o*w+s*C+l*I,r[4]=a*S+o*T+s*L+l*N,r[8]=a*b+o*A+s*P+l*D,r[12]=a*E+o*R+s*U+l*O,r[1]=u*M+c*w+h*C+d*I,r[5]=u*S+c*T+h*L+d*N,r[9]=u*b+c*A+h*P+d*D,r[13]=u*E+c*R+h*U+d*O,r[2]=p*M+f*w+m*C+v*I,r[6]=p*S+f*T+m*L+v*N,r[10]=p*b+f*A+m*P+v*D,r[14]=p*E+f*R+m*U+v*O,r[3]=g*M+y*w+_*C+x*I,r[7]=g*S+y*T+_*L+x*N,r[11]=g*b+y*A+_*P+x*D,r[15]=g*E+y*R+_*U+x*O,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],u=t[2],c=t[6],h=t[10],d=t[14];return t[3]*(+r*s*c-i*l*c-r*o*h+n*l*h+i*o*d-n*s*d)+t[7]*(+e*s*d-e*l*h+r*a*h-i*a*d+i*l*u-r*s*u)+t[11]*(+e*l*c-e*o*d-r*a*c+n*a*d+r*o*u-n*l*u)+t[15]*(-i*o*u-e*s*c+e*o*h+i*a*c-n*a*h+n*s*u)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.setPosition=function(t,e,n){var i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this},e.invert=function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],v=t[15],g=c*m*l-f*h*l+f*s*d-o*m*d-c*s*v+o*h*v,y=p*h*l-u*m*l-p*s*d+a*m*d+u*s*v-a*h*v,_=u*f*l-p*c*l+p*o*d-a*f*d-u*o*v+a*c*v,x=p*c*s-u*f*s-p*o*h+a*f*h+u*o*m-a*c*m,M=e*g+n*y+i*_+r*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/M;return t[0]=g*S,t[1]=(f*h*r-c*m*r-f*i*d+n*m*d+c*i*v-n*h*v)*S,t[2]=(o*m*r-f*s*r+f*i*l-n*m*l-o*i*v+n*s*v)*S,t[3]=(c*s*r-o*h*r-c*i*l+n*h*l+o*i*d-n*s*d)*S,t[4]=y*S,t[5]=(u*m*r-p*h*r+p*i*d-e*m*d-u*i*v+e*h*v)*S,t[6]=(p*s*r-a*m*r-p*i*l+e*m*l+a*i*v-e*s*v)*S,t[7]=(a*h*r-u*s*r+u*i*l-e*h*l-a*i*d+e*s*d)*S,t[8]=_*S,t[9]=(p*c*r-u*f*r-p*n*d+e*f*d+u*n*v-e*c*v)*S,t[10]=(a*f*r-p*o*r+p*n*l-e*f*l-a*n*v+e*o*v)*S,t[11]=(u*o*r-a*c*r-u*n*l+e*c*l+a*n*d-e*o*d)*S,t[12]=x*S,t[13]=(u*f*i-p*c*i+p*n*h-e*f*h-u*n*m+e*c*m)*S,t[14]=(p*o*i-a*f*i-p*n*s+e*f*s+a*n*m-e*o*m)*S,t[15]=(a*c*i-u*o*i+u*n*s-e*c*s-a*n*h+e*o*h)*S,this},e.scale=function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this},e.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},e.makeTranslation=function(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},e.makeRotationX=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},e.makeRotationY=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},e.makeRotationZ=function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},e.makeRotationAxis=function(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,o=t.y,s=t.z,l=r*a,u=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+n,u*s-i*a,0,l*s-i*o,u*s+i*a,r*s*s+n,0,0,0,0,1),this},e.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.makeShear=function(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this},e.compose=function(t,e,n){var i=this.elements,r=e._x,a=e._y,o=e._z,s=e._w,l=r+r,u=a+a,c=o+o,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,v=o*c,g=s*l,y=s*u,_=s*c,x=n.x,M=n.y,S=n.z;return i[0]=(1-(f+v))*x,i[1]=(d+_)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-_)*M,i[5]=(1-(h+v))*M,i[6]=(m+g)*M,i[7]=0,i[8]=(p+y)*S,i[9]=(m-g)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this},e.decompose=function(t,e,n){var i=this.elements,r=Tn.set(i[0],i[1],i[2]).length(),a=Tn.set(i[4],i[5],i[6]).length(),o=Tn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],An.copy(this);var s=1/r,l=1/a,u=1/o;return An.elements[0]*=s,An.elements[1]*=s,An.elements[2]*=s,An.elements[4]*=l,An.elements[5]*=l,An.elements[6]*=l,An.elements[8]*=u,An.elements[9]*=u,An.elements[10]*=u,e.setFromRotationMatrix(An),n.x=r,n.y=a,n.z=o,this},e.makePerspective=function(t,e,n,i,r,a,o){void 0===o&&(o=zt);var s,l,u=this.elements,c=2*r/(e-t),h=2*r/(n-i),d=(e+t)/(e-t),p=(n+i)/(n-i);if(o===zt)s=-(a+r)/(a-r),l=-2*a*r/(a-r);else{if(o!==Gt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);s=-a/(a-r),l=-a*r/(a-r)}return u[0]=c,u[4]=0,u[8]=d,u[12]=0,u[1]=0,u[5]=h,u[9]=p,u[13]=0,u[2]=0,u[6]=0,u[10]=s,u[14]=l,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this},e.makeOrthographic=function(t,e,n,i,r,a,o){void 0===o&&(o=zt);var s,l,u=this.elements,c=1/(e-t),h=1/(n-i),d=1/(a-r),p=(e+t)*c,f=(n+i)*h;if(o===zt)s=(a+r)*d,l=-2*d;else{if(o!==Gt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);s=r*d,l=-1*d}return u[0]=2*c,u[4]=0,u[8]=0,u[12]=-p,u[1]=0,u[5]=2*h,u[9]=0,u[13]=-f,u[2]=0,u[6]=0,u[10]=l,u[14]=-s,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this},e.equals=function(t){for(var e=this.elements,n=t.elements,i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t},t}(),Tn=new Ye,An=new wn,Rn=new Ye(0,0,0),Cn=new Ye(1,1,1),Ln=new Ye,Pn=new Ye,Un=new Ye,In=new wn,Nn=new qe,Dn=function(){function t(e,n,i,r){void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}var e=t.prototype;return e.set=function(t,e,n,i){return void 0===i&&(i=this._order),this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)},e.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},e.setFromRotationMatrix=function(t,e,n){void 0===e&&(e=this._order),void 0===n&&(n=!0);var i=t.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(oe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-oe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(oe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-oe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(oe(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-oe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this},e.setFromQuaternion=function(t,e,n){return In.makeRotationFromQuaternion(t),this.setFromRotationMatrix(In,e,n)},e.setFromVector3=function(t,e){return void 0===e&&(e=this._order),this.set(t.x,t.y,t.z,e)},e.reorder=function(t){return Nn.setFromEuler(this),this.setFromQuaternion(Nn,t)},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},e.fromArray=function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._x;case 2:return t.next=4,this._y;case 4:return t.next=6,this._z;case 6:return t.next=8,this._order;case 8:case"end":return t.stop()}}),t,this)})),Xt(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}])}();Dn.DEFAULT_ORDER="XYZ";var On=function(){function t(){this.mask=1}var e=t.prototype;return e.set=function(t){this.mask=1<<t>>>0},e.enable=function(t){this.mask|=1<<t},e.enableAll=function(){this.mask=-1},e.toggle=function(t){this.mask^=1<<t},e.disable=function(t){this.mask&=~(1<<t)},e.disableAll=function(){this.mask=0},e.test=function(t){return!!(this.mask&t.mask)},e.isEnabled=function(t){return!!(this.mask&1<<t)},t}(),Bn=0,Fn=new Ye,zn=new qe,Gn=new wn,kn=new Ye,Hn=new Ye,Vn=new Ye,Wn=new qe,Xn=new Ye(1,0,0),jn=new Ye(0,1,0),qn=new Ye(0,0,1),Yn={type:"added"},Zn={type:"removed"},Jn=function(t){function e(){var n;(n=t.call(this)||this).isObject3D=!0,Object.defineProperty(n,"id",{value:Bn++}),n.uuid=ae(),n.name="",n.type="Object3D",n.parent=null,n.children=[],n.up=e.DEFAULT_UP.clone();var i=new Ye,r=new Dn,a=new qe,o=new Ye(1,1,1);return r._onChange((function(){a.setFromEuler(r,!1)})),a._onChange((function(){r.setFromQuaternion(a,void 0,!1)})),Object.defineProperties(n,{position:{configurable:!0,enumerable:!0,value:i},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{configurable:!0,enumerable:!0,value:new wn},normalMatrix:{configurable:!0,enumerable:!0,value:new ve}}),n.matrix=new wn,n.matrixWorld=new wn,n.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,n.matrixWorldNeedsUpdate=!1,n.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,n.layers=new On,n.visible=!0,n.castShadow=!1,n.receiveShadow=!1,n.frustumCulled=!0,n.renderOrder=0,n.animations=[],n.userData={},n}Yt(e,t);var n=e.prototype;return n.onBeforeRender=function(){},n.onAfterRender=function(){},n.applyMatrix4=function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},n.applyQuaternion=function(t){return this.quaternion.premultiply(t),this},n.setRotationFromAxisAngle=function(t,e){this.quaternion.setFromAxisAngle(t,e)},n.setRotationFromEuler=function(t){this.quaternion.setFromEuler(t,!0)},n.setRotationFromMatrix=function(t){this.quaternion.setFromRotationMatrix(t)},n.setRotationFromQuaternion=function(t){this.quaternion.copy(t)},n.rotateOnAxis=function(t,e){return zn.setFromAxisAngle(t,e),this.quaternion.multiply(zn),this},n.rotateOnWorldAxis=function(t,e){return zn.setFromAxisAngle(t,e),this.quaternion.premultiply(zn),this},n.rotateX=function(t){return this.rotateOnAxis(Xn,t)},n.rotateY=function(t){return this.rotateOnAxis(jn,t)},n.rotateZ=function(t){return this.rotateOnAxis(qn,t)},n.translateOnAxis=function(t,e){return Fn.copy(t).applyQuaternion(this.quaternion),this.position.add(Fn.multiplyScalar(e)),this},n.translateX=function(t){return this.translateOnAxis(Xn,t)},n.translateY=function(t){return this.translateOnAxis(jn,t)},n.translateZ=function(t){return this.translateOnAxis(qn,t)},n.localToWorld=function(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)},n.worldToLocal=function(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Gn.copy(this.matrixWorld).invert())},n.lookAt=function(t,e,n){t.isVector3?kn.copy(t):kn.set(t,e,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Hn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gn.lookAt(Hn,kn,this.up):Gn.lookAt(kn,Hn,this.up),this.quaternion.setFromRotationMatrix(Gn),i&&(Gn.extractRotation(i.matrixWorld),zn.setFromRotationMatrix(Gn),this.quaternion.premultiply(zn.invert()))},n.add=function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Yn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},n.remove=function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Zn)),this},n.removeFromParent=function(){var t=this.parent;return null!==t&&t.remove(this),this},n.clear=function(){for(var t=0;t<this.children.length;t++){var e=this.children[t];e.parent=null,e.dispatchEvent(Zn)}return this.children.length=0,this},n.attach=function(t){return this.updateWorldMatrix(!0,!1),Gn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Gn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Gn),this.add(t),t.updateWorldMatrix(!1,!0),this},n.getObjectById=function(t){return this.getObjectByProperty("id",t)},n.getObjectByName=function(t){return this.getObjectByProperty("name",t)},n.getObjectByProperty=function(t,e){if(this[t]===e)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}},n.getObjectsByProperty=function(t,e){var n=[];this[t]===e&&n.push(this);for(var i=0,r=this.children.length;i<r;i++){var a=this.children[i].getObjectsByProperty(t,e);a.length>0&&(n=n.concat(a))}return n},n.getWorldPosition=function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Ye),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},n.getWorldQuaternion=function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new qe),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hn,t,Vn),t},n.getWorldScale=function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Ye),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hn,Wn,t),t},n.getWorldDirection=function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Ye),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},n.raycast=function(){},n.traverse=function(t){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverse(t)},n.traverseVisible=function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}},n.traverseAncestors=function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},n.updateMatrix=function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},n.updateMatrixWorld=function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++){var r=e[n];!0!==r.matrixWorldAutoUpdate&&!0!==t||r.updateMatrixWorld(t)}},n.updateWorldMatrix=function(t,e){var n=this.parent;if(!0===t&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e)for(var i=this.children,r=0,a=i.length;r<a;r++){var o=i[r];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}},n.toJSON=function(t){var e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});var i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),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),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);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,l=o.length;s<l;s++){var u=o[s];r(t.shapes,u)}else r(t.shapes,o)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(r(t.materials,this.material[h]));i.material=c}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(var p=0;p<this.children.length;p++)i.children.push(this.children[p].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(var f=0;f<this.animations.length;f++){var m=this.animations[f];i.animations.push(r(t.animations,m))}}if(e){var v=E(t.geometries),g=E(t.materials),y=E(t.textures),_=E(t.images),x=E(t.shapes),M=E(t.skeletons),S=E(t.animations),b=E(t.nodes);v.length>0&&(n.geometries=v),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),M.length>0&&(n.skeletons=M),S.length>0&&(n.animations=S),b.length>0&&(n.nodes=b)}return n.object=i,n;function E(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}},n.clone=function(t){return(new this.constructor).copy(this,t)},n.copy=function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var i=t.children[n];this.add(i.clone())}return this},e}(te);Jn.DEFAULT_UP=new Ye(0,1,0),Jn.DEFAULT_MATRIX_AUTO_UPDATE=!0,Jn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Kn=new Ye,Qn=new Ye,$n=new Ye,ti=new Ye,ei=new Ye,ni=new Ye,ii=new Ye,ri=new Ye,ai=new Ye,oi=new Ye,si=!1,li=function(){function t(t,e,n){void 0===t&&(t=new Ye),void 0===e&&(e=new Ye),void 0===n&&(n=new Ye),this.a=t,this.b=e,this.c=n}t.getNormal=function(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Ye),i.subVectors(n,e),Kn.subVectors(t,e),i.cross(Kn);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},t.getBarycoord=function(t,e,n,i,r){Kn.subVectors(i,e),Qn.subVectors(n,e),$n.subVectors(t,e);var a=Kn.dot(Kn),o=Kn.dot(Qn),s=Kn.dot($n),l=Qn.dot(Qn),u=Qn.dot($n),c=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Ye),0===c)return r.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,p=(a*u-o*s)*h;return r.set(1-d-p,p,d)},t.containsPoint=function(t,e,n,i){return this.getBarycoord(t,e,n,i,ti),ti.x>=0&&ti.y>=0&&ti.x+ti.y<=1},t.getUV=function(t,e,n,i,r,a,o,s){return!1===si&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),si=!0),this.getInterpolation(t,e,n,i,r,a,o,s)},t.getInterpolation=function(t,e,n,i,r,a,o,s){return this.getBarycoord(t,e,n,i,ti),s.setScalar(0),s.addScaledVector(r,ti.x),s.addScaledVector(a,ti.y),s.addScaledVector(o,ti.z),s},t.isFrontFacing=function(t,e,n,i){return Kn.subVectors(n,e),Qn.subVectors(t,e),Kn.cross(Qn).dot(i)<0};var e=t.prototype;return e.set=function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},e.setFromPointsAndIndices=function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},e.setFromAttributeAndIndices=function(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},e.getArea=function(){return Kn.subVectors(this.c,this.b),Qn.subVectors(this.a,this.b),.5*Kn.cross(Qn).length()},e.getMidpoint=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Ye),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},e.getNormal=function(e){return t.getNormal(this.a,this.b,this.c,e)},e.getPlane=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Plane),t.setFromCoplanarPoints(this.a,this.b,this.c)},e.getBarycoord=function(e,n){return t.getBarycoord(e,this.a,this.b,this.c,n)},e.getUV=function(e,n,i,r,a){return!1===si&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),si=!0),t.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)},e.getInterpolation=function(e,n,i,r,a){return t.getInterpolation(e,this.a,this.b,this.c,n,i,r,a)},e.containsPoint=function(e){return t.containsPoint(e,this.a,this.b,this.c)},e.isFrontFacing=function(e){return t.isFrontFacing(this.a,this.b,this.c,e)},e.intersectsBox=function(t){return t.intersectsTriangle(this)},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Ye);var n,i,r=this.a,a=this.b,o=this.c;ei.subVectors(a,r),ni.subVectors(o,r),ri.subVectors(t,r);var s=ei.dot(ri),l=ni.dot(ri);if(s<=0&&l<=0)return e.copy(r);ai.subVectors(t,a);var u=ei.dot(ai),c=ni.dot(ai);if(u>=0&&c<=u)return e.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),e.copy(r).addScaledVector(ei,n);oi.subVectors(t,o);var d=ei.dot(oi),p=ni.dot(oi);if(p>=0&&d<=p)return e.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),e.copy(r).addScaledVector(ni,i);var m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return ii.subVectors(o,a),i=(c-u)/(c-u+(d-p)),e.copy(a).addScaledVector(ii,i);var v=1/(m+f+h);return n=f*v,i=h*v,e.copy(r).addScaledVector(ei,n).addScaledVector(ni,i)},e.equals=function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},t}(),ui=0,ci=function(t){function e(){var e;return(e=t.call(this)||this).isMaterial=!0,Object.defineProperty(e,"id",{value:ui++}),e.uuid=ae(),e.name="",e.type="Material",e.blending=1,e.side=a,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=204,e.blendDst=205,e.blendEquation=s,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=Dt,e.stencilZFail=Dt,e.stencilZPass=Dt,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}Yt(e,t);var n=e.prototype;return n.onBuild=function(){},n.onBeforeRender=function(){},n.onBeforeCompile=function(){},n.customProgramCacheKey=function(){return this.onBeforeCompile.toString()},n.setValues=function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE.Material: '"+e+"' is not a property of THREE."+this.type+".")}else console.warn("THREE.Material: parameter '"+e+"' has value of undefined.")}},n.toJSON=function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.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.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==a&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),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,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!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.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){var r=i(t.textures),o=i(t.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},Xt(e,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])}(te),hi={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},di={h:0,s:0,l:0},pi={h:0,s:0,l:0};function fi(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}var mi=function(){function t(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}var e=t.prototype;return e.set=function(t,e,n){if(void 0===e&&void 0===n){var i=t;i&&i.isColor?this.copy(i):"number"==typeof i?this.setHex(i):"string"==typeof i&&this.setStyle(i)}else this.setRGB(t,e,n);return this},e.setScalar=function(t){return this.r=t,this.g=t,this.b=t,this},e.setHex=function(t,e){return void 0===e&&(e=Ie.workingColorSpace),t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ie.toWorkingColorSpace(this,e),this},e.setRGB=function(t,e,n,i){return void 0===i&&(i=Ie.workingColorSpace),this.r=t,this.g=e,this.b=n,Ie.toWorkingColorSpace(this,i),this},e.setHSL=function(t,e,n,i){if(void 0===i&&(i=Ie.workingColorSpace),t=se(t,1),e=oe(e,0,1),n=oe(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,a=2*n-r;this.r=fi(a,r,t+1/3),this.g=fi(a,r,t),this.b=fi(a,r,t-1/3)}return Ie.toWorkingColorSpace(this,i),this},e.setStyle=function(t,e){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var i;if(void 0===e&&(e=Ie.workingColorSpace),i=/^(\w+)\(([^\)]*)\)/.exec(t)){var r,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){var s=i[1],l=s.length;if(3===l)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===l)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this},e.setColorName=function(t,e){void 0===e&&(e=Ie.workingColorSpace);var n=hi[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this},e.clone=function(){return new this.constructor(this.r,this.g,this.b)},e.copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},e.copySRGBToLinear=function(t){return this.r=Te(t.r),this.g=Te(t.g),this.b=Te(t.b),this},e.copyLinearToSRGB=function(t){return this.r=Ae(t.r),this.g=Ae(t.g),this.b=Ae(t.b),this},e.convertSRGBToLinear=function(){return this.copySRGBToLinear(this),this},e.convertLinearToSRGB=function(){return this.copyLinearToSRGB(this),this},e.getHex=function(t){return void 0===t&&(t=Ie.workingColorSpace),Ie.fromWorkingColorSpace(vi.copy(this),t),65536*Math.round(oe(255*vi.r,0,255))+256*Math.round(oe(255*vi.g,0,255))+Math.round(oe(255*vi.b,0,255))},e.getHexString=function(t){return void 0===t&&(t=Ie.workingColorSpace),("000000"+this.getHex(t).toString(16)).slice(-6)},e.getHSL=function(t,e){void 0===e&&(e=Ie.workingColorSpace),void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0}),Ie.fromWorkingColorSpace(vi.copy(this),e);var n,i,r=vi.r,a=vi.g,o=vi.b,s=Math.max(r,a,o),l=Math.min(r,a,o),u=(l+s)/2;if(l===s)n=0,i=0;else{var c=s-l;switch(i=u<=.5?c/(s+l):c/(2-s-l),s){case r:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-r)/c+2;break;case o:n=(r-a)/c+4}n/=6}return t.h=n,t.s=i,t.l=u,t},e.getRGB=function(t,e){return void 0===e&&(e=Ie.workingColorSpace),Ie.fromWorkingColorSpace(vi.copy(this),e),t.r=vi.r,t.g=vi.g,t.b=vi.b,t},e.getStyle=function(t){void 0===t&&(t=Ie.workingColorSpace),Ie.fromWorkingColorSpace(vi.copy(this),t);var e=vi.r,n=vi.g,i=vi.b;return t!==Ut?"color("+t+" "+e.toFixed(3)+" "+n.toFixed(3)+" "+i.toFixed(3)+")":"rgb("+Math.round(255*e)+","+Math.round(255*n)+","+Math.round(255*i)+")"},e.offsetHSL=function(t,e,n){return this.getHSL(di),di.h+=t,di.s+=e,di.l+=n,this.setHSL(di.h,di.s,di.l),this},e.add=function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},e.addColors=function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},e.addScalar=function(t){return this.r+=t,this.g+=t,this.b+=t,this},e.sub=function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},e.multiply=function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},e.multiplyScalar=function(t){return this.r*=t,this.g*=t,this.b*=t,this},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},e.lerpColors=function(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this},e.lerpHSL=function(t,e){this.getHSL(di),t.getHSL(pi);var n=le(di.h,pi.h,e),i=le(di.s,pi.s,e),r=le(di.l,pi.l,e);return this.setHSL(n,i,r),this},e.setFromVector3=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this},e.applyMatrix3=function(t){var e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},e.fromArray=function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},e.fromBufferAttribute=function(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this},e.toJSON=function(){return this.getHex()},e[Symbol.iterator]=Jt().mark((function t(){return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.r;case 2:return t.next=4,this.g;case 4:return t.next=6,this.b;case 6:case"end":return t.stop()}}),t,this)})),t}(),vi=new mi;mi.NAMES=hi;var gi=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshBasicMaterial=!0,n.type="MeshBasicMaterial",n.color=new mi(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=l,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.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.fog=e.fog,this},e}(ci),yi=_i();function _i(){for(var t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(i[a]=0,i[256|a]=32768,r[a]=24,r[256|a]=24):o<-14?(i[a]=1024>>-o-14,i[256|a]=1024>>-o-14|32768,r[a]=-o-1,r[256|a]=-o-1):o<=15?(i[a]=o+15<<10,i[256|a]=o+15<<10|32768,r[a]=13,r[256|a]=13):o<128?(i[a]=31744,i[256|a]=64512,r[a]=24,r[256|a]=24):(i[a]=31744,i[256|a]=64512,r[a]=13,r[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;!(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var p=1024;p<2048;++p)s[p]=939524096+(p-1024<<13);for(var f=1;f<31;++f)l[f]=f<<23;l[31]=1199570944,l[32]=2147483648;for(var m=33;m<63;++m)l[m]=2147483648+(m-32<<23);l[63]=3347054592;for(var v=1;v<64;++v)32!==v&&(u[v]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:l,offsetTable:u}}function xi(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=oe(t,-65504,65504),yi.floatView[0]=t;var e=yi.uint32View[0],n=e>>23&511;return yi.baseTable[n]+((8388607&e)>>yi.shiftTable[n])}function Mi(t){var e=t>>10;return yi.uint32View[0]=yi.mantissaTable[yi.offsetTable[e]+(1023&t)]+yi.exponentTable[e],yi.floatView[0]}var Si={toHalfFloat:xi,fromHalfFloat:Mi},bi=new Ye,Ei=new me,wi=function(){function t(t,e,n){if(void 0===n&&(n=!1),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=Ot,this.updateRange={offset:0,count:-1},this.gpuType=O,this.version=0}var e=t.prototype;return e.onUploadCallback=function(){},e.setUsage=function(t){return this.usage=t,this},e.copy=function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this},e.copyAt=function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},e.copyArray=function(t){return this.array.set(t),this},e.applyMatrix3=function(t){if(2===this.itemSize)for(var e=0,n=this.count;e<n;e++)Ei.fromBufferAttribute(this,e),Ei.applyMatrix3(t),this.setXY(e,Ei.x,Ei.y);else if(3===this.itemSize)for(var i=0,r=this.count;i<r;i++)bi.fromBufferAttribute(this,i),bi.applyMatrix3(t),this.setXYZ(i,bi.x,bi.y,bi.z);return this},e.applyMatrix4=function(t){for(var e=0,n=this.count;e<n;e++)bi.fromBufferAttribute(this,e),bi.applyMatrix4(t),this.setXYZ(e,bi.x,bi.y,bi.z);return this},e.applyNormalMatrix=function(t){for(var e=0,n=this.count;e<n;e++)bi.fromBufferAttribute(this,e),bi.applyNormalMatrix(t),this.setXYZ(e,bi.x,bi.y,bi.z);return this},e.transformDirection=function(t){for(var e=0,n=this.count;e<n;e++)bi.fromBufferAttribute(this,e),bi.transformDirection(t),this.setXYZ(e,bi.x,bi.y,bi.z);return this},e.set=function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},e.getX=function(t){var e=this.array[t*this.itemSize];return this.normalized&&(e=de(e,this.array)),e},e.setX=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize]=e,this},e.getY=function(t){var e=this.array[t*this.itemSize+1];return this.normalized&&(e=de(e,this.array)),e},e.setY=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+1]=e,this},e.getZ=function(t){var e=this.array[t*this.itemSize+2];return this.normalized&&(e=de(e,this.array)),e},e.setZ=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+2]=e,this},e.getW=function(t){var e=this.array[t*this.itemSize+3];return this.normalized&&(e=de(e,this.array)),e},e.setW=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+3]=e,this},e.setXY=function(t,e,n){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this},e.setXYZ=function(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},e.setXYZW=function(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array),r=pe(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},e.onUpload=function(t){return this.onUploadCallback=t,this},e.clone=function(){return new this.constructor(this.array,this.itemSize).copy(this)},e.toJSON=function(){var t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Ot&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t},e.copyColorsArray=function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new mi),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this},e.copyVector2sArray=function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new me),e[n++]=a.x,e[n++]=a.y}return this},e.copyVector3sArray=function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new Ye),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},e.copyVector4sArray=function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new Vector4),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this},Xt(t,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])}(),Ti=function(t){function e(e,n,i){return t.call(this,new Int8Array(e),n,i)||this}return Yt(e,t),e}(wi),Ai=function(t){function e(e,n,i){return t.call(this,new Uint8Array(e),n,i)||this}return Yt(e,t),e}(wi),Ri=function(t){function e(e,n,i){return t.call(this,new Uint8ClampedArray(e),n,i)||this}return Yt(e,t),e}(wi),Ci=function(t){function e(e,n,i){return t.call(this,new Int16Array(e),n,i)||this}return Yt(e,t),e}(wi),Li=function(t){function e(e,n,i){return t.call(this,new Uint16Array(e),n,i)||this}return Yt(e,t),e}(wi),Pi=function(t){function e(e,n,i){return t.call(this,new Int32Array(e),n,i)||this}return Yt(e,t),e}(wi),Ui=function(t){function e(e,n,i){return t.call(this,new Uint32Array(e),n,i)||this}return Yt(e,t),e}(wi),Ii=function(t){function e(e,n,i){var r;return(r=t.call(this,new Uint16Array(e),n,i)||this).isFloat16BufferAttribute=!0,r}Yt(e,t);var n=e.prototype;return n.getX=function(t){var e=Mi(this.array[t*this.itemSize]);return this.normalized&&(e=de(e,this.array)),e},n.setX=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize]=xi(e),this},n.getY=function(t){var e=Mi(this.array[t*this.itemSize+1]);return this.normalized&&(e=de(e,this.array)),e},n.setY=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+1]=xi(e),this},n.getZ=function(t){var e=Mi(this.array[t*this.itemSize+2]);return this.normalized&&(e=de(e,this.array)),e},n.setZ=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+2]=xi(e),this},n.getW=function(t){var e=Mi(this.array[t*this.itemSize+3]);return this.normalized&&(e=de(e,this.array)),e},n.setW=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.array[t*this.itemSize+3]=xi(e),this},n.setXY=function(t,e,n){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array)),this.array[t+0]=xi(e),this.array[t+1]=xi(n),this},n.setXYZ=function(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array)),this.array[t+0]=xi(e),this.array[t+1]=xi(n),this.array[t+2]=xi(i),this},n.setXYZW=function(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array),r=pe(r,this.array)),this.array[t+0]=xi(e),this.array[t+1]=xi(n),this.array[t+2]=xi(i),this.array[t+3]=xi(r),this},e}(wi),Ni=function(t){function e(e,n,i){return t.call(this,new Float32Array(e),n,i)||this}return Yt(e,t),e}(wi),Di=function(t){function e(e,n,i){return t.call(this,new Float64Array(e),n,i)||this}return Yt(e,t),e}(wi),Oi=0,Bi=new wn,Fi=new Jn,zi=new Ye,Gi=new Ke,ki=new Ke,Hi=new Ye,Vi=function(t){function e(){var e;return(e=t.call(this)||this).isBufferGeometry=!0,Object.defineProperty(e,"id",{value:Oi++,writable:!0,enumerable:!0,configurable:!0}),e.uuid=ae(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}Yt(e,t);var n=e.prototype;return n.getIndex=function(){return this.index},n.setIndex=function(t){return Array.isArray(t)?this.index=new(ye(t)?Ui:Li)(t,1):this.index=t,this},n.getAttribute=function(t){return this.attributes[t]},n.setAttribute=function(t,e){return this.attributes[t]=e,this},n.deleteAttribute=function(t){return delete this.attributes[t],this},n.hasAttribute=function(t){return void 0!==this.attributes[t]},n.addGroup=function(t,e,n){void 0===n&&(n=0),this.groups.push({start:t,count:e,materialIndex:n})},n.clearGroups=function(){this.groups=[]},n.setDrawRange=function(t,e){this.drawRange.start=t,this.drawRange.count=e},n.applyMatrix4=function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new ve).getNormalMatrix(t);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},n.applyQuaternion=function(t){return Bi.makeRotationFromQuaternion(t),this.applyMatrix4(Bi),this},n.rotateX=function(t){return Bi.makeRotationX(t),this.applyMatrix4(Bi),this},n.rotateY=function(t){return Bi.makeRotationY(t),this.applyMatrix4(Bi),this},n.rotateZ=function(t){return Bi.makeRotationZ(t),this.applyMatrix4(Bi),this},n.translate=function(t,e,n){return Bi.makeTranslation(t,e,n),this.applyMatrix4(Bi),this},n.scale=function(t,e,n){return Bi.makeScale(t,e,n),this.applyMatrix4(Bi),this},n.lookAt=function(t){return Fi.lookAt(t),Fi.updateMatrix(),this.applyMatrix4(Fi.matrix),this},n.center=function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},n.setFromPoints=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ni(e,3)),this},n.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new Ke);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Ye(-1/0,-1/0,-1/0),new Ye(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,i=e.length;n<i;n++){var r=e[n];Gi.setFromBufferAttribute(r),this.morphTargetsRelative?(Hi.addVectors(this.boundingBox.min,Gi.min),this.boundingBox.expandByPoint(Hi),Hi.addVectors(this.boundingBox.max,Gi.max),this.boundingBox.expandByPoint(Hi)):(this.boundingBox.expandByPoint(Gi.min),this.boundingBox.expandByPoint(Gi.max))}}else 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)},n.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new vn);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Ye,1/0);if(t){var n=this.boundingSphere.center;if(Gi.setFromBufferAttribute(t),e)for(var i=0,r=e.length;i<r;i++){var a=e[i];ki.setFromBufferAttribute(a),this.morphTargetsRelative?(Hi.addVectors(Gi.min,ki.min),Gi.expandByPoint(Hi),Hi.addVectors(Gi.max,ki.max),Gi.expandByPoint(Hi)):(Gi.expandByPoint(ki.min),Gi.expandByPoint(ki.max))}Gi.getCenter(n);for(var o=0,s=0,l=t.count;s<l;s++)Hi.fromBufferAttribute(t,s),o=Math.max(o,n.distanceToSquared(Hi));if(e)for(var u=0,c=e.length;u<c;u++)for(var h=e[u],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)Hi.fromBufferAttribute(h,p),d&&(zi.fromBufferAttribute(t,p),Hi.add(zi)),o=Math.max(o,n.distanceToSquared(Hi));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},n.computeTangents=function(){var t=this.index,e=this.attributes;if(null!==t&&void 0!==e.position&&void 0!==e.normal&&void 0!==e.uv){var n=t.array,i=e.position.array,r=e.normal.array,a=e.uv.array,o=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new wi(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new Ye,u[c]=new Ye;var h=new Ye,d=new Ye,p=new Ye,f=new me,m=new me,v=new me,g=new Ye,y=new Ye,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,M=_.length;x<M;++x)for(var S=_[x],b=S.start,E=b,w=b+S.count;E<w;E+=3)O(n[E+0],n[E+1],n[E+2]);for(var T=new Ye,A=new Ye,R=new Ye,C=new Ye,L=0,P=_.length;L<P;++L)for(var U=_[L],I=U.start,N=I,D=I+U.count;N<D;N+=3)B(n[N+0]),B(n[N+1]),B(n[N+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(t,e,n){h.fromArray(i,3*t),d.fromArray(i,3*e),p.fromArray(i,3*n),f.fromArray(a,2*t),m.fromArray(a,2*e),v.fromArray(a,2*n),d.sub(h),p.sub(h),m.sub(f),v.sub(f);var r=1/(m.x*v.y-v.x*m.y);isFinite(r)&&(g.copy(d).multiplyScalar(v.y).addScaledVector(p,-m.y).multiplyScalar(r),y.copy(p).multiplyScalar(m.x).addScaledVector(d,-v.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[n].add(g),u[t].add(y),u[e].add(y),u[n].add(y))}function B(t){R.fromArray(r,3*t),C.copy(R);var e=l[t];T.copy(e),T.sub(R.multiplyScalar(R.dot(e))).normalize(),A.crossVectors(C,e);var n=A.dot(u[t])<0?-1:1;s[4*t]=T.x,s[4*t+1]=T.y,s[4*t+2]=T.z,s[4*t+3]=n}},n.computeVertexNormals=function(){var t=this.index,e=this.getAttribute("position");if(void 0!==e){var n=this.getAttribute("normal");if(void 0===n)n=new wi(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(var i=0,r=n.count;i<r;i++)n.setXYZ(i,0,0,0);var a=new Ye,o=new Ye,s=new Ye,l=new Ye,u=new Ye,c=new Ye,h=new Ye,d=new Ye;if(t)for(var p=0,f=t.count;p<f;p+=3){var m=t.getX(p+0),v=t.getX(p+1),g=t.getX(p+2);a.fromBufferAttribute(e,m),o.fromBufferAttribute(e,v),s.fromBufferAttribute(e,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,m),u.fromBufferAttribute(n,v),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(v,u.x,u.y,u.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=e.count;y<_;y+=3)a.fromBufferAttribute(e,y+0),o.fromBufferAttribute(e,y+1),s.fromBufferAttribute(e,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}},n.merge=function(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this},n.normalizeNormals=function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)Hi.fromBufferAttribute(t,e),Hi.normalize(),t.setXYZ(e,Hi.x,Hi.y,Hi.z)},n.toNonIndexed=function(){function t(t,e){for(var n=t.array,i=t.itemSize,r=t.normalized,a=new n.constructor(e.length*i),o=0,s=0,l=0,u=e.length;l<u;l++){o=t.isInterleavedBufferAttribute?e[l]*t.data.stride+t.offset:e[l]*i;for(var c=0;c<i;c++)a[s++]=n[o++]}return new wi(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var n=new e,i=this.index.array,r=this.attributes;for(var a in r){var o=t(r[a],i);n.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var p=t(c[h],i);u.push(p)}n.morphAttributes[l]=u}n.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,m=0,v=f.length;m<v;m++){var g=f[m];n.addGroup(g.start,g.count,g.materialIndex)}return n},n.toJSON=function(){var t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;null!==i&&(t.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a];t.data.attributes[a]=o.toJSON(t.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,p=c.length;d<p;d++){var f=c[d];h.push(f.toJSON(t.data))}h.length>0&&(s[u]=h,l=!0)}l&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);var m=this.groups;m.length>0&&(t.data.groups=JSON.parse(JSON.stringify(m)));var v=this.boundingSphere;return null!==v&&(t.data.boundingSphere={center:v.center.toArray(),radius:v.radius}),t},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var i=t.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(e));this.morphAttributes[s]=l}this.morphTargetsRelative=t.morphTargetsRelative;for(var d=t.groups,p=0,f=d.length;p<f;p++){var m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}var v=t.boundingBox;null!==v&&(this.boundingBox=v.clone());var g=t.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(te),Wi=new wn,Xi=new En,ji=new vn,qi=new Ye,Yi=new Ye,Zi=new Ye,Ji=new Ye,Ki=new Ye,Qi=new Ye,$i=new me,tr=new me,er=new me,nr=new Ye,ir=new Ye,rr=new Ye,ar=new Ye,or=new Ye,sr=function(t){function e(e,n){var i;return void 0===e&&(e=new Vi),void 0===n&&(n=new gi),(i=t.call(this)||this).isMesh=!0,i.type="Mesh",i.geometry=e,i.material=n,i.geometry.isCompatibleGeometry&&i.geometry.updateBuffer(),i.updateMorphTargets(),i}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this},n.updateMorphTargets=function(){var t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){var n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}},n.getVertexPosition=function(t,e){var n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(i,t);var o=this.morphTargetInfluences;if(r&&o){Qi.set(0,0,0);for(var s=0,l=r.length;s<l;s++){var u=o[s],c=r[s];0!==u&&(Ki.fromBufferAttribute(c,t),a?Qi.addScaledVector(Ki,u):Qi.addScaledVector(Ki.sub(e),u))}e.add(Qi)}return e},n.raycast=function(t,e){var n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(r),Xi.copy(t.ray).recast(t.near),!1===ji.containsPoint(Xi.origin)){if(null===Xi.intersectSphere(ji,qi))return;if(Xi.origin.distanceToSquared(qi)>Math.pow(t.far-t.near,2))return}Wi.copy(r).invert(),Xi.copy(t.ray).applyMatrix4(Wi),null!==n.boundingBox&&!1===Xi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,Xi)}},n._computeIntersections=function(t,e,n){var i,r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(a))for(var p=0,f=h.length;p<f;p++)for(var m=h[p],v=a[m.materialIndex],g=Math.max(m.start,d.start),y=Math.min(o.count,Math.min(m.start+m.count,d.start+d.count));g<y;g+=3){(i=lr(this,v,t,n,l,u,c,o.getX(g),o.getX(g+1),o.getX(g+2)))&&(i.faceIndex=Math.floor(g/3),i.face.materialIndex=m.materialIndex,e.push(i))}else for(var _=Math.max(0,d.start),x=Math.min(o.count,d.start+d.count);_<x;_+=3){(i=lr(this,a,t,n,l,u,c,o.getX(_),o.getX(_+1),o.getX(_+2)))&&(i.faceIndex=Math.floor(_/3),e.push(i))}else if(void 0!==s)if(Array.isArray(a))for(var M=0,S=h.length;M<S;M++)for(var b=h[M],E=a[b.materialIndex],w=Math.max(b.start,d.start),T=Math.min(s.count,Math.min(b.start+b.count,d.start+d.count));w<T;w+=3){(i=lr(this,E,t,n,l,u,c,w,w+1,w+2))&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=b.materialIndex,e.push(i))}else for(var A=Math.max(0,d.start),R=Math.min(s.count,d.start+d.count);A<R;A+=3){(i=lr(this,a,t,n,l,u,c,A,A+1,A+2))&&(i.faceIndex=Math.floor(A/3),e.push(i))}},e}(Jn);function lr(t,e,n,i,r,s,l,u,c,h){t.getVertexPosition(u,Yi),t.getVertexPosition(c,Zi),t.getVertexPosition(h,Ji);var d=function(t,e,n,i,r,s,l,u){if(null===(e.side===o?i.intersectTriangle(l,s,r,!0,u):i.intersectTriangle(r,s,l,e.side===a,u)))return null;or.copy(u),or.applyMatrix4(t.matrixWorld);var c=n.ray.origin.distanceTo(or);return c<n.near||c>n.far?null:{distance:c,point:or.clone(),object:t}}(t,e,n,i,Yi,Zi,Ji,ar);if(d){r&&($i.fromBufferAttribute(r,u),tr.fromBufferAttribute(r,c),er.fromBufferAttribute(r,h),d.uv=li.getInterpolation(ar,Yi,Zi,Ji,$i,tr,er,new me)),s&&($i.fromBufferAttribute(s,u),tr.fromBufferAttribute(s,c),er.fromBufferAttribute(s,h),d.uv1=li.getInterpolation(ar,Yi,Zi,Ji,$i,tr,er,new me),d.uv2=d.uv1),l&&(nr.fromBufferAttribute(l,u),ir.fromBufferAttribute(l,c),rr.fromBufferAttribute(l,h),d.normal=li.getInterpolation(ar,Yi,Zi,Ji,nr,ir,rr,new Ye),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));var p={a:u,b:c,c:h,normal:new Ye,materialIndex:0};li.getNormal(Yi,Zi,Ji,p.normal),d.face=p}return d}var ur=function(t){function e(e,n,i,r,a,o){var s;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=1),void 0===a&&(a=1),void 0===o&&(o=1),(s=t.call(this)||this).type="BoxGeometry",s.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:a,depthSegments:o};var l=s;r=Math.floor(r),a=Math.floor(a),o=Math.floor(o);var u=[],c=[],h=[],d=[],p=0,f=0;function m(t,e,n,i,r,a,o,s,m,v,g){for(var y=a/m,_=o/v,x=a/2,M=o/2,S=s/2,b=m+1,E=v+1,w=0,T=0,A=new Ye,R=0;R<E;R++)for(var C=R*_-M,L=0;L<b;L++){var P=L*y-x;A[t]=P*i,A[e]=C*r,A[n]=S,c.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=s>0?1:-1,h.push(A.x,A.y,A.z),d.push(L/m),d.push(1-R/v),w+=1}for(var U=0;U<v;U++)for(var I=0;I<m;I++){var N=p+I+b*U,D=p+I+b*(U+1),O=p+(I+1)+b*(U+1),B=p+(I+1)+b*U;u.push(N,D,B),u.push(D,O,B),T+=6}l.addGroup(f,T,g),f+=T,p+=w}return m("z","y","x",-1,-1,i,n,e,o,a,0),m("z","y","x",1,-1,i,n,-e,o,a,1),m("x","z","y",1,1,e,i,n,r,o,2),m("x","z","y",1,-1,e,i,-n,r,o,3),m("x","y","z",1,-1,e,n,i,r,a,4),m("x","y","z",-1,-1,e,n,-i,r,a,5),s.setIndex(u),s.setAttribute("position",new Ni(c,3)),s.setAttribute("normal",new Ni(h,3)),s.setAttribute("uv",new Ni(d,2)),s}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)},e}(Vi);function cr(t){var e={};for(var n in t)for(var i in e[n]={},t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}return e}function hr(t){for(var e={},n=0;n<t.length;n++){var i=cr(t[n]);for(var r in i)e[r]=i[r]}return e}function dr(t){return null===t.getRenderTarget()?t.outputColorSpace:It}var pr={clone:cr,merge:hr},fr=function(t){function e(e){var n;return(n=t.call(this)||this).isShaderMaterial=!0,n.type="ShaderMaterial",n.defines={},n.uniforms={},n.uniformsGroups=[],n.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",n.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",n.linewidth=1,n.wireframe=!1,n.wireframeLinewidth=1,n.fog=!1,n.lights=!1,n.clipping=!1,n.forceSinglePass=!0,n.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},n.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},n.index0AttributeName=void 0,n.uniformsNeedUpdate=!1,n.glslVersion=null,void 0!==e&&n.setValues(e),n}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cr(e.uniforms),this.uniformsGroups=function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].clone());return e}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);for(var i in n.glslVersion=this.glslVersion,n.uniforms={},this.uniforms){var r=this.uniforms[i].value;r&&r.isTexture?n.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?n.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?n.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?n.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?n.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?n.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?n.uniforms[i]={type:"m4",value:r.toArray()}:n.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(n.extensions=a),n},e}(ci),mr=function(t){function e(){var e;return(e=t.call(this)||this).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new wn,e.projectionMatrix=new wn,e.projectionMatrixInverse=new wn,e.coordinateSystem=zt,e}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this},n.getWorldDirection=function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Ye),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},n.updateMatrixWorld=function(e){t.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},n.updateWorldMatrix=function(e,n){t.prototype.updateWorldMatrix.call(this,e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()},n.clone=function(){return(new this.constructor).copy(this)},e}(Jn),vr=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=50),void 0===n&&(n=1),void 0===i&&(i=.1),void 0===r&&(r=2e3),(a=t.call(this)||this).isPerspectiveCamera=!0,a.type="PerspectiveCamera",a.fov=e,a.zoom=1,a.near=i,a.far=r,a.focus=10,a.aspect=n,a.view=null,a.filmGauge=35,a.filmOffset=0,a.updateProjectionMatrix(),a}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),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},n.setFocalLength=function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*re*Math.atan(e),this.updateProjectionMatrix()},n.getFocalLength=function(){var t=Math.tan(.5*ie*this.fov);return.5*this.getFilmHeight()/t},n.getEffectiveFOV=function(){return 2*re*Math.atan(Math.tan(.5*ie*this.fov)/this.zoom)},n.getFilmWidth=function(){return this.filmGauge*Math.min(this.aspect,1)},n.getFilmHeight=function(){return this.filmGauge/Math.max(this.aspect,1)},n.setViewOffset=function(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},n.clearViewOffset=function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},n.updateProjectionMatrix=function(){var t=this.near,e=t*Math.tan(.5*ie*this.fov)/this.zoom,n=2*e,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,e-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=t*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,null!==this.view&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n},e}(mr),gr=-90,yr=function(t){function e(e,n,i){var r;(r=t.call(this)||this).type="CubeCamera",r.renderTarget=i,r.coordinateSystem=null;var a=new vr(gr,1,e,n);a.layers=r.layers,r.add(a);var o=new vr(gr,1,e,n);o.layers=r.layers,r.add(o);var s=new vr(gr,1,e,n);s.layers=r.layers,r.add(s);var l=new vr(gr,1,e,n);l.layers=r.layers,r.add(l);var u=new vr(gr,1,e,n);u.layers=r.layers,r.add(u);var c=new vr(gr,1,e,n);return c.layers=r.layers,r.add(c),r}Yt(e,t);var n=e.prototype;return n.updateCoordinateSystem=function(){for(var t,e=this.coordinateSystem,n=this.children.concat(),i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=jt(n);!(t=u()).done;){var c=t.value;this.remove(c)}if(e===zt)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(e!==Gt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}for(var h,d=jt(n);!(h=d()).done;){var p=h.value;this.add(p),p.updateMatrixWorld()}},n.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());var i=this.children,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=t.getRenderTarget(),d=t.toneMapping,p=t.xr.enabled;t.toneMapping=h,t.xr.enabled=!1;var f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,a),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,l),n.texture.generateMipmaps=f,t.setRenderTarget(n,5),t.render(e,u),t.setRenderTarget(c),t.toneMapping=d,t.xr.enabled=p,n.texture.needsPMREMUpdate=!0},e}(Jn),_r=function(t){function e(e,n,i,r,a,o,s,l,u,c){var h;return e=void 0!==e?e:[],n=void 0!==n?n:y,(h=t.call(this,e,n,i,r,a,o,s,l,u,c)||this).isCubeTexture=!0,h.flipY=!1,h}return Yt(e,t),Xt(e,[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}])}(ze),xr=function(t){function e(e,n){var i;void 0===e&&(e=1),void 0===n&&(n={}),(i=t.call(this,e,e,n)||this).isWebGLCubeRenderTarget=!0;var r={width:e,height:e,depth:1},a=[r,r,r,r,r,r];return void 0!==n.encoding&&(we("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Lt?Ut:Pt),i.texture=new _r(a,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),i.texture.isRenderTargetTexture=!0,i.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,i.texture.minFilter=void 0!==n.minFilter?n.minFilter:C,i}Yt(e,t);var n=e.prototype;return n.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;var n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new ur(5,5,5),s=new fr({name:"CubemapFromEquirect",uniforms:cr(n),vertexShader:i,fragmentShader:r,side:o,blending:0});s.uniforms.tEquirect.value=e;var l=new sr(a,s),u=e.minFilter;return e.minFilter===P&&(e.minFilter=C),new yr(1,10,this).update(t,l),e.minFilter=u,l.geometry.dispose(),l.material.dispose(),this},n.clear=function(t,e,n,i){for(var r=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,i);t.setRenderTarget(r)},e}(ke),Mr=new Ye,Sr=new Ye,br=new ve,Er=function(){function t(t,e){void 0===t&&(t=new Ye(1,0,0)),void 0===e&&(e=0),this.isPlane=!0,this.normal=t,this.constant=e}var e=t.prototype;return e.set=function(t,e){return this.normal.copy(t),this.constant=e,this},e.setComponents=function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},e.setFromNormalAndCoplanarPoint=function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},e.setFromCoplanarPoints=function(t,e,n){var i=Mr.subVectors(n,e).cross(Sr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this},e.copy=function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},e.normalize=function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},e.negate=function(){return this.constant*=-1,this.normal.negate(),this},e.distanceToPoint=function(t){return this.normal.dot(t)+this.constant},e.distanceToSphere=function(t){return this.distanceToPoint(t.center)-t.radius},e.projectPoint=function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Ye),e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))},e.intersectLine=function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Ye);var n=t.delta(Mr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;var r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)},e.intersectsLine=function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},e.intersectsBox=function(t){return t.intersectsPlane(this)},e.intersectsSphere=function(t){return t.intersectsPlane(this)},e.coplanarPoint=function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Ye),t.copy(this.normal).multiplyScalar(-this.constant)},e.applyMatrix4=function(t,e){var n=e||br.getNormalMatrix(t),i=this.coplanarPoint(Mr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},e.translate=function(t){return this.constant-=t.dot(this.normal),this},e.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},e.clone=function(){return(new this.constructor).copy(this)},t}(),wr=new vn,Tr=new Ye,Ar=function(){function t(t,e,n,i,r,a){void 0===t&&(t=new Er),void 0===e&&(e=new Er),void 0===n&&(n=new Er),void 0===i&&(i=new Er),void 0===r&&(r=new Er),void 0===a&&(a=new Er),this.planes=[t,e,n,i,r,a]}var e=t.prototype;return e.set=function(t,e,n,i,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},e.copy=function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},e.setFromProjectionMatrix=function(t,e){void 0===e&&(e=zt);var n=this.planes,i=t.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],_=i[15];if(n[0].setComponents(s-r,h-l,m-d,_-v).normalize(),n[1].setComponents(s+r,h+l,m+d,_+v).normalize(),n[2].setComponents(s+a,h+u,m+p,_+g).normalize(),n[3].setComponents(s-a,h-u,m-p,_-g).normalize(),n[4].setComponents(s-o,h-c,m-f,_-y).normalize(),e===zt)n[5].setComponents(s+o,h+c,m+f,_+y).normalize();else{if(e!==Gt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,c,f,y).normalize()}return this},e.intersectsObject=function(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),wr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{var e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),wr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(wr)},e.intersectsSprite=function(t){return wr.center.set(0,0,0),wr.radius=.7071067811865476,wr.applyMatrix4(t.matrixWorld),this.intersectsSphere(wr)},e.intersectsSphere=function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)<i)return!1}return!0},e.intersectsBox=function(t){for(var e=this.planes,n=0;n<6;n++){var i=e[n];if(Tr.x=i.normal.x>0?t.max.x:t.min.x,Tr.y=i.normal.y>0?t.max.y:t.min.y,Tr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Tr)<0)return!1}return!0},e.containsPoint=function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0},e.clone=function(){return(new this.constructor).copy(this)},t}();function Rr(){var t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Cr(t,e){var n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){var a=i.get(e);(!a||a.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version})}else{e.isInterleavedBufferAttribute&&(e=e.data);var o=i.get(e);void 0===o?i.set(e,function(e,i){var r,a=e.array,o=e.usage,s=t.createBuffer();if(t.bindBuffer(i,s),t.bufferData(i,a,o),e.onUploadCallback(),a instanceof Float32Array)r=t.FLOAT;else if(a instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");r=t.HALF_FLOAT}else r=t.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=t.SHORT;else if(a instanceof Uint32Array)r=t.UNSIGNED_INT;else if(a instanceof Int32Array)r=t.INT;else if(a instanceof Int8Array)r=t.BYTE;else if(a instanceof Uint8Array)r=t.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);r=t.UNSIGNED_BYTE}return{buffer:s,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(!function(e,i,r){var a=i.array,o=i.updateRange;t.bindBuffer(r,e),-1===o.count?t.bufferSubData(r,0,a):(n?t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),i.onUploadCallback()}(o.buffer,e,r),o.version=e.version)}}}}var Lr=function(t){function e(e,n,i,r){var a;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=1),(a=t.call(this)||this).type="PlaneGeometry",a.parameters={width:e,height:n,widthSegments:i,heightSegments:r};for(var o=e/2,s=n/2,l=Math.floor(i),u=Math.floor(r),c=l+1,h=u+1,d=e/l,p=n/u,f=[],m=[],v=[],g=[],y=0;y<h;y++)for(var _=y*p-s,x=0;x<c;x++){var M=x*d-o;m.push(M,-_,0),v.push(0,0,1),g.push(x/l),g.push(1-y/u)}for(var S=0;S<u;S++)for(var b=0;b<l;b++){var E=b+c*S,w=b+c*(S+1),T=b+1+c*(S+1),A=b+1+c*S;f.push(E,w,A),f.push(w,T,A)}return a.setIndex(f),a.setAttribute("position",new Ni(m,3)),a.setAttribute("normal",new Ni(v,3)),a.setAttribute("uv",new Ni(g,2)),a}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)},e}(Vi),Pr={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660,\t0.0556434,\n\t\t-1.5371385,\t1.8760108, -0.2040259,\n\t\t-0.4985314,\t0.0415560,\t1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0 && !defined( NOCLIPPING )\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}float linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\t\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\n#ifdef USE_MODELMATRIXATTRIB\n\ttransformedNormal = ndsNormalMatrix * transformedNormal;\n#else\n\ttransformedNormal = mat3(modelViewMatrix) * transformedNormal;\n#endif\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n\t\tfloat x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n\t\tfloat x2 = x * x;\n\t\tfloat x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\t\treturn ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in 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.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in 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#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= mix( saturate( 1. - material.transmissionAlpha + linearToRelativeLuminance( totalSpecular ) ), 1.0, metalness );\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\t mvPosition = instanceMatrix * mvPosition;\n#endif\n#ifdef USE_MODELMATRIXATTRIB\n\tmvPosition = ndsModelViewMatrix * vec4( transformed, 1.0 );\n#else\n\tmvPosition = modelViewMatrix * mvPosition;\n#endif\n\tgl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\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 ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tmaterial.transmissionAlpha =material.transmission;\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a *\ta * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#ifdef USE_MODELMATRIXATTRIB \n\tmat4 ndsModelViewMatrix = viewMatrix * modelMatrixAttrib; \n\tmat3 ndsNormalMatrix = mat3(ndsModelViewMatrix);\t\n#endif \n#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\t #ifdef USE_MODELMATRIXATTRIB \n\t\t\t\tworldPosition = modelMatrixAttrib * vec4( transformed, 1.0 ); \n\t#else\n\t\t\t worldPosition = modelMatrix * vec4( transformed, 1.0 ); \n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\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>\nvarying vec2 vHighPrecisionZW;\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\tvHighPrecisionZW = gl_Position.zw;\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 <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\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\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <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}",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 <alphatest_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}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\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 <uv_pars_fragment>\n#include <map_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 <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_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 <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_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\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\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}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_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_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\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}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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 <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 <normal_vertex>\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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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}",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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\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}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_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_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\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}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\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 <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\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}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_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\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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\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_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Ur={common:{diffuse:{value:new mi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ve}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ve}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ve}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ve},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ve},normalScale:{value:new me(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ve},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ve}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ve}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ve}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new mi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new mi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0},uvTransform:{value:new ve}},sprite:{diffuse:{value:new mi(16777215)},opacity:{value:1},center:{value:new me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}}},Ir={basic:{uniforms:hr([Ur.common,Ur.specularmap,Ur.envmap,Ur.aomap,Ur.lightmap,Ur.fog]),vertexShader:Pr.meshbasic_vert,fragmentShader:Pr.meshbasic_frag},lambert:{uniforms:hr([Ur.common,Ur.specularmap,Ur.envmap,Ur.aomap,Ur.lightmap,Ur.emissivemap,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,Ur.fog,Ur.lights,{emissive:{value:new mi(0)}}]),vertexShader:Pr.meshlambert_vert,fragmentShader:Pr.meshlambert_frag},phong:{uniforms:hr([Ur.common,Ur.specularmap,Ur.envmap,Ur.aomap,Ur.lightmap,Ur.emissivemap,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,Ur.fog,Ur.lights,{emissive:{value:new mi(0)},specular:{value:new mi(1118481)},shininess:{value:30}}]),vertexShader:Pr.meshphong_vert,fragmentShader:Pr.meshphong_frag},standard:{uniforms:hr([Ur.common,Ur.envmap,Ur.aomap,Ur.lightmap,Ur.emissivemap,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,Ur.roughnessmap,Ur.metalnessmap,Ur.fog,Ur.lights,{emissive:{value:new mi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pr.meshphysical_vert,fragmentShader:Pr.meshphysical_frag},toon:{uniforms:hr([Ur.common,Ur.aomap,Ur.lightmap,Ur.emissivemap,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,Ur.gradientmap,Ur.fog,Ur.lights,{emissive:{value:new mi(0)}}]),vertexShader:Pr.meshtoon_vert,fragmentShader:Pr.meshtoon_frag},matcap:{uniforms:hr([Ur.common,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,Ur.fog,{matcap:{value:null}}]),vertexShader:Pr.meshmatcap_vert,fragmentShader:Pr.meshmatcap_frag},points:{uniforms:hr([Ur.points,Ur.fog]),vertexShader:Pr.points_vert,fragmentShader:Pr.points_frag},dashed:{uniforms:hr([Ur.common,Ur.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pr.linedashed_vert,fragmentShader:Pr.linedashed_frag},depth:{uniforms:hr([Ur.common,Ur.displacementmap]),vertexShader:Pr.depth_vert,fragmentShader:Pr.depth_frag},normal:{uniforms:hr([Ur.common,Ur.bumpmap,Ur.normalmap,Ur.displacementmap,{opacity:{value:1}}]),vertexShader:Pr.meshnormal_vert,fragmentShader:Pr.meshnormal_frag},sprite:{uniforms:hr([Ur.sprite,Ur.fog]),vertexShader:Pr.sprite_vert,fragmentShader:Pr.sprite_frag},background:{uniforms:{uvTransform:{value:new ve},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Pr.background_vert,fragmentShader:Pr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Pr.backgroundCube_vert,fragmentShader:Pr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Pr.cube_vert,fragmentShader:Pr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pr.equirect_vert,fragmentShader:Pr.equirect_frag},distanceRGBA:{uniforms:hr([Ur.common,Ur.displacementmap,{referencePosition:{value:new Ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pr.distanceRGBA_vert,fragmentShader:Pr.distanceRGBA_frag},shadow:{uniforms:hr([Ur.lights,Ur.fog,{color:{value:new mi(0)},opacity:{value:1}}]),vertexShader:Pr.shadow_vert,fragmentShader:Pr.shadow_frag}};Ir.physical={uniforms:hr([Ir.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ve},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ve},clearcoatNormalScale:{value:new me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ve},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ve},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ve},sheen:{value:0},sheenColor:{value:new mi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ve},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ve},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ve},transmissionSamplerSize:{value:new me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ve},attenuationDistance:{value:0},attenuationColor:{value:new mi(0)},specularColor:{value:new mi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ve},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ve},anisotropyVector:{value:new me},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ve}}]),vertexShader:Pr.meshphysical_vert,fragmentShader:Pr.meshphysical_frag};var Nr={r:0,b:0,g:0};function Dr(t,e,n,i,r,s,l){var u,c,h=new mi(0),d=!0===s?0:1,p=null,f=0,m=null;function v(e,n){e.getRGB(Nr,dr(t)),i.buffers.color.setClear(Nr.r,Nr.g,Nr.b,n,l)}return{getClearColor:function(){return h},setClearColor:function(t,e){void 0===e&&(e=1),h.set(t),v(h,d=e)},getClearAlpha:function(){return d},setClearAlpha:function(t){v(h,d=t)},render:function(s,g){var y=!1,_=!0===g.isScene?g.background:null;switch(_&&_.isTexture&&(_=(g.backgroundBlurriness>0?n:e).get(_)),null===_?v(h,d):_&&_.isColor&&(v(_,1),y=!0),t.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,l),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,l),y=!0}(t.autoClear||y)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),_&&(_.isCubeTexture||_.mapping===S)?(void 0===c&&((c=new sr(new ur(1,1,1),new fr({name:"BackgroundCubeMaterial",uniforms:cr(Ir.backgroundCube.uniforms),vertexShader:Ir.backgroundCube.vertexShader,fragmentShader:Ir.backgroundCube.fragmentShader,side:o,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),c.material.uniforms.envMap.value=_,c.material.uniforms.flipEnvMap.value=_.isCubeTexture&&!1===_.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=_.colorSpace!==Ut,p===_&&f===_.version&&m===t.toneMapping||(c.material.needsUpdate=!0,p=_,f=_.version,m=t.toneMapping),c.layers.enableAll(),s.unshift(c,c.geometry,c.material,0,0,null)):_&&_.isTexture&&(void 0===u&&((u=new sr(new Lr(2,2),new fr({name:"BackgroundMaterial",uniforms:cr(Ir.background.uniforms),vertexShader:Ir.background.vertexShader,fragmentShader:Ir.background.fragmentShader,side:a,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(u)),u.material.uniforms.t2D.value=_,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=_.colorSpace!==Ut,!0===_.matrixAutoUpdate&&_.updateMatrix(),u.material.uniforms.uvTransform.value.copy(_.matrix),p===_&&f===_.version&&m===t.toneMapping||(u.material.needsUpdate=!0,p=_,f=_.version,m=t.toneMapping),u.layers.enableAll(),s.unshift(u,u.geometry,u.material,0,0,null))}}}function Or(t,e,n,i,r){void 0===r&&(r=!1);var a=t.getParameter(t.MAX_VERTEX_ATTRIBS),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=r&&(i.isWebGL2||null!==o),l={},u=f(null),c=u,h=!1;function d(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function p(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function f(t){for(var e=[],n=[],i=[],r=0;r<a;r++)e[r]=0,n[r]=0,i[r]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function m(){for(var t=c.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function v(t){g(t,0)}function g(n,r){var a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==r)&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),s[n]=r)}function y(){for(var e=c.newAttributes,n=c.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function _(e,n,i,r,a,o,s){!0===s?t.vertexAttribIPointer(e,n,i,a,o):t.vertexAttribPointer(e,n,i,r,a,o)}function x(r,a,o,s,l){if(void 0===l&&(l=!1),!1!==i.isWebGL2||!r.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==e.get("ANGLE_instanced_arrays")){l||m();var u=s.attributes,c=o.getAttributes(),h=a.defaultAttributeValues;for(var d in c){var p=c[d];if(p.location>=0){var f=u[d];if(void 0===f&&("instanceMatrix"===d&&r.instanceMatrix&&(f=r.instanceMatrix),"instanceColor"===d&&r.instanceColor&&(f=r.instanceColor)),!f)continue;if(l&&!f.isInstancedBufferAttribute)continue;if(void 0!==f){var x=f.normalized,M=f.itemSize,S=n.get(f);if(void 0===S)continue;var b=S.buffer,E=S.type,w=S.bytesPerElement,T=!0===i.isWebGL2&&(E===t.INT||E===t.UNSIGNED_INT||f.gpuType===N);if(f.isInterleavedBufferAttribute){var A=f.data,R=A.stride,C=f.offset;if(A.isInstancedInterleavedBuffer){for(var L=0;L<p.locationSize;L++)g(p.location+L,A.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=A.meshPerAttribute*A.count)}else for(var P=0;P<p.locationSize;P++)v(p.location+P);t.bindBuffer(t.ARRAY_BUFFER,b);for(var U=0;U<p.locationSize;U++)_(p.location+U,M/p.locationSize,E,x,R*w,(C+M/p.locationSize*U)*w,T)}else{if(f.isInstancedBufferAttribute){for(var I=0;I<p.locationSize;I++)g(p.location+I,f.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var D=0;D<p.locationSize;D++)v(p.location+D);t.bindBuffer(t.ARRAY_BUFFER,b);for(var O=0;O<p.locationSize;O++)_(p.location+O,M/p.locationSize,E,x,M*w,M/p.locationSize*O*w,T)}}else if(void 0!==h){var B=h[d];if(void 0!==B)switch(B.length){case 2:t.vertexAttrib2fv(p.location,B);break;case 3:t.vertexAttrib3fv(p.location,B);break;case 4:t.vertexAttrib4fv(p.location,B);break;default:t.vertexAttrib1fv(p.location,B)}}}}y()}}function M(){S(),h=!0,c!==u&&d((c=u).object)}function S(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:function(e,r,a,u,p){var m=!1;if(s){var v=function(e,n,r){var a=!0===r.wireframe,s=l[e.id];void 0===s&&(s={},l[e.id]=s);var u=s[n.id];void 0===u&&(u={},s[n.id]=u);var c=u[a];void 0===c&&(c=f(i.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),u[a]=c);return c}(u,a,r);c!==v&&d((c=v).object),m=function(t,e,n,i){var r=c.attributes,a=e.attributes,o=0,s=n.getAttributes();for(var l in s){if(s[l].location>=0){var u=r[l],h=a[l];if(void 0===h&&("instanceMatrix"===l&&t.instanceMatrix&&(h=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(h=t.instanceColor)),void 0===u)return!0;if(u.attribute!==h)return!0;if(h&&u.data!==h.data)return!0;o++}}return c.attributesNum!==o||c.index!==i}(e,u,a,p),m&&function(t,e,n,i){var r={},a=e.attributes,o=0,s=n.getAttributes();for(var l in s){if(s[l].location>=0){var u=a[l];void 0===u&&("instanceMatrix"===l&&t.instanceMatrix&&(u=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(u=t.instanceColor));var h={};h.attribute=u,u&&u.data&&(h.data=u.data),r[l]=h,o++}}c.attributes=r,c.attributesNum=o,c.index=i}(e,u,a,p)}else{var g=!0===r.wireframe;c.geometry===u.id&&c.program===a.id&&c.wireframe===g||(c.geometry=u.id,c.program=a.id,c.wireframe=g,m=!0)}null!==p&&n.update(p,t.ELEMENT_ARRAY_BUFFER),m||h?(h=!1,x(e,r,a,u,!1),null!==p&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(p).buffer)):u.instanceCount>0&&x(e,r,a,u,!0)},reset:M,resetDefaultState:S,dispose:function(){for(var t in M(),l){var e=l[t];for(var n in e){var i=e[n];for(var r in i)p(i[r].object),delete i[r];delete e[n]}delete l[t]}},releaseStatesOfGeometry:function(t){if(void 0!==l[t.id]){var e=l[t.id];for(var n in e){var i=e[n];for(var r in i)p(i[r].object),delete i[r];delete e[n]}delete l[t.id]}},releaseStatesOfProgram:function(t){for(var e in l){var n=l[e];if(void 0!==n[t.id]){var i=n[t.id];for(var r in i)p(i[r].object),delete i[r];delete n[t.id]}}},initAttributes:m,enableAttribute:v,disableUnusedAttributes:y}}function Br(t,e,n,i){var r,a=i.isWebGL2;this.setMode=function(t){r=t},this.render=function(e,i){t.drawArrays(r,e,i),n.update(i,r,1)},this.renderInstances=function(i,o,s){if(0!==s){var l,u;if(a)l=t,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](r,i,o,s),n.update(o,r,s)}}}function Fr(t,e,n){var i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),m=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),v=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?t.getParameter(t.MAX_SAMPLES):0}}function zr(t){var e=this,n=null,i=0,r=!1,a=!1,o=new Er,s=new ve,l={value:null,needsUpdate:!1};function u(t,n,i,r){var a=null!==t?t.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){var c=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,p=i;d!==a;++d,p+=4)o.copy(t[d]).applyMatrix4(h,s),o.normal.toArray(u,p),u[p+3]=o.constant}l.value=u,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){var n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){n=u(t,e,0)},this.setState=function(o,s,c){var h=o.clippingPlanes,d=o.clipIntersection,p=o.clipShadows,f=t.get(o);if(!r||null===h||0===h.length||a&&!p)a?u(null):function(){l.value!==n&&(l.value=n,l.needsUpdate=i>0);e.numPlanes=i,e.numIntersection=0}();else{var m=a?0:i,v=4*m,g=f.clippingState||null;l.value=g,g=u(h,s,v,c);for(var y=0;y!==v;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function Gr(t){var e=new WeakMap;function n(t,e){return e===x?t.mapping=y:e===M&&(t.mapping=_),t}function i(t){var n=t.target;n.removeEventListener("dispose",i);var r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){var a=r.mapping;if(a===x||a===M){if(e.has(r))return n(e.get(r).texture,r.mapping);var o=r.image;if(o&&o.height>0){var s=new xr(o.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}return r},dispose:function(){e=new WeakMap}}}var kr=function(t){function e(e,n,i,r,a,o){var s;return void 0===e&&(e=-1),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=-1),void 0===a&&(a=.1),void 0===o&&(o=2e3),(s=t.call(this)||this).isOrthographicCamera=!0,s.type="OrthographicCamera",s.zoom=1,s.view=null,s.left=e,s.right=n,s.top=i,s.bottom=r,s.near=a,s.far=o,s.updateProjectionMatrix(),s}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),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},n.setViewOffset=function(t,e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},n.clearViewOffset=function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},n.updateProjectionMatrix=function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-t,a=n+t,o=i+e,s=i-e;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,null!==this.view&&(n.object.view=Object.assign({},this.view)),n},e}(mr),Hr=[.125,.215,.35,.446,.526,.582],Vr=20,Wr=new kr,Xr=new mi,jr=null,qr=(1+Math.sqrt(5))/2,Yr=1/qr,Zr=[new Ye(1,1,1),new Ye(-1,1,1),new Ye(1,1,-1),new Ye(-1,1,-1),new Ye(0,qr,Yr),new Ye(0,qr,-Yr),new Ye(Yr,0,qr),new Ye(-Yr,0,qr),new Ye(qr,Yr,0),new Ye(-qr,Yr,0)],Jr=function(){function t(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}var e=t.prototype;return e.fromScene=function(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=.1),void 0===i&&(i=100),jr=this._renderer.getRenderTarget(),this._setSize(256);var r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r},e.fromEquirectangular=function(t,e){return void 0===e&&(e=null),this._fromTexture(t,e)},e.fromCubemap=function(t,e){return void 0===e&&(e=null),this._fromTexture(t,e)},e.compileCubemapShader=function(){null===this._cubemapMaterial&&(this._cubemapMaterial=ta(),this._compileMaterial(this._cubemapMaterial))},e.compileEquirectangularShader=function(){null===this._equirectMaterial&&(this._equirectMaterial=$r(),this._compileMaterial(this._equirectMaterial))},e.dispose=function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()},e._setSize=function(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)},e._dispose=function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()},e._cleanup=function(t){this._renderer.setRenderTarget(jr),t.scissorTest=!1,Qr(t,0,0,t.width,t.height)},e._fromTexture=function(t,e){t.mapping===y||t.mapping===_?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),jr=this._renderer.getRenderTarget();var n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n},e._allocateTargets=function(){var t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:C,minFilter:C,generateMipmaps:!1,type:B,format:k,colorSpace:It,depthBuffer:!1},i=Kr(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Kr(t,e,n);var r=this._lodMax,a=function(t){for(var e=[],n=[],i=[],r=t,a=t-4+1+Hr.length,o=0;o<a;o++){var s=Math.pow(2,r);n.push(s);var l=1/s;o>t-4?l=Hr[o-t+4-1]:0===o&&(l=0),i.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=6,f=6,m=3,v=2,g=1,y=new Float32Array(m*f*p),_=new Float32Array(v*f*p),x=new Float32Array(g*f*p),M=0;M<p;M++){var S=M%3*2/3-1,b=M>2?0:-1,E=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];y.set(E,m*f*M),_.set(d,v*f*M);var w=[M,M,M,M,M,M];x.set(w,g*f*M)}var T=new Vi;T.setAttribute("position",new wi(y,m)),T.setAttribute("uv",new wi(_,v)),T.setAttribute("faceIndex",new wi(x,g)),e.push(T),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(r);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(t,e,n){var i=new Float32Array(Vr),r=new Ye(0,1,0),a=new fr({name:"SphericalGaussianBlur",defines:{n:Vr,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:t+".0"},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return a}(r,t,e)}return i},e._compileMaterial=function(t){var e=new sr(this._lodPlanes[0],t);this._renderer.compile(e,Wr)},e._sceneToCubeUV=function(t,e,n,i){var r=new vr(90,1,e,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(Xr),l.toneMapping=h,l.autoClear=!1;var d=new gi({name:"PMREM.Background",side:o,depthWrite:!1,depthTest:!1}),p=new sr(new ur,d),f=!1,m=t.background;m?m.isColor&&(d.color.copy(m),t.background=null,f=!0):(d.color.copy(Xr),f=!0);for(var v=0;v<6;v++){var g=v%3;0===g?(r.up.set(0,a[v],0),r.lookAt(s[v],0,0)):1===g?(r.up.set(0,0,a[v]),r.lookAt(0,s[v],0)):(r.up.set(0,a[v],0),r.lookAt(0,0,s[v]));var y=this._cubeSize;Qr(i,g*y,v>2?y:0,y,y),l.setRenderTarget(i),f&&l.render(p,r,i),l.render(t,r,i)}p.geometry.dispose(),p.material.dispose(),l.toneMapping=c,l.autoClear=u,t.background=m},e._textureToCubeUV=function(t,e){var n=this._renderer,i=t.mapping===y||t.mapping===_;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=ta()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=$r());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new sr(this._lodPlanes[0],r);r.uniforms.envMap.value=t;var o=this._cubeSize;Qr(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(a,Wr,e)},e._applyPMREM=function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var i=1;i<this._lodPlanes.length;i++){var r=Math.sqrt(this._sigmas[i]*this._sigmas[i]-this._sigmas[i-1]*this._sigmas[i-1]),a=Zr[(i-1)%Zr.length];this._blur(t,i-1,i,r,a)}e.autoClear=n},e._blur=function(t,e,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)},e._halfBlur=function(t,e,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new sr(this._lodPlanes[i],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):Vr;f>Vr&&console.warn("sigmaRadians, "+r+", is too large and will clip, as it requested "+f+" samples when the maximum is set to "+Vr);for(var m=[],v=0,g=0;g<Vr;++g){var y=g/p,_=Math.exp(-y*y/2);m.push(_),0===g?v+=_:g<f&&(v+=2*_)}for(var x=0;x<m.length;x++)m[x]=m[x]/v;c.envMap.value=t.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var S=this._sizeLods[i];Qr(e,3*S*(i>M-4?i-M+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(e),s.render(u,Wr,e)},t}();function Kr(t,e,n){var i=new ke(t,e,n);return i.texture.mapping=S,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Qr(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function $r(){return new fr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ta(){return new fr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ea(t){var e=new WeakMap,n=null;function i(t){var n=t.target;n.removeEventListener("dispose",i);var r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){var a=r.mapping,o=a===x||a===M,s=a===y||a===_;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;var l=e.get(r);return null===n&&(n=new Jr(t)),l=o?n.fromEquirectangular(r,l):n.fromCubemap(r,l),e.set(r,l),l.texture}if(e.has(r))return e.get(r).texture;var u=r.image;if(o&&u&&u.height>0||s&&u&&function(t){for(var e=0,n=6,i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}(u)){null===n&&(n=new Jr(t));var c=o?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,c),r.addEventListener("dispose",i),c.texture}return null}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function na(t){var e={};function n(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){var e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ia(t,e,n,i){var r={},a=new WeakMap;function o(t){var s=t.target;for(var l in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[l]);for(var u in s.morphAttributes)for(var c=s.morphAttributes[u],h=0,d=c.length;h<d;h++)e.remove(c[h]);s.removeEventListener("dispose",o),delete r[s.id];var p=a.get(s);p&&(e.remove(p),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){var n=[],i=t.index,r=t.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{var p=r.array;o=r.version;for(var f=0,m=p.length/3-1;f<m;f+=3){var v=f+0,g=f+1,y=f+2;n.push(v,g,g,y,y,v)}}var _=new(ye(n)?Ui:Li)(n,1);_.version=o;var x=a.get(t);x&&e.remove(x),a.set(t,_)}return{get:function(t,e){return e.isCompatibleGeometry&&e.updateBuffer(),!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e},update:function(n){var i=n.attributes;for(var r in i)e.update(i[r],t.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],l=0,u=s.length;l<u;l++)e.update(s[l],t.ARRAY_BUFFER)},wireframeAttributes:a,getWireframeAttribute:function(t){var e=a.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return a.get(t)}}}function ra(t,e,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(t){r=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,i){t.drawElements(r,i,a,e*o),n.update(i,r,1)},this.renderInstances=function(i,l,u){if(0!==u){var c,h;if(s)c=t,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,l,a,i*o,u),n.update(l,r,u)}}}function aa(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function oa(t,e){return t[0]-e[0]}function sa(t,e){return Math.abs(e[1])-Math.abs(t[1])}function la(t,e,n){for(var i={},r=new Float32Array(8),a=new WeakMap,o=new Ge,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c){var h=l.morphTargetInfluences;if(!0===e.isWebGL2){var d=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,p=void 0!==d?d.length:0,f=a.get(u);if(void 0===f||f.count!==p){void 0!==f&&f.texture.dispose();var m=void 0!==u.morphAttributes.position,v=void 0!==u.morphAttributes.normal,g=void 0!==u.morphAttributes.color,y=u.morphAttributes.position||[],_=u.morphAttributes.normal||[],x=u.morphAttributes.color||[],M=0;!0===m&&(M=1),!0===v&&(M=2),!0===g&&(M=3);var S=u.attributes.position.count*M,b=1;S>e.maxTextureSize&&(b=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);var E=new Float32Array(S*b*4*p),w=new He(E,S,b,p);w.type=O,w.needsUpdate=!0;for(var T=4*M,A=0;A<p;A++)for(var R=y[A],C=_[A],L=x[A],P=S*b*4*A,U=0;U<R.count;U++){var I=U*T;!0===m&&(o.fromBufferAttribute(R,U),E[P+I+0]=o.x,E[P+I+1]=o.y,E[P+I+2]=o.z,E[P+I+3]=0),!0===v&&(o.fromBufferAttribute(C,U),E[P+I+4]=o.x,E[P+I+5]=o.y,E[P+I+6]=o.z,E[P+I+7]=0),!0===g&&(o.fromBufferAttribute(L,U),E[P+I+8]=o.x,E[P+I+9]=o.y,E[P+I+10]=o.z,E[P+I+11]=4===L.itemSize?o.w:1)}f={count:p,texture:w,size:new me(S,b)},a.set(u,f),u.addEventListener("dispose",(function t(){w.dispose(),a.delete(u),u.removeEventListener("dispose",t)}))}for(var N=0,D=0;D<h.length;D++)N+=h[D];var B=u.morphTargetsRelative?1:1-N;c.getUniforms().setValue(t,"morphTargetBaseInfluence",B),c.getUniforms().setValue(t,"morphTargetInfluences",h),c.getUniforms().setValue(t,"morphTargetsTexture",f.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",f.size)}else{var F=void 0===h?0:h.length,z=i[u.id];if(void 0===z||z.length!==F){z=[];for(var G=0;G<F;G++)z[G]=[G,0];i[u.id]=z}for(var k=0;k<F;k++){var H=z[k];H[0]=k,H[1]=h[k]}z.sort(sa);for(var V=0;V<8;V++)V<F&&z[V][1]?(s[V][0]=z[V][0],s[V][1]=z[V][1]):(s[V][0]=Number.MAX_SAFE_INTEGER,s[V][1]=0);s.sort(oa);for(var W=u.morphAttributes.position,X=u.morphAttributes.normal,j=0,q=0;q<8;q++){var Y=s[q],Z=Y[0],J=Y[1];Z!==Number.MAX_SAFE_INTEGER&&J?(W&&u.getAttribute("morphTarget"+q)!==W[Z]&&u.setAttribute("morphTarget"+q,W[Z]),X&&u.getAttribute("morphNormal"+q)!==X[Z]&&u.setAttribute("morphNormal"+q,X[Z]),r[q]=J,j+=J):(W&&!0===u.hasAttribute("morphTarget"+q)&&u.deleteAttribute("morphTarget"+q),X&&!0===u.hasAttribute("morphNormal"+q)&&u.deleteAttribute("morphNormal"+q),r[q]=0)}var K=u.morphTargetsRelative?1:1-j;c.getUniforms().setValue(t,"morphTargetBaseInfluence",K),c.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function ua(t,e,n,i){var r=new WeakMap;function a(t){var e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(o){var s=i.render.frame,l=o.geometry,u=e.get(o,l);return r.get(u)!==s&&(e.update(u),r.set(u,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),n.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,t.ARRAY_BUFFER)),u},dispose:function(){r=new WeakMap}}}var ca=new ze,ha=new He,da=new We,pa=new _r,fa=[],ma=[],va=new Float32Array(16),ga=new Float32Array(9),ya=new Float32Array(4);function _a(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,a=fa[r];if(void 0===a&&(a=new Float32Array(r),fa[r]=a),0!==e){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function xa(t,e){if(t.length!==e.length)return!1;for(var n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Ma(t,e){for(var n=0,i=e.length;n<i;n++)t[n]=e[n]}function Sa(t,e){var n=ma[e];void 0===n&&(n=new Int32Array(e),ma[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ba(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ea(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(xa(n,e))return;t.uniform2fv(this.addr,e),Ma(n,e)}}function wa(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(xa(n,e))return;t.uniform3fv(this.addr,e),Ma(n,e)}}function Ta(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(xa(n,e))return;t.uniform4fv(this.addr,e),Ma(n,e)}}function Aa(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(xa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ma(n,e)}else{if(xa(n,i))return;ya.set(i),t.uniformMatrix2fv(this.addr,!1,ya),Ma(n,i)}}function Ra(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(xa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ma(n,e)}else{if(xa(n,i))return;ga.set(i),t.uniformMatrix3fv(this.addr,!1,ga),Ma(n,i)}}function Ca(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(xa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ma(n,e)}else{if(xa(n,i))return;va.set(i),t.uniformMatrix4fv(this.addr,!1,va),Ma(n,i)}}function La(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Pa(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(xa(n,e))return;t.uniform2iv(this.addr,e),Ma(n,e)}}function Ua(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(xa(n,e))return;t.uniform3iv(this.addr,e),Ma(n,e)}}function Ia(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(xa(n,e))return;t.uniform4iv(this.addr,e),Ma(n,e)}}function Na(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Da(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(xa(n,e))return;t.uniform2uiv(this.addr,e),Ma(n,e)}}function Oa(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(xa(n,e))return;t.uniform3uiv(this.addr,e),Ma(n,e)}}function Ba(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(xa(n,e))return;t.uniform4uiv(this.addr,e),Ma(n,e)}}function Fa(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(e||ca,r)}function za(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||da,r)}function Ga(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||pa,r)}function ka(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||ha,r)}function Ha(t,e){t.uniform1fv(this.addr,e)}function Va(t,e){var n=_a(e,this.size,2);t.uniform2fv(this.addr,n)}function Wa(t,e){var n=_a(e,this.size,3);t.uniform3fv(this.addr,n)}function Xa(t,e){var n=_a(e,this.size,4);t.uniform4fv(this.addr,n)}function ja(t,e){var n=_a(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function qa(t,e){var n=_a(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Ya(t,e){var n=_a(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Za(t,e){t.uniform1iv(this.addr,e)}function Ja(t,e){t.uniform2iv(this.addr,e)}function Ka(t,e){t.uniform3iv(this.addr,e)}function Qa(t,e){t.uniform4iv(this.addr,e)}function $a(t,e){t.uniform1uiv(this.addr,e)}function to(t,e){t.uniform2uiv(this.addr,e)}function eo(t,e){t.uniform3uiv(this.addr,e)}function no(t,e){t.uniform4uiv(this.addr,e)}function io(t,e,n){var i=this.cache,r=e.length,a=Sa(n,r);xa(i,a)||(t.uniform1iv(this.addr,a),Ma(i,a));for(var o=0;o!==r;++o)n.setTexture2D(e[o]||ca,a[o])}function ro(t,e,n){var i=this.cache,r=e.length,a=Sa(n,r);xa(i,a)||(t.uniform1iv(this.addr,a),Ma(i,a));for(var o=0;o!==r;++o)n.setTexture3D(e[o]||da,a[o])}function ao(t,e,n){var i=this.cache,r=e.length,a=Sa(n,r);xa(i,a)||(t.uniform1iv(this.addr,a),Ma(i,a));for(var o=0;o!==r;++o)n.setTextureCube(e[o]||pa,a[o])}function oo(t,e,n){var i=this.cache,r=e.length,a=Sa(n,r);xa(i,a)||(t.uniform1iv(this.addr,a),Ma(i,a));for(var o=0;o!==r;++o)n.setTexture2DArray(e[o]||ha,a[o])}var so=function(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return ba;case 35664:return Ea;case 35665:return wa;case 35666:return Ta;case 35674:return Aa;case 35675:return Ra;case 35676:return Ca;case 5124:case 35670:return La;case 35667:case 35671:return Pa;case 35668:case 35672:return Ua;case 35669:case 35673:return Ia;case 5125:return Na;case 36294:return Da;case 36295:return Oa;case 36296:return Ba;case 35678:case 36198:case 36298:case 36306:case 35682:return Fa;case 35679:case 36299:case 36307:return za;case 35680:case 36300:case 36308:case 36293:return Ga;case 36289:case 36303:case 36311:case 36292:return ka}}(e.type)},lo=function(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Ha;case 35664:return Va;case 35665:return Wa;case 35666:return Xa;case 35674:return ja;case 35675:return qa;case 35676:return Ya;case 5124:case 35670:return Za;case 35667:case 35671:return Ja;case 35668:case 35672:return Ka;case 35669:case 35673:return Qa;case 5125:return $a;case 36294:return to;case 36295:return eo;case 36296:return no;case 35678:case 36198:case 36298:case 36306:case 35682:return io;case 35679:case 36299:case 36307:return ro;case 35680:case 36300:case 36308:case 36293:return ao;case 36289:case 36303:case 36311:case 36292:return oo}}(e.type)},uo=function(){function t(t){this.id=t,this.seq=[],this.map={}}return t.prototype.setValue=function(t,e,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(t,e[o.id],n)}},t}(),co=/(\w+)(\])?(\[|\.)?/g;function ho(t,e){t.seq.push(e),t.map[e.id]=e}function po(t,e,n){var i=t.name,r=i.length;for(co.lastIndex=0;;){var a=co.exec(i),o=co.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===r){ho(n,void 0===u?new so(s,t,e):new lo(s,t,e));break}var c=n.map[s];void 0===c&&ho(n,c=new uo(s)),n=c}}var fo=function(){function t(t,e){this.seq=[],this.map={};for(var n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<n;++i){var r=t.getActiveUniform(e,i);po(r,t.getUniformLocation(e,r.name),this)}}var e=t.prototype;return e.setValue=function(t,e,n,i){var r=this.map[e];void 0!==r&&r.setValue(t,n,i)},e.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},t.upload=function(t,e,n,i){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}},t.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var a=t[i];a.id in e&&n.push(a)}return n},t}();function mo(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}var vo=0;function go(t,e,n){var i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){for(var n=t.split("\n"),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length),o=r;o<a;o++){var s=o+1;i.push((s===e?">":" ")+" "+s+": "+n[o])}return i.join("\n")}(t.getShaderSource(e),o)}return r}function yo(t,e){var n=function(t){switch(t){case It:return["Linear","( value )"];case Ut:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function _o(t,e){var n;switch(e){case d:n="Linear";break;case p:n="Reinhard";break;case f:n="OptimizedCineon";break;case m:n="ACESFilmic";break;case v:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function xo(t){return""!==t}function Mo(t,e){var n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function So(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var bo=/^[ \t]*#include +<([\w\d./]+)>/gm;function Eo(t){return t.replace(bo,wo)}function wo(t,e){var n=Pr[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Eo(n)}var To=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ao(t){return t.replace(To,Ro)}function Ro(t,e,n,i){for(var r="",a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function Co(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Lo(t,e,a,o){var s,d,p=t.getContext(),f=a.defines,m=a.vertexShader,v=a.fragmentShader,g=function(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===n?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===i?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===r&&(e="SHADOWMAP_TYPE_VSM"),e}(a),x=function(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case y:case _:e="ENVMAP_TYPE_CUBE";break;case S:e="ENVMAP_TYPE_CUBE_UV"}return e}(a),M=function(t){var e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===_&&(e="ENVMAP_MODE_REFRACTION");return e}(a),b=function(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case l:e="ENVMAP_BLENDING_MULTIPLY";break;case u:e="ENVMAP_BLENDING_MIX";break;case c:e="ENVMAP_BLENDING_ADD"}return e}(a),E=function(t){var e=t.envMapCubeUVHeight;if(null===e)return null;var n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(a),w=a.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xo).join("\n")}(a),T=function(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(f),A=p.createProgram(),R=a.glslVersion?"#version "+a.glslVersion+"\n":"";a.isRawShaderMaterial?((s=["#define SHADER_TYPE "+a.shaderType,"#define SHADER_NAME "+a.shaderName,T].filter(xo).join("\n")).length>0&&(s+="\n"),(d=[w,"#define SHADER_TYPE "+a.shaderType,"#define SHADER_NAME "+a.shaderName,T].filter(xo).join("\n")).length>0&&(d+="\n")):(s=[Co(a),"#define SHADER_TYPE "+a.shaderType,"#define SHADER_NAME "+a.shaderName,T,a.instancing?"#define USE_INSTANCING":"",a.instancingColor?"#define USE_INSTANCING_COLOR":"",a.useModelMatrixAttrib?"#define USE_MODELMATRIXATTRIB":"",a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+M:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",a.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",a.displacementMap?"#define USE_DISPLACEMENTMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.anisotropyMap?"#define USE_ANISOTROPYMAP":"",a.clearcoatMap?"#define USE_CLEARCOATMAP":"",a.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",a.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",a.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.transmission?"#define USE_TRANSMISSION":"",a.transmissionMap?"#define USE_TRANSMISSIONMAP":"",a.thicknessMap?"#define USE_THICKNESSMAP":"",a.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",a.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",a.mapUv?"#define MAP_UV "+a.mapUv:"",a.alphaMapUv?"#define ALPHAMAP_UV "+a.alphaMapUv:"",a.lightMapUv?"#define LIGHTMAP_UV "+a.lightMapUv:"",a.aoMapUv?"#define AOMAP_UV "+a.aoMapUv:"",a.emissiveMapUv?"#define EMISSIVEMAP_UV "+a.emissiveMapUv:"",a.bumpMapUv?"#define BUMPMAP_UV "+a.bumpMapUv:"",a.normalMapUv?"#define NORMALMAP_UV "+a.normalMapUv:"",a.displacementMapUv?"#define DISPLACEMENTMAP_UV "+a.displacementMapUv:"",a.metalnessMapUv?"#define METALNESSMAP_UV "+a.metalnessMapUv:"",a.roughnessMapUv?"#define ROUGHNESSMAP_UV "+a.roughnessMapUv:"",a.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+a.anisotropyMapUv:"",a.clearcoatMapUv?"#define CLEARCOATMAP_UV "+a.clearcoatMapUv:"",a.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+a.clearcoatNormalMapUv:"",a.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+a.clearcoatRoughnessMapUv:"",a.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+a.iridescenceMapUv:"",a.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+a.iridescenceThicknessMapUv:"",a.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+a.sheenColorMapUv:"",a.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+a.sheenRoughnessMapUv:"",a.specularMapUv?"#define SPECULARMAP_UV "+a.specularMapUv:"",a.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+a.specularColorMapUv:"",a.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+a.specularIntensityMapUv:"",a.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+a.transmissionMapUv:"",a.thicknessMapUv?"#define THICKNESSMAP_UV "+a.thicknessMapUv:"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexAlphas?"#define USE_COLOR_ALPHA":"",a.vertexUv1s?"#define USE_UV1":"",a.vertexUv2s?"#define USE_UV2":"",a.vertexUv3s?"#define USE_UV3":"",a.pointsUvs?"#define USE_POINTS_UV":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.morphColors&&a.isWebGL2?"#define USE_MORPHCOLORS":"",a.morphTargetsCount>0&&a.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",a.morphTargetsCount>0&&a.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+a.morphTextureStride:"",a.morphTargetsCount>0&&a.isWebGL2?"#define MORPHTARGETS_COUNT "+a.morphTargetsCount:"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+g:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.useLegacyLights?"#define LEGACY_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&a.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_MODELMATRIXATTRIB","\tattribute mat4 modelMatrixAttrib;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(xo).join("\n"),d=[w,Co(a),"#define SHADER_TYPE "+a.shaderType,"#define SHADER_NAME "+a.shaderName,T,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+x:"",a.envMap?"#define "+M:"",a.envMap?"#define "+b:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",a.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.anisotropy?"#define USE_ANISOTROPY":"",a.anisotropyMap?"#define USE_ANISOTROPYMAP":"",a.clearcoat?"#define USE_CLEARCOAT":"",a.clearcoatMap?"#define USE_CLEARCOATMAP":"",a.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.iridescence?"#define USE_IRIDESCENCE":"",a.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",a.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",a.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.alphaTest?"#define USE_ALPHATEST":"",a.sheen?"#define USE_SHEEN":"",a.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",a.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",a.transmission?"#define USE_TRANSMISSION":"",a.transmissionMap?"#define USE_TRANSMISSIONMAP":"",a.thicknessMap?"#define USE_THICKNESSMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors||a.instancingColor?"#define USE_COLOR":"",a.vertexAlphas?"#define USE_COLOR_ALPHA":"",a.vertexUv1s?"#define USE_UV1":"",a.vertexUv2s?"#define USE_UV2":"",a.vertexUv3s?"#define USE_UV3":"",a.pointsUvs?"#define USE_POINTS_UV":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+g:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.useLegacyLights?"#define LEGACY_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&a.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",a.toneMapping!==h?"#define TONE_MAPPING":"",a.toneMapping!==h?Pr.tonemapping_pars_fragment:"",a.toneMapping!==h?_o("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.opaque?"#define OPAQUE":"",Pr.encodings_pars_fragment,yo("linearToOutputTexel",a.outputColorSpace),a.useDepthPacking?"#define DEPTH_PACKING "+a.depthPacking:"","\n"].filter(xo).join("\n")),m=So(m=Mo(m=Eo(m),a),a),v=So(v=Mo(v=Eo(v),a),a),m=Ao(m),v=Ao(v),a.isWebGL2&&!0!==a.isRawShaderMaterial&&(R="#version 300 es\n",s=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+s,d=["#define varying in",a.glslVersion===Bt?"":"layout(location = 0) out highp vec4 pc_fragColor;",a.glslVersion===Bt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+d);var C,L,P=R+s+m,U=R+d+v,I=mo(p,p.VERTEX_SHADER,P),N=mo(p,p.FRAGMENT_SHADER,U);if(p.attachShader(A,I),p.attachShader(A,N),void 0!==a.index0AttributeName?p.bindAttribLocation(A,0,a.index0AttributeName):!0===a.morphTargets&&p.bindAttribLocation(A,0,"position"),p.linkProgram(A),t.debug.checkShaderErrors){var D=p.getProgramInfoLog(A).trim(),O=p.getShaderInfoLog(I).trim(),B=p.getShaderInfoLog(N).trim(),F=!0,z=!0;if(!1===p.getProgramParameter(A,p.LINK_STATUS))if(F=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(p,A,I,N);else{var G=go(p,I,"vertex"),k=go(p,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+p.getError()+" - VALIDATE_STATUS "+p.getProgramParameter(A,p.VALIDATE_STATUS)+"\n\nProgram Info Log: "+D+"\n"+G+"\n"+k)}else""!==D?console.warn("THREE.WebGLProgram: Program Info Log:",D):""!==O&&""!==B||(z=!1);z&&(this.diagnostics={runnable:F,programLog:D,vertexShader:{log:O,prefix:s},fragmentShader:{log:B,prefix:d}})}return p.deleteShader(I),p.deleteShader(N),this.getUniforms=function(){return void 0===C&&(C=new fo(p,A)),C},this.getAttributes=function(){return void 0===L&&(L=function(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=t.getActiveAttrib(e,r),o=a.name,s=1;a.type===t.FLOAT_MAT2&&(s=2),a.type===t.FLOAT_MAT3&&(s=3),a.type===t.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:t.getAttribLocation(e,o),locationSize:s}}return n}(p,A)),L},this.destroy=function(){o.releaseStatesOfProgram(this),p.deleteProgram(A),this.program=void 0},this.type=a.shaderType,this.name=a.shaderName,this.id=vo++,this.cacheKey=e,this.usedTimes=1,this.program=A,this.vertexShader=I,this.fragmentShader=N,this}var Po=0,Uo=function(){function t(){this.shaderCache=new Map,this.materialCache=new Map}var e=t.prototype;return e.update=function(t){var e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this},e.remove=function(t){for(var e,n=jt(this.materialCache.get(t));!(e=n()).done;){var i=e.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}return this.materialCache.delete(t),this},e.getVertexShaderID=function(t){return this._getShaderStage(t.vertexShader).id},e.getFragmentShaderID=function(t){return this._getShaderStage(t.fragmentShader).id},e.dispose=function(){this.shaderCache.clear(),this.materialCache.clear()},e._getShaderCacheForMaterial=function(t){var e=this.materialCache,n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n},e._getShaderStage=function(t){var e=this.shaderCache,n=e.get(t);return void 0===n&&(n=new Io(t),e.set(t,n)),n},t}(),Io=function(t){this.id=Po++,this.code=t,this.usedTimes=0};function No(t,e,n,i,r,a,s){var l=new On,u=new Uo,c=[],d=r.isWebGL2,p=r.logarithmicDepthBuffer,f=r.vertexTextures,m=r.precision,v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(t){return 0===t?"uv":"uv"+t}return{getParameters:function(a,l,c,y,_){var x=y.fog,M=_.geometry,b=a.isMeshStandardMaterial?y.environment:null,E=(a.isMeshStandardMaterial?n:e).get(a.envMap||b),w=E&&E.mapping===S?E.image.height:null,T=v[a.type];null!==a.precision&&(m=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",m,"instead.");var A,R,C,L,P=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,U=void 0!==P?P.length:0,I=0;if(void 0!==M.morphAttributes.position&&(I=1),void 0!==M.morphAttributes.normal&&(I=2),void 0!==M.morphAttributes.color&&(I=3),T){var N=Ir[T];A=N.vertexShader,R=N.fragmentShader}else A=a.vertexShader,R=a.fragmentShader,u.update(a),C=u.getVertexShaderID(a),L=u.getFragmentShaderID(a);var D=t.getRenderTarget(),O=!0===_.isInstancedMesh,B=!!a.map,F=!!a.matcap,z=!!E,G=!!a.aoMap,k=!!a.lightMap,H=!!a.bumpMap,V=!!a.normalMap,W=!!a.displacementMap,X=!!a.emissiveMap,j=!!a.metalnessMap,q=!!a.roughnessMap,Y=a.anisotropy>0,Z=a.clearcoat>0,J=a.iridescence>0,K=a.sheen>0,Q=a.transmission>0,$=Y&&!!a.anisotropyMap,tt=Z&&!!a.clearcoatMap,et=Z&&!!a.clearcoatNormalMap,nt=Z&&!!a.clearcoatRoughnessMap,it=J&&!!a.iridescenceMap,rt=J&&!!a.iridescenceThicknessMap,at=K&&!!a.sheenColorMap,ot=K&&!!a.sheenRoughnessMap,st=!!a.specularMap,lt=!!a.specularColorMap,ut=!!a.specularIntensityMap,ct=Q&&!!a.transmissionMap,ht=Q&&!!a.thicknessMap,dt=!!a.gradientMap,pt=!!a.alphaMap,ft=a.alphaTest>0,mt=!!a.extensions,vt=!!M.attributes.uv1,gt=!!M.attributes.uv2,yt=!!M.attributes.uv3;return{isWebGL2:d,shaderID:T,shaderType:a.type,shaderName:a.type,vertexShader:A,fragmentShader:R,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:L,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:m,instancing:O,instancingColor:O&&null!==_.instanceColor,supportsVertexTextures:f,outputColorSpace:null===D?t.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:It,map:B,matcap:F,envMap:z,envMapMode:z&&E.mapping,envMapCubeUVHeight:w,aoMap:G,lightMap:k,bumpMap:H,normalMap:V,displacementMap:f&&W,emissiveMap:X,normalMapObjectSpace:V&&1===a.normalMapType,normalMapTangentSpace:V&&0===a.normalMapType,metalnessMap:j,roughnessMap:q,anisotropy:Y,anisotropyMap:$,clearcoat:Z,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:at,sheenRoughnessMap:ot,specularMap:st,specularColorMap:lt,specularIntensityMap:ut,transmission:Q,transmissionMap:ct,thicknessMap:ht,gradientMap:dt,opaque:!1===a.transparent&&1===a.blending,alphaMap:pt,alphaTest:ft,combine:a.combine,mapUv:B&&g(a.map.channel),aoMapUv:G&&g(a.aoMap.channel),lightMapUv:k&&g(a.lightMap.channel),bumpMapUv:H&&g(a.bumpMap.channel),normalMapUv:V&&g(a.normalMap.channel),displacementMapUv:W&&g(a.displacementMap.channel),emissiveMapUv:X&&g(a.emissiveMap.channel),metalnessMapUv:j&&g(a.metalnessMap.channel),roughnessMapUv:q&&g(a.roughnessMap.channel),anisotropyMapUv:$&&g(a.anisotropyMap.channel),clearcoatMapUv:tt&&g(a.clearcoatMap.channel),clearcoatNormalMapUv:et&&g(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&g(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&g(a.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&g(a.iridescenceThicknessMap.channel),sheenColorMapUv:at&&g(a.sheenColorMap.channel),sheenRoughnessMapUv:ot&&g(a.sheenRoughnessMap.channel),specularMapUv:st&&g(a.specularMap.channel),specularColorMapUv:lt&&g(a.specularColorMap.channel),specularIntensityMapUv:ut&&g(a.specularIntensityMap.channel),transmissionMapUv:ct&&g(a.transmissionMap.channel),thicknessMapUv:ht&&g(a.thicknessMap.channel),alphaMapUv:pt&&g(a.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(V||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,vertexUv1s:vt,vertexUv2s:gt,vertexUv3s:yt,pointsUvs:!0===_.isPoints&&!!M.attributes.uv&&(B||pt),fog:!!x,useFog:!0===a.fog,fogExp2:x&&x.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:U,morphTextureStride:I,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:h,useLegacyLights:t.useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:a.side===o,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:mt&&!0===a.extensions.derivatives,extensionFragDepth:mt&&!0===a.extensions.fragDepth,extensionDrawBuffers:mt&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:mt&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey(),useModelMatrixAttrib:!!(_.instancedCount&&_.instancedCount>=1)}},getProgramCacheKey:function(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){l.disableAll(),e.isWebGL2&&l.enable(0);e.supportsVertexTextures&&l.enable(1);e.instancing&&l.enable(2);e.instancingColor&&l.enable(3);e.matcap&&l.enable(4);e.envMap&&l.enable(5);e.normalMapObjectSpace&&l.enable(6);e.normalMapTangentSpace&&l.enable(7);e.clearcoat&&l.enable(8);e.iridescence&&l.enable(9);e.alphaTest&&l.enable(10);e.vertexColors&&l.enable(11);e.vertexAlphas&&l.enable(12);e.vertexUv1s&&l.enable(13);e.vertexUv2s&&l.enable(14);e.vertexUv3s&&l.enable(15);e.vertexTangents&&l.enable(16);e.anisotropy&&l.enable(17);t.push(l.mask),l.disableAll(),e.useModelMatrixAttrib&&l.enable(0);t.push(l.mask),l.disableAll(),e.fog&&l.enable(0);e.useFog&&l.enable(1);e.flatShading&&l.enable(2);e.logarithmicDepthBuffer&&l.enable(3);e.skinning&&l.enable(4);e.morphTargets&&l.enable(5);e.morphNormals&&l.enable(6);e.morphColors&&l.enable(7);e.premultipliedAlpha&&l.enable(8);e.shadowMapEnabled&&l.enable(9);e.useLegacyLights&&l.enable(10);e.doubleSided&&l.enable(11);e.flipSided&&l.enable(12);e.useDepthPacking&&l.enable(13);e.dithering&&l.enable(14);e.transmission&&l.enable(15);e.sheen&&l.enable(16);e.opaque&&l.enable(17);e.pointsUvs&&l.enable(18);t.push(l.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){var e,n=v[t.type];if(n){var i=Ir[n];e=pr.clone(i.uniforms)}else e=t.uniforms;return e},acquireProgram:function(e,n){for(var i,r=0,o=c.length;r<o;r++){var s=c[r];if(s.cacheKey===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new Lo(t,n,e,a),c.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){var e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){u.remove(t)},programs:c,dispose:function(){u.dispose()}}}function Do(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Oo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Bo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Fo(){var t=[],e=0,n=[],i=[],r=[];function a(n,i,r,a,o,s){var l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,i,o,s,l){var u=a(t,e,i,o,s,l);!0===i.transparent?r.push(u):n.push(u)},unshift:function(t,e,i,o,s,l){var u=a(t,e,i,o,s,l);!0===i.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(var n=e,i=t.length;n<i;n++){var r=t[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Oo),i.length>1&&i.sort(e||Bo),r.length>1&&r.sort(e||Bo)}}}function zo(){var t=new WeakMap;return{get:function(e,n){var i,r=t.get(e);return void 0===r?(i=new Fo,t.set(e,[i])):n>=r.length?(i=new Fo,r.push(i)):i=r[n],i},dispose:function(){t=new WeakMap}}}function Go(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ye,color:new mi};break;case"SpotLight":n={position:new Ye,direction:new Ye,color:new mi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ye,color:new mi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ye,skyColor:new mi,groundColor:new mi};break;case"RectAreaLight":n={color:new mi,position:new Ye,halfWidth:new Ye,halfHeight:new Ye}}return t[e.id]=n,n}}}var ko=0;function Ho(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Vo(t,e){for(var n,i=new Go,r=(n={},{get:function(t){if(void 0!==n[t.id])return n[t.id];var e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me,shadowCameraNear:1,shadowCameraFar:1e3}}return n[t.id]=e,e}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0},o=0;o<9;o++)a.probe.push(new Ye);var s=new Ye,l=new wn,u=new wn;return{setup:function(n,o){for(var s=0,l=0,u=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,p=0,f=0,m=0,v=0,g=0,y=0,_=0,x=0;n.sort(Ho);for(var M=!0===o?Math.PI:1,S=0,b=n.length;S<b;S++){var E=n[S],w=E.color,T=E.intensity,A=E.distance,R=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)s+=w.r*T*M,l+=w.g*T*M,u+=w.b*T*M;else if(E.isLightProbe)for(var C=0;C<9;C++)a.probe[C].addScaledVector(E.sh.coefficients[C],T);else if(E.isDirectionalLight){var L=i.get(E);if(L.color.copy(E.color).multiplyScalar(E.intensity*M),E.castShadow){var P=E.shadow,U=r.get(E);U.shadowBias=P.bias,U.shadowNormalBias=P.normalBias,U.shadowRadius=P.radius,U.shadowMapSize=P.mapSize,a.directionalShadow[h]=U,a.directionalShadowMap[h]=R,a.directionalShadowMatrix[h]=E.shadow.matrix,v++}a.directional[h]=L,h++}else if(E.isSpotLight){var I=i.get(E);I.position.setFromMatrixPosition(E.matrixWorld),I.color.copy(w).multiplyScalar(T*M),I.distance=A,I.coneCos=Math.cos(E.angle),I.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),I.decay=E.decay,a.spot[p]=I;var N=E.shadow;if(E.map&&(a.spotLightMap[_]=E.map,_++,N.updateMatrices(E),E.castShadow&&x++),a.spotLightMatrix[p]=N.matrix,E.castShadow){var D=r.get(E);D.shadowBias=N.bias,D.shadowNormalBias=N.normalBias,D.shadowRadius=N.radius,D.shadowMapSize=N.mapSize,a.spotShadow[p]=D,a.spotShadowMap[p]=R,y++}p++}else if(E.isRectAreaLight){var O=i.get(E);O.color.copy(w).multiplyScalar(T),O.halfWidth.set(.5*E.width,0,0),O.halfHeight.set(0,.5*E.height,0),a.rectArea[f]=O,f++}else if(E.isPointLight){var B=i.get(E);if(B.color.copy(E.color).multiplyScalar(E.intensity*M),B.distance=E.distance,B.decay=E.decay,E.castShadow){var F=E.shadow,z=r.get(E);z.shadowBias=F.bias,z.shadowNormalBias=F.normalBias,z.shadowRadius=F.radius,z.shadowMapSize=F.mapSize,z.shadowCameraNear=F.camera.near,z.shadowCameraFar=F.camera.far,a.pointShadow[d]=z,a.pointShadowMap[d]=R,a.pointShadowMatrix[d]=E.shadow.matrix,g++}a.point[d]=B,d++}else if(E.isHemisphereLight){var G=i.get(E);G.skyColor.copy(E.color).multiplyScalar(T*M),G.groundColor.copy(E.groundColor).multiplyScalar(T*M),a.hemi[m]=G,m++}}f>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(a.rectAreaLTC1=Ur.LTC_FLOAT_1,a.rectAreaLTC2=Ur.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Ur.LTC_HALF_1,a.rectAreaLTC2=Ur.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=l,a.ambient[2]=u;var k=a.hash;k.directionalLength===h&&k.pointLength===d&&k.spotLength===p&&k.rectAreaLength===f&&k.hemiLength===m&&k.numDirectionalShadows===v&&k.numPointShadows===g&&k.numSpotShadows===y&&k.numSpotMaps===_||(a.directional.length=h,a.spot.length=p,a.rectArea.length=f,a.point.length=d,a.hemi.length=m,a.directionalShadow.length=v,a.directionalShadowMap.length=v,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=v,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,k.directionalLength=h,k.pointLength=d,k.spotLength=p,k.rectAreaLength=f,k.hemiLength=m,k.numDirectionalShadows=v,k.numPointShadows=g,k.numSpotShadows=y,k.numSpotMaps=_,a.version=ko++)},setupView:function(t,e){for(var n=0,i=0,r=0,o=0,c=0,h=e.matrixWorldInverse,d=0,p=t.length;d<p;d++){var f=t[d];if(f.isDirectionalLight){var m=a.directional[n];m.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),n++}else if(f.isSpotLight){var v=a.spot[r];v.position.setFromMatrixPosition(f.matrixWorld),v.position.applyMatrix4(h),v.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),r++}else if(f.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(f.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*f.width,0,0),g.halfHeight.set(0,.5*f.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),o++}else if(f.isPointLight){var y=a.point[i];y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(h),i++}else if(f.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(f.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function Wo(t,e){var n=new Vo(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function Xo(t,e){var n=new WeakMap;return{get:function(i,r){void 0===r&&(r=0);var a,o=n.get(i);return void 0===o?(a=new Wo(t,e),n.set(i,[a])):r>=o.length?(a=new Wo(t,e),o.push(a)):a=o[r],a},dispose:function(){n=new WeakMap}}}var jo=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshDepthMaterial=!0,n.type="MeshDepthMaterial",n.depthPacking=3200,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,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},e}(ci),qo=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshDistanceMaterial=!0,n.type="MeshDistanceMaterial",n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},e}(ci);function Yo(t,e,i){var s,l=new Ar,u=new me,c=new me,h=new Ge,d=new jo({depthPacking:3201}),p=new qo,f={},m=i.maxTextureSize,v=((s={})[a]=o,s[o]=a,s[2]=2,s),g=new fr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new me},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),y=g.clone();y.defines.HORIZONTAL_PASS=1;var _=new Vi;_.setAttribute("position",new wi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new sr(_,g),M=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=n;var S=this.type;function b(n,i){var r=e.update(x);g.defines.VSM_SAMPLES!==n.blurSamples&&(g.defines.VSM_SAMPLES=n.blurSamples,y.defines.VSM_SAMPLES=n.blurSamples,g.needsUpdate=!0,y.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ke(u.x,u.y)),g.uniforms.shadow_pass.value=n.map.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,g,x,null),y.uniforms.shadow_pass.value=n.mapPass.texture,y.uniforms.resolution.value=n.mapSize,y.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,y,x,null)}function E(e,n,i,a){var o=null,s=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==s)o=s;else if(o=!0===i.isPointLight?p:d,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var l=o.uuid,u=n.uuid,c=f[l];void 0===c&&(c={},f[l]=c);var h=c[u];void 0===h&&(h=o.clone(),c[u]=h),o=h}(o.visible=n.visible,o.wireframe=n.wireframe,o.side=a===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:v[n.side],o.alphaMap=n.alphaMap,o.alphaTest=n.alphaTest,o.map=n.map,o.clipShadows=n.clipShadows,o.clippingPlanes=n.clippingPlanes,o.clipIntersection=n.clipIntersection,o.displacementMap=n.displacementMap,o.displacementScale=n.displacementScale,o.displacementBias=n.displacementBias,o.wireframeLinewidth=n.wireframeLinewidth,o.linewidth=n.linewidth,!0===i.isPointLight&&!0===o.isMeshDistanceMaterial)&&(t.properties.get(o).light=i);return o}function w(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===r)&&(!n.frustumCulled||l.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=e.update(n),c=n.material;if(Array.isArray(c))for(var h=u.groups,d=0,p=h.length;d<p;d++){var f=h[d],m=c[f.materialIndex];if(m&&m.visible){var v=E(n,m,o,s);t.renderBufferDirect(a,null,u,v,n,f)}}else if(c.visible){var g=E(n,c,o,s);t.renderBufferDirect(a,null,u,g,n,null)}}for(var y=n.children,_=0,x=y.length;_<x;_++)w(y[_],i,a,o,s)}}this.render=function(e,n,i){if(!1!==M.enabled&&(!1!==M.autoUpdate||!1!==M.needsUpdate)&&0!==e.length){var a=t.getRenderTarget(),o=t.getActiveCubeFace(),s=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=S!==r&&this.type===r,f=S===r&&this.type!==r,v=0,g=e.length;v<g;v++){var y=e[v],_=y.shadow;if(void 0!==_){if(!1!==_.autoUpdate||!1!==_.needsUpdate){u.copy(_.mapSize);var x=_.getFrameExtents();if(u.multiply(x),c.copy(_.mapSize),(u.x>m||u.y>m)&&(u.x>m&&(c.x=Math.floor(m/x.x),u.x=c.x*x.x,_.mapSize.x=c.x),u.y>m&&(c.y=Math.floor(m/x.y),u.y=c.y*x.y,_.mapSize.y=c.y)),null===_.map||!0===p||!0===f){var E=this.type!==r?{minFilter:T,magFilter:T}:{};null!==_.map&&_.map.dispose(),_.map=new ke(u.x,u.y,E),_.map.texture.name=y.name+".shadowMap",_.camera.updateProjectionMatrix()}t.setRenderTarget(_.map),t.clear();for(var A=_.getViewportCount(),R=0;R<A;R++){var C=_.getViewport(R);h.set(c.x*C.x,c.y*C.y,c.x*C.z,c.y*C.w),d.viewport(h),_.updateMatrices(y,R),l=_.getFrustum(),w(n,i,_.camera,y,this.type)}!0!==_.isPointLightShadow&&this.type===r&&b(_,i),_.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",y,"has no shadow.")}S=this.type,M.needsUpdate=!1,t.setRenderTarget(a,o,s)}}}function Zo(t,e,n){var i,r,a=n.isWebGL2;var l=new function(){var e=!1,n=new Ge,i=null,r=new Ge(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,o,s){!0===s&&(e*=o,i*=o,a*=o),n.set(e,i,a,o),!1===r.equals(n)&&(t.clearColor(e,i,a,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},u=new function(){var e=!1,n=null,i=null,r=null;return{setTest:function(e){e?W(t.DEPTH_TEST):X(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},c=new function(){var e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(n){e||(n?W(t.STENCIL_TEST):X(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&a===o||(t.stencilFunc(e,n,o),i=e,r=n,a=o)},setOp:function(e,n,i){o===e&&s===n&&l===i||(t.stencilOp(e,n,i),o=e,s=n,l=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,u=null}}},h=new WeakMap,d=new WeakMap,p={},f={},m=new WeakMap,v=[],g=null,y=!1,_=null,x=null,M=null,S=null,b=null,E=null,w=null,T=!1,A=null,R=null,C=null,L=null,P=null,U=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),I=!1,N=0,D=t.getParameter(t.VERSION);-1!==D.indexOf("WebGL")?(N=parseFloat(/^WebGL (\d)/.exec(D)[1]),I=N>=1):-1!==D.indexOf("OpenGL ES")&&(N=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),I=N>=2);var O=null,B={},F=t.getParameter(t.SCISSOR_BOX),z=t.getParameter(t.VIEWPORT),G=(new Ge).fromArray(F),k=(new Ge).fromArray(z);function H(e,n,i,r){var o=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var l=0;l<i;l++)!a||e!==t.TEXTURE_3D&&e!==t.TEXTURE_2D_ARRAY?t.texImage2D(n+l,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,o):t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,o);return s}var V={};function W(e){!0!==p[e]&&(t.enable(e),p[e]=!0)}function X(e){!1!==p[e]&&(t.disable(e),p[e]=!1)}V[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),V[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),a&&(V[t.TEXTURE_2D_ARRAY]=H(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),V[t.TEXTURE_3D]=H(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),l.setClear(0,0,0,1),u.setClear(1),c.setClear(0),W(t.DEPTH_TEST),u.setFunc(3),J(!1),K(1),W(t.CULL_FACE),Z(0);var j=((i={})[100]=t.FUNC_ADD,i[101]=t.FUNC_SUBTRACT,i[102]=t.FUNC_REVERSE_SUBTRACT,i);if(a)j[103]=t.MIN,j[104]=t.MAX;else{var q=e.get("EXT_blend_minmax");null!==q&&(j[103]=q.MIN_EXT,j[104]=q.MAX_EXT)}var Y=((r={})[200]=t.ZERO,r[201]=t.ONE,r[202]=t.SRC_COLOR,r[204]=t.SRC_ALPHA,r[210]=t.SRC_ALPHA_SATURATE,r[208]=t.DST_COLOR,r[206]=t.DST_ALPHA,r[203]=t.ONE_MINUS_SRC_COLOR,r[205]=t.ONE_MINUS_SRC_ALPHA,r[209]=t.ONE_MINUS_DST_COLOR,r[207]=t.ONE_MINUS_DST_ALPHA,r);function Z(e,n,i,r,a,o,l,u){if(0!==e){if(!1===y&&(W(t.BLEND),y=!0),5===e)a=a||n,o=o||i,l=l||r,n===x&&a===b||(t.blendEquationSeparate(j[n],j[a]),x=n,b=a),i===M&&r===S&&o===E&&l===w||(t.blendFuncSeparate(Y[i],Y[r],Y[o],Y[l]),M=i,S=r,E=o,w=l),_=e,T=!1;else if(e!==_||u!==T){if(x===s&&b===s||(t.blendEquation(t.FUNC_ADD),x=s,b=s),u)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}M=null,S=null,E=null,w=null,_=e,T=u}}else!0===y&&(X(t.BLEND),y=!1)}function J(e){A!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),A=e)}function K(e){0!==e?(W(t.CULL_FACE),e!==R&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):X(t.CULL_FACE),R=e}function Q(e,n,i){e?(W(t.POLYGON_OFFSET_FILL),L===n&&P===i||(t.polygonOffset(n,i),L=n,P=i)):X(t.POLYGON_OFFSET_FILL)}return{buffers:{color:l,depth:u,stencil:c},enable:W,disable:X,bindFramebuffer:function(e,n){return f[e]!==n&&(t.bindFramebuffer(e,n),f[e]=n,a&&(e===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(i,r){var a=v,o=!1;if(i)if(void 0===(a=m.get(r))&&(a=[],m.set(r,a)),i.isWebGLMultipleRenderTargets){var s=i.texture;if(a.length!==s.length||a[0]!==t.COLOR_ATTACHMENT0){for(var l=0,u=s.length;l<u;l++)a[l]=t.COLOR_ATTACHMENT0+l;a.length=s.length,o=!0}}else a[0]!==t.COLOR_ATTACHMENT0&&(a[0]=t.COLOR_ATTACHMENT0,o=!0);else a[0]!==t.BACK&&(a[0]=t.BACK,o=!0);o&&(n.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return g!==e&&(t.useProgram(e),g=e,!0)},setBlending:Z,setMaterial:function(e,n){2===e.side?X(t.CULL_FACE):W(t.CULL_FACE);var i=e.side===o;n&&(i=!i),J(i),1===e.blending&&!1===e.transparent?Z(0):Z(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),u.setFunc(e.depthFunc),u.setTest(e.depthTest),u.setMask(e.depthWrite),l.setMask(e.colorWrite);var r=e.stencilWrite;c.setTest(r),r&&(c.setMask(e.stencilWriteMask),c.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),c.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?W(t.SAMPLE_ALPHA_TO_COVERAGE):X(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:J,setCullFace:K,setLineWidth:function(e){e!==C&&(I&&t.lineWidth(e),C=e)},setPolygonOffset:Q,setScissorTest:function(e){e?W(t.SCISSOR_TEST):X(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+U-1),O!==e&&(t.activeTexture(e),O=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===O?t.TEXTURE0+U-1:O);var r=B[i];void 0===r&&(r={type:void 0,texture:void 0},B[i]=r),r.type===e&&r.texture===n||(O!==i&&(t.activeTexture(i),O=i),t.bindTexture(e,n||V[e]),r.type=e,r.texture=n)},unbindTexture:function(){var e=B[O];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){var i=d.get(n);void 0===i&&(i=new WeakMap,d.set(n,i));var r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){var i=d.get(n).get(e);h.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),h.set(n,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===G.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),G.copy(e))},viewport:function(e){!1===k.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),k.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),!0===a&&(t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),p={},O=null,B={},f={},m=new WeakMap,v=[],g=null,y=!1,_=null,x=null,M=null,S=null,b=null,E=null,w=null,T=!1,A=null,R=null,C=null,L=null,P=null,G.set(0,0,t.canvas.width,t.canvas.height),k.set(0,0,t.canvas.width,t.canvas.height),l.reset(),u.reset(),c.reset()}}}function Jo(t,e,n,i,r,a,o){var s,l,u,c,h=r.isWebGL2,d=r.maxTextures,p=r.maxCubemapSize,f=r.maxTextureSize,m=r.maxSamples,v=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,g="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap,_=new WeakMap,x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function M(t,e){return x?new OffscreenCanvas(t,e):Me("canvas")}function S(t,e,n,i){var r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?he:Math.floor,o=a(r*t.width),s=a(r*t.height);void 0===c&&(c=M(o,s));var l=n?M(o,s):c;return l.width=o,l.height=s,l.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function b(t){return ue(t.width)&&ue(t.height)}function w(t,e){return t.generateMipmaps&&e&&t.minFilter!==T&&t.minFilter!==C}function L(e){t.generateMipmap(e)}function N(n,i,r,a,o){if(void 0===o&&(o=!1),!1===h)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;return i===t.RED&&(r===t.FLOAT&&(s=t.R32F),r===t.HALF_FLOAT&&(s=t.R16F),r===t.UNSIGNED_BYTE&&(s=t.R8)),i===t.RG&&(r===t.FLOAT&&(s=t.RG32F),r===t.HALF_FLOAT&&(s=t.RG16F),r===t.UNSIGNED_BYTE&&(s=t.RG8)),i===t.RGBA&&(r===t.FLOAT&&(s=t.RGBA32F),r===t.HALF_FLOAT&&(s=t.RGBA16F),r===t.UNSIGNED_BYTE&&(s=a===Ut&&!1===o?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(s=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(s=t.RGB5_A1)),s!==t.R16F&&s!==t.R32F&&s!==t.RG16F&&s!==t.RG32F&&s!==t.RGBA16F&&s!==t.RGBA32F||e.get("EXT_color_buffer_float"),s}function F(t,e,n){return!0===w(t,n)||t.isFramebufferTexture&&t.minFilter!==T&&t.minFilter!==C?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function z(e){return e===T||e===A||e===R?t.NEAREST:t.LINEAR}function W(t){var e=t.target;e.removeEventListener("dispose",W),function(t){var e=i.get(t);if(void 0===e.__webglInit)return;var n=t.source,r=_.get(n);if(r){var a=r[e.__cacheKey];a.usedTimes--,0===a.usedTimes&&j(t),0===Object.keys(r).length&&_.delete(n)}i.remove(t)}(e),e.isVideoTexture&&y.delete(e)}function X(e){var n=e.target;n.removeEventListener("dispose",X),function(e){var n=e.texture,r=i.get(e),a=i.get(n);void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)t.deleteFramebuffer(r.__webglFramebuffer[s]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[s]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(var l=0;l<r.__webglColorRenderbuffer.length;l++)r.__webglColorRenderbuffer[l]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[l]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(var u=0,c=n.length;u<c;u++){var h=i.get(n[u]);h.__webglTexture&&(t.deleteTexture(h.__webglTexture),o.memory.textures--),i.remove(n[u])}i.remove(n),i.remove(e)}(n)}function j(e){var n=i.get(e);t.deleteTexture(n.__webglTexture);var r=e.source;delete _.get(r)[n.__cacheKey],o.memory.textures--}var q=0;function Y(e,r){var a=i.get(e);if(e.isVideoTexture&&function(t){var e=o.render.frame;y.get(t)!==e&&(y.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){var s=e.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void tt(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}var Z=((s={})[1e3]=t.REPEAT,s[1001]=t.CLAMP_TO_EDGE,s[1002]=t.MIRRORED_REPEAT,s),J=((l={})[1003]=t.NEAREST,l[1004]=t.NEAREST_MIPMAP_NEAREST,l[1005]=t.NEAREST_MIPMAP_LINEAR,l[1006]=t.LINEAR,l[1007]=t.LINEAR_MIPMAP_NEAREST,l[1008]=t.LINEAR_MIPMAP_LINEAR,l),K=((u={})[512]=t.NEVER,u[519]=t.ALWAYS,u[513]=t.LESS,u[515]=t.LEQUAL,u[514]=t.EQUAL,u[518]=t.GEQUAL,u[516]=t.GREATER,u[517]=t.NOTEQUAL,u);function Q(n,a,o){if(o?(t.texParameteri(n,t.TEXTURE_WRAP_S,Z[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,Z[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,Z[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,J[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,J[a.minFilter])):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),a.wrapS===E&&a.wrapT===E||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,t.TEXTURE_MAG_FILTER,z(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,z(a.minFilter)),a.minFilter!==T&&a.minFilter!==C&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,K[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){var s=e.get("EXT_texture_filter_anisotropic");if(a.magFilter===T)return;if(a.minFilter!==R&&a.minFilter!==P)return;if(a.type===O&&!1===e.has("OES_texture_float_linear"))return;if(!1===h&&a.type===B&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function $(e,n){var i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",W));var r=n.source,a=_.get(r);void 0===a&&(a={},_.set(r,a));var s=function(t){var e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[e.__cacheKey];void 0!==l&&(a[e.__cacheKey].usedTimes--,0===l.usedTimes&&j(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return i}function tt(e,r,o){var s=t.TEXTURE_2D;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(s=t.TEXTURE_2D_ARRAY),r.isData3DTexture&&(s=t.TEXTURE_3D);var l=$(e,r),u=r.source;n.bindTexture(s,e.__webglTexture,t.TEXTURE0+o);var c=i.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(t.TEXTURE0+o),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);var d,p=function(t){return!h&&(t.wrapS!==E||t.wrapT!==E||t.minFilter!==T&&t.minFilter!==C)}(r)&&!1===b(r.image),m=S(r.image,p,!1,f),v=b(m=ot(r,m))||h,g=a.convert(r.format,r.colorSpace),y=a.convert(r.type),_=N(r.internalFormat,g,y,r.colorSpace);Q(s,r,v);var x=r.mipmaps,M=h&&!0!==r.isVideoTexture,A=void 0===c.__version||!0===l,R=F(r,m,v);if(r.isDepthTexture)_=t.DEPTH_COMPONENT,h?_=r.type===O?t.DEPTH_COMPONENT32F:r.type===D?t.DEPTH_COMPONENT24:r.type===G?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:r.type===O&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===H&&_===t.DEPTH_COMPONENT&&r.type!==I&&r.type!==D&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=D,y=a.convert(r.type)),r.format===V&&_===t.DEPTH_COMPONENT&&(_=t.DEPTH_STENCIL,r.type!==G&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=G,y=a.convert(r.type))),A&&(M?n.texStorage2D(t.TEXTURE_2D,1,_,m.width,m.height):n.texImage2D(t.TEXTURE_2D,0,_,m.width,m.height,0,g,y,null));else if(r.isDataTexture)if(x.length>0&&v){M&&A&&n.texStorage2D(t.TEXTURE_2D,R,_,x[0].width,x[0].height);for(var P=0,U=x.length;P<U;P++)d=x[P],M?n.texSubImage2D(t.TEXTURE_2D,P,0,0,d.width,d.height,g,y,d.data):n.texImage2D(t.TEXTURE_2D,P,_,d.width,d.height,0,g,y,d.data);r.generateMipmaps=!1}else M?(A&&n.texStorage2D(t.TEXTURE_2D,R,_,m.width,m.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,m.width,m.height,g,y,m.data)):n.texImage2D(t.TEXTURE_2D,0,_,m.width,m.height,0,g,y,m.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){M&&A&&n.texStorage3D(t.TEXTURE_2D_ARRAY,R,_,x[0].width,x[0].height,m.depth);for(var B=0,z=x.length;B<z;B++)d=x[B],r.format!==k?null!==g?M?n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,B,0,0,0,d.width,d.height,m.depth,g,d.data,0,0):n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,B,_,d.width,d.height,m.depth,0,d.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage3D(t.TEXTURE_2D_ARRAY,B,0,0,0,d.width,d.height,m.depth,g,y,d.data):n.texImage3D(t.TEXTURE_2D_ARRAY,B,_,d.width,d.height,m.depth,0,g,y,d.data)}else{M&&A&&n.texStorage2D(t.TEXTURE_2D,R,_,x[0].width,x[0].height);for(var W=0,X=x.length;W<X;W++)d=x[W],r.format!==k?null!==g?M?n.compressedTexSubImage2D(t.TEXTURE_2D,W,0,0,d.width,d.height,g,d.data):n.compressedTexImage2D(t.TEXTURE_2D,W,_,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage2D(t.TEXTURE_2D,W,0,0,d.width,d.height,g,y,d.data):n.texImage2D(t.TEXTURE_2D,W,_,d.width,d.height,0,g,y,d.data)}else if(r.isDataArrayTexture)M?(A&&n.texStorage3D(t.TEXTURE_2D_ARRAY,R,_,m.width,m.height,m.depth),n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,m.width,m.height,m.depth,g,y,m.data)):n.texImage3D(t.TEXTURE_2D_ARRAY,0,_,m.width,m.height,m.depth,0,g,y,m.data);else if(r.isData3DTexture)M?(A&&n.texStorage3D(t.TEXTURE_3D,R,_,m.width,m.height,m.depth),n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,m.width,m.height,m.depth,g,y,m.data)):n.texImage3D(t.TEXTURE_3D,0,_,m.width,m.height,m.depth,0,g,y,m.data);else if(r.isFramebufferTexture){if(A)if(M)n.texStorage2D(t.TEXTURE_2D,R,_,m.width,m.height);else for(var j=m.width,q=m.height,Y=0;Y<R;Y++)n.texImage2D(t.TEXTURE_2D,Y,_,j,q,0,g,y,null),j>>=1,q>>=1}else if(x.length>0&&v){M&&A&&n.texStorage2D(t.TEXTURE_2D,R,_,x[0].width,x[0].height);for(var Z=0,J=x.length;Z<J;Z++)d=x[Z],M?n.texSubImage2D(t.TEXTURE_2D,Z,0,0,g,y,d):n.texImage2D(t.TEXTURE_2D,Z,_,g,y,d);r.generateMipmaps=!1}else M?(A&&n.texStorage2D(t.TEXTURE_2D,R,_,m.width,m.height),n.texSubImage2D(t.TEXTURE_2D,0,0,0,g,y,m)):n.texImage2D(t.TEXTURE_2D,0,_,g,y,m);w(r,v)&&L(s),c.__version=u.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function et(e,r,o,s,l){var u=a.convert(o.format,o.colorSpace),c=a.convert(o.type),h=N(o.internalFormat,u,c,o.colorSpace);i.get(r).__hasExternalTextures||(l===t.TEXTURE_3D||l===t.TEXTURE_2D_ARRAY?n.texImage3D(l,0,h,r.width,r.height,r.depth,0,u,c,null):n.texImage2D(l,0,h,r.width,r.height,0,u,c,null)),n.bindFramebuffer(t.FRAMEBUFFER,e),at(r)?v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,s,l,i.get(o).__webglTexture,0,rt(r)):(l===t.TEXTURE_2D||l>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,s,l,i.get(o).__webglTexture,0),n.bindFramebuffer(t.FRAMEBUFFER,null)}function nt(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer){var r=t.DEPTH_COMPONENT16;if(i||at(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===O?r=t.DEPTH_COMPONENT32F:o.type===D&&(r=t.DEPTH_COMPONENT24));var s=rt(n);at(n)?v.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,s,r,n.width,n.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,s,r,n.width,n.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,n.width,n.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(n.depthBuffer&&n.stencilBuffer){var l=rt(n);i&&!1===at(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,l,t.DEPTH24_STENCIL8,n.width,n.height):at(n)?v.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,l,t.DEPTH24_STENCIL8,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<u.length;c++){var h=u[c],d=a.convert(h.format,h.colorSpace),p=a.convert(h.type),f=N(h.internalFormat,d,p,h.colorSpace),m=rt(n);i&&!1===at(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,m,f,n.width,n.height):at(n)?v.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,m,f,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,f,n.width,n.height)}t.bindRenderbuffer(t.RENDERBUFFER,null)}function it(e){var r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),Y(r.depthTexture,0);var a=i.get(r.depthTexture).__webglTexture,o=rt(r);if(r.depthTexture.format===H)at(r)?v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==V)throw new Error("Unknown depthTexture format");at(r)?v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[o]),r.__webglDepthbuffer[o]=t.createRenderbuffer(),nt(r.__webglDepthbuffer[o],e,!1)}else n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),nt(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(t.FRAMEBUFFER,null)}function rt(t){return Math.min(m,t.samples)}function at(t){var n=i.get(t);return h&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function ot(t,n){var i=t.colorSpace,r=t.format,a=t.type;return!0===t.isCompressedTexture||t.format===Ft||i!==It&&i!==Pt&&(i===Ut?!1===h?!0===e.has("EXT_sRGB")&&r===k?(t.format=Ft,t.minFilter=C,t.generateMipmaps=!1):n=Ne.sRGBToLinear(n):r===k&&a===U||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){var t=q;return t>=d&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+d),q+=1,t},this.resetTextureUnits=function(){q=0},this.setTexture2D=Y,this.setTexture2DArray=function(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?tt(a,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?tt(a,e,r):n.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,r){var o=i.get(e);e.version>0&&o.__version!==e.version?function(e,r,o){if(6!==r.image.length)return;var s=$(e,r),l=r.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);var u=i.get(l);if(l.version!==u.__version||!0===s){n.activeTexture(t.TEXTURE0+o),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);for(var c=r.isCompressedTexture||r.image[0].isCompressedTexture,d=r.image[0]&&r.image[0].isDataTexture,f=[],m=0;m<6;m++)f[m]=c||d?d?r.image[m].image:r.image[m]:S(r.image[m],!1,!0,p),f[m]=ot(r,f[m]);var v,g=f[0],y=b(g)||h,_=a.convert(r.format,r.colorSpace),x=a.convert(r.type),M=N(r.internalFormat,_,x,r.colorSpace),E=h&&!0!==r.isVideoTexture,T=void 0===u.__version||!0===s,A=F(r,g,y);if(Q(t.TEXTURE_CUBE_MAP,r,y),c){E&&T&&n.texStorage2D(t.TEXTURE_CUBE_MAP,A,M,g.width,g.height);for(var R=0;R<6;R++){v=f[R].mipmaps;for(var C=0;C<v.length;C++){var P=v[C];r.format!==k?null!==_?E?n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,C,0,0,P.width,P.height,_,P.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,C,M,P.width,P.height,0,P.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,C,0,0,P.width,P.height,_,x,P.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,C,M,P.width,P.height,0,_,x,P.data)}}}else{v=r.mipmaps,E&&T&&(v.length>0&&A++,n.texStorage2D(t.TEXTURE_CUBE_MAP,A,M,f[0].width,f[0].height));for(var U=0;U<6;U++)if(d){E?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,0,0,f[U].width,f[U].height,_,x,f[U].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,M,f[U].width,f[U].height,0,_,x,f[U].data);for(var I=0;I<v.length;I++){var D=v[I].image[U].image;E?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,I+1,0,0,D.width,D.height,_,x,D.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,I+1,M,D.width,D.height,0,_,x,D.data)}}else{E?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,0,0,_,x,f[U]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,M,_,x,f[U]);for(var O=0;O<v.length;O++){var B=v[O];E?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,O+1,0,0,_,x,B.image[U]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+U,O+1,M,_,x,B.image[U])}}}w(r,y)&&L(t.TEXTURE_CUBE_MAP),u.__version=l.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,r):n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+r)},this.rebindTextures=function(e,n,r){var a=i.get(e);void 0!==n&&et(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),void 0!==r&&it(e)},this.setupRenderTarget=function(e){var s=e.texture,l=i.get(e),u=i.get(s);e.addEventListener("dispose",X),!0!==e.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=t.createTexture()),u.__version=s.version,o.memory.textures++);var c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=b(e)||h;if(c){l.__webglFramebuffer=[];for(var f=0;f<6;f++)l.__webglFramebuffer[f]=t.createFramebuffer()}else{if(l.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers)for(var m=e.texture,v=0,g=m.length;v<g;v++){var y=i.get(m[v]);void 0===y.__webglTexture&&(y.__webglTexture=t.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(h&&e.samples>0&&!1===at(e)){var _=d?s:[s];l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(var x=0;x<_.length;x++){var M=_[x];l.__webglColorRenderbuffer[x]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,l.__webglColorRenderbuffer[x]);var S=a.convert(M.format,M.colorSpace),E=a.convert(M.type),T=N(M.internalFormat,S,E,M.colorSpace,!0===e.isXRRenderTarget),A=rt(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,A,T,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+x,t.RENDERBUFFER,l.__webglColorRenderbuffer[x])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),nt(l.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(c){n.bindTexture(t.TEXTURE_CUBE_MAP,u.__webglTexture),Q(t.TEXTURE_CUBE_MAP,s,p);for(var R=0;R<6;R++)et(l.__webglFramebuffer[R],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+R);w(s,p)&&L(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(var C=e.texture,P=0,U=C.length;P<U;P++){var I=C[P],D=i.get(I);n.bindTexture(t.TEXTURE_2D,D.__webglTexture),Q(t.TEXTURE_2D,I,p),et(l.__webglFramebuffer,e,I,t.COLOR_ATTACHMENT0+P,t.TEXTURE_2D),w(I,p)&&L(t.TEXTURE_2D)}n.unbindTexture()}else{var O=t.TEXTURE_2D;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(h?O=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(O,u.__webglTexture),Q(O,s,p),et(l.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0,O),w(s,p)&&L(O),n.unbindTexture()}e.depthBuffer&&it(e)},this.updateRenderTargetMipmap=function(e){for(var r=b(e)||h,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],o=0,s=a.length;o<s;o++){var l=a[o];if(w(l,r)){var u=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,c=i.get(l).__webglTexture;n.bindTexture(u,c),L(u),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(h&&e.samples>0&&!1===at(e)){var r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=e.width,o=e.height,s=t.COLOR_BUFFER_BIT,l=[],u=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=i.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(var p=0;p<r.length;p++)n.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,c.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(var f=0;f<r.length;f++){l.push(t.COLOR_ATTACHMENT0+f),e.depthBuffer&&l.push(u);var m=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===m&&(e.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(s|=t.STENCIL_BUFFER_BIT)),d&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c.__webglColorRenderbuffer[f]),!0===m&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[u]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[u])),d){var v=i.get(r[f]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,v,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,t.NEAREST),g&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,l)}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(var y=0;y<r.length;y++){n.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.RENDERBUFFER,c.__webglColorRenderbuffer[y]);var _=i.get(r[y]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,c.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+y,t.TEXTURE_2D,_,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=et,this.useMultisampledRTT=at}function Ko(t,e,n){var i=n.isWebGL2;return{convert:function(n,r){var a;if(void 0===r&&(r=Pt),n===U)return t.UNSIGNED_BYTE;if(n===F)return t.UNSIGNED_SHORT_4_4_4_4;if(n===z)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===n)return t.BYTE;if(1011===n)return t.SHORT;if(n===I)return t.UNSIGNED_SHORT;if(n===N)return t.INT;if(n===D)return t.UNSIGNED_INT;if(n===O)return t.FLOAT;if(n===B)return i?t.HALF_FLOAT:null!==(a=e.get("OES_texture_half_float"))?a.HALF_FLOAT_OES:null;if(1021===n)return t.ALPHA;if(n===k)return t.RGBA;if(1024===n)return t.LUMINANCE;if(1025===n)return t.LUMINANCE_ALPHA;if(n===H)return t.DEPTH_COMPONENT;if(n===V)return t.DEPTH_STENCIL;if(n===Ft)return null!==(a=e.get("EXT_sRGB"))?a.SRGB_ALPHA_EXT:null;if(1028===n)return t.RED;if(n===W)return t.RED_INTEGER;if(1030===n)return t.RG;if(n===X)return t.RG_INTEGER;if(n===j)return t.RGBA_INTEGER;if(n===q||n===Y||n===Z||n===J)if(r===Ut){if(null===(a=e.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===q)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Y)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Z)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===J)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=e.get("WEBGL_compressed_texture_s3tc")))return null;if(n===q)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Y)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Z)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===J)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===K||n===Q||n===$||n===tt){if(null===(a=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===K)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Q)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===tt)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(a=e.get("WEBGL_compressed_texture_etc1"))?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===et||n===nt){if(null===(a=e.get("WEBGL_compressed_texture_etc")))return null;if(n===et)return r===Ut?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===nt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}if(n===it||n===rt||n===at||n===ot||n===st||n===lt||n===ut||n===ct||n===ht||n===dt||n===pt||n===ft||n===mt||n===vt){if(null===(a=e.get("WEBGL_compressed_texture_astc")))return null;if(n===it)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===rt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===at)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ot)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===st)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===lt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ut)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===ct)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ht)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===dt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===pt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ft)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===mt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===vt)return r===Ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===gt){if(null===(a=e.get("EXT_texture_compression_bptc")))return null;if(n===gt)return r===Ut?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===n||n===yt||n===_t||n===xt){if(null===(a=e.get("EXT_texture_compression_rgtc")))return null;if(n===gt)return a.COMPRESSED_RED_RGTC1_EXT;if(n===yt)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===_t)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===xt)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===G?i?t.UNSIGNED_INT_24_8:null!==(a=e.get("WEBGL_depth_texture"))?a.UNSIGNED_INT_24_8_WEBGL:null:void 0!==t[n]?t[n]:null}}}var Qo=function(t){function e(e){var n;return void 0===e&&(e=[]),(n=t.call(this)||this).isArrayCamera=!0,n.cameras=e,n}return Yt(e,t),e}(vr),$o=function(t){function e(){var e;return(e=t.call(this)||this).isGroup=!0,e.type="Group",e}return Yt(e,t),e}(Jn),ts={type:"move"},es=function(){function t(){this._targetRay=null,this._grip=null,this._hand=null}var e=t.prototype;return e.getHandSpace=function(){return null===this._hand&&(this._hand=new $o,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},e.getTargetRaySpace=function(){return null===this._targetRay&&(this._targetRay=new $o,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ye,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ye),this._targetRay},e.getGripSpace=function(){return null===this._grip&&(this._grip=new $o,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ye,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ye),this._grip},e.dispatchEvent=function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},e.connect=function(t){if(t&&t.hand){var e=this._hand;if(e)for(var n,i=jt(t.hand.values());!(n=i()).done;){var r=n.value;this._getHandJoint(e,r)}}return this.dispatchEvent({type:"connected",data:t}),this},e.disconnect=function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},e.update=function(t,e,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(var u,c=jt(t.hand.values());!(u=c()).done;){var h=u.value,d=e.getJointPose(h,n),p=this._getHandJoint(l,h);null!==d&&(p.matrix.fromArray(d.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=d.radius),p.visible=null!==d}var f=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],v=f.position.distanceTo(m.position);l.inputState.pinching&&v>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&v<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&null!==(r=e.getPose(t.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(i=e.getPose(t.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(ts)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this},e._getHandJoint=function(t,e){if(void 0===t.joints[e.jointName]){var n=new $o;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]},t}(),ns=function(t){function e(e,n,i,r,a,o,s,l,u,c){var h;if((c=void 0!==c?c:H)!==H&&c!==V)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&c===H&&(i=D),void 0===i&&c===V&&(i=G),(h=t.call(this,null,r,a,o,s,l,c,i,u)||this).isDepthTexture=!0,h.image={width:e,height:n},h.magFilter=void 0!==s?s:T,h.minFilter=void 0!==l?l:T,h.flipY=!1,h.generateMipmaps=!1,h.compareFunction=null,h}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.compareFunction=e.compareFunction,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return null!==this.compareFunction&&(n.compareFunction=this.compareFunction),n},e}(ze),is=function(t){function e(e,n){var i,r=i=t.call(this)||this,a=null,o=1,s=null,l="local-floor",u=1,c=null,h=null,d=null,p=null,f=null,m=null,v=n.getContextAttributes(),g=null,y=null,_=[],x=[],M=null,S=new vr;S.layers.enable(1),S.viewport=new Ge;var b=new vr;b.layers.enable(2),b.viewport=new Ge;var E=[S,b],w=new Qo;w.layers.enable(1),w.layers.enable(2);var T=null,A=null;function R(t){var e=x.indexOf(t.inputSource);if(-1!==e){var n=_[e];void 0!==n&&(n.update(t.inputSource,t.frame,c||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}}function C(){a.removeEventListener("select",R),a.removeEventListener("selectstart",R),a.removeEventListener("selectend",R),a.removeEventListener("squeeze",R),a.removeEventListener("squeezestart",R),a.removeEventListener("squeezeend",R),a.removeEventListener("end",C),a.removeEventListener("inputsourceschange",L);for(var t=0;t<_.length;t++){var n=x[t];null!==n&&(x[t]=null,_[t].disconnect(n))}T=null,A=null,e.setRenderTarget(g),f=null,p=null,d=null,a=null,y=null,B.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}function L(t){for(var e=0;e<t.removed.length;e++){var n=t.removed[e],i=x.indexOf(n);i>=0&&(x[i]=null,_[i].disconnect(n))}for(var r=0;r<t.added.length;r++){var a=t.added[r],o=x.indexOf(a);if(-1===o){for(var s=0;s<_.length;s++){if(s>=x.length){x.push(a),o=s;break}if(null===x[s]){x[s]=a,o=s;break}}if(-1===o)break}var l=_[o];l&&l.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getCamera=function(){return{cameraXR:w,cameras:E}},i.setUserCamera=function(t){M=t},i.getController=function(t){var e=_[t];return void 0===e&&(e=new es,_[t]=e),e.getTargetRaySpace()},i.getControllerGrip=function(t){var e=_[t];return void 0===e&&(e=new es,_[t]=e),e.getGripSpace()},i.getHand=function(t){var e=_[t];return void 0===e&&(e=new es,_[t]=e),e.getHandSpace()},i.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(t){l=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return c||s},i.setReferenceSpace=function(t){c=t},i.getBaseLayer=function(){return null!==p?p:f},i.getBinding=function(){return d},i.getFrame=function(){return m},i.getSession=function(){return a},i.setSession=function(){var t=Vt(Jt().mark((function t(i){var h,m,_,x,M;return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(a=i)){t.next=25;break}if(g=e.getRenderTarget(),a.addEventListener("select",R),a.addEventListener("selectstart",R),a.addEventListener("selectend",R),a.addEventListener("squeeze",R),a.addEventListener("squeezestart",R),a.addEventListener("squeezeend",R),a.addEventListener("end",C),a.addEventListener("inputsourceschange",L),!0===v.xrCompatible){t.next=14;break}return t.next=14,n.makeXRCompatible();case 14:return void 0===a.renderState.layers||!1===e.capabilities.isWebGL2?(h={antialias:void 0!==a.renderState.layers||v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:o},f=new XRWebGLLayer(a,n,h),a.updateRenderState({baseLayer:f}),y=new ke(f.framebufferWidth,f.framebufferHeight,{format:k,type:U,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})):(m=null,_=null,x=null,v.depth&&(x=v.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,m=v.stencil?V:H,_=v.stencil?G:D),M={colorFormat:n.RGBA8,depthFormat:x,scaleFactor:o},d=new XRWebGLBinding(a,n),p=d.createProjectionLayer(M),a.updateRenderState({layers:[p]}),y=new ke(p.textureWidth,p.textureHeight,{format:k,type:U,depthTexture:new ns(p.textureWidth,p.textureHeight,_,void 0,void 0,void 0,void 0,void 0,void 0,m),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0}),e.properties.get(y).__ignoreDepthValues=p.ignoreDepthValues),y.isXRRenderTarget=!0,this.setFoveation(u),c=null,t.next=20,a.requestReferenceSpace(l);case 20:s=t.sent,B.setContext(a),B.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode};var P=new Ye,I=new Ye;function N(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}i.updateCameraXR=function(t){if(null===a)return t;M&&(t=M),w.near=b.near=S.near=t.near,w.far=b.far=S.far=t.far,T===w.near&&A===w.far||(a.updateRenderState({depthNear:w.near,depthFar:w.far}),T=w.near,A=w.far);var e=t.parent,n=w.cameras;N(w,e);for(var i=0;i<n.length;i++)N(n[i],e);return 2===n.length?function(t,e,n){P.setFromMatrixPosition(e.matrixWorld),I.setFromMatrixPosition(n.matrixWorld);var i=P.distanceTo(I),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*c,p=o*h,f=i/(-c+h),m=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();var v=o+f,g=s+f,y=d-m,_=p+(i-m),x=l*s/g*v,M=u*s/g*v;t.projectionMatrix.makePerspective(y,_,x,M,v,g),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(w,S,b):w.projectionMatrix.copy(S.projectionMatrix),M&&function(t,e){var n=M;null===e?n.matrix.copy(t.matrixWorld):(n.matrix.copy(e.matrixWorld),n.matrix.invert(),n.matrix.multiply(t.matrixWorld));n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0);for(var i=n.children,r=0,a=i.length;r<a;r++)i[r].updateMatrixWorld(!0);n.projectionMatrix.copy(t.projectionMatrix),n.projectionMatrixInverse.copy(t.projectionMatrixInverse),n.isPerspectiveCamera&&(n.fov=2*re*Math.atan(1/n.projectionMatrix.elements[5]),n.zoom=1)}(w,e),w},i.getFoveation=function(){if(null!==p||null!==f)return u},i.setFoveation=function(t){u=t,null!==p&&(p.fixedFoveation=t),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=t)};var O=null;var B=new Rr;return B.setAnimationLoop((function(t,n){if(h=n.getViewerPose(c||s),m=n,null!==h){var i=h.views;null!==f&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));var a=!1;i.length!==w.cameras.length&&(w.cameras.length=0,a=!0);for(var o=0;o<i.length;o++){var l=i[o],u=null;if(null!==f)u=f.getViewport(l);else{var v=d.getViewSubImage(p,l);u=v.viewport,0===o&&(e.setRenderTargetTextures(y,v.colorTexture,p.ignoreDepthValues?void 0:v.depthStencilTexture),e.setRenderTarget(y))}var g=E[o];void 0===g&&((g=new vr).layers.enable(o),g.viewport=new Ge,E[o]=g),g.matrix.fromArray(l.transform.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale),g.projectionMatrix.fromArray(l.projectionMatrix),g.projectionMatrixInverse.copy(g.projectionMatrix).invert(),g.viewport.set(u.x,u.y,u.width,u.height),0===o&&(w.matrix.copy(g.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),!0===a&&w.cameras.push(g)}}for(var M=0;M<_.length;M++){var S=x[M],b=_[M];null!==S&&void 0!==b&&b.update(S,n,c||s)}O&&O(t,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),m=null})),i.setAnimationLoop=function(t){O=t},i.dispose=function(){},i}return Yt(e,t),e}(te);function rs(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(i,r){i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map,n(r.map,i.mapTransform)),r.alphaMap&&(i.alphaMap.value=r.alphaMap,n(r.alphaMap,i.alphaMapTransform)),r.bumpMap&&(i.bumpMap.value=r.bumpMap,n(r.bumpMap,i.bumpMapTransform),i.bumpScale.value=r.bumpScale,r.side===o&&(i.bumpScale.value*=-1)),r.normalMap&&(i.normalMap.value=r.normalMap,n(r.normalMap,i.normalMapTransform),i.normalScale.value.copy(r.normalScale),r.side===o&&i.normalScale.value.negate()),r.displacementMap&&(i.displacementMap.value=r.displacementMap,n(r.displacementMap,i.displacementMapTransform),i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,i.emissiveMapTransform)),r.specularMap&&(i.specularMap.value=r.specularMap,n(r.specularMap,i.specularMapTransform)),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);var a=e.get(r).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;var s=!0===t.useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*s,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,dr(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,a,s,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,i){t.metalness.value=i.metalness,i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,t.metalnessMapTransform));t.roughness.value=i.roughness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,t.roughnessMapTransform));var r=e.get(i).envMap;r&&(t.envMapIntensity.value=i.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===o&&t.clearcoatNormalScale.value.negate()));e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){var i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,a,s):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function as(t,e,n,i){var r={},a={},o=[],s=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,n){var i=t.value;if(void 0===n[e]){if("number"==typeof i)n[e]=i;else{for(var r=Array.isArray(i)?i:[i],a=[],o=0;o<r.length;o++)a.push(r[o].clone());n[e]=a}return!0}if("number"==typeof i){if(n[e]!==i)return n[e]=i,!0}else for(var s=Array.isArray(n[e])?n[e]:[n[e]],l=Array.isArray(i)?i:[i],u=0;u<s.length;u++){var c=s[u];if(!1===c.equals(l[u]))return c.copy(l[u]),!0}return!1}function u(t){var e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function c(e){var n=e.target;n.removeEventListener("dispose",c);var i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(t,e){var n=e.program;i.uniformBlockBinding(t,n)},update:function(n,h){var d=r[n.id];void 0===d&&(!function(t){for(var e=t.uniforms,n=0,i=16,r=0,a=0,o=e.length;a<o;a++){for(var s=e[a],l={boundary:0,storage:0},c=Array.isArray(s.value)?s.value:[s.value],h=0,d=c.length;h<d;h++){var p=u(c[h]);l.boundary+=p.boundary,l.storage+=p.storage}if(s.__data=new Float32Array(l.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=n,a>0)0!==(r=n%i)&&i-r-l.boundary<0&&(n+=i-r,s.__offset=n);n+=l.storage}(r=n%i)>0&&(n+=i-r);t.__size=n,t.__cache={}}(n),d=function(e){var n=function(){for(var t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;var i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",c));var p=h.program;i.updateUBOMapping(n,p);var f=e.render.frame;a[n.id]!==f&&(!function(e){var n=r[e.id],i=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(var o=0,s=i.length;o<s;o++){var c=i[o];if(!0===l(c,o,a)){for(var h=c.__offset,d=Array.isArray(c.value)?c.value:[c.value],p=0,f=0;f<d.length;f++){var m=d[f],v=u(m);"number"==typeof m?(c.__data[0]=m,t.bufferSubData(t.UNIFORM_BUFFER,h+p,c.__data)):m.isMatrix3?(c.__data[0]=m.elements[0],c.__data[1]=m.elements[1],c.__data[2]=m.elements[2],c.__data[3]=m.elements[0],c.__data[4]=m.elements[3],c.__data[5]=m.elements[4],c.__data[6]=m.elements[5],c.__data[7]=m.elements[0],c.__data[8]=m.elements[6],c.__data[9]=m.elements[7],c.__data[10]=m.elements[8],c.__data[11]=m.elements[0]):(m.toArray(c.__data,p),p+=v.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,h,c.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),a[n.id]=f)},dispose:function(){for(var e in r)t.deleteBuffer(r[e]);o=[],r={},a={}}}}var os=function(){return Xt((function(t){void 0===t&&(t={});var n,i=t,r=i.canvas,s=void 0===r?function(){var t=Me("canvas");return t.style.display="block",t}():r,l=i.context,u=void 0===l?null:l,c=i.depth,d=void 0===c||c,p=i.stencil,f=void 0===p||p,m=i.alpha,v=void 0!==m&&m,g=i.antialias,y=void 0!==g&&g,_=i.premultipliedAlpha,x=void 0===_||_,M=i.preserveDrawingBuffer,S=void 0!==M&&M,b=i.powerPreference,E=void 0===b?"default":b,w=i.failIfMajorPerformanceCaveat,T=void 0!==w&&w;this.isWebGLRenderer=!0,n=null!==u?u.getContextAttributes().alpha:v;var A=new Uint32Array(4),R=new Int32Array(4),C=null,L=null,P=[],N=[];this.domElement=s,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=Ut,this.useLegacyLights=!0,this.toneMapping=h,this.toneMappingExposure=1;var H=this,V=!1,q=0,Y=0,Z=null,J=-1,K=null,Q=new Ge,$=new Ge,tt=null;new mi(0);var et=s.width,nt=s.height,it=1,rt=null,at=null,ot=new Ge(0,0,et,nt),st=new Ge(0,0,et,nt),lt=!1,ut=new Ar,ct=!1,ht=!1,dt=new wn;new me;var pt=new Ye,ft={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function mt(){return null===Z?it:1}var vt,gt,yt,_t,xt,Mt,St,bt,Et,wt,Tt,At,Rt,Ct,Lt,Pt,Nt,Dt,Ot,Bt,Ft,zt,Gt,kt,Ht=u;function Vt(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=s.getContext(i,e);if(null!==r)return r}return null}try{var Wt={alpha:!0,depth:d,stencil:f,antialias:y,premultipliedAlpha:x,preserveDrawingBuffer:S,powerPreference:E,failIfMajorPerformanceCaveat:T};if("setAttribute"in s&&s.setAttribute("data-engine","three.js r"+e),s.addEventListener("webglcontextlost",Yt,!1),s.addEventListener("webglcontextrestored",Zt,!1),s.addEventListener("webglcontextcreationerror",Jt,!1),null===Ht){var Xt=["webgl2","webgl","experimental-webgl"];if(!0===H.isWebGL1Renderer&&Xt.shift(),null===(Ht=Vt(Xt,Wt)))throw Vt(Xt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Ht instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Ht.getShaderPrecisionFormat&&(Ht.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function jt(){vt=new na(Ht),gt=new Fr(Ht,vt,t),vt.init(gt),zt=new Ko(Ht,vt,gt),yt=new Zo(Ht,vt,gt),_t=new aa(Ht),xt=new Do,Mt=new Jo(Ht,vt,yt,xt,gt,zt,_t),St=new Gr(H),bt=new ea(H),Et=new Cr(Ht,gt),Gt=new Or(Ht,vt,Et,gt,!!t.enableVAO),wt=new ia(Ht,Et,_t,Gt),Tt=new ua(Ht,wt,Et,_t),Ot=new la(Ht,gt,Mt),Pt=new zr(xt),At=new No(H,St,bt,vt,gt,Gt,Pt),Rt=new rs(H,xt),Ct=new zo,Lt=new Xo(vt,gt),Dt=new Dr(H,St,bt,yt,Tt,n,x),Nt=new Yo(H,Tt,gt),kt=new as(Ht,_t,gt,yt),Bt=new Br(Ht,vt,_t,gt),Ft=new ra(Ht,vt,_t,gt),_t.programs=At.programs,H.capabilities=gt,H.extensions=vt,H.properties=xt,H.renderLists=Ct,H.shadowMap=Nt,H.state=yt,H.info=_t,H.renderContext.capabilities=gt,H.renderContext.extensions=vt,H.renderContext.properties=xt,H.renderContext.renderLists=Ct,H.renderContext.shadowMap=Nt,H.renderContext.state=yt,H.renderContext.info=_t,H.renderContext.properties=xt,H.renderContext.textures=Mt,H.renderContext.cubemaps=St,H.renderContext.cubeuvmaps=bt,H.renderContext.attributes=Et,H.renderContext.geometries=wt,H.renderContext.objects=Tt,H.renderContext.clipping=Pt,H.renderContext.renderStates=Lt,H.renderContext.bindingStates=Gt}this.renderContext={frustum:ut},jt();var qt=new is(H,Ht);function Yt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),V=!0}function Zt(){console.log("THREE.WebGLRenderer: Context Restored."),V=!1;var t=_t.autoReset,e=Nt.enabled,n=Nt.autoUpdate,i=Nt.needsUpdate,r=Nt.type;jt(),_t.autoReset=t,Nt.enabled=e,Nt.autoUpdate=n,Nt.needsUpdate=i,Nt.type=r}function Jt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Kt(t){var e=t.target;e.removeEventListener("dispose",Kt),function(t){(function(t){var e=xt.get(t).programs;void 0!==e&&(e.forEach((function(t){At.releaseProgram(t)})),t.isShaderMaterial&&At.releaseShaderCache(t))})(t),xt.remove(t)}(e)}this.xr=qt,this.getContext=function(){return Ht},this.getContextAttributes=function(){return Ht.getContextAttributes()},this.forceContextLoss=function(){var t=vt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=vt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return it},this.setPixelRatio=function(t){void 0!==t&&(it=t,this.setSize(et,nt,!1))},this.getSize=function(t){return t?t.set(et,nt):{width:et,height:nt}},this.setSize=function(t,e,n){void 0===n&&(n=!0),qt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(et=t,nt=e,s.width=Math.floor(t*it),s.height=Math.floor(e*it),!0===n&&(s.style.width=t+"px",s.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(et*it,nt*it).floor()},this.setDrawingBufferSize=function(t,e,n){et=t,nt=e,it=n,s.width=Math.floor(t*n),s.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(Q)},this.getViewport=function(t){return t.copy(ot)},this.setViewport=function(t,e,n,i){t.isVector4?ot.set(t.x,t.y,t.z,t.w):ot.set(t,e,n,i),yt.viewport(Q.copy(ot).multiplyScalar(it).floor())},this.setViewportDirect=function(t,e,n,i){t.isVector4?ot.set(t.x,t.y,t.z,t.w):ot.set(t,e,n,i),yt.viewport(Q.copy(ot))},this.getScissor=function(t){return t.copy(st)},this.setScissor=function(t,e,n,i){t.isVector4?st.set(t.x,t.y,t.z,t.w):st.set(t,e,n,i),yt.scissor($.copy(st).multiplyScalar(it).floor())},this.setScissorDirect=function(t,e,n,i){t.isVector4?st.set(t.x,t.y,t.z,t.w):st.set(t,e,n,i),yt.scissor($.copy(st))},this.getScissorTest=function(){return lt},this.setScissorTest=function(t){yt.setScissorTest(lt=t)},this.setOpaqueSort=function(t){rt=t},this.setTransparentSort=function(t){at=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new mi),t.copy(Dt.getClearColor())},this.setClearColor=function(){Dt.setClearColor.apply(Dt,arguments)},this.getClearAlpha=function(){return Dt.getClearAlpha()},this.setClearAlpha=function(){Dt.setClearAlpha.apply(Dt,arguments)},this.clear=function(t,e,n){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===n&&(n=!0);var i=0;if(t){var r=!1;if(null!==Z){var a=Z.texture.format;r=a===j||a===X||a===W}if(r){var o=Z.texture.type,s=o===U||o===D||o===I||o===G||o===F||o===z,l=Dt.getClearColor(),u=Dt.getClearAlpha(),c=l.r,h=l.g,d=l.b,p=xt.get(Z).__webglFramebuffer;s?(A[0]=c,A[1]=h,A[2]=d,A[3]=u,Ht.clearBufferuiv(Ht.COLOR,p,A)):(R[0]=c,R[1]=h,R[2]=d,R[3]=u,Ht.clearBufferiv(Ht.COLOR,p,R))}else i|=Ht.COLOR_BUFFER_BIT}e&&(i|=Ht.DEPTH_BUFFER_BIT),n&&(i|=Ht.STENCIL_BUFFER_BIT),Ht.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.dispose=function(){s.removeEventListener("webglcontextlost",Yt,!1),s.removeEventListener("webglcontextrestored",Zt,!1),s.removeEventListener("webglcontextcreationerror",Jt,!1),Ct.dispose(),Lt.dispose(),xt.dispose(),St.dispose(),bt.dispose(),Tt.dispose(),Gt.dispose(),kt.dispose(),At.dispose(),qt.dispose(),qt.removeEventListener("sessionstart",$t),qt.removeEventListener("sessionend",te),ee.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=ft);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(t,e,n,i,r){!0!==e.isScene&&(e=ft);Mt.resetTextureUnits();var a=e.fog,o=i.isMeshStandardMaterial?e.environment:null,s=null===Z?H.outputColorSpace:!0===Z.isXRRenderTarget?Z.texture.colorSpace:It,l=(i.isMeshStandardMaterial?bt:St).get(i.envMap||o),u=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,m=i.toneMapped?H.toneMapping:h,v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==v?v.length:0,y=xt.get(i),_=L.state.lights;if(!0===ct&&(!0===ht||t!==K)){var x=t===K&&i.id===J;Pt.setState(i,t,x)}var M=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==_.state.version||y.outputColorSpace!==s||r.isInstancedMesh&&!1===y.instancing?M=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?M=!0:r.isSkinnedMesh||!0!==y.skinning?y.envMap!==l||!0===i.fog&&y.fog!==a?M=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===Pt.numPlanes&&y.numIntersection===Pt.numIntersection?(y.vertexAlphas!==u||y.vertexTangents!==c||y.morphTargets!==d||y.morphNormals!==p||y.morphColors!==f||y.toneMapping!==m||!0===gt.isWebGL2&&y.morphTargetsCount!==g)&&(M=!0):M=!0:M=!0:M=!0:(M=!0,y.__version=i.version);var S=y.currentProgram;!0===M&&(S=ie(i,e,r));var b=!1,E=!1,w=!1;i.needsRefresh&&(E=!0,i.needsRefresh=!1);var T=S.getUniforms(),A=y.uniforms;yt.useProgram(S.program)&&(b=!0,E=!0,w=!0);i.id!==J&&(J=i.id,E=!0);if(b||K!==t){if(T.setValue(Ht,"projectionMatrix",t.projectionMatrix),gt.logarithmicDepthBuffer&&T.setValue(Ht,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),K!==t&&(K=t,E=!0,w=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){var R=T.map.cameraPosition;void 0!==R&&R.setValue(Ht,pt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(Ht,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isLineBasicMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&T.setValue(Ht,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){T.setOptional(Ht,r,"bindMatrix"),T.setOptional(Ht,r,"bindMatrixInverse");var C=r.skeleton;C&&(gt.floatVertexTextures?(null===C.boneTexture&&C.computeBoneTexture(),T.setValue(Ht,"boneTexture",C.boneTexture,Mt),T.setValue(Ht,"boneTextureSize",C.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var P=n.morphAttributes;(void 0!==P.position||void 0!==P.normal||void 0!==P.color&&!0===gt.isWebGL2)&&Ot.update(r,n,S);(E||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(Ht,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(A.envMap.value=l,A.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);E&&(T.setValue(Ht,"toneMappingExposure",H.toneMappingExposure),y.needsLights&&(I=w,(U=A).ambientLightColor.needsUpdate=I,U.lightProbe.needsUpdate=I,U.directionalLights.needsUpdate=I,U.directionalLightShadows.needsUpdate=I,U.pointLights.needsUpdate=I,U.pointLightShadows.needsUpdate=I,U.spotLights.needsUpdate=I,U.spotLightShadows.needsUpdate=I,U.rectAreaLights.needsUpdate=I,U.hemisphereLights.needsUpdate=I),a&&!0===i.fog&&Rt.refreshFogUniforms(A,a),Rt.refreshMaterialUniforms(A,i,it,nt,null),fo.upload(Ht,y.uniformsList,A,Mt));var U,I;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(fo.upload(Ht,y.uniformsList,A,Mt),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&T.setValue(Ht,"center",r.center);if(T.setValue(Ht,"modelViewMatrix",r.modelViewMatrix),T.setValue(Ht,"normalMatrix",r.normalMatrix),T.setValue(Ht,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var N=i.uniformsGroups,D=0,O=N.length;D<O;D++)if(gt.isWebGL2){var B=N[D];kt.update(B,S),kt.bind(B,S)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return S}(t,e,n,i,r);yt.setMaterial(i,o),e.disableTransparent&&yt.setBlending(THREE.NoBlending);var l=n.index,u=1;!0===i.wireframe&&(l=wt.getWireframeAttribute(n),u=2);var c=n.drawRange,d=n.attributes.position,p=c.start*u,f=(c.start+c.count)*u;null!==a&&(p=Math.max(p,a.start*u),f=Math.min(f,(a.start+a.count)*u)),null!==l?(p=Math.max(p,0),f=Math.min(f,l.count)):null!=d&&(p=Math.max(p,0),f=Math.min(f,d.count));var m=f-p;if(!(m<0||m===1/0)){var v;Gt.setup(r,i,s,n,l);var g=Bt;if(null!==l&&(v=Et.get(l),(g=Ft).setIndex(v)),r.isMesh)!0===i.wireframe?(yt.setLineWidth(i.wireframeLinewidth*mt()),g.setMode(Ht.LINES)):g.setMode(Ht.TRIANGLES);else if(r.isLine){var y=i.linewidth;void 0===y&&(y=1),yt.setLineWidth(y*mt()),r.isLineSegments?g.setMode(Ht.LINES):r.isLineLoop?g.setMode(Ht.LINE_LOOP):g.setMode(Ht.LINE_STRIP)}else r.isPoints?g.setMode(Ht.POINTS):r.isSprite&&g.setMode(Ht.TRIANGLES);if(r.isInstancedMesh)g.renderInstances(p,m,r.count);else if(n.isInstancedBufferGeometry){var _=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,x=Math.min(n.instanceCount,_);g.renderInstances(p,m,x)}else g.render(p,m)}},this.compile=function(t,e){function n(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=o,t.needsUpdate=!0,ie(t,e,n),t.side=a,t.needsUpdate=!0,ie(t,e,n),t.side=2):ie(t,e,n)}(L=Lt.get(t)).init(),N.push(L),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(L.pushLight(t),t.castShadow&&L.pushShadow(t))})),L.setupLights(H.useLegacyLights),t.traverse((function(e){var i=e.material;if(i)if(Array.isArray(i))for(var r=0;r<i.length;r++){n(i[r],t,e)}else n(i,t,e)})),N.pop(),L=null};var Qt=null;function $t(){ee.stop()}function te(){ee.start()}var ee=new Rr;function ne(t,e,n,i){if(!1!==t.visible){if(t.layers.test(e.layers))if("explodeObject"==t.name&&t.update&&t.update(),t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)L.pushLight(t),t.castShadow&&L.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||ut.intersectsSprite(t)){i&&pt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(dt);var r=Tt.update(t),a=t.material;a.visible&&C.push(t,r,a,n,pt.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||ut.intersectsObject(t))){t.isSkinnedMesh&&t.skeleton.frame!==_t.render.frame&&(t.skeleton.update(),t.skeleton.frame=_t.render.frame);var o=Tt.update(t),s=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),pt.copy(t.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),pt.copy(o.boundingSphere.center)),pt.applyMatrix4(t.matrixWorld).applyMatrix4(dt)),Array.isArray(s))for(var l=o.groups,u=0,c=l.length;u<c;u++){var h=l[u],d=s[h.materialIndex];d&&d.visible&&C.push(t,o,d,n,pt.z,h)}else s.visible&&C.push(t,o,s,n,pt.z,null)}for(var p=t.children,f=0,m=p.length;f<m;f++)ne(p[f],e,n,i)}}function ie(t,e,n){!0!==e.isScene&&(e=ft);var i=xt.get(t),r=L.state.lights,a=L.state.shadowsArray,o=r.state.version,s=At.getParameters(t,r.state,a,e,n),l=At.getProgramCacheKey(s),u=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?bt:St).get(t.envMap||i.environment),void 0===u&&(t.addEventListener("dispose",Kt),u=new Map,i.programs=u);var c=u.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===o)return re(t,s),c}else s.uniforms=At.getUniforms(t),t.onBuild(n,s,H),t.onBeforeCompile(s,H),c=At.acquireProgram(s,l),u.set(l,c),i.uniforms=s.uniforms;var h=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(h.clippingPlanes=Pt.uniform),re(t,s),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=o,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix);var d=c.getUniforms(),p=fo.seqWithValue(d.seq,h);return i.currentProgram=c,i.uniformsList=p,c}function re(t,e){var n=xt.get(t);n.outputColorSpace=e.outputColorSpace,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}ee.setAnimationLoop((function(t){Qt&&Qt(t)})),"undefined"!=typeof self&&ee.setContext(self),this.setAnimationLoop=function(t){Qt=t,qt.setAnimationLoop(t),null===t?ee.stop():ee.start()},qt.addEventListener("sessionstart",$t),qt.addEventListener("sessionend",te),this.render=function(t,e,n){if(void 0===n&&(n={}),void 0===e||!0===e.isCamera){if(!0!==V){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===qt.enabled&&!0===qt.isPresenting&&(e=qt.updateCameraXR(e)),!0===t.isScene&&t.onBeforeRender(H,t,e,Z),n.renderInfo={},(L=Lt.get(t,N.length)).init(),n.renderInfo.currentRenderState=L,N.push(L),dt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.renderInfo.projScreenMatrix=dt,ut.setFromProjectionMatrix(dt),n.renderInfo.frustum=ut,ht=this.localClippingEnabled,ct=Pt.init(this.clippingPlanes,ht),n.renderInfo.clippingEnabled=ct,(C=Ct.get(t,P.length)).init(),P.push(C),ne(t,e,0,H.sortObjects),C.finish(),!0===H.sortObjects&&C.sort(rt,at),!0===ct&&Pt.beginShadows();var i=L.state.shadowsArray;if(Nt.render(i,t,e),!0===ct&&Pt.endShadows(),!0===this.info.autoReset&&this.info.reset(),this.info.render.frame++,Dt.render(C,t),L.setupLights(H.useLegacyLights),e.isArrayCamera)for(var r=e.cameras,a=0,o=r.length;a<o;a++){var s=r[a];this.renderScene(C,t,s,s.viewport,n)}else this.renderScene(C,t,e,void 0,n);null!==Z&&(Mt.updateMultisampleRenderTarget(Z),Mt.updateRenderTargetMipmap(Z)),!0===t.isScene&&t.onAfterRender(H,t,e),Gt.resetDefaultState(),J=-1,K=null,N.pop(),L=N.length>0?N[N.length-1]:null,P.pop(),C=P.length>0?P[P.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.renderScene=function(t,e,n,i,r){var a=t.opaque,o=t.transparent;L.setupLightsView(n),!0===ct&&Pt.setGlobalState(H.clippingPlanes,n),i&&this.setViewportDirect(i),a.length>0&&this.renderObjects(a,e,n),o.length>0&&this.renderObjects(o,e,n),yt.buffers.depth.setTest(!0),yt.buffers.depth.setMask(!0),yt.buffers.color.setMask(!0),yt.setPolygonOffset(!1)},this.renderObjects=function(t,e,n){for(var i=!0===e.isScene?e.overrideMaterial:null,r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,l=o.geometry,u=null===i?o.material:i,c=o.group;s.layers.test(n.layers)&&this.renderObject(s,e,n,l,u,c)}},this.renderObject=function(t,e,n,i,r,s){t.onBeforeRender(H,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(H,e,n,i,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=o,r.needsUpdate=!0,H.renderBufferDirect(n,e,i,r,t,s),r.side=a,r.needsUpdate=!0,H.renderBufferDirect(n,e,i,r,t,s),r.side=2):H.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(H,e,n,i,r,s)},this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return Y},this.getRenderTarget=function(){return Z},this.setRenderTargetTextures=function(t,e,n){xt.get(t.texture).__webglTexture=e,xt.get(t.depthTexture).__webglTexture=n;var i=xt.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===vt.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){var n=xt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),Z=t,q=e,Y=n;var i=!0,r=null,a=!1,o=!1;if(t){var s=xt.get(t);void 0!==s.__useDefaultFramebuffer?(yt.bindFramebuffer(Ht.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?Mt.setupRenderTarget(t):s.__hasExternalTextures&&Mt.rebindTextures(t,xt.get(t.texture).__webglTexture,xt.get(t.depthTexture).__webglTexture);var l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);var u=xt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=u[e],a=!0):r=gt.isWebGL2&&t.samples>0&&!1===Mt.useMultisampledRTT(t)?xt.get(t).__webglMultisampledFramebuffer:u,Q.copy(t.viewport),$.copy(t.scissor),tt=t.scissorTest}else Q.copy(ot).multiplyScalar(it).floor(),$.copy(st).multiplyScalar(it).floor(),tt=lt;if(yt.bindFramebuffer(Ht.FRAMEBUFFER,r)&&gt.drawBuffers&&i&&yt.drawBuffers(t,r),yt.viewport(Q),yt.scissor($),yt.setScissorTest(tt),a){var c=xt.get(t.texture);Ht.framebufferTexture2D(Ht.FRAMEBUFFER,Ht.COLOR_ATTACHMENT0,Ht.TEXTURE_CUBE_MAP_POSITIVE_X+e,c.__webglTexture,n)}else if(o){var h=xt.get(t.texture),d=e||0;Ht.framebufferTextureLayer(Ht.FRAMEBUFFER,Ht.COLOR_ATTACHMENT0,h.__webglTexture,n||0,d)}J=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,o){if(t&&t.isWebGLRenderTarget){var s=xt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){yt.bindFramebuffer(Ht.FRAMEBUFFER,s);try{var l=t.texture,u=l.format,c=l.type;if(u!==k&&zt.convert(u)!==Ht.getParameter(Ht.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===B&&(vt.has("EXT_color_buffer_half_float")||gt.isWebGL2&&vt.has("EXT_color_buffer_float"));if(!(c===U||zt.convert(c)===Ht.getParameter(Ht.IMPLEMENTATION_COLOR_READ_TYPE)||c===O&&(gt.isWebGL2||vt.has("OES_texture_float")||vt.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ht.readPixels(e,n,i,r,zt.convert(u),zt.convert(c),a)}finally{var d=null!==Z?xt.get(Z).__webglFramebuffer:null;yt.bindFramebuffer(Ht.FRAMEBUFFER,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i);Mt.setTexture2D(e,0),Ht.copyTexSubImage2D(Ht.TEXTURE_2D,n,0,0,t.x,t.y,r,a),yt.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i){void 0===i&&(i=0);var r=e.image.width,a=e.image.height,o=zt.convert(n.format),s=zt.convert(n.type);Mt.setTexture2D(n,0),Ht.pixelStorei(Ht.UNPACK_FLIP_Y_WEBGL,n.flipY),Ht.pixelStorei(Ht.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Ht.pixelStorei(Ht.UNPACK_ALIGNMENT,n.unpackAlignment),e.isDataTexture?Ht.texSubImage2D(Ht.TEXTURE_2D,i,t.x,t.y,r,a,o,s,e.image.data):e.isCompressedTexture?Ht.compressedTexSubImage2D(Ht.TEXTURE_2D,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):Ht.texSubImage2D(Ht.TEXTURE_2D,i,t.x,t.y,o,s,e.image),0===i&&n.generateMipmaps&&Ht.generateMipmap(Ht.TEXTURE_2D),yt.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r){if(void 0===r&&(r=0),H.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,l=t.max.z-t.min.z+1,u=zt.convert(i.format),c=zt.convert(i.type);if(i.isData3DTexture)Mt.setTexture3D(i,0),a=Ht.TEXTURE_3D;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Mt.setTexture2DArray(i,0),a=Ht.TEXTURE_2D_ARRAY}Ht.pixelStorei(Ht.UNPACK_FLIP_Y_WEBGL,i.flipY),Ht.pixelStorei(Ht.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Ht.pixelStorei(Ht.UNPACK_ALIGNMENT,i.unpackAlignment);var h=Ht.getParameter(Ht.UNPACK_ROW_LENGTH),d=Ht.getParameter(Ht.UNPACK_IMAGE_HEIGHT),p=Ht.getParameter(Ht.UNPACK_SKIP_PIXELS),f=Ht.getParameter(Ht.UNPACK_SKIP_ROWS),m=Ht.getParameter(Ht.UNPACK_SKIP_IMAGES),v=n.isCompressedTexture?n.mipmaps[0]:n.image;Ht.pixelStorei(Ht.UNPACK_ROW_LENGTH,v.width),Ht.pixelStorei(Ht.UNPACK_IMAGE_HEIGHT,v.height),Ht.pixelStorei(Ht.UNPACK_SKIP_PIXELS,t.min.x),Ht.pixelStorei(Ht.UNPACK_SKIP_ROWS,t.min.y),Ht.pixelStorei(Ht.UNPACK_SKIP_IMAGES,t.min.z),n.isDataTexture||n.isData3DTexture?Ht.texSubImage3D(a,r,e.x,e.y,e.z,o,s,l,u,c,v.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ht.compressedTexSubImage3D(a,r,e.x,e.y,e.z,o,s,l,u,v.data)):Ht.texSubImage3D(a,r,e.x,e.y,e.z,o,s,l,u,c,v),Ht.pixelStorei(Ht.UNPACK_ROW_LENGTH,h),Ht.pixelStorei(Ht.UNPACK_IMAGE_HEIGHT,d),Ht.pixelStorei(Ht.UNPACK_SKIP_PIXELS,p),Ht.pixelStorei(Ht.UNPACK_SKIP_ROWS,f),Ht.pixelStorei(Ht.UNPACK_SKIP_IMAGES,m),0===r&&i.generateMipmaps&&Ht.generateMipmap(a),yt.unbindTexture()}},this.initTexture=function(t){t.isCubeTexture?Mt.setTextureCube(t,0):t.isData3DTexture?Mt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?Mt.setTexture2DArray(t,0):Mt.setTexture2D(t,0),yt.unbindTexture()},this.resetState=function(){q=0,Y=0,Z=null,yt.reset(),Gt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}),[{key:"coordinateSystem",get:function(){return zt}},{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(t){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}},{key:"outputEncoding",get:function(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Ut?Lt:Ct},set:function(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===Lt?Ut:It}}])}(),ss=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(os);ss.prototype.isWebGL1Renderer=!0;var ls,us=function(){function t(t,e){void 0===e&&(e=25e-5),this.isFogExp2=!0,this.name="",this.color=new mi(t),this.density=e}var e=t.prototype;return e.clone=function(){return new t(this.color,this.density)},e.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},t}(),cs=function(){function t(t,e,n){void 0===e&&(e=1),void 0===n&&(n=1e3),this.isFog=!0,this.name="",this.color=new mi(t),this.near=e,this.far=n}var e=t.prototype;return e.clone=function(){return new t(this.color,this.near,this.far)},e.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},t}(),hs=function(t){function e(){var e;return(e=t.call(this)||this).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:e})),e}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return null!==this.fog&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(n.object.backgroundIntensity=this.backgroundIntensity),n},Xt(e,[{key:"autoUpdate",get:function(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate},set:function(t){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=t}}])}(Jn),ds=function(){function t(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Ot,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ae()}var e=t.prototype;return e.onUploadCallback=function(){},e.setUsage=function(t){return this.usage=t,this},e.copy=function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},e.copyAt=function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},e.set=function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},e.clone=function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ae()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n},e.onUpload=function(t){return this.onUploadCallback=t,this},e.toJSON=function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ae()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}},Xt(t,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])}(),ps=new Ye,fs=function(){function t(t,e,n,i){void 0===i&&(i=!1),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}var e=t.prototype;return e.applyMatrix4=function(t){for(var e=0,n=this.data.count;e<n;e++)ps.fromBufferAttribute(this,e),ps.applyMatrix4(t),this.setXYZ(e,ps.x,ps.y,ps.z);return this},e.applyNormalMatrix=function(t){for(var e=0,n=this.count;e<n;e++)ps.fromBufferAttribute(this,e),ps.applyNormalMatrix(t),this.setXYZ(e,ps.x,ps.y,ps.z);return this},e.transformDirection=function(t){for(var e=0,n=this.count;e<n;e++)ps.fromBufferAttribute(this,e),ps.transformDirection(t),this.setXYZ(e,ps.x,ps.y,ps.z);return this},e.setX=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this},e.setY=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this},e.setZ=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this},e.setW=function(t,e){return this.normalized&&(e=pe(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this},e.getX=function(t){var e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=de(e,this.array)),e},e.getY=function(t){var e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=de(e,this.array)),e},e.getZ=function(t){var e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=de(e,this.array)),e},e.getW=function(t){var e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=de(e,this.array)),e},e.setXY=function(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this},e.setXYZ=function(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},e.setXYZW=function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=pe(e,this.array),n=pe(n,this.array),i=pe(i,this.array),r=pe(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this},e.clone=function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");for(var n=[],i=0;i<this.count;i++)for(var r=i*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[r+a]);return new wi(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new t(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},e.toJSON=function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var i=n*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[i+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}},Xt(t,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(t){this.data.needsUpdate=t}}])}(),ms=function(t){function e(e){var n;return(n=t.call(this)||this).isSpriteMaterial=!0,n.type="SpriteMaterial",n.color=new mi(16777215),n.map=null,n.alphaMap=null,n.rotation=0,n.sizeAttenuation=!0,n.transparent=!0,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this},e}(ci),vs=new Ye,gs=new Ye,ys=new Ye,_s=new me,xs=new me,Ms=new wn,Ss=new Ye,bs=new Ye,Es=new Ye,ws=new me,Ts=new me,As=new me,Rs=function(t){function e(e){var n;if((n=t.call(this)||this).isSprite=!0,n.type="Sprite",void 0===ls){ls=new Vi;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new ds(i,5);ls.setIndex([0,1,2,0,2,3]),ls.setAttribute("position",new fs(r,3,0,!1)),ls.setAttribute("uv",new fs(r,2,3,!1))}return n.geometry=ls,n.material=void 0!==e?e:new ms,n.center=new me(.5,.5),n}Yt(e,t);var n=e.prototype;return n.raycast=function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),gs.setFromMatrixScale(this.matrixWorld),Ms.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),ys.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&gs.multiplyScalar(-ys.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;Cs(Ss.set(-.5,-.5,0),ys,a,gs,n,i),Cs(bs.set(.5,-.5,0),ys,a,gs,n,i),Cs(Es.set(.5,.5,0),ys,a,gs,n,i),ws.set(0,0),Ts.set(1,0),As.set(1,1);var o=t.ray.intersectTriangle(Ss,bs,Es,!1,vs);if(null!==o||(Cs(bs.set(-.5,.5,0),ys,a,gs,n,i),Ts.set(0,1),null!==(o=t.ray.intersectTriangle(Ss,Es,bs,!1,vs)))){var s=t.ray.origin.distanceTo(vs);s<t.near||s>t.far||e.push({distance:s,point:vs.clone(),uv:li.getInterpolation(vs,Ss,bs,Es,ws,Ts,As,new me),face:null,object:this})}},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this},e}(Jn);function Cs(t,e,n,i,r,a){_s.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(xs.x=a*_s.x-r*_s.y,xs.y=r*_s.x+a*_s.y):xs.copy(_s),t.copy(e),t.x+=xs.x,t.y+=xs.y,t.applyMatrix4(Ms)}var Ls=new Ye,Ps=new Ye,Us=function(t){function e(){var e;return(e=t.call(this)||this)._currentLevel=0,e.type="LOD",Object.defineProperties(e,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}Yt(e,t);var n=e.prototype;return n.copy=function(e){t.prototype.copy.call(this,e,!1);for(var n=e.levels,i=0,r=n.length;i<r;i++){var a=n[i];this.addLevel(a.object.clone(),a.distance,a.hysteresis)}return this.autoUpdate=e.autoUpdate,this},n.addLevel=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),e=Math.abs(e);var i,r=this.levels;for(i=0;i<r.length&&!(e<r[i].distance);i++);return r.splice(i,0,{distance:e,hysteresis:n,object:t}),this.add(t),this},n.getCurrentLevel=function(){return this._currentLevel},n.getObjectForDistance=function(t){var e=this.levels;if(e.length>0){var n,i;for(n=1,i=e.length;n<i;n++){var r=e[n].distance;if(e[n].object.visible&&(r-=r*e[n].hysteresis),t<r)break}return e[n-1].object}return null},n.raycast=function(t,e){if(this.levels.length>0){Ls.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Ls);this.getObjectForDistance(n).raycast(t,e)}},n.update=function(t){var e=this.levels;if(e.length>1){Ls.setFromMatrixPosition(t.matrixWorld),Ps.setFromMatrixPosition(this.matrixWorld);var n,i,r=Ls.distanceTo(Ps)/t.zoom;for(e[0].object.visible=!0,n=1,i=e.length;n<i;n++){var a=e[n].distance;if(e[n].object.visible&&(a-=a*e[n].hysteresis),!(r>=a))break;e[n-1].object.visible=!1,e[n].object.visible=!0}for(this._currentLevel=n-1;n<i;n++)e[n].object.visible=!1}},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(n.object.autoUpdate=!1),n.object.levels=[];for(var i=this.levels,r=0,a=i.length;r<a;r++){var o=i[r];n.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return n},e}(Jn),Is=new Ye,Ns=new Ge,Ds=new Ge,Os=new Ye,Bs=new wn,Fs=new Ye,zs=new vn,Gs=new wn,ks=new En,Hs=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).isSkinnedMesh=!0,i.type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new wn,i.bindMatrixInverse=new wn,i.boundingBox=null,i.boundingSphere=null,i}Yt(e,t);var n=e.prototype;return n.computeBoundingBox=function(){var t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ke),this.boundingBox.makeEmpty();for(var e=t.getAttribute("position"),n=0;n<e.count;n++)Fs.fromBufferAttribute(e,n),this.applyBoneTransform(n,Fs),this.boundingBox.expandByPoint(Fs)},n.computeBoundingSphere=function(){var t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new vn),this.boundingSphere.makeEmpty();for(var e=t.getAttribute("position"),n=0;n<e.count;n++)Fs.fromBufferAttribute(e,n),this.applyBoneTransform(n,Fs),this.boundingSphere.expandByPoint(Fs)},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},n.raycast=function(t,e){var n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),zs.copy(this.boundingSphere),zs.applyMatrix4(i),!1!==t.ray.intersectsSphere(zs)&&(Gs.copy(i).invert(),ks.copy(t.ray).applyMatrix4(Gs),null!==this.boundingBox&&!1===ks.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,ks)))},n.getVertexPosition=function(e,n){return t.prototype.getVertexPosition.call(this,e,n),this.applyBoneTransform(e,n),n},n.bind=function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},n.pose=function(){this.skeleton.pose()},n.normalizeSkinWeights=function(){for(var t=new Ge,e=this.geometry.attributes.skinWeight,n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);var r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},n.updateMatrixWorld=function(e){t.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},n.applyBoneTransform=function(t,e){var n=this.skeleton,i=this.geometry;Ns.fromBufferAttribute(i.attributes.skinIndex,t),Ds.fromBufferAttribute(i.attributes.skinWeight,t),Is.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(var r=0;r<4;r++){var a=Ds.getComponent(r);if(0!==a){var o=Ns.getComponent(r);Bs.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(Os.copy(Is).applyMatrix4(Bs),a)}}return e.applyMatrix4(this.bindMatrixInverse)},n.boneTransform=function(t,e){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(t,e)},e}(sr),Vs=function(t){function e(){var e;return(e=t.call(this)||this).isBone=!0,e.type="Bone",e}return Yt(e,t),e}(Jn),Ws=function(t){function e(e,n,i,r,a,o,s,l,u,c,h,d){var p;return void 0===e&&(e=null),void 0===n&&(n=1),void 0===i&&(i=1),void 0===u&&(u=T),void 0===c&&(c=T),(p=t.call(this,null,o,s,l,u,c,r,a,h,d)||this).isDataTexture=!0,p.image={data:e,width:n,height:i},p.generateMipmaps=!1,p.flipY=!1,p.unpackAlignment=1,p}return Yt(e,t),e}(ze),Xs=new wn,js=new wn,qs=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e=[]),this.uuid=ae(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}var e=t.prototype;return e.init=function(){var t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new wn)}},e.calculateInverses=function(){this.boneInverses.length=0;for(var t=0,e=this.bones.length;t<e;t++){var n=new wn;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}},e.pose=function(){for(var t=0,e=this.bones.length;t<e;t++){var n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(var i=0,r=this.bones.length;i<r;i++){var a=this.bones[i];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}},e.update=function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=t.length;r<a;r++){var o=t[r]?t[r].matrixWorld:js;Xs.multiplyMatrices(o,e[r]),Xs.toArray(n,16*r)}null!==i&&(i.needsUpdate=!0)},e.clone=function(){return new t(this.bones,this.boneInverses)},e.computeBoneTexture=function(){var t=Math.sqrt(4*this.bones.length);t=ce(t),t=Math.max(t,4);var e=new Float32Array(t*t*4);e.set(this.boneMatrices);var n=new Ws(e,t,t,k,O);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this},e.getBoneByName=function(t){for(var e=0,n=this.bones.length;e<n;e++){var i=this.bones[e];if(i.name===t)return i}},e.dispose=function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)},e.fromJSON=function(t,e){this.uuid=t.uuid;for(var n=0,i=t.bones.length;n<i;n++){var r=t.bones[n],a=e[r];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new Vs),this.bones.push(a),this.boneInverses.push((new wn).fromArray(t.boneInverses[n]))}return this.init(),this},e.toJSON=function(){var t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;for(var e=this.bones,n=this.boneInverses,i=0,r=e.length;i<r;i++){var a=e[i];t.bones.push(a.uuid);var o=n[i];t.boneInverses.push(o.toArray())}return t},t}(),Ys=function(t){function e(e,n,i,r){var a;return void 0===r&&(r=1),(a=t.call(this,e,n,i)||this).isInstancedBufferAttribute=!0,a.meshPerAttribute=r,a}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e},e}(wi),Zs=new wn,Js=new wn,Ks=[],Qs=new Ke,$s=new wn,tl=new sr,el=new vn,nl=function(t){function e(e,n,i){var r;(r=t.call(this,e,n)||this).isInstancedMesh=!0,r.instanceMatrix=new Ys(new Float32Array(16*i),16),r.instanceColor=null,r.count=i,r.boundingBox=null,r.boundingSphere=null;for(var a=0;a<i;a++)r.setMatrixAt(a,$s);return r}Yt(e,t);var n=e.prototype;return n.computeBoundingBox=function(){var t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Ke),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(var n=0;n<e;n++)this.getMatrixAt(n,Zs),Qs.copy(t.boundingBox).applyMatrix4(Zs),this.boundingBox.union(Qs)},n.computeBoundingSphere=function(){var t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new vn),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(var n=0;n<e;n++)this.getMatrixAt(n,Zs),el.copy(t.boundingSphere).applyMatrix4(Zs),this.boundingSphere.union(el)},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},n.getColorAt=function(t,e){e.fromArray(this.instanceColor.array,3*t)},n.getMatrixAt=function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},n.raycast=function(t,e){var n=this.matrixWorld,i=this.count;if(tl.geometry=this.geometry,tl.material=this.material,void 0!==tl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),el.copy(this.boundingSphere),el.applyMatrix4(n),!1!==t.ray.intersectsSphere(el)))for(var r=0;r<i;r++){this.getMatrixAt(r,Zs),Js.multiplyMatrices(n,Zs),tl.matrixWorld=Js,tl.raycast(t,Ks);for(var a=0,o=Ks.length;a<o;a++){var s=Ks[a];s.instanceId=r,s.object=this,e.push(s)}Ks.length=0}},n.setColorAt=function(t,e){null===this.instanceColor&&(this.instanceColor=new Ys(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)},n.setMatrixAt=function(t,e){e.toArray(this.instanceMatrix.array,16*t)},n.updateMorphTargets=function(){},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(sr),il=function(t){function e(e){var n;return(n=t.call(this)||this).isLineBasicMaterial=!0,n.type="LineBasicMaterial",n.color=new mi(16777215),n.map=null,n.linewidth=1,n.linecap="round",n.linejoin="round",n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this},e}(ci),rl=new Ye,al=new Ye,ol=new wn,sl=new En,ll=new vn,ul=function(t){function e(e,n){var i;return void 0===e&&(e=new Vi),void 0===n&&(n=new il),(i=t.call(this)||this).isLine=!0,i.type="Line",i.geometry=e,i.material=n,i.geometry.isCompatibleGeometry&&i.geometry.updateBuffer(),i.updateMorphTargets(),i}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.material=e.material,this.geometry=e.geometry,this},n.computeLineDistances=function(){var t=this.geometry;if(null===t.index){for(var e=t.attributes.position,n=[0],i=1,r=e.count;i<r;i++)rl.fromBufferAttribute(e,i-1),al.fromBufferAttribute(e,i),n[i]=n[i-1],n[i]+=rl.distanceTo(al);t.setAttribute("lineDistance",new Ni(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this},n.raycast=function(t,e){var n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ll.copy(n.boundingSphere),ll.applyMatrix4(i),ll.radius+=r,!1!==t.ray.intersectsSphere(ll)){ol.copy(i).invert(),sl.copy(t.ray).applyMatrix4(ol);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new Ye,u=new Ye,c=new Ye,h=new Ye,d=this.isLineSegments?2:1,p=n.index,f=n.attributes.position;if(null!==p)for(var m=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count)-1;m<v;m+=d){var g=p.getX(m),y=p.getX(m+1);if(l.fromBufferAttribute(f,g),u.fromBufferAttribute(f,y),!(sl.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=t.ray.origin.distanceTo(h);_<t.near||_>t.far||e.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),M=Math.min(f.count,a.start+a.count)-1;x<M;x+=d){if(l.fromBufferAttribute(f,x),u.fromBufferAttribute(f,x+1),!(sl.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var S=t.ray.origin.distanceTo(h);S<t.near||S>t.far||e.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}},n.updateMorphTargets=function(){var t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){var n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}},e}(Jn),cl=new Ye,hl=new Ye,dl=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).isLineSegments=!0,i.type="LineSegments",i}return Yt(e,t),e.prototype.computeLineDistances=function(){var t=this.geometry;if(null===t.index){for(var e=t.attributes.position,n=[],i=0,r=e.count;i<r;i+=2)cl.fromBufferAttribute(e,i),hl.fromBufferAttribute(e,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+cl.distanceTo(hl);t.setAttribute("lineDistance",new Ni(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this},e}(ul),pl=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).isLineLoop=!0,i.type="LineLoop",i}return Yt(e,t),e}(ul),fl=function(t){function e(e){var n;return(n=t.call(this)||this).isPointsMaterial=!0,n.type="PointsMaterial",n.color=new mi(16777215),n.map=null,n.alphaMap=null,n.size=1,n.sizeAttenuation=!0,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this},e}(ci),ml=new wn,vl=new En,gl=new vn,yl=new Ye,_l=function(t){function e(e,n){var i;return void 0===e&&(e=new Vi),void 0===n&&(n=new fl),(i=t.call(this)||this).isPoints=!0,i.type="Points",i.geometry=e,i.material=n,i.geometry.isCompatibleGeometry&&i.geometry.updateBuffer(),i.updateMorphTargets(),i}Yt(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.material=e.material,this.geometry=e.geometry,this},n.raycast=function(t,e){var n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),gl.copy(n.boundingSphere),gl.applyMatrix4(i),gl.radius+=r,!1!==t.ray.intersectsSphere(gl)){ml.copy(i).invert(),vl.copy(t.ray).applyMatrix4(ml);var o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);yl.fromBufferAttribute(u,d),xl(yl,d,s,i,t,e,this)}else for(var p=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);p<f;p++)yl.fromBufferAttribute(u,p),xl(yl,p,s,i,t,e,this)}},n.updateMorphTargets=function(){var t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){var n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i<r;i++){var a=n[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}},e}(Jn);function xl(t,e,n,i,r,a,o){var s=vl.distanceSqToPoint(t);if(s<n){var l=new Ye;vl.closestPointToPoint(t,l),l.applyMatrix4(i);var u=r.ray.origin.distanceTo(l);if(u<r.near||u>r.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:e,face:null,object:o})}}var Ml=function(t){function e(e,n,i,r,a,o,s,l,u){var c;(c=t.call(this,e,n,i,r,a,o,s,l,u)||this).isVideoTexture=!0,c.minFilter=void 0!==o?o:C,c.magFilter=void 0!==a?a:C,c.generateMipmaps=!1;var h=c;return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)})),c}Yt(e,t);var n=e.prototype;return n.clone=function(){return new this.constructor(this.image).copy(this)},n.update=function(){var t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)},e}(ze),Sl=function(t){function e(e,n){var i;return(i=t.call(this,{width:e,height:n})||this).isFramebufferTexture=!0,i.magFilter=T,i.minFilter=T,i.generateMipmaps=!1,i.needsUpdate=!0,i}return Yt(e,t),e}(ze),bl=function(t){function e(e,n,i,r,a,o,s,l,u,c,h,d){var p;return(p=t.call(this,null,o,s,l,u,c,r,a,h,d)||this).isCompressedTexture=!0,p.image={width:n,height:i},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return Yt(e,t),e}(ze),El=function(t){function e(e,n,i,r,a,o){var s;return(s=t.call(this,e,n,i,a,o)||this).isCompressedArrayTexture=!0,s.image.depth=r,s.wrapR=E,s}return Yt(e,t),e}(bl),wl=function(t){function e(e,n,i,r,a,o,s,l,u){var c;return(c=t.call(this,e,n,i,r,a,o,s,l,u)||this).isCanvasTexture=!0,c.needsUpdate=!0,c}return Yt(e,t),e}(ze),Tl=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var e=t.prototype;return e.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},e.getPointAt=function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},e.getPoints=function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},e.getSpacedPoints=function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},e.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=t;a++)r+=(e=this.getPoint(a/t)).distanceTo(i),n.push(r),i=e;return this.cacheArcLengths=n,n},e.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},e.getUtoTmapping=function(t,e){var n,i=this.getLengths(),r=0,a=i.length;n=e||t*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(a-1)},e.getTangent=function(t,e){var n=1e-4,i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);var a=this.getPoint(i),o=this.getPoint(r),s=e||(a.isVector2?new me:new Ye);return s.copy(o).sub(a).normalize(),s},e.getTangentAt=function(t,e){var n=this.getUtoTmapping(t);return this.getTangent(n,e)},e.computeFrenetFrames=function(t,e){for(var n=new Ye,i=[],r=[],a=[],o=new Ye,s=new wn,l=0;l<=t;l++){var u=l/t;i[l]=this.getTangentAt(u,new Ye)}r[0]=new Ye,a[0]=new Ye;var c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var f=1;f<=t;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();var m=Math.acos(oe(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(s.makeRotationAxis(o,m))}a[f].crossVectors(i[f],r[f])}if(!0===e){var v=Math.acos(oe(r[0].dot(r[t]),-1,1));v/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(v=-v);for(var g=1;g<=t;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],v*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},e.toJSON=function(){var t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},e.fromJSON=function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},t}(),Al=function(t){function e(e,n,i,r,a,o,s,l){var u;return void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=1),void 0===r&&(r=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),void 0===s&&(s=!1),void 0===l&&(l=0),(u=t.call(this)||this).isEllipseCurve=!0,u.type="EllipseCurve",u.aX=e,u.aY=n,u.xRadius=i,u.yRadius=r,u.aStartAngle=a,u.aEndAngle=o,u.aClockwise=s,u.aRotation=l,u}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){for(var n=e||new me,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+t*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)},n.copy=function(e){return t.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},n.toJSON=function(){var e=t.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},n.fromJSON=function(e){return t.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},e}(Tl),Rl=function(t){function e(e,n,i,r,a,o){var s;return(s=t.call(this,e,n,i,i,r,a,o)||this).isArcCurve=!0,s.type="ArcCurve",s}return Yt(e,t),e}(Al);function Cl(){var t=0,e=0,n=0,i=0;function r(r,a,o,s){t=r,e=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(t,e,n,i,a){r(e,n,a*(n-t),a*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,a,o,s){var l=(e-t)/a-(n-t)/(a+o)+(n-e)/o,u=(n-e)/o-(i-e)/(o+s)+(i-n)/s;r(e,n,l*=o,u*=o)},calc:function(r){var a=r*r;return t+e*r+n*a+i*(a*r)}}}var Ll=new Ye,Pl=new Cl,Ul=new Cl,Il=new Cl,Nl=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=[]),void 0===n&&(n=!1),void 0===i&&(i="centripetal"),void 0===r&&(r=.5),(a=t.call(this)||this).isCatmullRomCurve3=!0,a.type="CatmullRomCurve3",a.points=e,a.closed=n,a.curveType=i,a.tension=r,a}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Ye);var n,i,r=e,a=this.points,o=a.length,s=(o-(this.closed?0:1))*t,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?n=a[(l-1)%o]:(Ll.subVectors(a[0],a[1]).add(a[0]),n=Ll);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?i=a[(l+2)%o]:(Ll.subVectors(a[o-1],a[o-2]).add(a[o-1]),i=Ll),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(c),d),f=Math.pow(c.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(i),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Pl.initNonuniformCatmullRom(n.x,c.x,h.x,i.x,p,f,m),Ul.initNonuniformCatmullRom(n.y,c.y,h.y,i.y,p,f,m),Il.initNonuniformCatmullRom(n.z,c.z,h.z,i.z,p,f,m)}else"catmullrom"===this.curveType&&(Pl.initCatmullRom(n.x,c.x,h.x,i.x,this.tension),Ul.initCatmullRom(n.y,c.y,h.y,i.y,this.tension),Il.initCatmullRom(n.z,c.z,h.z,i.z,this.tension));return r.set(Pl.calc(u),Ul.calc(u),Il.calc(u)),r},n.copy=function(e){t.prototype.copy.call(this,e),this.points=[];for(var n=0,i=e.points.length;n<i;n++){var r=e.points[n];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.points=[];for(var n=0,i=this.points.length;n<i;n++){var r=this.points[n];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.points=[];for(var n=0,i=e.points.length;n<i;n++){var r=e.points[n];this.points.push((new Ye).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},e}(Tl);function Dl(t,e,n,i,r){var a=.5*(i-e),o=.5*(r-n),s=t*t;return(2*n-2*i+a+o)*(t*s)+(-3*n+3*i-2*a-o)*s+a*t+n}function Ol(t,e,n,i){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Bl(t,e,n,i,r){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}var Fl=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=new me),void 0===n&&(n=new me),void 0===i&&(i=new me),void 0===r&&(r=new me),(a=t.call(this)||this).isCubicBezierCurve=!0,a.type="CubicBezierCurve",a.v0=e,a.v1=n,a.v2=i,a.v3=r,a}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new me);var n=e,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Bl(t,i.x,r.x,a.x,o.x),Bl(t,i.y,r.y,a.y,o.y)),n},n.copy=function(e){return t.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},n.toJSON=function(){var e=t.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},n.fromJSON=function(e){return t.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},e}(Tl),zl=function(t){function e(e,n,i,r){var a;return void 0===e&&(e=new Ye),void 0===n&&(n=new Ye),void 0===i&&(i=new Ye),void 0===r&&(r=new Ye),(a=t.call(this)||this).isCubicBezierCurve3=!0,a.type="CubicBezierCurve3",a.v0=e,a.v1=n,a.v2=i,a.v3=r,a}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Ye);var n=e,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Bl(t,i.x,r.x,a.x,o.x),Bl(t,i.y,r.y,a.y,o.y),Bl(t,i.z,r.z,a.z,o.z)),n},n.copy=function(e){return t.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},n.toJSON=function(){var e=t.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},n.fromJSON=function(e){return t.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},e}(Tl),Gl=function(t){function e(e,n){var i;return void 0===e&&(e=new me),void 0===n&&(n=new me),(i=t.call(this)||this).isLineCurve=!0,i.type="LineCurve",i.v1=e,i.v2=n,i}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new me);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},n.getPointAt=function(t,e){return this.getPoint(t,e)},n.getTangent=function(t,e){return void 0===e&&(e=new me),e.subVectors(this.v2,this.v1).normalize()},n.getTangentAt=function(t,e){return this.getTangent(t,e)},n.copy=function(e){return t.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(Tl),kl=function(t){function e(e,n){var i;return void 0===e&&(e=new Ye),void 0===n&&(n=new Ye),(i=t.call(this)||this).isLineCurve3=!0,i.type="LineCurve3",i.v1=e,i.v2=n,i}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Ye);var n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},n.getPointAt=function(t,e){return this.getPoint(t,e)},n.getTangent=function(t,e){return void 0===e&&(e=new Ye),e.subVectors(this.v2,this.v1).normalize()},n.getTangentAt=function(t,e){return this.getTangent(t,e)},n.copy=function(e){return t.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(Tl),Hl=function(t){function e(e,n,i){var r;return void 0===e&&(e=new me),void 0===n&&(n=new me),void 0===i&&(i=new me),(r=t.call(this)||this).isQuadraticBezierCurve=!0,r.type="QuadraticBezierCurve",r.v0=e,r.v1=n,r.v2=i,r}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new me);var n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(Ol(t,i.x,r.x,a.x),Ol(t,i.y,r.y,a.y)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(Tl),Vl=function(t){function e(e,n,i){var r;return void 0===e&&(e=new Ye),void 0===n&&(n=new Ye),void 0===i&&(i=new Ye),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=e,r.v1=n,r.v2=i,r}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new Ye);var n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(Ol(t,i.x,r.x,a.x),Ol(t,i.y,r.y,a.y),Ol(t,i.z,r.z,a.z)),n},n.copy=function(e){return t.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},e}(Tl),Wl=function(t){function e(e){var n;return void 0===e&&(e=[]),(n=t.call(this)||this).isSplineCurve=!0,n.type="SplineCurve",n.points=e,n}Yt(e,t);var n=e.prototype;return n.getPoint=function(t,e){void 0===e&&(e=new me);var n=e,i=this.points,r=(i.length-1)*t,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(Dl(o,s.x,l.x,u.x,c.x),Dl(o,s.y,l.y,u.y,c.y)),n},n.copy=function(e){t.prototype.copy.call(this,e),this.points=[];for(var n=0,i=e.points.length;n<i;n++){var r=e.points[n];this.points.push(r.clone())}return this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.points=[];for(var n=0,i=this.points.length;n<i;n++){var r=this.points[n];e.points.push(r.toArray())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.points=[];for(var n=0,i=e.points.length;n<i;n++){var r=e.points[n];this.points.push((new me).fromArray(r))}return this},e}(Tl),Xl=Object.freeze({__proto__:null,ArcCurve:Rl,CatmullRomCurve3:Nl,CubicBezierCurve:Fl,CubicBezierCurve3:zl,EllipseCurve:Al,LineCurve:Gl,LineCurve3:kl,QuadraticBezierCurve:Hl,QuadraticBezierCurve3:Vl,SplineCurve:Wl}),jl=function(t){function e(){var e;return(e=t.call(this)||this).type="CurvePath",e.curves=[],e.autoClose=!1,e}Yt(e,t);var n=e.prototype;return n.add=function(t){this.curves.push(t)},n.closePath=function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Gl(e,t))},n.getPoint=function(t,e){for(var n=t*this.getLength(),i=this.getCurveLengths(),r=0;r<i.length;){if(i[r]>=n){var a=i[r]-n,o=this.curves[r],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,e)}r++}return null},n.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},n.updateArcLengths=function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},n.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},n.getSpacedPoints=function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},n.getPoints=function(t){void 0===t&&(t=12);for(var e,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},n.copy=function(e){t.prototype.copy.call(this,e),this.curves=[];for(var n=0,i=e.curves.length;n<i;n++){var r=e.curves[n];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var n=0,i=this.curves.length;n<i;n++){var r=this.curves[n];e.curves.push(r.toJSON())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var n=0,i=e.curves.length;n<i;n++){var r=e.curves[n];this.curves.push((new Xl[r.type]).fromJSON(r))}return this},e}(Tl),ql=function(t){function e(e){var n;return(n=t.call(this)||this).type="Path",n.currentPoint=new me,e&&n.setFromPoints(e),n}Yt(e,t);var n=e.prototype;return n.setFromPoints=function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},n.moveTo=function(t,e){return this.currentPoint.set(t,e),this},n.lineTo=function(t,e){var n=new Gl(this.currentPoint.clone(),new me(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},n.quadraticCurveTo=function(t,e,n,i){var r=new Hl(this.currentPoint.clone(),new me(t,e),new me(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},n.bezierCurveTo=function(t,e,n,i,r,a){var o=new Fl(this.currentPoint.clone(),new me(t,e),new me(n,i),new me(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},n.splineThru=function(t){var e=[this.currentPoint.clone()].concat(t),n=new Wl(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this},n.arc=function(t,e,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,i,r,a),this},n.absarc=function(t,e,n,i,r,a){return this.absellipse(t,e,n,n,i,r,a),this},n.ellipse=function(t,e,n,i,r,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(t+l,e+u,n,i,r,a,o,s),this},n.absellipse=function(t,e,n,i,r,a,o,s){var l=new Al(t,e,n,i,r,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this},n.copy=function(e){return t.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this},e}(jl),Yl=function(t){function e(e,n,i,r){var a;void 0===e&&(e=[new me(0,-.5),new me(.5,0),new me(0,.5)]),void 0===n&&(n=12),void 0===i&&(i=0),void 0===r&&(r=2*Math.PI),(a=t.call(this)||this).type="LatheGeometry",a.parameters={points:e,segments:n,phiStart:i,phiLength:r},n=Math.floor(n),r=oe(r,0,2*Math.PI);for(var o=[],s=[],l=[],u=[],c=[],h=1/n,d=new Ye,p=new me,f=new Ye,m=new Ye,v=new Ye,g=0,y=0,_=0;_<=e.length-1;_++)switch(_){case 0:g=e[_+1].x-e[_].x,y=e[_+1].y-e[_].y,f.x=1*y,f.y=-g,f.z=0*y,v.copy(f),f.normalize(),u.push(f.x,f.y,f.z);break;case e.length-1:u.push(v.x,v.y,v.z);break;default:g=e[_+1].x-e[_].x,y=e[_+1].y-e[_].y,f.x=1*y,f.y=-g,f.z=0*y,m.copy(f),f.x+=v.x,f.y+=v.y,f.z+=v.z,f.normalize(),u.push(f.x,f.y,f.z),v.copy(m)}for(var x=0;x<=n;x++)for(var M=i+x*h*r,S=Math.sin(M),b=Math.cos(M),E=0;E<=e.length-1;E++){d.x=e[E].x*S,d.y=e[E].y,d.z=e[E].x*b,s.push(d.x,d.y,d.z),p.x=x/n,p.y=E/(e.length-1),l.push(p.x,p.y);var w=u[3*E+0]*S,T=u[3*E+1],A=u[3*E+0]*b;c.push(w,T,A)}for(var R=0;R<n;R++)for(var C=0;C<e.length-1;C++){var L=C+R*e.length,P=L,U=L+e.length,I=L+e.length+1,N=L+1;o.push(P,U,N),o.push(I,N,U)}return a.setIndex(o),a.setAttribute("position",new Ni(s,3)),a.setAttribute("uv",new Ni(l,2)),a.setAttribute("normal",new Ni(c,3)),a}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)},e}(Vi),Zl=function(t){function e(e,n,i,r){var a;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=4),void 0===r&&(r=8);var o=new ql;return o.absarc(0,-n/2,e,1.5*Math.PI,0),o.absarc(0,n/2,e,0,.5*Math.PI),(a=t.call(this,o.getPoints(i),r)||this).type="CapsuleGeometry",a.parameters={radius:e,height:n,capSegments:i,radialSegments:r},a}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.length,t.capSegments,t.radialSegments)},e}(Yl),Jl=function(t){function e(e,n,i,r){var a;void 0===e&&(e=1),void 0===n&&(n=32),void 0===i&&(i=0),void 0===r&&(r=2*Math.PI),(a=t.call(this)||this).type="CircleGeometry",a.parameters={radius:e,segments:n,thetaStart:i,thetaLength:r},n=Math.max(3,n);var o=[],s=[],l=[],u=[],c=new Ye,h=new me;s.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=i+d/n*r;c.x=e*Math.cos(f),c.y=e*Math.sin(f),s.push(c.x,c.y,c.z),l.push(0,0,1),h.x=(s[p]/e+1)/2,h.y=(s[p+1]/e+1)/2,u.push(h.x,h.y)}for(var m=1;m<=n;m++)o.push(m,m+1,0);return a.setIndex(o),a.setAttribute("position",new Ni(s,3)),a.setAttribute("normal",new Ni(l,3)),a.setAttribute("uv",new Ni(u,2)),a}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)},e}(Vi),Kl=function(t){function e(e,n,i,r,a,o,s,l){var u;void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=1),void 0===r&&(r=32),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===s&&(s=0),void 0===l&&(l=2*Math.PI),(u=t.call(this)||this).type="CylinderGeometry",u.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:l};var c=u;r=Math.floor(r),a=Math.floor(a);var h=[],d=[],p=[],f=[],m=0,v=[],g=i/2,y=0;function _(t){for(var i=m,a=new me,o=new Ye,u=0,v=!0===t?e:n,_=!0===t?1:-1,x=1;x<=r;x++)d.push(0,g*_,0),p.push(0,_,0),f.push(.5,.5),m++;for(var M=m,S=0;S<=r;S++){var b=S/r*l+s,E=Math.cos(b),w=Math.sin(b);o.x=v*w,o.y=g*_,o.z=v*E,d.push(o.x,o.y,o.z),p.push(0,_,0),a.x=.5*E+.5,a.y=.5*w*_+.5,f.push(a.x,a.y),m++}for(var T=0;T<r;T++){var A=i+T,R=M+T;!0===t?h.push(R,R+1,A):h.push(R+1,R,A),u+=3}c.addGroup(y,u,!0===t?1:2),y+=u}return function(){for(var t=new Ye,o=new Ye,u=0,_=(n-e)/i,x=0;x<=a;x++){for(var M=[],S=x/a,b=S*(n-e)+e,E=0;E<=r;E++){var w=E/r,T=w*l+s,A=Math.sin(T),R=Math.cos(T);o.x=b*A,o.y=-S*i+g,o.z=b*R,d.push(o.x,o.y,o.z),t.set(A,_,R).normalize(),p.push(t.x,t.y,t.z),f.push(w,1-S),M.push(m++)}v.push(M)}for(var C=0;C<r;C++)for(var L=0;L<a;L++){var P=v[L][C],U=v[L+1][C],I=v[L+1][C+1],N=v[L][C+1];h.push(P,U,N),h.push(U,I,N),u+=6}c.addGroup(y,u,0),y+=u}(),!1===o&&(e>0&&_(!0),n>0&&_(!1)),u.setIndex(h),u.setAttribute("position",new Ni(d,3)),u.setAttribute("normal",new Ni(p,3)),u.setAttribute("uv",new Ni(f,2)),u}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)},e}(Vi),Ql=function(t){function e(e,n,i,r,a,o,s){var l;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===i&&(i=32),void 0===r&&(r=1),void 0===a&&(a=!1),void 0===o&&(o=0),void 0===s&&(s=2*Math.PI),(l=t.call(this,0,e,n,i,r,a,o,s)||this).type="ConeGeometry",l.parameters={radius:e,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},l}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)},e}(Kl),$l=function(t){function e(e,n,i,r){var a;void 0===e&&(e=[]),void 0===n&&(n=[]),void 0===i&&(i=1),void 0===r&&(r=0),(a=t.call(this)||this).type="PolyhedronGeometry",a.parameters={vertices:e,indices:n,radius:i,detail:r};var o=[],s=[];function l(t,e,n,i){for(var r=i+1,a=[],o=0;o<=r;o++){a[o]=[];for(var s=t.clone().lerp(n,o/r),l=e.clone().lerp(n,o/r),c=r-o,h=0;h<=c;h++)a[o][h]=0===h&&o===r?s:s.clone().lerp(l,h/c)}for(var d=0;d<r;d++)for(var p=0;p<2*(r-d)-1;p++){var f=Math.floor(p/2);p%2==0?(u(a[d][f+1]),u(a[d+1][f]),u(a[d][f])):(u(a[d][f+1]),u(a[d+1][f+1]),u(a[d+1][f]))}}function u(t){o.push(t.x,t.y,t.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 h(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function d(t){return Math.atan2(t.z,-t.x)}return function(t){for(var e=new Ye,i=new Ye,r=new Ye,a=0;a<n.length;a+=3)c(n[a+0],e),c(n[a+1],i),c(n[a+2],r),l(e,i,r,t)}(r),function(t){for(var e=new Ye,n=0;n<o.length;n+=3)e.x=o[n+0],e.y=o[n+1],e.z=o[n+2],e.normalize().multiplyScalar(t),o[n+0]=e.x,o[n+1]=e.y,o[n+2]=e.z}(i),function(){for(var t=new Ye,e=0;e<o.length;e+=3){t.x=o[e+0],t.y=o[e+1],t.z=o[e+2];var n=d(t)/2/Math.PI+.5,i=(r=t,Math.atan2(-r.y,Math.sqrt(r.x*r.x+r.z*r.z))/Math.PI+.5);s.push(n,1-i)}var r;(function(){for(var t=new Ye,e=new Ye,n=new Ye,i=new Ye,r=new me,a=new me,l=new me,u=0,c=0;u<o.length;u+=9,c+=6){t.set(o[u+0],o[u+1],o[u+2]),e.set(o[u+3],o[u+4],o[u+5]),n.set(o[u+6],o[u+7],o[u+8]),r.set(s[c+0],s[c+1]),a.set(s[c+2],s[c+3]),l.set(s[c+4],s[c+5]),i.copy(t).add(e).add(n).divideScalar(3);var p=d(i);h(r,c+0,t,p),h(a,c+2,e,p),h(l,c+4,n,p)}})(),function(){for(var t=0;t<s.length;t+=6){var e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),a=Math.min(e,n,i);r>.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),a.setAttribute("position",new Ni(o,3)),a.setAttribute("normal",new Ni(o.slice(),3)),a.setAttribute("uv",new Ni(s,2)),0===r?a.computeVertexNormals():a.normalizeNormals(),a}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.vertices,t.indices,t.radius,t.details)},e}(Vi),tu=function(t){function e(e,n){var i;void 0===e&&(e=1),void 0===n&&(n=0);var r=(1+Math.sqrt(5))/2,a=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-a,-r,0,-a,r,0,a,-r,0,a,r,-a,-r,0,-a,r,0,a,-r,0,a,r,0,-r,0,-a,r,0,-a,-r,0,a,r,0,a];return(i=t.call(this,o,[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,n)||this).type="DodecahedronGeometry",i.parameters={radius:e,detail:n},i}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.detail)},e}($l),eu=new Ye,nu=new Ye,iu=new Ye,ru=new li,au=function(t){function e(e,n){var i;if(void 0===e&&(e=null),void 0===n&&(n=1),(i=t.call(this)||this).type="EdgesGeometry",i.parameters={geometry:e,thresholdAngle:n},null!==e){for(var r=Math.pow(10,4),a=Math.cos(ie*n),o=e.getIndex(),s=e.getAttribute("position"),l=o?o.count:s.count,u=[0,0,0],c=["a","b","c"],h=new Array(3),d={},p=[],f=0;f<l;f+=3){o?(u[0]=o.getX(f),u[1]=o.getX(f+1),u[2]=o.getX(f+2)):(u[0]=f,u[1]=f+1,u[2]=f+2);var m=ru.a,v=ru.b,g=ru.c;if(m.fromBufferAttribute(s,u[0]),v.fromBufferAttribute(s,u[1]),g.fromBufferAttribute(s,u[2]),ru.getNormal(iu),h[0]=Math.round(m.x*r)+","+Math.round(m.y*r)+","+Math.round(m.z*r),h[1]=Math.round(v.x*r)+","+Math.round(v.y*r)+","+Math.round(v.z*r),h[2]=Math.round(g.x*r)+","+Math.round(g.y*r)+","+Math.round(g.z*r),h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(var y=0;y<3;y++){var _=(y+1)%3,x=h[y],M=h[_],S=ru[c[y]],b=ru[c[_]],E=x+"_"+M,w=M+"_"+x;w in d&&d[w]?(iu.dot(d[w].normal)<=a&&(p.push(S.x,S.y,S.z),p.push(b.x,b.y,b.z)),d[w]=null):E in d||(d[E]={index0:u[y],index1:u[_],normal:iu.clone()})}}for(var T in d)if(d[T]){var A=d[T],R=A.index0,C=A.index1;eu.fromBufferAttribute(s,R),nu.fromBufferAttribute(s,C),p.push(eu.x,eu.y,eu.z),p.push(nu.x,nu.y,nu.z)}i.setAttribute("position",new Ni(p,3))}return i}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e}(Vi),ou=function(t){function e(e){var n;return(n=t.call(this,e)||this).uuid=ae(),n.type="Shape",n.holes=[],n}Yt(e,t);var n=e.prototype;return n.getPointsHoles=function(t){for(var e=[],n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},n.extractPoints=function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},n.copy=function(e){t.prototype.copy.call(this,e),this.holes=[];for(var n=0,i=e.holes.length;n<i;n++){var r=e.holes[n];this.holes.push(r.clone())}return this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var n=0,i=this.holes.length;n<i;n++){var r=this.holes[n];e.holes.push(r.toJSON())}return e},n.fromJSON=function(e){t.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var n=0,i=e.holes.length;n<i;n++){var r=e.holes[n];this.holes.push((new ql).fromJSON(r))}return this},e}(ql),su=function(t,e,n){void 0===n&&(n=2);var i,r,a,o,s,l,u,c=e&&e.length,h=c?e[0]*n:t.length,d=lu(t,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,n,i){var r,a,o,s=[];for(r=0,a=e.length;r<a;r++)(o=lu(t,e[r]*i,r<a-1?e[r+1]*i:t.length,i,!1))===o.next&&(o.steiner=!0),s.push(_u(o));for(s.sort(mu),r=0;r<s.length;r++)n=vu(s[r],n);return n}(t,e,d,n)),t.length>80*n){i=a=t[0],r=o=t[1];for(var f=n;f<h;f+=n)(s=t[f])<i&&(i=s),(l=t[f+1])<r&&(r=l),s>a&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-i,o-r))?32767/u:0}return cu(d,p,n,i,r,u,0),p};function lu(t,e,n,i,r){var a,o;if(r===function(t,e,n,i){for(var r=0,a=e,o=n-i;a<n;a+=i)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,e,n,i)>0)for(a=e;a<n;a+=i)o=Cu(a,t[a],t[a+1],o);else for(a=n-i;a>=e;a-=i)o=Cu(a,t[a],t[a+1],o);return o&&bu(o,o.next)&&(Lu(o),o=o.next),o}function uu(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!bu(i,i.next)&&0!==Su(i.prev,i,i.next))i=i.next;else{if(Lu(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function cu(t,e,n,i,r,a,o){if(t){!o&&a&&function(t,e,n,i){var r=t;do{0===r.z&&(r.z=yu(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,a,o,s,l,u=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,i=n,s=0,e=0;e<u&&(s++,i=i.nextZ);e++);for(l=u;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;n=i}a.nextZ=null,u*=2}while(o>1)}(r)}(t,i,r,a);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?du(t,i,r,a):hu(t))e.push(s.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Lu(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?cu(t=pu(uu(t),e,n),e,n,i,r,a,2):2===o&&fu(t,e,n,i,r,a):cu(uu(t),e,n,i,r,a,1);break}}}function hu(t){var e=t.prev,n=t,i=t.next;if(Su(e,n,i)>=0)return!1;for(var r=e.x,a=n.x,o=i.x,s=e.y,l=n.y,u=i.y,c=r<a?r<o?r:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,d=r>a?r>o?r:o:a>o?a:o,p=s>l?s>u?s:u:l>u?l:u,f=i.next;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&xu(r,s,a,l,o,u,f.x,f.y)&&Su(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function du(t,e,n,i){var r=t.prev,a=t,o=t.next;if(Su(r,a,o)>=0)return!1;for(var s=r.x,l=a.x,u=o.x,c=r.y,h=a.y,d=o.y,p=s<l?s<u?s:u:l<u?l:u,f=c<h?c<d?c:d:h<d?h:d,m=s>l?s>u?s:u:l>u?l:u,v=c>h?c>d?c:d:h>d?h:d,g=yu(p,f,e,n,i),y=yu(m,v,e,n,i),_=t.prevZ,x=t.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=v&&_!==r&&_!==o&&xu(s,c,l,h,u,d,_.x,_.y)&&Su(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=v&&x!==r&&x!==o&&xu(s,c,l,h,u,d,x.x,x.y)&&Su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=v&&_!==r&&_!==o&&xu(s,c,l,h,u,d,_.x,_.y)&&Su(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=v&&x!==r&&x!==o&&xu(s,c,l,h,u,d,x.x,x.y)&&Su(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function pu(t,e,n){var i=t;do{var r=i.prev,a=i.next.next;!bu(r,a)&&Eu(r,i,i.next,a)&&Au(r,a)&&Au(a,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(a.i/n|0),Lu(i),Lu(i.next),i=t=a),i=i.next}while(i!==t);return uu(i)}function fu(t,e,n,i,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Mu(o,s)){var l=Ru(o,s);return o=uu(o,o.next),l=uu(l,l.next),cu(o,e,n,i,r,a,0),void cu(l,e,n,i,r,a,0)}s=s.next}o=o.next}while(o!==t)}function mu(t,e){return t.x-e.x}function vu(t,e){var n=function(t,e){var n,i=e,r=-1/0,a=t.x,o=t.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=a&&s>r&&(r=s,n=i.x<i.next.x?i:i.next,s===a))return n}i=i.next}while(i!==e);if(!n)return null;var l,u=n,c=n.x,h=n.y,d=1/0;i=n;do{a>=i.x&&i.x>=c&&a!==i.x&&xu(o<h?a:r,o,c,h,o<h?r:a,o,i.x,i.y)&&(l=Math.abs(o-i.y)/(a-i.x),Au(i,t)&&(l<d||l===d&&(i.x>n.x||i.x===n.x&&gu(n,i)))&&(n=i,d=l)),i=i.next}while(i!==u);return n}(t,e);if(!n)return e;var i=Ru(n,t);return uu(i,i.next),uu(n,n.next)}function gu(t,e){return Su(t.prev,t,e.prev)<0&&Su(e.next,t,t.next)<0}function yu(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function _u(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function xu(t,e,n,i,r,a,o,s){return(r-o)*(e-s)>=(t-o)*(a-s)&&(t-o)*(i-s)>=(n-o)*(e-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function Mu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Eu(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Au(t,e)&&Au(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,a=(t.y+e.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!==t);return i}(t,e)&&(Su(t.prev,t,e.prev)||Su(t,e.prev,e))||bu(t,e)&&Su(t.prev,t,t.next)>0&&Su(e.prev,e,e.next)>0)}function Su(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function bu(t,e){return t.x===e.x&&t.y===e.y}function Eu(t,e,n,i){var r=Tu(Su(t,e,n)),a=Tu(Su(t,e,i)),o=Tu(Su(n,i,t)),s=Tu(Su(n,i,e));return r!==a&&o!==s||(!(0!==r||!wu(t,n,e))||(!(0!==a||!wu(t,i,e))||(!(0!==o||!wu(n,t,i))||!(0!==s||!wu(n,e,i)))))}function wu(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Tu(t){return t>0?1:t<0?-1:0}function Au(t,e){return Su(t.prev,t,t.next)<0?Su(t,e,t.next)>=0&&Su(t,t.prev,e)>=0:Su(t,e,t.prev)<0||Su(t,t.next,e)<0}function Ru(t,e){var n=new Pu(t.i,t.x,t.y),i=new Pu(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Cu(t,e,n,i){var r=new Pu(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Lu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Pu(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Uu=function(){function t(){}return t.area=function(t){for(var e=t.length,n=0,i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},t.isClockWise=function(e){return t.area(e)<0},t.triangulateShape=function(t,e){var n=[],i=[],r=[];Iu(t),Nu(n,t);var a=t.length;e.forEach(Iu);for(var o=0;o<e.length;o++)i.push(a),a+=e[o].length,Nu(n,e[o]);for(var s=su(n,i),l=0;l<s.length;l+=3)r.push(s.slice(l,l+3));return r},t}();function Iu(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Nu(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}var Du=function(t){function e(e,n){var i;void 0===e&&(e=new ou([new me(.5,.5),new me(-.5,.5),new me(-.5,-.5),new me(.5,-.5)])),void 0===n&&(n={}),(i=t.call(this)||this).type="ExtrudeGeometry",i.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];for(var r=i,a=[],o=[],s=0,l=e.length;s<l;s++){u(e[s])}function u(t){var e,i,s,l,u,c=[],h=void 0!==n.curveSegments?n.curveSegments:12,d=void 0!==n.steps?n.steps:1,p=void 0!==n.depth?n.depth:1,f=void 0===n.bevelEnabled||n.bevelEnabled,m=void 0!==n.bevelThickness?n.bevelThickness:.2,v=void 0!==n.bevelSize?n.bevelSize:m-.1,g=void 0!==n.bevelOffset?n.bevelOffset:0,y=void 0!==n.bevelSegments?n.bevelSegments:3,_=n.extrudePath,x=void 0!==n.UVGenerator?n.UVGenerator:Ou,M=!1;_&&(e=_.getSpacedPoints(d),M=!0,f=!1,i=_.computeFrenetFrames(d,!1),s=new Ye,l=new Ye,u=new Ye),f||(y=0,m=0,v=0,g=0);var S=t.extractPoints(h),b=S.shape,E=S.holes;if(!Uu.isClockWise(b)){b=b.reverse();for(var w=0,T=E.length;w<T;w++){var A=E[w];Uu.isClockWise(A)&&(E[w]=A.reverse())}}for(var R=Uu.triangulateShape(b,E),C=b,L=0,P=E.length;L<P;L++){var U=E[L];b=b.concat(U)}function I(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,n)}var N=b.length,D=R.length;function O(t,e,n){var i,r,a,o=t.x-e.x,s=t.y-e.y,l=n.x-t.x,u=n.y-t.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=e.x-s/d,m=e.y+o/d,v=((n.x-u/p-f)*u-(n.y+l/p-m)*l)/(o*u-s*l),g=(i=f+o*v-t.x)*i+(r=m+s*v-t.y)*r;if(g<=2)return new me(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(c)):(i=o,r=s,a=Math.sqrt(c/2))}return new me(i/a,r/a)}for(var B=[],F=0,z=C.length,G=z-1,k=F+1;F<z;F++,G++,k++)G===z&&(G=0),k===z&&(k=0),B[F]=O(C[F],C[G],C[k]);for(var H,V=[],W=B.concat(),X=0,j=E.length;X<j;X++){var q=E[X];H=[];for(var Y=0,Z=q.length,J=Z-1,K=Y+1;Y<Z;Y++,J++,K++)J===Z&&(J=0),K===Z&&(K=0),H[Y]=O(q[Y],q[J],q[K]);V.push(H),W=W.concat(H)}for(var Q=0;Q<y;Q++){for(var $=Q/y,tt=m*Math.cos($*Math.PI/2),et=v*Math.sin($*Math.PI/2)+g,nt=0,it=C.length;nt<it;nt++){var rt=I(C[nt],B[nt],et);Pt(rt.x,rt.y,-tt)}for(var at=0,ot=E.length;at<ot;at++){var st=E[at];H=V[at];for(var lt=0,ut=st.length;lt<ut;lt++){var ct=I(st[lt],H[lt],et);Pt(ct.x,ct.y,-tt)}}}for(var ht=v+g,dt=0;dt<N;dt++){var pt=f?I(b[dt],W[dt],ht):b[dt];M?(l.copy(i.normals[0]).multiplyScalar(pt.x),s.copy(i.binormals[0]).multiplyScalar(pt.y),u.copy(e[0]).add(l).add(s),Pt(u.x,u.y,u.z)):Pt(pt.x,pt.y,0)}for(var ft=1;ft<=d;ft++)for(var mt=0;mt<N;mt++){var vt=f?I(b[mt],W[mt],ht):b[mt];M?(l.copy(i.normals[ft]).multiplyScalar(vt.x),s.copy(i.binormals[ft]).multiplyScalar(vt.y),u.copy(e[ft]).add(l).add(s),Pt(u.x,u.y,u.z)):Pt(vt.x,vt.y,p/d*ft)}for(var gt=y-1;gt>=0;gt--){for(var yt=gt/y,_t=m*Math.cos(yt*Math.PI/2),xt=v*Math.sin(yt*Math.PI/2)+g,Mt=0,St=C.length;Mt<St;Mt++){var bt=I(C[Mt],B[Mt],xt);Pt(bt.x,bt.y,p+_t)}for(var Et=0,wt=E.length;Et<wt;Et++){var Tt=E[Et];H=V[Et];for(var At=0,Rt=Tt.length;At<Rt;At++){var Ct=I(Tt[At],H[At],xt);M?Pt(Ct.x,Ct.y+e[d-1].y,e[d-1].x+_t):Pt(Ct.x,Ct.y,p+_t)}}}function Lt(t,e){for(var n=t.length;--n>=0;){var i=n,r=n-1;r<0&&(r=t.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=N*a,l=N*(a+1);It(e+i+s,e+r+s,e+r+l,e+i+l)}}}function Pt(t,e,n){c.push(t),c.push(e),c.push(n)}function Ut(t,e,n){Nt(t),Nt(e),Nt(n);var i=a.length/3,o=x.generateTopUV(r,a,i-3,i-2,i-1);Dt(o[0]),Dt(o[1]),Dt(o[2])}function It(t,e,n,i){Nt(t),Nt(e),Nt(i),Nt(e),Nt(n),Nt(i);var o=a.length/3,s=x.generateSideWallUV(r,a,o-6,o-3,o-2,o-1);Dt(s[0]),Dt(s[1]),Dt(s[3]),Dt(s[1]),Dt(s[2]),Dt(s[3])}function Nt(t){a.push(c[3*t+0]),a.push(c[3*t+1]),a.push(c[3*t+2])}function Dt(t){o.push(t.x),o.push(t.y)}!function(){var t=a.length/3;if(f){for(var e=0,n=N*e,i=0;i<D;i++){var o=R[i];Ut(o[2]+n,o[1]+n,o[0]+n)}n=N*(e=d+2*y);for(var s=0;s<D;s++){var l=R[s];Ut(l[0]+n,l[1]+n,l[2]+n)}}else{for(var u=0;u<D;u++){var c=R[u];Ut(c[2],c[1],c[0])}for(var h=0;h<D;h++){var p=R[h];Ut(p[0]+N*d,p[1]+N*d,p[2]+N*d)}}r.addGroup(t,a.length/3-t,0)}(),function(){var t=a.length/3,e=0;Lt(C,e),e+=C.length;for(var n=0,i=E.length;n<i;n++){var o=E[n];Lt(o,e),e+=o.length}r.addGroup(t,a.length/3-t,1)}()}return i.setAttribute("position",new Ni(a,3)),i.setAttribute("uv",new Ni(o,2)),i.computeVertexNormals(),i}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(var i=0,r=t.length;i<r;i++){var a=t[i];n.shapes.push(a.uuid)}else n.shapes.push(t.uuid);n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)},e.fromJSON=function(t,n){for(var i=[],r=0,a=t.shapes.length;r<a;r++){var o=n[t.shapes[r]];i.push(o)}var s=t.options.extrudePath;return void 0!==s&&(t.options.extrudePath=(new Xl[s.type]).fromJSON(s)),new e(i,t.options)},e}(Vi),Ou={generateTopUV:function(t,e,n,i,r){var a=e[3*n],o=e[3*n+1],s=e[3*i],l=e[3*i+1],u=e[3*r],c=e[3*r+1];return[new me(a,o),new me(s,l),new me(u,c)]},generateSideWallUV:function(t,e,n,i,r,a){var o=e[3*n],s=e[3*n+1],l=e[3*n+2],u=e[3*i],c=e[3*i+1],h=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*a],v=e[3*a+1],g=e[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new me(o,1-l),new me(u,1-h),new me(d,1-f),new me(m,1-g)]:[new me(s,1-l),new me(c,1-h),new me(p,1-f),new me(v,1-g)]}};var Bu=function(t){function e(e,n){var i;void 0===e&&(e=1),void 0===n&&(n=0);var r=(1+Math.sqrt(5))/2,a=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1];return(i=t.call(this,a,[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,n)||this).type="IcosahedronGeometry",i.parameters={radius:e,detail:n},i}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.detail)},e}($l),Fu=function(t){function e(e,n){var i;void 0===e&&(e=1),void 0===n&&(n=0);return(i=t.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,n)||this).type="OctahedronGeometry",i.parameters={radius:e,detail:n},i}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.detail)},e}($l),zu=function(t){function e(e,n,i,r,a,o){var s;void 0===e&&(e=.5),void 0===n&&(n=1),void 0===i&&(i=32),void 0===r&&(r=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),(s=t.call(this)||this).type="RingGeometry",s.parameters={innerRadius:e,outerRadius:n,thetaSegments:i,phiSegments:r,thetaStart:a,thetaLength:o},i=Math.max(3,i);for(var l=[],u=[],c=[],h=[],d=e,p=(n-e)/(r=Math.max(1,r)),f=new Ye,m=new me,v=0;v<=r;v++){for(var g=0;g<=i;g++){var y=a+g/i*o;f.x=d*Math.cos(y),f.y=d*Math.sin(y),u.push(f.x,f.y,f.z),c.push(0,0,1),m.x=(f.x/n+1)/2,m.y=(f.y/n+1)/2,h.push(m.x,m.y)}d+=p}for(var _=0;_<r;_++)for(var x=_*(i+1),M=0;M<i;M++){var S=M+x,b=S,E=S+i+1,w=S+i+2,T=S+1;l.push(b,E,T),l.push(E,w,T)}return s.setIndex(l),s.setAttribute("position",new Ni(u,3)),s.setAttribute("normal",new Ni(c,3)),s.setAttribute("uv",new Ni(h,2)),s}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)},e}(Vi),Gu=function(t){function e(e,n){var i;void 0===e&&(e=new ou([new me(0,.5),new me(-.5,-.5),new me(.5,-.5)])),void 0===n&&(n=12),(i=t.call(this)||this).type="ShapeGeometry",i.parameters={shapes:e,curveSegments:n};var r=[],a=[],o=[],s=[],l=0,u=0;if(!1===Array.isArray(e))h(e);else for(var c=0;c<e.length;c++)h(e[c]),i.addGroup(l,u,c),l+=u,u=0;function h(t){var e=a.length/3,i=t.extractPoints(n),l=i.shape,c=i.holes;!1===Uu.isClockWise(l)&&(l=l.reverse());for(var h=0,d=c.length;h<d;h++){var p=c[h];!0===Uu.isClockWise(p)&&(c[h]=p.reverse())}for(var f=Uu.triangulateShape(l,c),m=0,v=c.length;m<v;m++){var g=c[m];l=l.concat(g)}for(var y=0,_=l.length;y<_;y++){var x=l[y];a.push(x.x,x.y,0),o.push(0,0,1),s.push(x.x,x.y)}for(var M=0,S=f.length;M<S;M++){var b=f[M],E=b[0]+e,w=b[1]+e,T=b[2]+e;r.push(E,w,T),u+=3}}return i.setIndex(r),i.setAttribute("position",new Ni(a,3)),i.setAttribute("normal",new Ni(o,3)),i.setAttribute("uv",new Ni(s,2)),i}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,i=t.length;n<i;n++){var r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,e)},e.fromJSON=function(t,n){for(var i=[],r=0,a=t.shapes.length;r<a;r++){var o=n[t.shapes[r]];i.push(o)}return new e(i,t.curveSegments)},e}(Vi);var ku=function(t){function e(e,n,i,r,a,o,s){var l;void 0===e&&(e=1),void 0===n&&(n=32),void 0===i&&(i=16),void 0===r&&(r=0),void 0===a&&(a=2*Math.PI),void 0===o&&(o=0),void 0===s&&(s=Math.PI),(l=t.call(this)||this).type="SphereGeometry",l.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:r,phiLength:a,thetaStart:o,thetaLength:s},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));for(var u=Math.min(o+s,Math.PI),c=0,h=[],d=new Ye,p=new Ye,f=[],m=[],v=[],g=[],y=0;y<=i;y++){var _=[],x=y/i,M=0;0===y&&0===o?M=.5/n:y===i&&u===Math.PI&&(M=-.5/n);for(var S=0;S<=n;S++){var b=S/n;d.x=-e*Math.cos(r+b*a)*Math.sin(o+x*s),d.y=e*Math.cos(o+x*s),d.z=e*Math.sin(r+b*a)*Math.sin(o+x*s),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(b+M,1-x),_.push(c++)}h.push(_)}for(var E=0;E<i;E++)for(var w=0;w<n;w++){var T=h[E][w+1],A=h[E][w],R=h[E+1][w],C=h[E+1][w+1];(0!==E||o>0)&&f.push(T,A,C),(E!==i-1||u<Math.PI)&&f.push(A,R,C)}return l.setIndex(f),l.setAttribute("position",new Ni(m,3)),l.setAttribute("normal",new Ni(v,3)),l.setAttribute("uv",new Ni(g,2)),l}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)},e}(Vi),Hu=function(t){function e(e,n){var i;void 0===e&&(e=1),void 0===n&&(n=0);return(i=t.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,n)||this).type="TetrahedronGeometry",i.parameters={radius:e,detail:n},i}return Yt(e,t),e.fromJSON=function(t){return new e(t.radius,t.detail)},e}($l),Vu=function(t){function e(e,n,i,r,a){var o;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===i&&(i=12),void 0===r&&(r=48),void 0===a&&(a=2*Math.PI),(o=t.call(this)||this).type="TorusGeometry",o.parameters={radius:e,tube:n,radialSegments:i,tubularSegments:r,arc:a},i=Math.floor(i),r=Math.floor(r);for(var s=[],l=[],u=[],c=[],h=new Ye,d=new Ye,p=new Ye,f=0;f<=i;f++)for(var m=0;m<=r;m++){var v=m/r*a,g=f/i*Math.PI*2;d.x=(e+n*Math.cos(g))*Math.cos(v),d.y=(e+n*Math.cos(g))*Math.sin(v),d.z=n*Math.sin(g),l.push(d.x,d.y,d.z),h.x=e*Math.cos(v),h.y=e*Math.sin(v),p.subVectors(d,h).normalize(),u.push(p.x,p.y,p.z),c.push(m/r),c.push(f/i)}for(var y=1;y<=i;y++)for(var _=1;_<=r;_++){var x=(r+1)*y+_-1,M=(r+1)*(y-1)+_-1,S=(r+1)*(y-1)+_,b=(r+1)*y+_;s.push(x,M,b),s.push(M,S,b)}return o.setIndex(s),o.setAttribute("position",new Ni(l,3)),o.setAttribute("normal",new Ni(u,3)),o.setAttribute("uv",new Ni(c,2)),o}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)},e}(Vi),Wu=function(t){function e(e,n,i,r,a,o){var s;void 0===e&&(e=1),void 0===n&&(n=.4),void 0===i&&(i=64),void 0===r&&(r=8),void 0===a&&(a=2),void 0===o&&(o=3),(s=t.call(this)||this).type="TorusKnotGeometry",s.parameters={radius:e,tube:n,tubularSegments:i,radialSegments:r,p:a,q:o},i=Math.floor(i),r=Math.floor(r);for(var l=[],u=[],c=[],h=[],d=new Ye,p=new Ye,f=new Ye,m=new Ye,v=new Ye,g=new Ye,y=new Ye,_=0;_<=i;++_){var x=_/i*a*Math.PI*2;P(x,a,o,e,f),P(x+.01,a,o,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize();for(var M=0;M<=r;++M){var S=M/r*Math.PI*2,b=-n*Math.cos(S),E=n*Math.sin(S);d.x=f.x+(b*y.x+E*v.x),d.y=f.y+(b*y.y+E*v.y),d.z=f.z+(b*y.z+E*v.z),u.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),h.push(_/i),h.push(M/r)}}for(var w=1;w<=i;w++)for(var T=1;T<=r;T++){var A=(r+1)*(w-1)+(T-1),R=(r+1)*w+(T-1),C=(r+1)*w+T,L=(r+1)*(w-1)+T;l.push(A,R,L),l.push(R,C,L)}function P(t,e,n,i,r){var a=Math.cos(t),o=Math.sin(t),s=n/e*t,l=Math.cos(s);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(s)*.5}return s.setIndex(l),s.setAttribute("position",new Ni(u,3)),s.setAttribute("normal",new Ni(c,3)),s.setAttribute("uv",new Ni(h,2)),s}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e.fromJSON=function(t){return new e(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)},e}(Vi),Xu=function(t){function e(e,n,i,r,a){var o;void 0===e&&(e=new Vl(new Ye(-1,-1,0),new Ye(-1,1,0),new Ye(1,1,0))),void 0===n&&(n=64),void 0===i&&(i=1),void 0===r&&(r=8),void 0===a&&(a=!1),(o=t.call(this)||this).type="TubeGeometry",o.parameters={path:e,tubularSegments:n,radius:i,radialSegments:r,closed:a};var s=e.computeFrenetFrames(n,a);o.tangents=s.tangents,o.normals=s.normals,o.binormals=s.binormals;var l=new Ye,u=new Ye,c=new me,h=new Ye,d=[],p=[],f=[],m=[];function v(t){h=e.getPointAt(t/n,h);for(var a=s.normals[t],o=s.binormals[t],c=0;c<=r;c++){var f=c/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);u.x=v*a.x+m*o.x,u.y=v*a.y+m*o.y,u.z=v*a.z+m*o.z,u.normalize(),p.push(u.x,u.y,u.z),l.x=h.x+i*u.x,l.y=h.y+i*u.y,l.z=h.z+i*u.z,d.push(l.x,l.y,l.z)}}return function(){for(var t=0;t<n;t++)v(t);v(!1===a?n:0),function(){for(var t=0;t<=n;t++)for(var e=0;e<=r;e++)c.x=t/n,c.y=e/r,f.push(c.x,c.y)}(),function(){for(var t=1;t<=n;t++)for(var e=1;e<=r;e++){var i=(r+1)*(t-1)+(e-1),a=(r+1)*t+(e-1),o=(r+1)*t+e,s=(r+1)*(t-1)+e;m.push(i,a,s),m.push(a,o,s)}}()}(),o.setIndex(m),o.setAttribute("position",new Ni(d,3)),o.setAttribute("normal",new Ni(p,3)),o.setAttribute("uv",new Ni(f,2)),o}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},e.fromJSON=function(t){return new e((new Xl[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)},e}(Vi),ju=function(t){function e(e){var n;if(void 0===e&&(e=null),(n=t.call(this)||this).type="WireframeGeometry",n.parameters={geometry:e},null!==e){var i=[],r=new Set,a=new Ye,o=new Ye;if(null!==e.index){var s=e.attributes.position,l=e.index,u=e.groups;0===u.length&&(u=[{start:0,count:l.count,materialIndex:0}]);for(var c=0,h=u.length;c<h;++c)for(var d=u[c],p=d.start,f=p,m=p+d.count;f<m;f+=3)for(var v=0;v<3;v++){var g=l.getX(f+v),y=l.getX(f+(v+1)%3);a.fromBufferAttribute(s,g),o.fromBufferAttribute(s,y),!0===qu(a,o,r)&&(i.push(a.x,a.y,a.z),i.push(o.x,o.y,o.z))}}else for(var _=e.attributes.position,x=0,M=_.count/3;x<M;x++)for(var S=0;S<3;S++){var b=3*x+S,E=3*x+(S+1)%3;a.fromBufferAttribute(_,b),o.fromBufferAttribute(_,E),!0===qu(a,o,r)&&(i.push(a.x,a.y,a.z),i.push(o.x,o.y,o.z))}n.setAttribute("position",new Ni(i,3))}return n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.parameters=Object.assign({},e.parameters),this},e}(Vi);function qu(t,e,n){var i=t.x+","+t.y+","+t.z+"-"+e.x+","+e.y+","+e.z,r=e.x+","+e.y+","+e.z+"-"+t.x+","+t.y+","+t.z;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var Yu=Object.freeze({__proto__:null,BoxGeometry:ur,CapsuleGeometry:Zl,CircleGeometry:Jl,ConeGeometry:Ql,CylinderGeometry:Kl,DodecahedronGeometry:tu,EdgesGeometry:au,ExtrudeGeometry:Du,IcosahedronGeometry:Bu,LatheGeometry:Yl,OctahedronGeometry:Fu,PlaneGeometry:Lr,PolyhedronGeometry:$l,RingGeometry:zu,ShapeGeometry:Gu,SphereGeometry:ku,TetrahedronGeometry:Hu,TorusGeometry:Vu,TorusKnotGeometry:Wu,TubeGeometry:Xu,WireframeGeometry:ju}),Zu=function(t){function e(e){var n;return(n=t.call(this)||this).isShadowMaterial=!0,n.type="ShadowMaterial",n.color=new mi(0),n.transparent=!0,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.fog=e.fog,this},e}(ci),Ju=function(t){function e(e){var n;return(n=t.call(this,e)||this).isRawShaderMaterial=!0,n.type="RawShaderMaterial",n}return Yt(e,t),e}(fr),Ku=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshStandardMaterial=!0,n.defines={STANDARD:""},n.type="MeshStandardMaterial",n.color=new mi(16777215),n.roughness=1,n.metalness=0,n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new mi(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.roughnessMap=null,n.metalnessMap=null,n.alphaMap=null,n.envMap=null,n.envMapIntensity=1,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.flatShading=!1,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.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.normalMapType=e.normalMapType,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this},e}(ci),Qu=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshPhysicalMaterial=!0,n.defines={STANDARD:"",PHYSICAL:""},n.type="MeshPhysicalMaterial",n.anisotropyRotation=0,n.anisotropyMap=null,n.clearcoatMap=null,n.clearcoatRoughness=0,n.clearcoatRoughnessMap=null,n.clearcoatNormalScale=new me(1,1),n.clearcoatNormalMap=null,n.ior=1.5,Object.defineProperty(n,"reflectivity",{get:function(){return oe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),n.iridescenceMap=null,n.iridescenceIOR=1.3,n.iridescenceThicknessRange=[100,400],n.iridescenceThicknessMap=null,n.sheenColor=new mi(0),n.sheenColorMap=null,n.sheenRoughness=1,n.sheenRoughnessMap=null,n.transmissionMap=null,n.thickness=0,n.thicknessMap=null,n.attenuationDistance=1/0,n.attenuationColor=new mi(1,1,1),n.specularIntensity=1,n.specularIntensityMap=null,n.specularColor=new mi(1,1,1),n.specularColorMap=null,n._anisotropy=0,n._clearcoat=0,n._iridescence=0,n._sheen=0,n._transmission=0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[].concat(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this},Xt(e,[{key:"anisotropy",get:function(){return this._anisotropy},set:function(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}},{key:"iridescence",get:function(){return this._iridescence},set:function(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}},{key:"sheen",get:function(){return this._sheen},set:function(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}},{key:"transmission",get:function(){return this._transmission},set:function(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}}])}(Ku),$u=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshPhongMaterial=!0,n.type="MeshPhongMaterial",n.color=new mi(16777215),n.specular=new mi(1118481),n.shininess=30,n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new mi(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=l,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.flatShading=!1,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.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.normalMapType=e.normalMapType,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.flatShading=e.flatShading,this.fog=e.fog,this},e}(ci),tc=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshToonMaterial=!0,n.defines={TOON:""},n.type="MeshToonMaterial",n.color=new mi(16777215),n.map=null,n.gradientMap=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new mi(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,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.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this},e}(ci),ec=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshNormalMaterial=!0,n.type="MeshNormalMaterial",n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.flatShading=!1,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,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.flatShading=e.flatShading,this},e}(ci),nc=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshLambertMaterial=!0,n.type="MeshLambertMaterial",n.color=new mi(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.emissive=new mi(0),n.emissiveIntensity=1,n.emissiveMap=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.combine=l,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.flatShading=!1,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.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.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,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.flatShading=e.flatShading,this.fog=e.fog,this},e}(ci),ic=function(t){function e(e){var n;return(n=t.call(this)||this).isMeshMatcapMaterial=!0,n.defines={MATCAP:""},n.type="MeshMatcapMaterial",n.color=new mi(16777215),n.matcap=null,n.map=null,n.bumpMap=null,n.bumpScale=1,n.normalMap=null,n.normalMapType=0,n.normalScale=new me(1,1),n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.alphaMap=null,n.flatShading=!1,n.fog=!0,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this},e}(ci),rc=function(t){function e(e){var n;return(n=t.call(this)||this).isLineDashedMaterial=!0,n.type="LineDashedMaterial",n.scale=1,n.dashSize=3,n.gapSize=1,n.setValues(e),n}return Yt(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this},e}(il);function ac(t,e,n){return sc(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)}function oc(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function sc(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function lc(t){for(var e=t.length,n=new Array(e),i=0;i!==e;++i)n[i]=i;return n.sort((function(e,n){return t[e]-t[n]})),n}function uc(t,e,n){for(var i=t.length,r=new t.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*e,l=0;l!==e;++l)r[o++]=t[s+l];return r}function cc(t,e,n,i){for(var r=1,a=t[0];void 0!==a&&void 0===a[i];)a=t[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(e.push(a.time),n.push.apply(n,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(e.push(a.time),o.toArray(n,n.length)),a=t[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(e.push(a.time),n.push(o)),a=t[r++]}while(void 0!==a)}}var hc={arraySlice:ac,convertArray:oc,isTypedArray:sc,getKeyframeOrder:lc,sortedArray:uc,flattenJSON:cc,subclip:function(t,e,n,i,r){void 0===r&&(r=30);var a=t.clone();a.name=e;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],u=l.getValueSize(),c=[],h=[],d=0;d<l.times.length;++d){var p=l.times[d]*r;if(!(p<n||p>=i)){c.push(l.times[d]);for(var f=0;f<u;++f)h.push(l.values[d*u+f])}}0!==c.length&&(l.times=oc(c,l.times.constructor),l.values=oc(h,l.values.constructor),o.push(l))}a.tracks=o;for(var m=1/0,v=0;v<a.tracks.length;++v)m>a.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=t),void 0===i&&(i=30),i<=0&&(i=30);for(var r=n.tracks.length,a=e/i,o=function(){var e=n.tracks[s],i=e.ValueTypeName;if("bool"===i||"string"===i)return 0;var r=t.tracks.find((function(t){return t.name===e.name&&t.ValueTypeName===i}));if(void 0===r)return 0;var o=0,l=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);var u=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h,d=e.times.length-1;if(a<=e.times[0]){var p=o,f=l-o;h=ac(e.values,p,f)}else if(a>=e.times[d]){var m=d*l+o,v=m+l-o;h=ac(e.values,m,v)}else{var g=e.createInterpolant(),y=o,_=l-o;g.evaluate(a),h=ac(g.resultBuffer,y,_)}"quaternion"===i&&(new qe).fromArray(h).normalize().conjugate().toArray(h);for(var x=r.times.length,M=0;M<x;++M){var S=M*c+u;if("quaternion"===i)qe.multiplyQuaternionsFlat(r.values,S,h,0,r.values,S);else for(var b=c-2*u,E=0;E<b;++E)r.values[S+E]-=h[E]}},s=0;s<r;++s)o();return t.blendMode=Rt,t}},dc=function(){function t(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}var e=t.prototype;return e.evaluate=function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{var a;n:{i:if(!(t<i)){for(var o=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,t<(i=e[++n]))break e}a=e.length;break n}if(t>=r)break t;var s=e[1];t<s&&(n=2,r=s);for(var l=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,t>=(r=e[--n-1]))break e}a=n,n=0}for(;n<a;){var u=n+a>>>1;t<e[u]?a=u:n=u+1}if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},e.getSettings_=function(){return this.settings||this.DefaultSettings_},e.copySampleValue_=function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i,a=0;a!==i;++a)e[a]=n[r+a];return e},e.interpolate_=function(){throw new Error("call to abstract method")},e.intervalChanged_=function(){},t}(),pc=function(t){function e(e,n,i,r){var a;return(a=t.call(this,e,n,i,r)||this)._weightPrev=-0,a._offsetPrev=-0,a._weightNext=-0,a._offsetNext=-0,a.DefaultSettings_={endingStart:Et,endingEnd:Et},a}Yt(e,t);var n=e.prototype;return n.intervalChanged_=function(t,e,n){var i=this.parameterPositions,r=t-2,a=t+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case wt:r=t,o=2*e-n;break;case Tt:o=e+i[r=i.length-2]-i[r+1];break;default:r=t,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case wt:a=t,s=2*n-e;break;case Tt:a=1,s=n+i[1]-i[0];break;default:a=t-1,s=e}var l=.5*(n-e),u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(s-n),this._offsetPrev=r*u,this._offsetNext=a*u},n.interpolate_=function(t,e,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f,x=0;x!==o;++x)r[x]=v*a[u+x]+g*a[l+x]+y*a[s+x]+_*a[c+x];return r},e}(dc),fc=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}return Yt(e,t),e.prototype.interpolate_=function(t,e,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,l=s-o,u=(n-e)/(i-e),c=1-u,h=0;h!==o;++h)r[h]=a[l+h]*c+a[s+h]*u;return r},e}(dc),mc=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}return Yt(e,t),e.prototype.interpolate_=function(t){return this.copySampleValue_(t-1)},e}(dc),vc=function(){function t(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=oc(e,this.TimeBufferType),this.values=oc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}t.toJSON=function(t){var e,n=t.constructor;if(n.toJSON!==this.toJSON)e=n.toJSON(t);else{e={name:t.name,times:oc(t.times,Array),values:oc(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e};var e=t.prototype;return e.InterpolantFactoryMethodDiscrete=function(t){return new mc(this.times,this.values,this.getValueSize(),t)},e.InterpolantFactoryMethodLinear=function(t){return new fc(this.times,this.values,this.getValueSize(),t)},e.InterpolantFactoryMethodSmooth=function(t){return new pc(this.times,this.values,this.getValueSize(),t)},e.setInterpolation=function(t){var e;switch(t){case Mt:e=this.InterpolantFactoryMethodDiscrete;break;case St:e=this.InterpolantFactoryMethodLinear;break;case bt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},e.getInterpolation=function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Mt;case this.InterpolantFactoryMethodLinear:return St;case this.InterpolantFactoryMethodSmooth:return bt}},e.getValueSize=function(){return this.values.length/this.times.length},e.shift=function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},e.scale=function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},e.trim=function(t,e){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<t;)++r;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=ac(n,r,a),this.values=ac(this.values,r*o,a*o)}return this},e.validate=function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!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),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==i&&sc(i))for(var l=0,u=i.length;l!==u;++l){var c=i[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),t=!1;break}}return t},e.optimize=function(){for(var t=ac(this.times),e=ac(this.values),n=this.getValueSize(),i=this.getInterpolation()===bt,r=t.length-1,a=1,o=1;o<r;++o){var s=!1,l=t[o];if(l!==t[o+1]&&(1!==o||l!==t[0]))if(i)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var p=e[u+d];if(p!==e[c+d]||p!==e[h+d]){s=!0;break}}if(s){if(o!==a){t[a]=t[o];for(var f=o*n,m=a*n,v=0;v!==n;++v)e[m+v]=e[f+v]}++a}}if(r>0){t[a]=t[r];for(var g=r*n,y=a*n,_=0;_!==n;++_)e[y+_]=e[g+_];++a}return a!==t.length?(this.times=ac(t,0,a),this.values=ac(e,0,a*n)):(this.times=t,this.values=e),this},e.clone=function(){var t=ac(this.times,0),e=ac(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n},t}();vc.prototype.TimeBufferType=Float32Array,vc.prototype.ValueBufferType=Float32Array,vc.prototype.DefaultInterpolation=St;var gc=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(vc);gc.prototype.ValueTypeName="bool",gc.prototype.ValueBufferType=Array,gc.prototype.DefaultInterpolation=Mt,gc.prototype.InterpolantFactoryMethodLinear=void 0,gc.prototype.InterpolantFactoryMethodSmooth=void 0;var yc=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(vc);yc.prototype.ValueTypeName="color";var _c=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(vc);_c.prototype.ValueTypeName="number";var xc=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}return Yt(e,t),e.prototype.interpolate_=function(t,e,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-e)/(i-e),l=t*o,u=l+o;l!==u;l+=4)qe.slerpFlat(r,0,a,l-o,a,l,s);return r},e}(dc),Mc=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e.prototype.InterpolantFactoryMethodLinear=function(t){return new xc(this.times,this.values,this.getValueSize(),t)},e}(vc);Mc.prototype.ValueTypeName="quaternion",Mc.prototype.DefaultInterpolation=St,Mc.prototype.InterpolantFactoryMethodSmooth=void 0;var Sc=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(vc);Sc.prototype.ValueTypeName="string",Sc.prototype.ValueBufferType=Array,Sc.prototype.DefaultInterpolation=Mt,Sc.prototype.InterpolantFactoryMethodLinear=void 0,Sc.prototype.InterpolantFactoryMethodSmooth=void 0;var bc=function(t){function e(){return t.apply(this,arguments)||this}return Yt(e,t),e}(vc);bc.prototype.ValueTypeName="vector";var Ec=function(){function t(t,e,n,i){void 0===e&&(e=-1),void 0===i&&(i=At),this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=ae(),this.duration<0&&this.resetDuration()}t.parse=function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,a=n.length;r!==a;++r)e.push(wc(n[r]).scale(i));var o=new this(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o},t.toJSON=function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},r=0,a=n.length;r!==a;++r)e.push(vc.toJSON(n[r]));return i},t.CreateFromMorphTargetSequence=function(t,e,n,i){for(var r=e.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var u=lc(s);s=uc(s,1,u),l=uc(l,1,u),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new _c(".morphTargetInfluences["+e[o].name+"]",s,l).scale(1/n))}return new this(t,-1,a)},t.findByName=function(t,e){var n=t;if(!Array.isArray(t)){var i=t;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null},t.CreateClipsFromMorphTargetSequences=function(t,e,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],l=s.name.match(r);if(l&&l.length>1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var d in i)h.push(this.CreateFromMorphTargetSequence(d,i[d],e,n));return h},t.parseAnimation=function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var a=[],o=[];cc(n,a,o,i),0!==a.length&&r.push(new t(e,a,o))}},i=[],r=t.name||"default",a=t.fps||30,o=t.blendMode,s=t.length||-1,l=t.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var p=0;p<c[d].morphTargets.length;p++)h[c[d].morphTargets[p]]=-1;for(var f in h){for(var m=[],v=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];m.push(y.time),v.push(y.morphTarget===f?1:0)}i.push(new _c(".morphTargetInfluence["+f+"]",m,v))}s=h.length*a}else{var _=".bones["+e[u].name+"]";n(bc,_+".position",c,"pos",i),n(Mc,_+".quaternion",c,"rot",i),n(bc,_+".scale",c,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)};var e=t.prototype;return e.resetDuration=function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},e.trim=function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},e.validate=function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},e.optimize=function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},e.clone=function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)},e.toJSON=function(){return this.constructor.toJSON(this)},t}();function wc(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _c;case"vector":case"vector2":case"vector3":case"vector4":return bc;case"color":return yc;case"quaternion":return Mc;case"bool":case"boolean":return gc;case"string":return Sc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var n=[],i=[];cc(t.keys,n,i,"value"),t.times=n,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}var Tc,Ac={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Rc=function(t,e,n){var i=this,r=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===r&&void 0!==i.onStart&&i.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){var e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(var e=0,n=l.length;e<n;e+=2){var i=l[e],r=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return r}return null}},Cc=new Rc,Lc=function(){function t(t){this.manager=void 0!==t?t:Cc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var e=t.prototype;return e.load=function(){},e.loadAsync=function(t,e){var n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))},e.parse=function(){},e.setCrossOrigin=function(t){return this.crossOrigin=t,this},e.setWithCredentials=function(t){return this.withCredentials=t,this},e.setPath=function(t){return this.path=t,this},e.setResourcePath=function(t){return this.resourcePath=t,this},e.setRequestHeader=function(t){return this.requestHeader=t,this},t}(),Pc={},Uc=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).response=n,i}return Yt(e,t),e}($t(Error)),Ic=function(t){function e(e){return t.call(this,e)||this}Yt(e,t);var n=e.prototype;return n.load=function(t,e,n,i){var r=this;void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var a=Ac.get(t);if(void 0!==a)return this.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0===Pc[t]){Pc[t]=[],Pc[t].push({onLoad:e,onProgress:n,onError:i});var o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then((function(e){if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;var n=Pc[t],i=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a,s=0,l=new ReadableStream({start:function(t){!function e(){i.read().then((function(i){var r=i.done,l=i.value;if(r)t.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}t.enqueue(l),e()}}))}()}});return new Response(l)}throw new Uc('fetch for "'+e.url+'" responded with '+e.status+": "+e.statusText,e)})).then((function(t){switch(l){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((function(t){return(new DOMParser).parseFromString(t,s)}));case"json":return t.json();default:if(void 0===s)return t.text();var e=/charset="?([^;"\s]*)"?/i.exec(s),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((function(t){return i.decode(t)}))}})).then((function(e){Ac.add(t,e);var n=Pc[t];delete Pc[t];for(var i=0,r=n.length;i<r;i++){var a=n[i];a.onLoad&&a.onLoad(e)}})).catch((function(e){var n=Pc[t];if(void 0===n)throw r.manager.itemError(t),e;delete Pc[t];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(e)}r.manager.itemError(t)})).finally((function(){r.manager.itemEnd(t)})),this.manager.itemStart(t)}else Pc[t].push({onLoad:e,onProgress:n,onError:i})},n.setResponseType=function(t){return this.responseType=t,this},n.setMimeType=function(t){return this.mimeType=t,this},e}(Lc),Nc=function(t){function e(e){return t.call(this,e)||this}Yt(e,t);var n=e.prototype;return n.load=function(t,e,n,i){var r=this,a=new Ic(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)},n.parse=function(t){for(var e=[],n=0;n<t.length;n++){var i=Ec.parse(t[n]);e.push(i)}return e},e}(Lc),Dc=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){var r=this,a=[],o=new bl,s=new Ic(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials);var l=0;function u(u){s.load(t[u],(function(t){var n=r.parse(t,!0);a[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=C),o.image=a,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,i)}if(Array.isArray(t))for(var c=0,h=t.length;c<h;++c)u(c);else s.load(t,(function(t){var n=r.parse(t,!0);if(n.isCubemap){for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=C),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,i);return o},e}(Lc),Oc=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=Ac.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;var o=Me("img");function s(){u(),Ac.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){u(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o},e}(Lc),Bc=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){var r=new _r;r.colorSpace=Ut;var a=new Oc(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(t[n],(function(t){r.images[n]=t,6===++o&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(var l=0;l<t.length;++l)s(l);return r},e}(Lc),Fc=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){var r=this,a=new Ws,o=new Ic(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){var n=r.parse(t);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:E,a.wrapT=void 0!==n.wrapT?n.wrapT:E,a.magFilter=void 0!==n.magFilter?n.magFilter:C,a.minFilter=void 0!==n.minFilter?n.minFilter:C,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace?a.colorSpace=n.colorSpace:void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=P),1===n.mipmapCount&&(a.minFilter=C),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,e&&e(a,n))}),n,i),a},e}(Lc),zc=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){var r=new ze,a=new Oc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r},e}(Lc),Gc=function(t){function e(e,n){var i;return void 0===n&&(n=1),(i=t.call(this)||this).isLight=!0,i.type="Light",i.color=new mi(e),i.intensity=n,i}Yt(e,t);var n=e.prototype;return n.dispose=function(){},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.color.copy(e.color),this.intensity=e.intensity,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,void 0!==this.groundColor&&(n.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(n.object.distance=this.distance),void 0!==this.angle&&(n.object.angle=this.angle),void 0!==this.decay&&(n.object.decay=this.decay),void 0!==this.penumbra&&(n.object.penumbra=this.penumbra),void 0!==this.shadow&&(n.object.shadow=this.shadow.toJSON()),n},e}(Jn),kc=function(t){function e(e,n,i){var r;return(r=t.call(this,e,i)||this).isHemisphereLight=!0,r.type="HemisphereLight",r.position.copy(Jn.DEFAULT_UP),r.updateMatrix(),r.groundColor=new mi(n),r}return Yt(e,t),e.prototype.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.groundColor.copy(e.groundColor),this},e}(Gc),Hc=new wn,Vc=new Ye,Wc=new Ye,Xc=function(){function t(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new me(512,512),this.map=null,this.mapPass=null,this.matrix=new wn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ar,this._frameExtents=new me(1,1),this._viewportCount=1,this._viewports=[new Ge(0,0,1,1)]}var e=t.prototype;return e.getViewportCount=function(){return this._viewportCount},e.getFrustum=function(){return this._frustum},e.updateMatrices=function(t){var e=this.camera,n=this.matrix;Vc.setFromMatrixPosition(t.matrixWorld),e.position.copy(Vc),Wc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Wc),e.updateMatrixWorld(),Hc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Hc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Hc)},e.getViewport=function(t){return this._viewports[t]},e.getFrameExtents=function(){return this._frameExtents},e.dispose=function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()},e.copy=function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},e.clone=function(){return(new this.constructor).copy(this)},e.toJSON=function(){var t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t},t}(),jc=function(t){function e(){var e;return(e=t.call(this,new vr(50,1,.5,500))||this).isSpotLightShadow=!0,e.focus=1,e}Yt(e,t);var n=e.prototype;return n.updateMatrices=function(e){var n=this.camera,i=2*re*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||n.far;i===n.fov&&r===n.aspect&&a===n.far||(n.fov=i,n.aspect=r,n.far=a,n.updateProjectionMatrix()),t.prototype.updateMatrices.call(this,e)},n.copy=function(e){return t.prototype.copy.call(this,e),this.focus=e.focus,this},e}(Xc),qc=function(t){function e(e,n,i,r,a,o){var s;return void 0===i&&(i=0),void 0===r&&(r=Math.PI/3),void 0===a&&(a=0),void 0===o&&(o=2),(s=t.call(this,e,n)||this).isSpotLight=!0,s.type="SpotLight",s.position.copy(Jn.DEFAULT_UP),s.updateMatrix(),s.target=new Jn,s.distance=i,s.angle=r,s.penumbra=a,s.decay=o,s.map=null,s.shadow=new jc,s}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.shadow.dispose()},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),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},Xt(e,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}])}(Gc),Yc=new wn,Zc=new Ye,Jc=new Ye,Kc=function(t){function e(){var e;return(e=t.call(this,new vr(90,1,.5,500))||this).isPointLightShadow=!0,e._frameExtents=new me(4,2),e._viewportCount=6,e._viewports=[new Ge(2,1,1,1),new Ge(0,1,1,1),new Ge(3,1,1,1),new Ge(1,1,1,1),new Ge(3,0,1,1),new Ge(1,0,1,1)],e._cubeDirections=[new Ye(1,0,0),new Ye(-1,0,0),new Ye(0,0,1),new Ye(0,0,-1),new Ye(0,1,0),new Ye(0,-1,0)],e._cubeUps=[new Ye(0,1,0),new Ye(0,1,0),new Ye(0,1,0),new Ye(0,1,0),new Ye(0,0,1),new Ye(0,0,-1)],e}return Yt(e,t),e.prototype.updateMatrices=function(t,e){void 0===e&&(e=0);var n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Zc.setFromMatrixPosition(t.matrixWorld),n.position.copy(Zc),Jc.copy(n.position),Jc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Jc),n.updateMatrixWorld(),i.makeTranslation(-Zc.x,-Zc.y,-Zc.z),Yc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yc)},e}(Xc),Qc=function(t){function e(e,n,i,r){var a;return void 0===i&&(i=0),void 0===r&&(r=2),(a=t.call(this,e,n)||this).isPointLight=!0,a.type="PointLight",a.distance=i,a.decay=r,a.shadow=new Kc,a}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.shadow.dispose()},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this},Xt(e,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}])}(Gc),$c=function(t){function e(){var e;return(e=t.call(this,new kr(-5,5,5,-5,.5,500))||this).isDirectionalLightShadow=!0,e}return Yt(e,t),e}(Xc),th=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Jn.DEFAULT_UP),i.updateMatrix(),i.target=new Jn,i.shadow=new $c,i}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.shadow.dispose()},n.copy=function(e){return t.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this},e}(Gc),eh=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).isAmbientLight=!0,i.type="AmbientLight",i}return Yt(e,t),e}(Gc),nh=function(t){function e(e,n,i,r){var a;return void 0===i&&(i=10),void 0===r&&(r=10),(a=t.call(this,e,n)||this).isRectAreaLight=!0,a.type="RectAreaLight",a.width=i,a.height=r,a}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.width=this.width,n.object.height=this.height,n},Xt(e,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(t){this.intensity=t/(this.width*this.height*Math.PI)}}])}(Gc),ih=function(){function t(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Ye)}var e=t.prototype;return e.set=function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},e.zero=function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},e.getAt=function(t,e){var n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],n*i*1.092548),e.addScaledVector(a[5],i*r*1.092548),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],n*r*1.092548),e.addScaledVector(a[8],.546274*(n*n-i*i)),e},e.getIrradianceAt=function(t,e){var n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*i),e.addScaledVector(a[2],1.023328*r),e.addScaledVector(a[3],1.023328*n),e.addScaledVector(a[4],.858086*n*i),e.addScaledVector(a[5],.858086*i*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],.858086*n*r),e.addScaledVector(a[8],.429043*(n*n-i*i)),e},e.add=function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},e.addScaledSH=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this},e.scale=function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},e.lerp=function(t,e){for(var n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this},e.equals=function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},e.copy=function(t){return this.set(t.coefficients)},e.clone=function(){return(new this.constructor).copy(this)},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(t,e+3*i);return t},t.getBasisAt=function(t,e){var n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)},t}(),rh=function(t){function e(e,n){var i;return void 0===e&&(e=new ih),void 0===n&&(n=1),(i=t.call(this,void 0,n)||this).isLightProbe=!0,i.sh=e,i}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.sh.copy(e.sh),this},n.fromJSON=function(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.object.sh=this.sh.toArray(),n},e}(Gc),ah=function(t){function e(e){var n;return(n=t.call(this,e)||this).textures={},n}Yt(e,t);var n=e.prototype;return n.load=function(t,e,n,i){var r=this,a=new Ic(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)},n.parse=function(t){var n=this.textures;function i(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var r=e.createMaterialFromType(t.type);if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=t.sheen),void 0!==t.sheenColor&&(r.sheenColor=(new mi).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(r.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.specularIntensity&&(r.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.iridescence&&(r.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(r.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(r.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.thickness&&(r.thickness=t.thickness),void 0!==t.attenuationDistance&&(r.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(r.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(r.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.shadowSide&&(r.shadowSide=t.shadowSide),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.alphaToCoverage&&(r.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(r.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(r.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var a in t.uniforms){var o=t.uniforms[a];switch(r.uniforms[a]={},o.type){case"t":r.uniforms[a].value=i(o.value);break;case"c":r.uniforms[a].value=(new mi).setHex(o.value);break;case"v2":r.uniforms[a].value=(new me).fromArray(o.value);break;case"v3":r.uniforms[a].value=(new Ye).fromArray(o.value);break;case"v4":r.uniforms[a].value=(new Ge).fromArray(o.value);break;case"m3":r.uniforms[a].value=(new ve).fromArray(o.value);break;case"m4":r.uniforms[a].value=(new wn).fromArray(o.value);break;default:r.uniforms[a].value=o.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(r.glslVersion=t.glslVersion),void 0!==t.extensions)for(var s in t.extensions)r.extensions[s]=t.extensions[s];if(void 0!==t.lights&&(r.lights=t.lights),void 0!==t.clipping&&(r.clipping=t.clipping),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=i(t.map)),void 0!==t.matcap&&(r.matcap=i(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){var l=t.normalScale;!1===Array.isArray(l)&&(l=[l,l]),r.normalScale=(new me).fromArray(l)}return void 0!==t.displacementMap&&(r.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(r.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(r.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(r.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new me).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(r.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(r.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(r.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(r.thicknessMap=i(t.thicknessMap)),void 0!==t.anisotropyMap&&(r.anisotropyMap=i(t.anisotropyMap)),void 0!==t.sheenColorMap&&(r.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(r.sheenRoughnessMap=i(t.sheenRoughnessMap)),r},n.setTextures=function(t){return this.textures=t,this},e.createMaterialFromType=function(t){return new{ShadowMaterial:Zu,SpriteMaterial:ms,RawShaderMaterial:Ju,ShaderMaterial:fr,PointsMaterial:fl,MeshPhysicalMaterial:Qu,MeshStandardMaterial:Ku,MeshPhongMaterial:$u,MeshToonMaterial:tc,MeshNormalMaterial:ec,MeshLambertMaterial:nc,MeshDepthMaterial:jo,MeshDistanceMaterial:qo,MeshBasicMaterial:gi,MeshMatcapMaterial:ic,LineDashedMaterial:rc,LineBasicMaterial:il,Material:ci}[t]},e}(Lc),oh=function(){function t(){}return t.decodeText=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}},t.extractUrlBase=function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)},t.resolveURL=function(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)},t}(),sh=function(t){function e(){var e;return(e=t.call(this)||this).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e},e}(Vi),lh=function(t){function e(e){return t.call(this,e)||this}Yt(e,t);var n=e.prototype;return n.load=function(t,e,n,i){var r=this,a=new Ic(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)},n.parse=function(t){var e={},n={};function i(t,i){if(void 0!==e[i])return e[i];var r=t.interleavedBuffers[i],a=function(t,e){if(void 0!==n[e])return n[e];var i=t.arrayBuffers,r=i[e],a=new Uint32Array(r).buffer;return n[e]=a,a}(t,r.buffer),o=xe(r.type,a),s=new ds(o,r.stride);return s.uuid=r.uuid,e[i]=s,s}var r=t.isInstancedBufferGeometry?new sh:new Vi,a=t.data.index;if(void 0!==a){var o=xe(a.type,a.array);r.setIndex(new wi(o,1))}var s=t.data.attributes;for(var l in s){var u=s[l],c=void 0;if(u.isInterleavedBufferAttribute){var h=i(t.data,u.data);c=new fs(h,u.itemSize,u.offset,u.normalized)}else{var d=xe(u.type,u.array);c=new(u.isInstancedBufferAttribute?Ys:wi)(d,u.itemSize,u.normalized)}void 0!==u.name&&(c.name=u.name),void 0!==u.usage&&c.setUsage(u.usage),void 0!==u.updateRange&&(c.updateRange.offset=u.updateRange.offset,c.updateRange.count=u.updateRange.count),r.setAttribute(l,c)}var p=t.data.morphAttributes;if(p)for(var f in p){for(var m=p[f],v=[],g=0,y=m.length;g<y;g++){var _=m[g],x=void 0;if(_.isInterleavedBufferAttribute){var M=i(t.data,_.data);x=new fs(M,_.itemSize,_.offset,_.normalized)}else{var S=xe(_.type,_.array);x=new wi(S,_.itemSize,_.normalized)}void 0!==_.name&&(x.name=_.name),v.push(x)}r.morphAttributes[f]=v}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);var b=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==b)for(var E=0,w=b.length;E!==w;++E){var T=b[E];r.addGroup(T.start,T.count,T.materialIndex)}var A=t.data.boundingSphere;if(void 0!==A){var R=new Ye;void 0!==A.center&&R.fromArray(A.center),r.boundingSphere=new vn(R,A.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r},e}(Lc),uh=function(t){function e(e){return t.call(this,e)||this}Yt(e,t);var n=e.prototype;return n.load=function(t,e,n,i){var r=this,a=""===this.path?oh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;var o=new Ic(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){var a=null;try{a=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(a,e)}),n,i)},n.loadAsync=function(){var t=Vt(Jt().mark((function t(e,n){var i,r,a,o,s,l;return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this,r=""===this.path?oh.extractUrlBase(e):this.path,this.resourcePath=this.resourcePath||r,(a=new Ic(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),t.next=9,a.loadAsync(e,n);case 9:if(o=t.sent,s=JSON.parse(o),void 0!==(l=s.metadata)&&void 0!==l.type&&"geometry"!==l.type.toLowerCase()){t.next=14;break}throw new Error("THREE.ObjectLoader: Can't load "+e);case 14:return t.next=16,i.parseAsync(s);case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}(),n.parse=function(t,e){var n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),a=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,r,s,o,n),u=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,u),void 0!==e){var c=!1;for(var h in a)if(a[h].data instanceof HTMLImageElement){c=!0;break}!1===c&&e(l)}return l},n.parseAsync=function(){var t=Vt(Jt().mark((function t(e){var n,i,r,a,o,s,l,u;return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),t.next=5,this.parseImagesAsync(e.images);case 5:return a=t.sent,o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,s,o,n),u=this.parseSkeletons(e.skeletons,l),this.bindSkeletons(l,u),t.abrupt("return",l);case 12:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.parseShapes=function(t){var e={};if(void 0!==t)for(var n=0,i=t.length;n<i;n++){var r=(new ou).fromJSON(t[n]);e[r.uuid]=r}return e},n.parseSkeletons=function(t,e){var n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(var r=0,a=t.length;r<a;r++){var o=(new qs).fromJSON(t[r],i);n[o.uuid]=o}return n},n.parseGeometries=function(t,e){var n={};if(void 0!==t)for(var i=new lh,r=0,a=t.length;r<a;r++){var o=void 0,s=t[r];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;default:s.type in Yu?o=Yu[s.type].fromJSON(s,e):console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"')}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},n.parseMaterials=function(t,e){var n={},i={};if(void 0!==t){var r=new ah;r.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},n.parseAnimations=function(t){var e={};if(void 0!==t)for(var n=0;n<t.length;n++){var i=t[n],r=Ec.parse(i);e[r.uuid]=r}return e},n.parseImages=function(t,e){var n,i=this,r={};function a(t){if("string"==typeof t){var e=t;return function(t){return i.manager.itemStart(t),n.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e)}return t.data?{data:xe(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){var o=new Rc(e);(n=new Oc(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=t.length;s<l;s++){var u=t[s],c=u.url;if(Array.isArray(c)){for(var h=[],d=0,p=c.length;d<p;d++){var f=a(c[d]);null!==f&&(f instanceof HTMLImageElement?h.push(f):h.push(new Ws(f.data,f.width,f.height)))}r[u.uuid]=new Oe(h)}else{var m=a(u.url);r[u.uuid]=new Oe(m)}}}return r},n.parseImagesAsync=function(){var t=Vt(Jt().mark((function t(e){var n,i,r,a,o,s,l,u,c,h,d,p,f,m,v;return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=function(){return o=Vt(Jt().mark((function t(e){var i,a;return Jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=8;break}return a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i=e)?i:n.resourcePath+i,t.next=5,r.loadAsync(a);case 5:return t.abrupt("return",t.sent);case 8:if(!e.data){t.next=12;break}return t.abrupt("return",{data:xe(e.type,e.data),width:e.width,height:e.height});case 12:return t.abrupt("return",null);case 13:case"end":return t.stop()}}),t)}))),o.apply(this,arguments)},a=function(t){return o.apply(this,arguments)},n=this,i={},!(void 0!==e&&e.length>0)){t.next=33;break}(r=new Oc(this.manager)).setCrossOrigin(this.crossOrigin),s=0,l=e.length;case 8:if(!(s<l)){t.next=33;break}if(u=e[s],c=u.url,!Array.isArray(c)){t.next=26;break}h=[],d=0,p=c.length;case 14:if(!(d<p)){t.next=23;break}return f=c[d],t.next=18,a(f);case 18:null!==(m=t.sent)&&(m instanceof HTMLImageElement?h.push(m):h.push(new Ws(m.data,m.width,m.height)));case 20:d++,t.next=14;break;case 23:i[u.uuid]=new Oe(h),t.next=30;break;case 26:return t.next=28,a(u.url);case 28:v=t.sent,i[u.uuid]=new Oe(v);case 30:s++,t.next=8;break;case 33:return t.abrupt("return",i);case 34:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.parseTextures=function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var o=t[r];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===e[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=e[o.image],l=s.data,u=void 0;Array.isArray(l)?(u=new _r,6===l.length&&(u.needsUpdate=!0)):(u=l&&l.data?new Ws:new ze,l&&(u.needsUpdate=!0)),u.source=s,u.uuid=o.uuid,void 0!==o.name&&(u.name=o.name),void 0!==o.mapping&&(u.mapping=n(o.mapping,ch)),void 0!==o.channel&&(u.channel=o.channel),void 0!==o.offset&&u.offset.fromArray(o.offset),void 0!==o.repeat&&u.repeat.fromArray(o.repeat),void 0!==o.center&&u.center.fromArray(o.center),void 0!==o.rotation&&(u.rotation=o.rotation),void 0!==o.wrap&&(u.wrapS=n(o.wrap[0],hh),u.wrapT=n(o.wrap[1],hh)),void 0!==o.format&&(u.format=o.format),void 0!==o.internalFormat&&(u.internalFormat=o.internalFormat),void 0!==o.type&&(u.type=o.type),void 0!==o.colorSpace&&(u.colorSpace=o.colorSpace),void 0!==o.encoding&&(u.encoding=o.encoding),void 0!==o.minFilter&&(u.minFilter=n(o.minFilter,dh)),void 0!==o.magFilter&&(u.magFilter=n(o.magFilter,dh)),void 0!==o.anisotropy&&(u.anisotropy=o.anisotropy),void 0!==o.flipY&&(u.flipY=o.flipY),void 0!==o.generateMipmaps&&(u.generateMipmaps=o.generateMipmaps),void 0!==o.premultiplyAlpha&&(u.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(u.unpackAlignment=o.unpackAlignment),void 0!==o.compareFunction&&(u.compareFunction=o.compareFunction),void 0!==o.userData&&(u.userData=o.userData),i[o.uuid]=u}return i},n.parseObject=function(t,e,n,i,r){var a,o,s;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function u(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],i=0,r=t.length;i<r;i++){var a=t[i];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function c(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":a=new hs,void 0!==t.background&&(Number.isInteger(t.background)?a.background=new mi(t.background):a.background=c(t.background)),void 0!==t.environment&&(a.environment=c(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?a.fog=new cs(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(a.fog=new us(t.fog.color,t.fog.density))),void 0!==t.backgroundBlurriness&&(a.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(a.backgroundIntensity=t.backgroundIntensity);break;case"PerspectiveCamera":a=new vr(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(a.focus=t.focus),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.filmGauge&&(a.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(a.filmOffset=t.filmOffset),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"OrthographicCamera":a=new kr(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(a.zoom=t.zoom),void 0!==t.view&&(a.view=Object.assign({},t.view));break;case"AmbientLight":a=new eh(t.color,t.intensity);break;case"DirectionalLight":a=new th(t.color,t.intensity);break;case"PointLight":a=new Qc(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":a=new nh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":a=new qc(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":a=new kc(t.color,t.groundColor,t.intensity);break;case"LightProbe":a=(new rh).fromJSON(t);break;case"SkinnedMesh":o=l(t.geometry),s=u(t.material),a=new Hs(o,s),void 0!==t.bindMode&&(a.bindMode=t.bindMode),void 0!==t.bindMatrix&&a.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(a.skeleton=t.skeleton);break;case"Mesh":o=l(t.geometry),s=u(t.material),a=new sr(o,s);break;case"InstancedMesh":o=l(t.geometry),s=u(t.material);var h=t.count,d=t.instanceMatrix,p=t.instanceColor;(a=new nl(o,s,h)).instanceMatrix=new Ys(new Float32Array(d.array),16),void 0!==p&&(a.instanceColor=new Ys(new Float32Array(p.array),p.itemSize));break;case"LOD":a=new Us;break;case"Line":a=new ul(l(t.geometry),u(t.material));break;case"LineLoop":a=new pl(l(t.geometry),u(t.material));break;case"LineSegments":a=new dl(l(t.geometry),u(t.material));break;case"PointCloud":case"Points":a=new _l(l(t.geometry),u(t.material));break;case"Sprite":a=new Rs(u(t.material));break;case"Group":a=new $o;break;case"Bone":a=new Vs;break;default:a=new Jn}if(a.uuid=t.uuid,void 0!==t.name&&(a.name=t.name),void 0!==t.matrix?(a.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(a.matrixAutoUpdate=t.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==t.position&&a.position.fromArray(t.position),void 0!==t.rotation&&a.rotation.fromArray(t.rotation),void 0!==t.quaternion&&a.quaternion.fromArray(t.quaternion),void 0!==t.scale&&a.scale.fromArray(t.scale)),void 0!==t.up&&a.up.fromArray(t.up),void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(a.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(a.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(a.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&a.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(a.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(a.visible=t.visible),void 0!==t.frustumCulled&&(a.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(a.renderOrder=t.renderOrder),void 0!==t.userData&&(a.userData=t.userData),void 0!==t.layers&&(a.layers.mask=t.layers),void 0!==t.children)for(var f=t.children,m=0;m<f.length;m++)a.add(this.parseObject(f[m],e,n,i,r));if(void 0!==t.animations)for(var v=t.animations,g=0;g<v.length;g++){var y=v[g];a.animations.push(r[y])}if("LOD"===t.type){void 0!==t.autoUpdate&&(a.autoUpdate=t.autoUpdate);for(var _=t.levels,x=0;x<_.length;x++){var M=_[x],S=a.getObjectByProperty("uuid",M.object);void 0!==S&&a.addLevel(S,M.distance,M.hysteresis)}}return a},n.bindSkeletons=function(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){var n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))},e}(Lc),ch={UVMapping:g,CubeReflectionMapping:y,CubeRefractionMapping:_,EquirectangularReflectionMapping:x,EquirectangularRefractionMapping:M,CubeUVReflectionMapping:S},hh={RepeatWrapping:b,ClampToEdgeWrapping:E,MirroredRepeatWrapping:w},dh={NearestFilter:T,NearestMipmapNearestFilter:A,NearestMipmapLinearFilter:R,LinearFilter:C,LinearMipmapNearestFilter:L,LinearMipmapLinearFilter:P},ph=function(t){function e(e){var n;return(n=t.call(this,e)||this).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),n.options={premultiplyAlpha:"none"},n}Yt(e,t);var n=e.prototype;return n.setOptions=function(t){return this.options=t,this},n.load=function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var r=this,a=Ac.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){Ac.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)},e}(Lc),fh=function(){function t(){}return t.getContext=function(){return void 0===Tc&&(Tc=new(window.AudioContext||window.webkitAudioContext)),Tc},t.setContext=function(t){Tc=t},t}(),mh=function(t){function e(e){return t.call(this,e)||this}return Yt(e,t),e.prototype.load=function(t,e,n,i){var r=this,a=new Ic(this.manager);function o(e){i?i(e):console.error(e),r.manager.itemError(t)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(t){try{var n=t.slice(0);fh.getContext().decodeAudioData(n,(function(t){e(t)}),o)}catch(t){o(t)}}),n,i)},e}(Lc),vh=function(t){function e(e,n,i){var r;void 0===i&&(i=1),(r=t.call(this,void 0,i)||this).isHemisphereLightProbe=!0;var a=(new mi).set(e),o=(new mi).set(n),s=new Ye(a.r,a.g,a.b),l=new Ye(o.r,o.g,o.b),u=Math.sqrt(Math.PI),c=u*Math.sqrt(.75);return r.sh.coefficients[0].copy(s).add(l).multiplyScalar(u),r.sh.coefficients[1].copy(s).sub(l).multiplyScalar(c),r}return Yt(e,t),e}(rh),gh=function(t){function e(e,n){var i;void 0===n&&(n=1),(i=t.call(this,void 0,n)||this).isAmbientLightProbe=!0;var r=(new mi).set(e);return i.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI)),i}return Yt(e,t),e}(rh),yh=new wn,_h=new wn,xh=new wn,Mh=function(){function t(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new vr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new vr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}return t.prototype.update=function(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,xh.copy(t.projectionMatrix);var n,i,r=e.eyeSep/2,a=r*e.near/e.focus,o=e.near*Math.tan(ie*e.fov*.5)/e.zoom;_h.elements[12]=-r,yh.elements[12]=r,n=-o*e.aspect+a,i=o*e.aspect+a,xh.elements[0]=2*e.near/(i-n),xh.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(xh),n=-o*e.aspect-a,i=o*e.aspect-a,xh.elements[0]=2*e.near/(i-n),xh.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(xh)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(_h),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(yh)},t}(),Sh=function(){function t(t){void 0===t&&(t=!0),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}var e=t.prototype;return e.start=function(){this.startTime=bh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},e.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},e.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},e.getDelta=function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=bh();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t},t}();function bh(){return("undefined"==typeof performance?Date:performance).now()}var Eh=new Ye,wh=new qe,Th=new Ye,Ah=new Ye,Rh=function(t){function e(){var e;return(e=t.call(this)||this).type="AudioListener",e.context=fh.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new Sh,e}Yt(e,t);var n=e.prototype;return n.getInput=function(){return this.gain},n.removeFilter=function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},n.getFilter=function(){return this.filter},n.setFilter=function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},n.getMasterVolume=function(){return this.gain.gain.value},n.setMasterVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},n.updateMatrixWorld=function(e){t.prototype.updateMatrixWorld.call(this,e);var n=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Eh,wh,Th),Ah.set(0,0,-1).applyQuaternion(wh),n.positionX){var r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Eh.x,r),n.positionY.linearRampToValueAtTime(Eh.y,r),n.positionZ.linearRampToValueAtTime(Eh.z,r),n.forwardX.linearRampToValueAtTime(Ah.x,r),n.forwardY.linearRampToValueAtTime(Ah.y,r),n.forwardZ.linearRampToValueAtTime(Ah.z,r),n.upX.linearRampToValueAtTime(i.x,r),n.upY.linearRampToValueAtTime(i.y,r),n.upZ.linearRampToValueAtTime(i.z,r)}else n.setPosition(Eh.x,Eh.y,Eh.z),n.setOrientation(Ah.x,Ah.y,Ah.z,i.x,i.y,i.z)},e}(Jn),Ch=function(t){function e(e){var n;return(n=t.call(this)||this).type="Audio",n.listener=e,n.context=e.context,n.gain=n.context.createGain(),n.gain.connect(e.getInput()),n.autoplay=!1,n.buffer=null,n.detune=0,n.loop=!1,n.loopStart=0,n.loopEnd=0,n.offset=0,n.duration=void 0,n.playbackRate=1,n.isPlaying=!1,n.hasPlaybackControl=!0,n.source=null,n.sourceType="empty",n._startedAt=0,n._progress=0,n._connected=!1,n.filters=[],n}Yt(e,t);var n=e.prototype;return n.getOutput=function(){return this.gain},n.setNodeSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},n.setMediaElementSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},n.setMediaStreamSource=function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},n.setBuffer=function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},n.play=function(t){if(void 0===t&&(t=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+t;var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},n.pause=function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.stop=function(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},n.connect=function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this},n.disconnect=function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this},n.getFilters=function(){return this.filters},n.setFilters=function(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this},n.setDetune=function(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},n.getDetune=function(){return this.detune},n.getFilter=function(){return this.getFilters()[0]},n.setFilter=function(t){return this.setFilters(t?[t]:[])},n.setPlaybackRate=function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.getPlaybackRate=function(){return this.playbackRate},n.onEnded=function(){this.isPlaying=!1},n.getLoop=function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},n.setLoop=function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},n.setLoopStart=function(t){return this.loopStart=t,this},n.setLoopEnd=function(t){return this.loopEnd=t,this},n.getVolume=function(){return this.gain.gain.value},n.setVolume=function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},e}(Jn),Lh=new Ye,Ph=new qe,Uh=new Ye,Ih=new Ye,Nh=function(t){function e(e){var n;return(n=t.call(this,e)||this).panner=n.context.createPanner(),n.panner.panningModel="HRTF",n.panner.connect(n.gain),n}Yt(e,t);var n=e.prototype;return n.connect=function(){t.prototype.connect.call(this),this.panner.connect(this.gain)},n.disconnect=function(){t.prototype.disconnect.call(this),this.panner.disconnect(this.gain)},n.getOutput=function(){return this.panner},n.getRefDistance=function(){return this.panner.refDistance},n.setRefDistance=function(t){return this.panner.refDistance=t,this},n.getRolloffFactor=function(){return this.panner.rolloffFactor},n.setRolloffFactor=function(t){return this.panner.rolloffFactor=t,this},n.getDistanceModel=function(){return this.panner.distanceModel},n.setDistanceModel=function(t){return this.panner.distanceModel=t,this},n.getMaxDistance=function(){return this.panner.maxDistance},n.setMaxDistance=function(t){return this.panner.maxDistance=t,this},n.setDirectionalCone=function(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this},n.updateMatrixWorld=function(e){if(t.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Lh,Ph,Uh),Ih.set(0,0,1).applyQuaternion(Ph);var n=this.panner;if(n.positionX){var i=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Lh.x,i),n.positionY.linearRampToValueAtTime(Lh.y,i),n.positionZ.linearRampToValueAtTime(Lh.z,i),n.orientationX.linearRampToValueAtTime(Ih.x,i),n.orientationY.linearRampToValueAtTime(Ih.y,i),n.orientationZ.linearRampToValueAtTime(Ih.z,i)}else n.setPosition(Lh.x,Lh.y,Lh.z),n.setOrientation(Ih.x,Ih.y,Ih.z)}},e}(Ch),Dh=function(){function t(t,e){void 0===e&&(e=2048),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}var e=t.prototype;return e.getFrequencyData=function(){return this.analyser.getByteFrequencyData(this.data),this.data},e.getAverageFrequency=function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length},t}(),Oh=function(){function t(t,e,n){var i,r,a;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}var e=t.prototype;return e.accumulate=function(t,e){var n=this.buffer,i=this.valueSize,r=t*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},e.accumulateAdditive=function(t){var e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t},e.apply=function(t){var e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=e*this._origIndex;this._mixBufferRegion(n,i,s,1-r,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(var l=e,u=e+e;l!==u;++l)if(n[l]!==n[l+e]){o.setValue(n,i);break}},e.saveOriginalState=function(){var t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(var r=n,a=i;r!==a;++r)e[r]=e[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},e.restoreOriginalState=function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},e._setAdditiveIdentityNumeric=function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,n=t;n<e;n++)this.buffer[n]=0},e._setAdditiveIdentityQuaternion=function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},e._setAdditiveIdentityOther=function(){for(var t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]},e._select=function(t,e,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)t[e+a]=t[n+a]},e._slerp=function(t,e,n,i){qe.slerpFlat(t,e,t,e,t,n,i)},e._slerpAdditive=function(t,e,n,i,r){var a=this._workIndex*r;qe.multiplyQuaternionsFlat(t,a,t,e,t,n),qe.slerpFlat(t,e,t,e,t,a,i)},e._lerp=function(t,e,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*i}},e._lerpAdditive=function(t,e,n,i,r){for(var a=0;a!==r;++a){var o=e+a;t[o]=t[o]+t[n+a]*i}},t}(),Bh="\\[\\]\\.:\\/",Fh=new RegExp("["+Bh+"]","g"),zh="[^"+Bh+"]",Gh="[^"+Bh.replace("\\.","")+"]",kh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",zh)+/(WCOD+)?/.source.replace("WCOD",Gh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",zh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",zh)+"$"),Hh=["material","materials","bones","map"],Vh=function(){function t(t,e,n){var i=n||Wh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}var e=t.prototype;return e.getValue=function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},e.setValue=function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},e.bind=function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},e.unbind=function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()},t}(),Wh=function(){function t(e,n,i){this.path=n,this.parsedPath=i||t.parseTrackName(n),this.node=t.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}t.create=function(e,n,i){return e&&e.isAnimationObjectGroup?new t.Composite(e,n,i):new t(e,n,i)},t.sanitizeNodeName=function(t){return t.replace(/\s/g,"_").replace(Fh,"")},t.parseTrackName=function(t){var e=kh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==Hh.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: "+t);return n},t.findNode=function(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var i=function t(n){for(var i=0;i<n.length;i++){var r=n[i];if(r.name===e||r.uuid===e)return r;var a=t(r.children);if(a)return a}return null}(t.children);if(i)return i}return null};var e=t.prototype;return e._getValue_unavailable=function(){},e._setValue_unavailable=function(){},e._getValue_direct=function(t,e){t[e]=this.targetObject[this.propertyName]},e._getValue_array=function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)t[e++]=n[i]},e._getValue_arrayElement=function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},e._getValue_toArray=function(t,e){this.resolvedProperty.toArray(t,e)},e._setValue_direct=function(t,e){this.targetObject[this.propertyName]=t[e]},e._setValue_direct_setNeedsUpdate=function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},e._setValue_direct_setMatrixWorldNeedsUpdate=function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0},e._setValue_array=function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++]},e._setValue_array_setNeedsUpdate=function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},e._setValue_array_setMatrixWorldNeedsUpdate=function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0},e._setValue_arrayElement=function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},e._setValue_arrayElement_setNeedsUpdate=function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},e._setValue_arrayElement_setMatrixWorldNeedsUpdate=function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0},e._setValue_fromArray=function(t,e){this.resolvedProperty.fromArray(t,e)},e._setValue_fromArray_setNeedsUpdate=function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},e._setValue_fromArray_setMatrixWorldNeedsUpdate=function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0},e._getValue_unbound=function(t,e){this.bind(),this.getValue(t,e)},e._setValue_unbound=function(t,e){this.bind(),this.setValue(t,e)},e.bind=function(){var e=this.node,n=this.parsedPath,i=n.objectName,r=n.propertyName,a=n.propertyIndex;if(e||(e=t.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(i){var o=n.objectIndex;switch(i){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 s=0;s<e.length;s++)if(e[s].name===o){o=s;break}break;case"map":if("map"in e){e=e.map;break}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.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}var l=e[r];if(void 0!==l){var u=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===r){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.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[a]&&(a=e.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=a}else void 0!==l.fromArray&&void 0!==l.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+r+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},e.unbind=function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound},t}();Wh.Composite=Vh,Wh.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Wh.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Wh.prototype.GetterByBindingType=[Wh.prototype._getValue_direct,Wh.prototype._getValue_array,Wh.prototype._getValue_arrayElement,Wh.prototype._getValue_toArray],Wh.prototype.SetterByBindingTypeAndVersioning=[[Wh.prototype._setValue_direct,Wh.prototype._setValue_direct_setNeedsUpdate,Wh.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Wh.prototype._setValue_array,Wh.prototype._setValue_array_setNeedsUpdate,Wh.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Wh.prototype._setValue_arrayElement,Wh.prototype._setValue_arrayElement_setNeedsUpdate,Wh.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Wh.prototype._setValue_fromArray,Wh.prototype._setValue_fromArray_setNeedsUpdate,Wh.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Xh=function(){function t(){this.isAnimationObjectGroup=!0,this.uuid=ae(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;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}}}var e=t.prototype;return e.add=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length,o=void 0,s=t.length,l=this.nCachedObjects_,u=0,c=arguments.length;u!==c;++u){var h=arguments[u],d=h.uuid,p=e[d];if(void 0===p){p=s++,e[d]=p,t.push(h);for(var f=0,m=a;f!==m;++f)r[f].push(new Wh(h,n[f],i[f]))}else if(p<l){o=t[p];var v=--l,g=t[v];e[g.uuid]=p,t[p]=g,e[d]=v,t[v]=h;for(var y=0,_=a;y!==_;++y){var x=r[y],M=x[v],S=x[p];x[p]=M,void 0===S&&(S=new Wh(h,n[y],i[y])),x[v]=S}}else t[p]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l},e.remove=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,u=e[l];if(void 0!==u&&u>=r){var c=r++,h=t[c];e[h.uuid]=u,t[u]=h,e[l]=c,t[c]=s;for(var d=0,p=i;d!==p;++d){var f=n[d],m=f[c],v=f[u];f[u]=m,f[c]=v}}}this.nCachedObjects_=r},e.uncache=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=t.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,u=e[l];if(void 0!==u)if(delete e[l],u<r){var c=--r,h=t[c],d=--a,p=t[d];e[h.uuid]=u,t[u]=h,e[p.uuid]=c,t[c]=p,t.pop();for(var f=0,m=i;f!==m;++f){var v=n[f],g=v[c],y=v[d];v[u]=g,v[c]=y,v.pop()}}else{var _=--a,x=t[_];_>0&&(e[x.uuid]=u),t[u]=x,t.pop();for(var M=0,S=i;M!==S;++M){var b=n[M];b[u]=b[_],b.pop()}}}this.nCachedObjects_=r},e.subscribe_=function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);i=r.length,n[t]=i,a.push(t),o.push(e),r.push(c);for(var h=u,d=s.length;h!==d;++h){var p=s[h];c[h]=new Wh(p,t,e)}return c},e.unsubscribe_=function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}},t}(),jh=function(){function t(t,e,n,i){void 0===n&&(n=null),void 0===i&&(i=e.blendMode),this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;for(var r=e.tracks,a=r.length,o=new Array(a),s={endingStart:Et,endingEnd:Et},l=0;l!==a;++l){var u=r[l].createInterpolant(null);o[l]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),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}var e=t.prototype;return e.play=function(){return this._mixer._activateAction(this),this},e.stop=function(){return this._mixer._deactivateAction(this),this.reset()},e.reset=function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},e.isRunning=function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},e.isScheduled=function(){return this._mixer._isActiveAction(this)},e.startAt=function(t){return this._startTime=t,this},e.setLoop=function(t,e){return this.loop=t,this.repetitions=e,this},e.setEffectiveWeight=function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},e.getEffectiveWeight=function(){return this._effectiveWeight},e.fadeIn=function(t){return this._scheduleFading(t,0,1)},e.fadeOut=function(t){return this._scheduleFading(t,1,0)},e.crossFadeFrom=function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,a=r/i,o=i/r;t.warp(1,a,e),this.warp(o,1,e)}return this},e.crossFadeTo=function(t,e,n){return t.crossFadeFrom(this,e,n)},e.stopFading=function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.setEffectiveTimeScale=function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},e.getEffectiveTimeScale=function(){return this._effectiveTimeScale},e.setDuration=function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},e.syncWith=function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},e.halt=function(t){return this.warp(this._effectiveTimeScale,0,t)},e.warp=function(t,e,n){var i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+n,l[0]=t/a,l[1]=e/a,this},e.stopWarping=function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.getMixer=function(){return this._mixer},e.getClip=function(){return this._clip},e.getRoot=function(){return this._localRoot||this._mixer._root},e._update=function(t,e,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(t-r)*n;a<0||0===n?e=0:(this._startTime=null,e=n*a)}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0){var l=this._interpolants,u=this._propertyBindings;if(this.blendMode===Rt)for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);else for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),u[d].accumulate(i,s)}}else this._updateWeight(t)},e._updateWeight=function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},e._updateTimeScale=function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},e._updateTime=function(t){var e=this._clip.duration,n=this.loop,i=this.time+t,r=this._loopCount,a=2202===n;if(0===t)return-1===r||!a||1&~r?i:e-i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=e||i<0){var o=Math.floor(i/e);i-=e*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var l=t<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&!(1&~r))return e-i}return i},e._setEndings=function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=wt,i.endingEnd=wt):(i.endingStart=t?this.zeroSlopeAtStart?wt:Et:Tt,i.endingEnd=e?this.zeroSlopeAtEnd?wt:Et:Tt)},e._scheduleFading=function(t,e,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]=e,o[1]=r+t,s[1]=n,this},t}(),qh=new Float32Array(1),Yh=function(t){function e(e){var n;return(n=t.call(this)||this)._root=e,n._initMemoryManager(),n._accuIndex=0,n.time=0,n.timeScale=1,n}Yt(e,t);var n=e.prototype;return n._bindAction=function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==r;++c){var h=i[c],d=h.name,p=u[d];if(void 0!==p)++p.referenceCount,a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[c].binding.parsedPath;++(p=new Oh(Wh.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}},n._activateAction=function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},n._deactivateAction=function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},n._initMemoryManager=function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},n._isActiveAction=function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},n._addInactiveAction=function(t,e,n){var i=this._actions,r=this._actionsByClip,a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t},n._removeInactiveAction=function(t){var e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],u=t._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(t)},n._removeInactiveBindingsForAction=function(t){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},n._lendAction=function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},n._takeBackAction=function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},n._addInactiveBinding=function(t,e,n){var i=this._bindingsByRootAndName,r=this._bindings,a=i[e];void 0===a&&(a={},i[e]=a),a[n]=t,t._cacheIndex=r.length,r.push(t)},n._removeInactiveBinding=function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},n._lendBinding=function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},n._takeBackBinding=function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},n._lendControlInterpolant=function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new fc(new Float32Array(2),new Float32Array(2),1,qh)).__cacheIndex=e,t[e]=n),n},n._takeBackControlInterpolant=function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},n.clipAction=function(t,e,n){var i=e||this._root,r=i.uuid,a="string"==typeof t?Ec.findByName(i,t):t,o=null!==a?a.uuid:t,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:At),void 0!==s){var u=s.actionByRoot[r];if(void 0!==u&&u.blendMode===n)return u;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new jh(this,a,e,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c},n.existingAction=function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?Ec.findByName(n,t):t,a=r?r.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},n.stopAllAction=function(){for(var t=this._actions,e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this},n.update=function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(i,t,r,a)}for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this},n.setTime=function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},n.getRoot=function(){return this._root},n.uncacheClip=function(t){var e=this._actions,n=t.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 l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=e[e.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,e[u]=c,e.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},n.uncacheRoot=function(t){var e=t.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},n.uncacheAction=function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))},e}(te),Zh=function(){function t(t){this.value=t}return t.prototype.clone=function(){return new t(void 0===this.value.clone?this.value:this.value.clone())},t}(),Jh=0,Kh=function(t){function e(){var e;return(e=t.call(this)||this).isUniformsGroup=!0,Object.defineProperty(e,"id",{value:Jh++}),e.name="",e.usage=Ot,e.uniforms=[],e}Yt(e,t);var n=e.prototype;return n.add=function(t){return this.uniforms.push(t),this},n.remove=function(t){var e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this},n.setName=function(t){return this.name=t,this},n.setUsage=function(t){return this.usage=t,this},n.dispose=function(){return this.dispatchEvent({type:"dispose"}),this},n.copy=function(t){this.name=t.name,this.usage=t.usage;var e=t.uniforms;this.uniforms.length=0;for(var n=0,i=e.length;n<i;n++)this.uniforms.push(e[n].clone());return this},n.clone=function(){return(new this.constructor).copy(this)},e}(te),Qh=function(t){function e(e,n,i){var r;return void 0===i&&(i=1),(r=t.call(this,e,n)||this).isInstancedInterleavedBuffer=!0,r.meshPerAttribute=i,r}Yt(e,t);var n=e.prototype;return n.copy=function(e){return t.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},n.clone=function(e){var n=t.prototype.clone.call(this,e);return n.meshPerAttribute=this.meshPerAttribute,n},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n},e}(ds),$h=function(){function t(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}var e=t.prototype;return e.setBuffer=function(t){return this.buffer=t,this},e.setType=function(t,e){return this.type=t,this.elementSize=e,this},e.setItemSize=function(t){return this.itemSize=t,this},e.setCount=function(t){return this.count=t,this},Xt(t,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])}(),td=function(){function t(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=1/0),this.ray=new En(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new On,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}var e=t.prototype;return e.set=function(t,e){this.ray.set(t,e)},e.setFromCamera=function(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)},e.intersectObject=function(t,e,n){return void 0===e&&(e=!0),void 0===n&&(n=[]),nd(t,this,n,e),n.sort(ed),n},e.intersectObjects=function(t,e,n){void 0===e&&(e=!0),void 0===n&&(n=[]);for(var i=0,r=t.length;i<r;i++)nd(t[i],this,n,e);return n.sort(ed),n},t}();function ed(t,e){return t.distance-e.distance}function nd(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i)for(var r=t.children,a=0,o=r.length;a<o;a++)nd(r[a],e,n,!0)}var id=function(){function t(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===n&&(n=0),this.radius=t,this.phi=e,this.theta=n,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},e.copy=function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},e.makeSafe=function(){var t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(oe(e/this.radius,-1,1))),this},e.clone=function(){return(new this.constructor).copy(this)},t}(),rd=function(){function t(t,e,n){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===n&&(n=0),this.radius=t,this.theta=e,this.y=n,this}var e=t.prototype;return e.set=function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},e.copy=function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},e.setFromVector3=function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},e.setFromCartesianCoords=function(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this},e.clone=function(){return(new this.constructor).copy(this)},t}(),ad=new me,od=function(){function t(t,e){void 0===t&&(t=new me(1/0,1/0)),void 0===e&&(e=new me(-1/0,-1/0)),this.isBox2=!0,this.min=t,this.max=e}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var n=ad.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.min.copy(t.min),this.max.copy(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Vector3),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},e.getSize=function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Vector3),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.sub(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},e.containsBox=function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new me),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new me),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return this.clampPoint(t,ad).distanceTo(t)},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),sd=new Ye,ld=new Ye,ud=function(){function t(t,e){void 0===t&&(t=new Ye),void 0===e&&(e=new Ye),this.start=t,this.end=e}var e=t.prototype;return e.set=function(t,e){return this.start.copy(t),this.end.copy(e),this},e.copy=function(t){return this.start.copy(t.start),this.end.copy(t.end),this},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Ye),t.addVectors(this.start,this.end).multiplyScalar(.5)},e.delta=function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Ye),t.subVectors(this.end,this.start)},e.distanceSq=function(){return this.start.distanceToSquared(this.end)},e.distance=function(){return this.start.distanceTo(this.end)},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Ye),this.delta(e).multiplyScalar(t).add(this.start)},e.closestPointToPointParameter=function(t,e){sd.subVectors(t,this.start),ld.subVectors(this.end,this.start);var n=ld.dot(ld),i=ld.dot(sd)/n;return e&&(i=oe(i,0,1)),i},e.closestPointToPoint=function(t,e,n){var i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Ye),this.delta(n).multiplyScalar(i).add(this.start)},e.applyMatrix4=function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},e.equals=function(t){return t.start.equals(this.start)&&t.end.equals(this.end)},e.clone=function(){return(new this.constructor).copy(this)},t}(),cd=new Ye,hd=function(t){function e(e,n){var i;(i=t.call(this)||this).light=e,i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=n,i.type="SpotLightHelper";for(var r=new Vi,a=[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],o=0,s=1;o<32;o++,s++){var l=o/32*Math.PI*2,u=s/32*Math.PI*2;a.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}r.setAttribute("position",new Ni(a,3));var c=new il({fog:!1,toneMapped:!1});return i.cone=new dl(r,c),i.add(i.cone),i.update(),i}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},n.update=function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),cd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},e}(Jn),dd=new Ye,pd=new wn,fd=new wn,md=function(t){function e(e){for(var n,i=vd(e),r=new Vi,a=[],o=[],s=new mi(0,0,1),l=new mi(0,1,0),u=0;u<i.length;u++){var c=i[u];c.parent&&c.parent.isBone&&(a.push(0,0,0),a.push(0,0,0),o.push(s.r,s.g,s.b),o.push(l.r,l.g,l.b))}r.setAttribute("position",new Ni(a,3)),r.setAttribute("color",new Ni(o,3));var h=new il({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(n=t.call(this,r,h)||this).isSkeletonHelper=!0,n.type="SkeletonHelper",n.root=e,n.bones=i,n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n}Yt(e,t);var n=e.prototype;return n.updateMatrixWorld=function(e){var n=this.bones,i=this.geometry,r=i.getAttribute("position");fd.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<n.length;a++){var s=n[a];s.parent&&s.parent.isBone&&(pd.multiplyMatrices(fd,s.matrixWorld),dd.setFromMatrixPosition(pd),r.setXYZ(o,dd.x,dd.y,dd.z),pd.multiplyMatrices(fd,s.parent.matrixWorld),dd.setFromMatrixPosition(pd),r.setXYZ(o+1,dd.x,dd.y,dd.z),o+=2)}i.getAttribute("position").needsUpdate=!0,t.prototype.updateMatrixWorld.call(this,e)},n.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl);function vd(t){var e=[];!0===t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,vd(t.children[n]));return e}var gd=function(t){function e(e,n,i){var r,a=new ku(n,4,2),o=new gi({wireframe:!0,fog:!1,toneMapped:!1});return(r=t.call(this,a,o)||this).light=e,r.color=i,r.type="PointLightHelper",r.matrix=r.light.matrixWorld,r.matrixAutoUpdate=!1,r.update(),r}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.geometry.dispose(),this.material.dispose()},n.update=function(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},e}(sr),yd=new Ye,_d=new mi,xd=new mi,Md=function(t){function e(e,n,i){var r;(r=t.call(this)||this).light=e,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=i,r.type="HemisphereLightHelper";var a=new Fu(n);a.rotateY(.5*Math.PI),r.material=new gi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===r.color&&(r.material.vertexColors=!0);var o=a.getAttribute("position"),s=new Float32Array(3*o.count);return a.setAttribute("color",new wi(s,3)),r.add(new sr(a,r.material)),r.update(),r}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},n.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");_d.copy(this.light.color),xd.copy(this.light.groundColor);for(var n=0,i=e.count;n<i;n++){var r=n<i/2?_d:xd;e.setXYZ(n,r.r,r.g,r.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(yd.setFromMatrixPosition(this.light.matrixWorld).negate())},e}(Jn),Sd=function(t){function e(e,n,i,r){var a;void 0===e&&(e=10),void 0===n&&(n=10),void 0===i&&(i=4473924),void 0===r&&(r=8947848),i=new mi(i),r=new mi(r);for(var o=n/2,s=e/n,l=e/2,u=[],c=[],h=0,d=0,p=-l;h<=n;h++,p+=s){u.push(-l,0,p,l,0,p),u.push(p,0,-l,p,0,l);var f=h===o?i:r;f.toArray(c,d),d+=3,f.toArray(c,d),d+=3,f.toArray(c,d),d+=3,f.toArray(c,d),d+=3}var m=new Vi;m.setAttribute("position",new Ni(u,3)),m.setAttribute("color",new Ni(c,3));var v=new il({vertexColors:!0,toneMapped:!1});return(a=t.call(this,m,v)||this).type="GridHelper",a}return Yt(e,t),e.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl),bd=function(t){function e(e,n,i,r,a,o){var s;void 0===e&&(e=10),void 0===n&&(n=16),void 0===i&&(i=8),void 0===r&&(r=64),void 0===a&&(a=4473924),void 0===o&&(o=8947848),a=new mi(a),o=new mi(o);var l=[],u=[];if(n>1)for(var c=0;c<n;c++){var h=c/n*(2*Math.PI),d=Math.sin(h)*e,p=Math.cos(h)*e;l.push(0,0,0),l.push(d,0,p);var f=1&c?a:o;u.push(f.r,f.g,f.b),u.push(f.r,f.g,f.b)}for(var m=0;m<i;m++)for(var v=1&m?a:o,g=e-e/i*m,y=0;y<r;y++){var _=y/r*(2*Math.PI),x=Math.sin(_)*g,M=Math.cos(_)*g;l.push(x,0,M),u.push(v.r,v.g,v.b),_=(y+1)/r*(2*Math.PI),x=Math.sin(_)*g,M=Math.cos(_)*g,l.push(x,0,M),u.push(v.r,v.g,v.b)}var S=new Vi;S.setAttribute("position",new Ni(l,3)),S.setAttribute("color",new Ni(u,3));var b=new il({vertexColors:!0,toneMapped:!1});return(s=t.call(this,S,b)||this).type="PolarGridHelper",s}return Yt(e,t),e.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl),Ed=new Ye,wd=new Ye,Td=new Ye,Ad=function(t){function e(e,n,i){var r;(r=t.call(this)||this).light=e,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=i,r.type="DirectionalLightHelper",void 0===n&&(n=1);var a=new Vi;a.setAttribute("position",new Ni([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));var o=new il({fog:!1,toneMapped:!1});return r.lightPlane=new ul(a,o),r.add(r.lightPlane),(a=new Vi).setAttribute("position",new Ni([0,0,0,0,0,1],3)),r.targetLine=new ul(a,o),r.add(r.targetLine),r.update(),r}Yt(e,t);var n=e.prototype;return n.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},n.update=function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Ed.setFromMatrixPosition(this.light.matrixWorld),wd.setFromMatrixPosition(this.light.target.matrixWorld),Td.subVectors(wd,Ed),this.lightPlane.lookAt(wd),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(wd),this.targetLine.scale.z=Td.length()},e}(Jn),Rd=new Ye,Cd=new mr,Ld=function(t){function e(e){var n,i=new Vi,r=new il({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],o=[],s={};function l(t,e){u(t),u(e)}function u(t){a.push(0,0,0),o.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(a.length/3-1)}l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4"),i.setAttribute("position",new Ni(a,3)),i.setAttribute("color",new Ni(o,3)),(n=t.call(this,i,r)||this).type="CameraHelper",n.camera=e,n.camera.updateProjectionMatrix&&n.camera.updateProjectionMatrix(),n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n.pointMap=s,n.update();var c=new mi(16755200),h=new mi(16711680),d=new mi(43775),p=new mi(16777215),f=new mi(3355443);return n.setColors(c,h,d,p,f),n}Yt(e,t);var n=e.prototype;return n.setColors=function(t,e,n,i,r){var a=this.geometry.getAttribute("color");a.setXYZ(0,t.r,t.g,t.b),a.setXYZ(1,t.r,t.g,t.b),a.setXYZ(2,t.r,t.g,t.b),a.setXYZ(3,t.r,t.g,t.b),a.setXYZ(4,t.r,t.g,t.b),a.setXYZ(5,t.r,t.g,t.b),a.setXYZ(6,t.r,t.g,t.b),a.setXYZ(7,t.r,t.g,t.b),a.setXYZ(8,t.r,t.g,t.b),a.setXYZ(9,t.r,t.g,t.b),a.setXYZ(10,t.r,t.g,t.b),a.setXYZ(11,t.r,t.g,t.b),a.setXYZ(12,t.r,t.g,t.b),a.setXYZ(13,t.r,t.g,t.b),a.setXYZ(14,t.r,t.g,t.b),a.setXYZ(15,t.r,t.g,t.b),a.setXYZ(16,t.r,t.g,t.b),a.setXYZ(17,t.r,t.g,t.b),a.setXYZ(18,t.r,t.g,t.b),a.setXYZ(19,t.r,t.g,t.b),a.setXYZ(20,t.r,t.g,t.b),a.setXYZ(21,t.r,t.g,t.b),a.setXYZ(22,t.r,t.g,t.b),a.setXYZ(23,t.r,t.g,t.b),a.setXYZ(24,e.r,e.g,e.b),a.setXYZ(25,e.r,e.g,e.b),a.setXYZ(26,e.r,e.g,e.b),a.setXYZ(27,e.r,e.g,e.b),a.setXYZ(28,e.r,e.g,e.b),a.setXYZ(29,e.r,e.g,e.b),a.setXYZ(30,e.r,e.g,e.b),a.setXYZ(31,e.r,e.g,e.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0},n.update=function(){var t=this.geometry,e=this.pointMap;Cd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Pd("c",e,t,Cd,0,0,-1),Pd("t",e,t,Cd,0,0,1),Pd("n1",e,t,Cd,-1,-1,-1),Pd("n2",e,t,Cd,1,-1,-1),Pd("n3",e,t,Cd,-1,1,-1),Pd("n4",e,t,Cd,1,1,-1),Pd("f1",e,t,Cd,-1,-1,1),Pd("f2",e,t,Cd,1,-1,1),Pd("f3",e,t,Cd,-1,1,1),Pd("f4",e,t,Cd,1,1,1),Pd("u1",e,t,Cd,.7,1.1,-1),Pd("u2",e,t,Cd,-.7,1.1,-1),Pd("u3",e,t,Cd,0,2,-1),Pd("cf1",e,t,Cd,-1,0,1),Pd("cf2",e,t,Cd,1,0,1),Pd("cf3",e,t,Cd,0,-1,1),Pd("cf4",e,t,Cd,0,1,1),Pd("cn1",e,t,Cd,-1,0,-1),Pd("cn2",e,t,Cd,1,0,-1),Pd("cn3",e,t,Cd,0,-1,-1),Pd("cn4",e,t,Cd,0,1,-1),t.getAttribute("position").needsUpdate=!0},n.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl);function Pd(t,e,n,i,r,a,o){Rd.set(r,a,o).unproject(i);var s=e[t];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u<c;u++)l.setXYZ(s[u],Rd.x,Rd.y,Rd.z)}var Ud,Id,Nd=new Ke,Dd=function(t){function e(e,n){var i;void 0===n&&(n=16776960);var r=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]),a=new Float32Array(24),o=new Vi;return o.setIndex(new wi(r,1)),o.setAttribute("position",new wi(a,3)),(i=t.call(this,o,new il({color:n,toneMapped:!1}))||this).object=e,i.type="BoxHelper",i.matrixAutoUpdate=!1,i.update(),i}Yt(e,t);var n=e.prototype;return n.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Nd.setFromObject(this.object),!Nd.isEmpty()){var e=Nd.min,n=Nd.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},n.setFromObject=function(t){return this.object=t,this.update(),this},n.copy=function(e,n){return t.prototype.copy.call(this,e,n),this.object=e.object,this},n.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl),Od=function(t){function e(e,n){var i;void 0===n&&(n=16776960);var r=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]),a=new Vi;return a.setIndex(new wi(r,1)),a.setAttribute("position",new Ni([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)),(i=t.call(this,a,new il({color:n,toneMapped:!1}))||this).box=e,i.type="Box3Helper",i.geometry.computeBoundingSphere(),i}Yt(e,t);var n=e.prototype;return n.updateMatrixWorld=function(e){var n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),t.prototype.updateMatrixWorld.call(this,e))},n.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl),Bd=function(t){function e(e,n,i){var r;void 0===n&&(n=1),void 0===i&&(i=16776960);var a=i,o=new Vi;o.setAttribute("position",new Ni([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),o.computeBoundingSphere(),(r=t.call(this,o,new il({color:a,toneMapped:!1}))||this).type="PlaneHelper",r.plane=e,r.size=n;var s=new Vi;return s.setAttribute("position",new Ni([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),r.add(new sr(s,new gi({color:a,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}Yt(e,t);var n=e.prototype;return n.updateMatrixWorld=function(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),t.prototype.updateMatrixWorld.call(this,e)},n.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},e}(ul),Fd=new Ye,zd=function(t){function e(e,n,i,r,a,o){var s;return void 0===e&&(e=new Ye(0,0,1)),void 0===n&&(n=new Ye(0,0,0)),void 0===i&&(i=1),void 0===r&&(r=16776960),void 0===a&&(a=.2*i),void 0===o&&(o=.2*a),(s=t.call(this)||this).type="ArrowHelper",void 0===Ud&&((Ud=new Vi).setAttribute("position",new Ni([0,0,0,0,1,0],3)),(Id=new Kl(0,.5,1,5,1)).translate(0,-.5,0)),s.position.copy(n),s.line=new ul(Ud,new il({color:r,toneMapped:!1})),s.line.matrixAutoUpdate=!1,s.add(s.line),s.cone=new sr(Id,new gi({color:r,toneMapped:!1})),s.cone.matrixAutoUpdate=!1,s.add(s.cone),s.setDirection(e),s.setLength(i,a,o),s}Yt(e,t);var n=e.prototype;return n.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Fd.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Fd,e)}},n.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},n.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},n.copy=function(e){return t.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},n.dispose=function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()},e}(Jn),Gd=function(t){function e(e){var n;void 0===e&&(e=1);var i=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new Vi;r.setAttribute("position",new Ni(i,3)),r.setAttribute("color",new Ni([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var a=new il({vertexColors:!0,toneMapped:!1});return(n=t.call(this,r,a)||this).type="AxesHelper",n}Yt(e,t);var n=e.prototype;return n.setColors=function(t,e,n){var i=new mi,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this},n.dispose=function(){this.geometry.dispose(),this.material.dispose()},e}(dl),kd=function(){function t(){this.type="ShapePath",this.color=new mi,this.subPaths=[],this.currentPath=null}var e=t.prototype;return e.moveTo=function(t,e){return this.currentPath=new ql,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},e.lineTo=function(t,e){return this.currentPath.lineTo(t,e),this},e.quadraticCurveTo=function(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this},e.bezierCurveTo=function(t,e,n,i,r,a){return this.currentPath.bezierCurveTo(t,e,n,i,r,a),this},e.splineThru=function(t){return this.currentPath.splineThru(t),this},e.toShapes=function(t){function e(t,e){for(var n=e.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=e[r],s=e[a],l=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=e[a],l=-l,s=e[r],u=-u),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var c=u*(t.x-o.x)-l*(t.y-o.y);if(0===c)return!0;if(c<0)continue;i=!i}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return i}var n,i,r,a=Uu.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return i=o[0],(r=new ou).curves=i.curves,s.push(r),s;var l=!a(o[0].getPoints());l=t?!l:l;var u,c,h=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,v=o.length;m<v;m++)n=a(u=(i=o[m]).getPoints()),(n=t?!n:n)?(!l&&d[f]&&f++,d[f]={s:new ou,p:u},d[f].s.curves=i.curves,l&&f++,p[f]=[]):p[f].push({h:i,p:u[0]});if(!d[0])return function(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n],a=new ou;a.curves=r.curves,e.push(a)}return e}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var M=0,S=d.length;M<S;M++)for(var b=p[M],E=0;E<b.length;E++){for(var w=b[E],T=!0,A=0;A<d.length;A++)e(w.p,d[A].p)&&(M!==A&&y++,T?(T=!1,h[A].push(w)):g=!0);T&&h[M].push(w)}y>0&&!1===g&&(p=h)}for(var R=0,C=d.length;R<C;R++){r=d[R].s,s.push(r);for(var L=0,P=(c=p[R]).length;L<P;L++)r.holes.push(c[L].h)}return s},t}(),Hd=function(t){function e(e,n,i,r,a,o){return console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),t.call(this,e,n,i,r,a,o)||this}return Yt(e,t),e}(ur),Vd=function(t){function e(e,n,i,r){return console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),t.call(this,e,n,i,r)||this}return Yt(e,t),e}(Zl),Wd=function(t){function e(e,n,i,r){return console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),t.call(this,e,n,i,r)||this}return Yt(e,t),e}(Jl),Xd=function(t){function e(e,n,i,r,a,o,s){return console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),t.call(this,e,n,i,r,a,o,s)||this}return Yt(e,t),e}(Ql),jd=function(t){function e(e,n,i,r,a,o,s,l){return console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),t.call(this,e,n,i,r,a,o,s,l)||this}return Yt(e,t),e}(Kl),qd=function(t){function e(e,n){return console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(tu),Yd=function(t){function e(e,n){return console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(Du),Zd=function(t){function e(e,n){return console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(Bu),Jd=function(t){function e(e,n,i,r){return console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),t.call(this,e,n,i,r)||this}return Yt(e,t),e}(Yl),Kd=function(t){function e(e,n){return console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(Fu),Qd=function(t){function e(e,n,i,r){return console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),t.call(this,e,n,i,r)||this}return Yt(e,t),e}(Lr),$d=function(t){function e(e,n,i,r){return console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),t.call(this,e,n,i,r)||this}return Yt(e,t),e}($l),tp=function(t){function e(e,n,i,r,a,o){return console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),t.call(this,e,n,i,r,a,o)||this}return Yt(e,t),e}(zu),ep=function(t){function e(e,n){return console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(Gu),np=function(t){function e(e,n,i,r,a,o,s){return console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),t.call(this,e,n,i,r,a,o,s)||this}return Yt(e,t),e}(ku),ip=function(t){function e(e,n){return console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),t.call(this,e,n)||this}return Yt(e,t),e}(Hu),rp=function(t){function e(e,n,i,r,a){return console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),t.call(this,e,n,i,r,a)||this}return Yt(e,t),e}(Vu),ap=function(t){function e(e,n,i,r,a,o){return console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),t.call(this,e,n,i,r,a,o)||this}return Yt(e,t),e}(Wu),op=function(t){function e(e,n,i,r,a){return console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),t.call(this,e,n,i,r,a)||this}return Yt(e,t),e}(Xu),sp=function(){function t(t,e,n,i,r,a){void 0===a&&(a=0),this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new Ye,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new mi,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=a}var e=t.prototype;return e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var i=0,r=t.vertexColors.length;i<r;i++)this.vertexColors[i]=t.vertexColors[i].clone();return this},t}(),lp=function(){function t(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null}var e=t.prototype;return e.computeGroups=function(t){var e,n,i=[],r=void 0,a=t.faces;for(n=0;n<a.length;n++){var o=a[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*n-e.start,i.push(e)),e={start:3*n,materialIndex:r})}void 0!==e&&(e.count=3*n-e.start,i.push(e)),this.groups=i},e.fromGeometry=function(t){var e,n=t.faces,i=t.vertices,r=t.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=t.morphTargets,l=s.length;if(l>0){e=[];for(var u=0;u<l;u++)e[u]={name:s[u].name,data:[]};this.morphTargets.position=e}var c,h=t.morphNormals,d=h.length;if(d>0){c=[];for(var p=0;p<d;p++)c[p]={name:h[p].name,data:[]};this.morphTargets.normal=c}var f=t.skinIndices,m=t.skinWeights,v=f.length===i.length,g=m.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var y=0;y<n.length;y++){var _=n[y];this.vertices.push(i[_.a],i[_.b],i[_.c]);var x=_.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var M=_.normal;this.normals.push(M,M,M)}var S=_.vertexColors;if(3===S.length)this.colors.push(S[0],S[1],S[2]);else{var b=_.color;this.colors.push(b,b,b)}if(!0===a){var E=r[0][y];void 0!==E?this.uvs.push(E[0],E[1],E[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new me,new me,new me))}if(!0===o){var w=r[1][y];void 0!==w?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new me,new me,new me))}for(var T=0;T<l;T++){var A=s[T].vertices;e[T].data.push(A[_.a],A[_.b],A[_.c])}for(var R=0;R<d;R++){var C=h[R].vertexNormals[y];c[R].data.push(C.a,C.b,C.c)}v&&this.skinIndices.push(f[_.a],f[_.b],f[_.c]),g&&this.skinWeights.push(m[_.a],m[_.b],m[_.c])}return this.computeGroups(t),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},t}(),up=0,cp=new wn,hp=new Jn,dp=new Ye,pp=function(t){function e(){var e,n;e=t.call(this)||this,Object.defineProperty(e,"id",{value:up+=2}),e.uuid=fe.generateUUID(),e.name="",e.type="CompatibleGeometry",e.isCompatibleGeometry=!0,e.vertices=[],e.colors=[],e.faces=[],e.faceVertexUvs=[[]],e.morphTargets=[],e.morphNormals=[],e.skinWeights=[],e.skinIndices=[],e.lineDistances=[],e.boundingBox=null,e.boundingSphere=null,e.elementsNeedUpdate=!1,e.verticesNeedUpdate=!1,e.uvsNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.lineDistancesNeedUpdate=!1,e.groupsNeedUpdate=!1;var i=function(t){if(!0===e.verticesNeedUpdate){var n=e.attributes.position;void 0!==n&&(n.copyVector3sArray(t.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1}if(!0===e.normalsNeedUpdate){var i=e.attributes.normal;void 0!==i&&(i.copyVector3sArray(t.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1}if(!0===e.colorsNeedUpdate){var r=e.attributes.color;void 0!==r&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),e.colorsNeedUpdate=!1}if(e.uvsNeedUpdate){var a=e.attributes.uv;void 0!==a&&(a.copyVector2sArray(t.uvs),a.needsUpdate=!0),e.uvsNeedUpdate=!1}if(e.lineDistancesNeedUpdate){var o=e.attributes.lineDistance;void 0!==o&&(o.copyArray(t.lineDistances),o.needsUpdate=!0),e.lineDistancesNeedUpdate=!1}e.groupsNeedUpdate&&(t.computeGroups(object.geometry),e.groups=t.groups,e.groupsNeedUpdate=!1)};return e.updateBuffer=function(){if(e.faces.length>0)n?e.elementsNeedUpdate?(n=(new lp).fromGeometry(e),i(n)):i(n):function(t){var n=new Float32Array(3*t.vertices.length);if(e.setAttribute("position",new wi(n,3).copyVector3sArray(t.vertices)),t.normals.length>0){var i=new Float32Array(3*t.normals.length);e.setAttribute("normal",new wi(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);e.setAttribute("color",new wi(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var a=new Float32Array(2*t.uvs.length);e.setAttribute("uv",new wi(a,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);e.setAttribute("uv2",new wi(o,2).copyVector2sArray(t.uvs2))}for(var s in e.groups=t.groups,t.morphTargets){for(var l=[],u=t.morphTargets[s],c=0,h=u.length;c<h;c++){var d=u[c],p=new Ni(3*d.data.length,3);p.name=d.name,l.push(p.copyVector3sArray(d.data))}e.morphAttributes[s]=l}if(t.skinIndices.length>0){var f=new Ni(4*t.skinIndices.length,4);e.setAttribute("skinIndex",f.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var m=new Ni(4*t.skinWeights.length,4);e.setAttribute("skinWeight",m.copyVector4sArray(t.skinWeights))}null!==t.boundingSphere&&(e.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(e.boundingBox=t.boundingBox.clone())}(n=(new lp).fromGeometry(e));else if(e.vertices.length>0)if(e.attributes.position)i(e);else{var t=new Ni(3*e.vertices.length,3),r=new Ni(3*e.colors.length,3);if(e.setAttribute("position",t.copyVector3sArray(e.vertices)),e.setAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var a=new Ni(e.lineDistances.length,1);e.setAttribute("lineDistance",a.copyArray(e.lineDistances))}}},e}Yt(e,t);var n=e.prototype;return n.applyMatrix4=function(t){for(var e=(new ve).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(t)}for(var r=0,a=this.faces.length;r<a;r++){var o=this.faces[r];o.normal.applyMatrix3(e).normalize();for(var s=0,l=o.vertexNormals.length;s<l;s++)o.vertexNormals[s].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},n.rotateX=function(t){return cp.makeRotationX(t),this.applyMatrix4(cp),this},n.rotateY=function(t){return cp.makeRotationY(t),this.applyMatrix4(cp),this},n.rotateZ=function(t){return cp.makeRotationZ(t),this.applyMatrix4(cp),this},n.translate=function(t,e,n){return cp.makeTranslation(t,e,n),this.applyMatrix4(cp),this},n.scale=function(t,e,n){return cp.makeScale(t,e,n),this.applyMatrix4(cp),this},n.lookAt=function(t){return hp.lookAt(t),hp.updateMatrix(),this.applyMatrix4(hp.matrix),this},n.fromBufferGeometry=function(t){var e=this,n=null!==t.index?t.index:void 0,i=t.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position,a=i.normal,o=i.color,s=i.uv,l=i.uv2;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var u=0;u<r.count;u++)e.vertices.push((new Ye).fromBufferAttribute(r,u)),void 0!==o&&e.colors.push((new mi).fromBufferAttribute(o,u));function c(t,n,i,r){var u=void 0===o?[]:[e.colors[t].clone(),e.colors[n].clone(),e.colors[i].clone()],c=void 0===a?[]:[(new Ye).fromBufferAttribute(a,t),(new Ye).fromBufferAttribute(a,n),(new Ye).fromBufferAttribute(a,i)],h=new sp(t,n,i,c,u,r);e.faces.push(h),void 0!==s&&e.faceVertexUvs[0].push([(new me).fromBufferAttribute(s,t),(new me).fromBufferAttribute(s,n),(new me).fromBufferAttribute(s,i)]),void 0!==l&&e.faceVertexUvs[1].push([(new me).fromBufferAttribute(l,t),(new me).fromBufferAttribute(l,n),(new me).fromBufferAttribute(l,i)])}var h=t.groups;if(h.length>0)for(var d=0;d<h.length;d++)for(var p=h[d],f=p.start,m=f,v=f+p.count;m<v;m+=3)void 0!==n?c(n.getX(m),n.getX(m+1),n.getX(m+2),p.materialIndex):c(m,m+1,m+2,p.materialIndex);else if(void 0!==n)for(var g=0;g<n.count;g+=3)c(n.getX(g),n.getX(g+1),n.getX(g+2));else for(var y=0;y<r.count;y+=3)c(y,y+1,y+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},n.center=function(){return this.computeBoundingBox(),this.boundingBox.getCenter(dp).negate(),this.translate(dp.x,dp.y,dp.z),this},n.normalize=function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,i=new wn;return i.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix4(i),this},n.computeFaceNormals=function(){for(var t=new Ye,e=new Ye,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];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),r.normal.copy(t)}},n.computeVertexNormals=function(t){void 0===t&&(t=!0);for(var e=new Array(this.vertices.length),n=0,i=this.vertices.length;n<i;n++)e[n]=new Ye;if(t)for(var r=new Ye,a=new Ye,o=0,s=this.faces.length;o<s;o++){var l=this.faces[o],u=this.vertices[l.a],c=this.vertices[l.b],h=this.vertices[l.c];r.subVectors(h,c),a.subVectors(u,c),r.cross(a),e[l.a].add(r),e[l.b].add(r),e[l.c].add(r)}else{this.computeFaceNormals();for(var d=0,p=this.faces.length;d<p;d++){var f=this.faces[d];e[f.a].add(f.normal),e[f.b].add(f.normal),e[f.c].add(f.normal)}}for(var m=0,v=this.vertices.length;m<v;m++)e[m].normalize();for(var g=0,y=this.faces.length;g<y;g++){var _=this.faces[g],x=_.vertexNormals;3===x.length?(x[0].copy(e[_.a]),x[1].copy(e[_.b]),x[2].copy(e[_.c])):(x[0]=e[_.a].clone(),x[1]=e[_.b].clone(),x[2]=e[_.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},n.computeFlatVertexNormals=function(){this.computeFaceNormals();for(var t=0,e=this.faces.length;t<e;t++){var n=this.faces[t],i=n.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)},n.computeMorphNormals=function(){for(var t=0,e=this.faces.length;t<e;t++){var n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(var i=0,r=n.vertexNormals.length;i<r;i++)n.__originalVertexNormals[i]?n.__originalVertexNormals[i].copy(n.vertexNormals[i]):n.__originalVertexNormals[i]=n.vertexNormals[i].clone()}var a=new Geometry;a.faces=this.faces;for(var o=0,s=this.morphTargets.length;o<s;o++){if(!this.morphNormals[o]){this.morphNormals[o]={},this.morphNormals[o].faceNormals=[],this.morphNormals[o].vertexNormals=[];for(var l=this.morphNormals[o].faceNormals,u=this.morphNormals[o].vertexNormals,c=0,h=this.faces.length;c<h;c++){var d=new Ye,p={a:new Ye,b:new Ye,c:new Ye};l.push(d),u.push(p)}}var f=this.morphNormals[o];a.vertices=this.morphTargets[o].vertices,a.computeFaceNormals(),a.computeVertexNormals();for(var m=0,v=this.faces.length;m<v;m++){var g=this.faces[m],y=f.faceNormals[m],_=f.vertexNormals[m];y.copy(g.normal),_.a.copy(g.vertexNormals[0]),_.b.copy(g.vertexNormals[1]),_.c.copy(g.vertexNormals[2])}}for(var x=0,M=this.faces.length;x<M;x++){var S=this.faces[x];S.normal=S.__originalFaceNormal,S.vertexNormals=S.__originalVertexNormals}},n.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new Ke),this.boundingBox.setFromPoints(this.vertices)},n.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new vn),this.boundingSphere.setFromPoints(this.vertices)},n.merge=function(t,e,n){if(void 0===n&&(n=0),t&&t.isCompatibleGeometry){var i,r=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,l=t.faces,u=this.colors,c=t.colors;void 0!==e&&(i=(new ve).getNormalMatrix(e));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==e&&p.applyMatrix4(e),a.push(p)}for(var f=0,m=c.length;f<m;f++)u.push(c[f].clone());for(var v=0,g=l.length;v<g;v++){var y=l[v],_=void 0,x=void 0,M=y.vertexNormals,S=y.vertexColors,b=new sp(y.a+r,y.b+r,y.c+r);b.normal.copy(y.normal),void 0!==i&&b.normal.applyMatrix3(i).normalize();for(var E=0,w=M.length;E<w;E++)_=M[E].clone(),void 0!==i&&_.applyMatrix3(i).normalize(),b.vertexNormals.push(_);b.color.copy(y.color);for(var T=0,A=S.length;T<A;T++)x=S[T],b.vertexColors.push(x.clone());b.materialIndex=y.materialIndex+n,s.push(b)}for(var R=0,C=t.faceVertexUvs.length;R<C;R++){var L=t.faceVertexUvs[R];void 0===this.faceVertexUvs[R]&&(this.faceVertexUvs[R]=[]);for(var P=0,U=L.length;P<U;P++){for(var I=L[P],N=[],D=0,O=I.length;D<O;D++)N.push(I[D].clone());this.faceVertexUvs[R].push(N)}}}else console.error("THREE.CompatibleGeometry.merge(): geometry not an instance of THREE.CompatibleGeometry.",t)},n.mergeMesh=function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},n.mergeVertices=function(t){void 0===t&&(t=4);for(var e={},n=[],i=[],r=Math.pow(10,t),a=0,o=this.vertices.length;a<o;a++){var s=this.vertices[a],l=Math.round(s.x*r)+"_"+Math.round(s.y*r)+"_"+Math.round(s.z*r);void 0===e[l]?(e[l]=a,n.push(this.vertices[a]),i[a]=n.length-1):i[a]=i[e[l]]}for(var u=[],c=0,h=this.faces.length;c<h;c++){var d=this.faces[c];d.a=i[d.a],d.b=i[d.b],d.c=i[d.c];for(var p=[d.a,d.b,d.c],f=0;f<3;f++)if(p[f]===p[(f+1)%3]){u.push(c);break}}for(var m=u.length-1;m>=0;m--){var v=u[m];this.faces.splice(v,1);for(var g=0,y=this.faceVertexUvs.length;g<y;g++)this.faceVertexUvs[g].splice(v,1)}var _=this.vertices.length-n.length;return this.vertices=n,_},n.setFromPoints=function(t){this.vertices=[];for(var e=0,n=t.length;e<n;e++){var i=t[e];this.vertices.push(new Ye(i.x,i.y,i.z||0))}return this},n.sortFacesByMaterialIndex=function(){for(var t=this.faces,e=t.length,n=0;n<e;n++)t[n]._id=n;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===e&&(i=[]),o&&o.length===e&&(r=[]);for(var s=0;s<e;s++){var l=t[s]._id;i&&i.push(a[l]),r&&r.push(o[l])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},n.toJSON=function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}for(var o=[],s=[],l={},u=[],c={},h=[],d={},p=0;p<this.faces.length;p++){var f=this.faces[p],m=void 0!==this.faceVertexUvs[0][p],v=f.normal.length()>0,g=f.vertexNormals.length>0,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,_=f.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,m),x=E(x,4,v),x=E(x,5,g),x=E(x,6,y),x=E(x,7,_),o.push(x),o.push(f.a,f.b,f.c),o.push(f.materialIndex),m){var M=this.faceVertexUvs[0][p];o.push(A(M[0]),A(M[1]),A(M[2]))}if(v&&o.push(w(f.normal)),g){var S=f.vertexNormals;o.push(w(S[0]),w(S[1]),w(S[2]))}if(y&&o.push(T(f.color)),_){var b=f.vertexColors;o.push(T(b[0]),T(b[1]),T(b[2]))}}function E(t,e,n){return n?t|1<<e:t&~(1<<e)}function w(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==l[e]||(l[e]=s.length/3,s.push(t.x,t.y,t.z)),l[e]}function T(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==c[e]||(c[e]=u.length,u.push(t.getHex())),c[e]}function A(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]||(d[e]=h.length/2,h.push(t.x,t.y)),d[e]}return t.data={},t.data.vertices=i,t.data.normals=s,u.length>0&&(t.data.colors=u),h.length>0&&(t.data.uvs=[h]),t.data.faces=o,t},n.clone=function(){return(new e).copy(this)},n.copy=function(t){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=t.name;for(var e=t.vertices,n=0,i=e.length;n<i;n++)this.vertices.push(e[n].clone());for(var r=t.colors,a=0,o=r.length;a<o;a++)this.colors.push(r[a].clone());for(var s=t.faces,l=0,u=s.length;l<u;l++)this.faces.push(s[l].clone());for(var c=0,h=t.faceVertexUvs.length;c<h;c++){var d=t.faceVertexUvs[c];void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var p=0,f=d.length;p<f;p++){for(var m=d[p],v=[],g=0,y=m.length;g<y;g++){var _=m[g];v.push(_.clone())}this.faceVertexUvs[c].push(v)}}for(var x=t.morphTargets,M=0,S=x.length;M<S;M++){var b={};if(b.name=x[M].name,void 0!==x[M].vertices){b.vertices=[];for(var E=0,w=x[M].vertices.length;E<w;E++)b.vertices.push(x[M].vertices[E].clone())}if(void 0!==x[M].normals){b.normals=[];for(var T=0,A=x[M].normals.length;T<A;T++)b.normals.push(x[M].normals[T].clone())}this.morphTargets.push(b)}for(var R=t.morphNormals,C=0,L=R.length;C<L;C++){var P={};if(void 0!==R[C].vertexNormals){P.vertexNormals=[];for(var U=0,I=R[C].vertexNormals.length;U<I;U++){var N=R[C].vertexNormals[U],D={};D.a=N.a.clone(),D.b=N.b.clone(),D.c=N.c.clone(),P.vertexNormals.push(D)}}if(void 0!==R[C].faceNormals){P.faceNormals=[];for(var O=0,B=R[C].faceNormals.length;O<B;O++)P.faceNormals.push(R[C].faceNormals[O].clone())}this.morphNormals.push(P)}for(var F=t.skinWeights,z=0,G=F.length;z<G;z++)this.skinWeights.push(F[z].clone());for(var k=t.skinIndices,H=0,V=k.length;H<V;H++)this.skinIndices.push(k[H].clone());for(var W=t.lineDistances,X=0,j=W.length;X<j;X++)this.lineDistances.push(W[X]);var q=t.boundingBox;null!==q&&(this.boundingBox=q.clone());var Y=t.boundingSphere;return null!==Y&&(this.boundingSphere=Y.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},n.dispose=function(){this.dispatchEvent({type:"dispose"})},e}(Vi);"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e),t.ACESFilmicToneMapping=m,t.AddEquation=s,t.AddOperation=c,t.AdditiveAnimationBlendMode=Rt,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysCompare=519,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=eh,t.AmbientLightProbe=gh,t.AnimationAction=jh,t.AnimationClip=Ec,t.AnimationLoader=Nc,t.AnimationMixer=Yh,t.AnimationObjectGroup=Xh,t.AnimationUtils=hc,t.ArcCurve=Rl,t.ArrayCamera=Qo,t.ArrowHelper=zd,t.Audio=Ch,t.AudioAnalyser=Dh,t.AudioContext=fh,t.AudioListener=Rh,t.AudioLoader=mh,t.AxesHelper=Gd,t.BackSide=o,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.Bone=Vs,t.BooleanKeyframeTrack=gc,t.Box2=od,t.Box3=Ke,t.Box3Helper=Od,t.BoxBufferGeometry=Hd,t.BoxGeometry=ur,t.BoxHelper=Dd,t.BufferAttribute=wi,t.BufferGeometry=Vi,t.BufferGeometryLoader=lh,t.ByteType=1010,t.Cache=Ac,t.Camera=mr,t.CameraHelper=Ld,t.CanvasTexture=wl,t.CapsuleBufferGeometry=Vd,t.CapsuleGeometry=Zl,t.CatmullRomCurve3=Nl,t.CineonToneMapping=f,t.CircleBufferGeometry=Wd,t.CircleGeometry=Jl,t.ClampToEdgeWrapping=E,t.Clock=Sh,t.Color=mi,t.ColorKeyframeTrack=yc,t.ColorManagement=Ie,t.CompatibleGeometry=pp,t.CompressedArrayTexture=El,t.CompressedTexture=bl,t.CompressedTextureLoader=Dc,t.ConeBufferGeometry=Xd,t.ConeGeometry=Ql,t.CubeCamera=yr,t.CubeReflectionMapping=y,t.CubeRefractionMapping=_,t.CubeTexture=_r,t.CubeTextureLoader=Bc,t.CubeUVReflectionMapping=S,t.CubicBezierCurve=Fl,t.CubicBezierCurve3=zl,t.CubicInterpolant=pc,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=Tl,t.CurvePath=jl,t.CustomBlending=5,t.CustomToneMapping=v,t.CylinderBufferGeometry=jd,t.CylinderGeometry=Kl,t.Cylindrical=rd,t.Data3DTexture=We,t.DataArrayTexture=He,t.DataTexture=Ws,t.DataTextureLoader=Fc,t.DataUtils=Si,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Cc,t.DepthFormat=H,t.DepthStencilFormat=V,t.DepthTexture=ns,t.DirectionalLight=th,t.DirectionalLightHelper=Ad,t.DiscreteInterpolant=mc,t.DisplayP3ColorSpace=Nt,t.DodecahedronBufferGeometry=qd,t.DodecahedronGeometry=tu,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicCopyUsage=35050,t.DynamicDrawUsage=35048,t.DynamicReadUsage=35049,t.EdgesGeometry=au,t.EllipseCurve=Al,t.EqualCompare=514,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=x,t.EquirectangularRefractionMapping=M,t.Euler=Dn,t.EventDispatcher=te,t.ExtrudeBufferGeometry=Yd,t.ExtrudeGeometry=Du,t.Face3=sp,t.FileLoader=Ic,t.Float16BufferAttribute=Ii,t.Float32BufferAttribute=Ni,t.Float64BufferAttribute=Di,t.FloatType=O,t.Fog=cs,t.FogExp2=us,t.FramebufferTexture=Sl,t.FrontSide=a,t.Frustum=Ar,t.GLBufferAttribute=$h,t.GLSL1="100",t.GLSL3=Bt,t.GreaterCompare=516,t.GreaterDepth=6,t.GreaterEqualCompare=518,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Sd,t.Group=$o,t.HalfFloatType=B,t.HemisphereLight=kc,t.HemisphereLightHelper=Md,t.HemisphereLightProbe=vh,t.IcosahedronBufferGeometry=Zd,t.IcosahedronGeometry=Bu,t.ImageBitmapLoader=ph,t.ImageLoader=Oc,t.ImageUtils=Ne,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=Ys,t.InstancedBufferGeometry=sh,t.InstancedInterleavedBuffer=Qh,t.InstancedMesh=nl,t.Int16BufferAttribute=Ci,t.Int32BufferAttribute=Pi,t.Int8BufferAttribute=Ti,t.IntType=N,t.InterleavedBuffer=ds,t.InterleavedBufferAttribute=fs,t.Interpolant=dc,t.InterpolateDiscrete=Mt,t.InterpolateLinear=St,t.InterpolateSmooth=bt,t.InvertStencilOp=5386,t.KeepStencilOp=Dt,t.KeyframeTrack=vc,t.LOD=Us,t.LatheBufferGeometry=Jd,t.LatheGeometry=Yl,t.Layers=On,t.LessCompare=513,t.LessDepth=2,t.LessEqualCompare=515,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=Gc,t.LightProbe=rh,t.Line=ul,t.Line3=ud,t.LineBasicMaterial=il,t.LineCurve=Gl,t.LineCurve3=kl,t.LineDashedMaterial=rc,t.LineLoop=pl,t.LineSegments=dl,t.LinearEncoding=Ct,t.LinearFilter=C,t.LinearInterpolant=fc,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=P,t.LinearMipmapNearestFilter=L,t.LinearSRGBColorSpace=It,t.LinearToneMapping=d,t.Loader=Lc,t.LoaderUtils=oh,t.LoadingManager=Rc,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=ci,t.MaterialLoader=ah,t.MathUtils=fe,t.Matrix3=ve,t.Matrix4=wn,t.MaxEquation=104,t.Mesh=sr,t.MeshBasicMaterial=gi,t.MeshDepthMaterial=jo,t.MeshDistanceMaterial=qo,t.MeshLambertMaterial=nc,t.MeshMatcapMaterial=ic,t.MeshNormalMaterial=ec,t.MeshPhongMaterial=$u,t.MeshPhysicalMaterial=Qu,t.MeshStandardMaterial=Ku,t.MeshToonMaterial=tc,t.MinEquation=103,t.MirroredRepeatWrapping=w,t.MixOperation=u,t.MultiplyBlending=4,t.MultiplyOperation=l,t.NearestFilter=T,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=R,t.NearestMipmapNearestFilter=A,t.NeverCompare=512,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColorSpace=Pt,t.NoToneMapping=h,t.NormalAnimationBlendMode=At,t.NormalBlending=1,t.NotEqualCompare=517,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=_c,t.Object3D=Jn,t.ObjectLoader=uh,t.ObjectSpaceNormalMap=1,t.OctahedronBufferGeometry=Kd,t.OctahedronGeometry=Fu,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=kr,t.PCFShadowMap=n,t.PCFSoftShadowMap=i,t.PMREMGenerator=Jr,t.Path=ql,t.PerspectiveCamera=vr,t.Plane=Er,t.PlaneBufferGeometry=Qd,t.PlaneGeometry=Lr,t.PlaneHelper=Bd,t.PointLight=Qc,t.PointLightHelper=gd,t.Points=_l,t.PointsMaterial=fl,t.PolarGridHelper=bd,t.PolyhedronBufferGeometry=$d,t.PolyhedronGeometry=$l,t.PositionalAudio=Nh,t.PropertyBinding=Wh,t.PropertyMixer=Oh,t.QuadraticBezierCurve=Hl,t.QuadraticBezierCurve3=Vl,t.Quaternion=qe,t.QuaternionKeyframeTrack=Mc,t.QuaternionLinearInterpolant=xc,t.RED_GREEN_RGTC2_Format=_t,t.RED_RGTC1_Format=36283,t.REVISION=e,t.RGBADepthPacking=3201,t.RGBAFormat=k,t.RGBAIntegerFormat=j,t.RGBA_ASTC_10x10_Format=ft,t.RGBA_ASTC_10x5_Format=ht,t.RGBA_ASTC_10x6_Format=dt,t.RGBA_ASTC_10x8_Format=pt,t.RGBA_ASTC_12x10_Format=mt,t.RGBA_ASTC_12x12_Format=vt,t.RGBA_ASTC_4x4_Format=it,t.RGBA_ASTC_5x4_Format=rt,t.RGBA_ASTC_5x5_Format=at,t.RGBA_ASTC_6x5_Format=ot,t.RGBA_ASTC_6x6_Format=st,t.RGBA_ASTC_8x5_Format=lt,t.RGBA_ASTC_8x6_Format=ut,t.RGBA_ASTC_8x8_Format=ct,t.RGBA_BPTC_Format=gt,t.RGBA_ETC2_EAC_Format=nt,t.RGBA_PVRTC_2BPPV1_Format=tt,t.RGBA_PVRTC_4BPPV1_Format=$,t.RGBA_S3TC_DXT1_Format=Y,t.RGBA_S3TC_DXT3_Format=Z,t.RGBA_S3TC_DXT5_Format=J,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=et,t.RGB_PVRTC_2BPPV1_Format=Q,t.RGB_PVRTC_4BPPV1_Format=K,t.RGB_S3TC_DXT1_Format=q,t.RGFormat=1030,t.RGIntegerFormat=X,t.RawShaderMaterial=Ju,t.Ray=En,t.Raycaster=td,t.RectAreaLight=nh,t.RedFormat=1028,t.RedIntegerFormat=W,t.ReinhardToneMapping=p,t.RepeatWrapping=b,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.RingBufferGeometry=tp,t.RingGeometry=zu,t.SIGNED_RED_GREEN_RGTC2_Format=xt,t.SIGNED_RED_RGTC1_Format=yt,t.SRGBColorSpace=Ut,t.Scene=hs,t.ShaderChunk=Pr,t.ShaderLib=Ir,t.ShaderMaterial=fr,t.ShadowMaterial=Zu,t.Shape=ou,t.ShapeBufferGeometry=ep,t.ShapeGeometry=Gu,t.ShapePath=kd,t.ShapeUtils=Uu,t.ShortType=1011,t.Skeleton=qs,t.SkeletonHelper=md,t.SkinnedMesh=Hs,t.Source=Oe,t.Sphere=vn,t.SphereBufferGeometry=np,t.SphereGeometry=ku,t.Spherical=id,t.SphericalHarmonics3=ih,t.SplineCurve=Wl,t.SpotLight=qc,t.SpotLightHelper=hd,t.Sprite=Rs,t.SpriteMaterial=ms,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=Ot,t.StaticReadUsage=35045,t.StereoCamera=Mh,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=Sc,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TetrahedronBufferGeometry=ip,t.TetrahedronGeometry=Hu,t.Texture=ze,t.TextureLoader=zc,t.TorusBufferGeometry=rp,t.TorusGeometry=Vu,t.TorusKnotBufferGeometry=ap,t.TorusKnotGeometry=Wu,t.Triangle=li,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=op,t.TubeGeometry=Xu,t.TwoPassDoubleSide=2,t.UVMapping=g,t.Uint16BufferAttribute=Li,t.Uint32BufferAttribute=Ui,t.Uint8BufferAttribute=Ai,t.Uint8ClampedBufferAttribute=Ri,t.Uniform=Zh,t.UniformsGroup=Kh,t.UniformsLib=Ur,t.UniformsUtils=pr,t.UnsignedByteType=U,t.UnsignedInt248Type=G,t.UnsignedIntType=D,t.UnsignedShort4444Type=F,t.UnsignedShort5551Type=z,t.UnsignedShortType=I,t.VSMShadowMap=r,t.Vector2=me,t.Vector3=Ye,t.Vector4=Ge,t.VectorKeyframeTrack=bc,t.VideoTexture=Ml,t.WebGL1Renderer=ss,t.WebGL3DRenderTarget=Xe,t.WebGLAnimation=Rr,t.WebGLArrayRenderTarget=Ve,t.WebGLAttributes=Cr,t.WebGLBackground=Dr,t.WebGLBindingStates=Or,t.WebGLBufferRenderer=Br,t.WebGLCapabilities=Fr,t.WebGLClipping=zr,t.WebGLCoordinateSystem=zt,t.WebGLCubeMaps=Gr,t.WebGLCubeRenderTarget=xr,t.WebGLCubeUVMaps=ea,t.WebGLExtensions=na,t.WebGLGeometries=ia,t.WebGLIndexedBufferRenderer=ra,t.WebGLInfo=aa,t.WebGLMaterials=rs,t.WebGLMorphtargets=la,t.WebGLMultipleRenderTargets=je,t.WebGLObjects=ua,t.WebGLProgram=Lo,t.WebGLPrograms=No,t.WebGLProperties=Do,t.WebGLRenderList=Fo,t.WebGLRenderLists=zo,t.WebGLRenderStates=Xo,t.WebGLRenderTarget=ke,t.WebGLRenderer=os,t.WebGLShader=mo,t.WebGLShaderCache=Uo,t.WebGLShadowMap=Yo,t.WebGLState=Zo,t.WebGLTextures=Jo,t.WebGLUniforms=fo,t.WebGLUniformsGroups=as,t.WebGLUtils=Ko,t.WebGPUCoordinateSystem=Gt,t.WebXRManager=is,t.WireframeGeometry=ju,t.WrapAroundEnding=Tt,t.ZeroCurvatureEnding=Et,t.ZeroFactor=200,t.ZeroSlopeEnding=wt,t.ZeroStencilOp=0,t._SRGBAFormat=Ft,t.createElementNS=Me,t.sRGBEncoding=Lt}));