/*! For license information please see bundle.js.LICENSE.txt */
(()=>{var e={286:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var a=0;a<this.length;a++){var o=this[a][0];null!=o&&(i[o]=!0)}for(var s=0;s<e.length;s++){var l=[].concat(e[s]);r&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),t.push(l))}},t}},672:e=>{"use strict";e.exports=function(e,t){return t=t||{},e&&(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e)}},39:(e,t,n)=>{function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e=function(e){"use strict";var t,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(n){u=function(e,t,n){return e[t]=n}}function c(e,n,r,i){var a,o,s,l;return n=n&&n.prototype instanceof g?n:g,n=Object.create(n.prototype),i=new E(i||[]),n._invoke=(a=e,o=r,s=i,l=d,function(e,n){if(l===f)throw new Error("Generator is already running");if(l===m){if("throw"===e)throw n;return L()}for(s.method=e,s.arg=n;;){var r=s.delegate;if(r){var i=function e(n,r){var i;if((i=n.iterator[r.method])===t){if(r.delegate=null,"throw"===r.method){if(n.iterator.return&&(r.method="return",r.arg=t,e(n,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}return"throw"===(i=h(i,n.iterator,r.arg)).type?(r.method="throw",r.arg=i.arg,r.delegate=null,v):(i=i.arg)?i.done?(r[n.resultName]=i.value,r.next=n.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}(r,s);if(i){if(i===v)continue;return i}}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if(l===d)throw l=m,s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(l=f,"normal"===(i=h(a,o,s)).type){if(l=s.done?m:p,i.arg!==v)return{value:i.arg,done:s.done}}else"throw"===i.type&&(l=m,s.method="throw",s.arg=i.arg)}}),n}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function g(){}function y(){}function x(){}var _={};u(_,o,(function(){return this})),(a=(a=Object.getPrototypeOf)&&a(a(A([]))))&&a!==n&&i.call(a,o)&&(_=a);var b=x.prototype=g.prototype=Object.create(_);function w(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function M(e,t){var n;this._invoke=function(a,o){function s(){return new t((function(n,s){!function n(a,o,s,l){if("throw"!==(a=h(e[a],e,o)).type){var u=a.arg;return(o=u.value)&&"object"===r(o)&&i.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(o).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(a.arg)}(a,o,n,s)}))}return n=n?n.then(s,s):s()}}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function A(e){if(e){if(n=e[o])return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n,r=-1;return(n=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}).next=n}}return{next:L}}function L(){return{value:t,done:!0}}return u(b,"constructor",y.prototype=x),u(x,"constructor",y),y.displayName=u(x,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,u(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},w(M.prototype),u(M.prototype,s,(function(){return this})),e.AsyncIterator=M,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new M(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},w(b),u(b,l,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=A,E.prototype={constructor:E,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(T),!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 e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;0<=a;--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 new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}var o=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r,i=n.completion;return"throw"===i.type&&(r=i.arg,T(n)),r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:A(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),v}},e}("object"===r(e=n.nmd(e))?e.exports:{});try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},733:(e,t,n)=>{"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function s(e){i(o,r,a,s,l,"next",e)}function l(e){i(o,r,a,s,l,"throw",e)}s(void 0)}))}}function o(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){if(e=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t))return(t=Object.getOwnPropertyDescriptor(e,t)).get?t.get.call(n):t.value})(e,t,n||e)}function u(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)),r}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v(e);return f(this,t?(n=v(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments))}}function f(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function x(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),e}n.r(t),n.d(t,{ACESFilmicToneMapping:()=>xe,AddEquation:()=>G,AddOperation:()=>fe,AdditiveAnimationBlendMode:()=>cn,AdditiveBlending:()=>B,AlphaFormat:()=>$e,AlwaysDepth:()=>ae,AlwaysStencilFunc:()=>Hn,AmbientLight:()=>id,AmbientLightProbe:()=>Td,AnimationClip:()=>Ah,AnimationLoader:()=>Dh,AnimationMixer:()=>Qd,AnimationObjectGroup:()=>Zd,AnimationUtils:()=>fh,ArcCurve:()=>ic,ArrayCamera:()=>kl,ArrowHelper:()=>Hp,Audio:()=>Od,AudioAnalyser:()=>Gd,AudioContext:()=>wd,AudioListener:()=>Nd,AudioLoader:()=>Md,AxesHelper:()=>Gp,AxisHelper:()=>function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Gp(e)},BackSide:()=>P,BasicDepthPacking:()=>wn,BasicShadowMap:()=>A,BinaryTextureLoader:()=>function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Bh(e)},Bone:()=>fu,BooleanKeyframeTrack:()=>_h,BoundingBoxHelper:()=>function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Fp(e,t)},Box2:()=>lp,Box3:()=>Lr,Box3Helper:()=>Bp,BoxBufferGeometry:()=>Ba,BoxGeometry:()=>Ba,BoxHelper:()=>Fp,BufferAttribute:()=>Ki,BufferGeometry:()=>ya,BufferGeometryLoader:()=>dd,ByteType:()=>Ge,Cache:()=>Lh,Camera:()=>Va,CameraHelper:()=>Pp,CanvasRenderer:()=>function(){console.error("THREE.CanvasRenderer has been removed")},CanvasTexture:()=>Wu,CatmullRomCurve3:()=>cc,CineonToneMapping:()=>ye,CircleBufferGeometry:()=>qu,CircleGeometry:()=>qu,ClampToEdgeWrapping:()=>ke,Clock:()=>kd,Color:()=>Xi,ColorKeyframeTrack:()=>bh,CompressedTexture:()=>Vu,CompressedTextureLoader:()=>Nh,ConeBufferGeometry:()=>Yu,ConeGeometry:()=>Yu,CubeCamera:()=>ja,CubeReflectionMapping:()=>we,CubeRefractionMapping:()=>Me,CubeTexture:()=>qa,CubeTextureLoader:()=>Fh,CubeUVReflectionMapping:()=>Ee,CubeUVRefractionMapping:()=>Ae,CubicBezierCurve:()=>fc,CubicBezierCurve3:()=>mc,CubicInterpolant:()=>vh,CullFaceBack:()=>S,CullFaceFront:()=>T,CullFaceFrontBack:()=>E,CullFaceNone:()=>M,Curve:()=>nc,CurvePath:()=>Uh,CustomBlending:()=>H,CustomToneMapping:()=>_e,CylinderBufferGeometry:()=>Xu,CylinderGeometry:()=>Xu,Cylindrical:()=>op,DataTexture:()=>mu,DataTexture2DArray:()=>Wo,DataTexture3D:()=>jo,DataTextureLoader:()=>Bh,DataUtils:()=>jp,DecrementStencilOp:()=>Rn,DecrementWrapStencilOp:()=>Pn,DefaultLoadingManager:()=>Rh,DepthFormat:()=>at,DepthStencilFormat:()=>ot,DepthTexture:()=>ju,DirectionalLight:()=>rd,DirectionalLightHelper:()=>kp,DiscreteInterpolant:()=>yh,DodecahedronBufferGeometry:()=>Zu,DodecahedronGeometry:()=>Zu,DoubleSide:()=>I,DstAlphaFactor:()=>$,DstColorFactor:()=>te,DynamicBufferAttribute:()=>function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Ki(e,t).setUsage(Vn)},DynamicCopyUsage:()=>Jn,DynamicDrawUsage:()=>Vn,DynamicReadUsage:()=>qn,EdgesGeometry:()=>tc,EdgesHelper:()=>function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Iu(new tc(e.geometry),new Su({color:void 0!==t?t:16777215}))},EllipseCurve:()=>rc,EqualDepth:()=>le,EqualStencilFunc:()=>On,EquirectangularReflectionMapping:()=>Se,EquirectangularRefractionMapping:()=>Te,Euler:()=>di,EventDispatcher:()=>$n,ExtrudeBufferGeometry:()=>Hc,ExtrudeGeometry:()=>Hc,FaceColors:()=>Jp,FileLoader:()=>Ih,FlatShading:()=>D,Float16BufferAttribute:()=>aa,Float32Attribute:()=>function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new oa(e,t)},Float32BufferAttribute:()=>oa,Float64Attribute:()=>function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new sa(e,t)},Float64BufferAttribute:()=>sa,FloatType:()=>Xe,Fog:()=>Bl,FogExp2:()=>Fl,Font:()=>xd,FontLoader:()=>bd,FrontSide:()=>C,Frustum:()=>eo,GLBufferAttribute:()=>tp,GLSL1:()=>Kn,GLSL3:()=>Qn,GammaEncoding:()=>vn,GreaterDepth:()=>ce,GreaterEqualDepth:()=>ue,GreaterEqualStencilFunc:()=>Un,GreaterStencilFunc:()=>Bn,GridHelper:()=>Sp,Group:()=>Rl,HalfFloatType:()=>Ye,HemisphereLight:()=>Wh,HemisphereLightHelper:()=>Mp,HemisphereLightProbe:()=>Sd,IcosahedronBufferGeometry:()=>Vc,IcosahedronGeometry:()=>Vc,ImageBitmapLoader:()=>gd,ImageLoader:()=>Oh,ImageUtils:()=>vr,ImmediateRenderObject:()=>dp,IncrementStencilOp:()=>kn,IncrementWrapStencilOp:()=>Cn,InstancedBufferAttribute:()=>hd,InstancedBufferGeometry:()=>cd,InstancedInterleavedBuffer:()=>ep,InstancedMesh:()=>Mu,Int16Attribute:()=>function(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new ta(e,t)},Int16BufferAttribute:()=>ta,Int32Attribute:()=>function(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new ra(e,t)},Int32BufferAttribute:()=>ra,Int8Attribute:()=>function(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Qi(e,t)},Int8BufferAttribute:()=>Qi,IntType:()=>je,InterleavedBuffer:()=>Ul,InterleavedBufferAttribute:()=>Gl,Interpolant:()=>mh,InterpolateDiscrete:()=>nn,InterpolateLinear:()=>rn,InterpolateSmooth:()=>an,InvertStencilOp:()=>In,JSONLoader:()=>function(){console.error("THREE.JSONLoader has been removed.")},KeepStencilOp:()=>An,KeyframeTrack:()=>xh,LOD:()=>su,LatheBufferGeometry:()=>Wc,LatheGeometry:()=>Wc,Layers:()=>pi,LensFlare:()=>function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},LessDepth:()=>oe,LessEqualDepth:()=>se,LessEqualStencilFunc:()=>Fn,LessStencilFunc:()=>Nn,Light:()=>Vh,LightProbe:()=>sd,Line:()=>Ru,Line3:()=>hp,LineBasicMaterial:()=>Su,LineCurve:()=>vc,LineCurve3:()=>gc,LineDashedMaterial:()=>dh,LineLoop:()=>Du,LinePieces:()=>Xp,LineSegments:()=>Iu,LineStrip:()=>qp,LinearEncoding:()=>fn,LinearFilter:()=>Oe,LinearInterpolant:()=>gh,LinearMipMapLinearFilter:()=>Ue,LinearMipMapNearestFilter:()=>Be,LinearMipmapLinearFilter:()=>ze,LinearMipmapNearestFilter:()=>Fe,LinearToneMapping:()=>ve,Loader:()=>Ch,LoaderUtils:()=>ud,LoadingManager:()=>kh,LogLuvEncoding:()=>yn,LoopOnce:()=>$t,LoopPingPong:()=>tn,LoopRepeat:()=>en,LuminanceAlphaFormat:()=>rt,LuminanceFormat:()=>nt,MOUSE:()=>b,Material:()=>Ui,MaterialLoader:()=>ld,Math:()=>dr,MathUtils:()=>dr,Matrix3:()=>mr,Matrix4:()=>ni,MaxEquation:()=>q,Mesh:()=>Oa,MeshBasicMaterial:()=>Yi,MeshDepthMaterial:()=>Ml,MeshDistanceMaterial:()=>Sl,MeshFaceMaterial:()=>function(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e},MeshLambertMaterial:()=>ch,MeshMatcapMaterial:()=>hh,MeshNormalMaterial:()=>uh,MeshPhongMaterial:()=>sh,MeshPhysicalMaterial:()=>oh,MeshStandardMaterial:()=>ah,MeshToonMaterial:()=>lh,MinEquation:()=>j,MirroredRepeatWrapping:()=>Re,MixOperation:()=>pe,MultiMaterial:()=>function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,(e.materials=e).clone=function(){return e.slice()},e},MultiplyBlending:()=>U,MultiplyOperation:()=>de,NearestFilter:()=>Ce,NearestMipMapLinearFilter:()=>Ne,NearestMipMapNearestFilter:()=>Ie,NearestMipmapLinearFilter:()=>De,NearestMipmapNearestFilter:()=>Pe,NeverDepth:()=>ie,NeverStencilFunc:()=>Dn,NoBlending:()=>O,NoColors:()=>Yp,NoToneMapping:()=>me,NormalAnimationBlendMode:()=>un,NormalBlending:()=>F,NotEqualDepth:()=>he,NotEqualStencilFunc:()=>zn,NumberKeyframeTrack:()=>wh,Object3D:()=>Ai,ObjectLoader:()=>pd,ObjectSpaceNormalMap:()=>Tn,OctahedronBufferGeometry:()=>jc,OctahedronGeometry:()=>jc,OneFactor:()=>Y,OneMinusDstAlphaFactor:()=>ee,OneMinusDstColorFactor:()=>ne,OneMinusSrcAlphaFactor:()=>Q,OneMinusSrcColorFactor:()=>Z,OrthographicCamera:()=>fo,PCFShadowMap:()=>L,PCFSoftShadowMap:()=>k,PMREMGenerator:()=>Ro,ParametricBufferGeometry:()=>qc,ParametricGeometry:()=>qc,Particle:()=>function(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new ru(e)},ParticleBasicMaterial:()=>function(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Nu(e)},ParticleSystem:()=>function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Uu(e,t)},ParticleSystemMaterial:()=>function(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Nu(e)},Path:()=>Hh,PerspectiveCamera:()=>Wa,Plane:()=>Ka,PlaneBufferGeometry:()=>ro,PlaneGeometry:()=>ro,PlaneHelper:()=>zp,PointCloud:()=>function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Uu(e,t)},PointCloudMaterial:()=>function(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Nu(e)},PointLight:()=>td,PointLightHelper:()=>xp,Points:()=>Uu,PointsMaterial:()=>Nu,PolarGridHelper:()=>Tp,PolyhedronBufferGeometry:()=>Ju,PolyhedronGeometry:()=>Ju,PositionalAudio:()=>Hd,PropertyBinding:()=>Jd,PropertyMixer:()=>Vd,QuadraticBezierCurve:()=>yc,QuadraticBezierCurve3:()=>xc,Quaternion:()=>Sr,QuaternionKeyframeTrack:()=>Sh,QuaternionLinearInterpolant:()=>Mh,REVISION:()=>_,RGBADepthPacking:()=>Mn,RGBAFormat:()=>tt,RGBAIntegerFormat:()=>dt,RGBA_ASTC_10x10_Format:()=>Nt,RGBA_ASTC_10x5_Format:()=>Pt,RGBA_ASTC_10x6_Format:()=>It,RGBA_ASTC_10x8_Format:()=>Dt,RGBA_ASTC_12x10_Format:()=>Ot,RGBA_ASTC_12x12_Format:()=>Ft,RGBA_ASTC_4x4_Format:()=>St,RGBA_ASTC_5x4_Format:()=>Tt,RGBA_ASTC_5x5_Format:()=>Et,RGBA_ASTC_6x5_Format:()=>At,RGBA_ASTC_6x6_Format:()=>Lt,RGBA_ASTC_8x5_Format:()=>kt,RGBA_ASTC_8x6_Format:()=>Rt,RGBA_ASTC_8x8_Format:()=>Ct,RGBA_BPTC_Format:()=>Bt,RGBA_ETC2_EAC_Format:()=>Mt,RGBA_PVRTC_2BPPV1_Format:()=>_t,RGBA_PVRTC_4BPPV1_Format:()=>xt,RGBA_S3TC_DXT1_Format:()=>ft,RGBA_S3TC_DXT3_Format:()=>mt,RGBA_S3TC_DXT5_Format:()=>vt,RGBDEncoding:()=>bn,RGBEEncoding:()=>gn,RGBEFormat:()=>it,RGBFormat:()=>et,RGBIntegerFormat:()=>ht,RGBM16Encoding:()=>_n,RGBM7Encoding:()=>xn,RGB_ETC1_Format:()=>bt,RGB_ETC2_Format:()=>wt,RGB_PVRTC_2BPPV1_Format:()=>yt,RGB_PVRTC_4BPPV1_Format:()=>gt,RGB_S3TC_DXT1_Format:()=>pt,RGFormat:()=>ut,RGIntegerFormat:()=>ct,RawShaderMaterial:()=>mo,Ray:()=>ti,Raycaster:()=>np,RectAreaLight:()=>ad,RedFormat:()=>st,RedIntegerFormat:()=>lt,ReinhardToneMapping:()=>ge,RepeatWrapping:()=>Le,ReplaceStencilOp:()=>Ln,ReverseSubtractEquation:()=>W,RingBufferGeometry:()=>Xc,RingGeometry:()=>Xc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Zt,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Xt,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Yt,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Jt,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Kt,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Qt,SRGB8_ALPHA8_ASTC_4x4_Format:()=>zt,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Ut,SRGB8_ALPHA8_ASTC_5x5_Format:()=>Ht,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Gt,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Vt,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Wt,SRGB8_ALPHA8_ASTC_8x6_Format:()=>jt,SRGB8_ALPHA8_ASTC_8x8_Format:()=>qt,Scene:()=>zl,SceneUtils:()=>Kp,ShaderChunk:()=>io,ShaderLib:()=>oo,ShaderMaterial:()=>Ga,ShadowMaterial:()=>ih,Shape:()=>Gh,ShapeBufferGeometry:()=>Yc,ShapeGeometry:()=>Yc,ShapePath:()=>yd,ShapeUtils:()=>Bc,ShortType:()=>Ve,Skeleton:()=>yu,SkeletonHelper:()=>yp,SkinnedMesh:()=>pu,SmoothShading:()=>N,Sphere:()=>Xr,SphereBufferGeometry:()=>Jc,SphereGeometry:()=>Jc,Spherical:()=>ap,SphericalHarmonics3:()=>od,SplineCurve:()=>_c,SpotLight:()=>Zh,SpotLightHelper:()=>fp,Sprite:()=>ru,SpriteMaterial:()=>Wl,SrcAlphaFactor:()=>K,SrcAlphaSaturateFactor:()=>re,SrcColorFactor:()=>J,StaticCopyUsage:()=>Yn,StaticDrawUsage:()=>Gn,StaticReadUsage:()=>jn,StereoCamera:()=>Ld,StreamCopyUsage:()=>Zn,StreamDrawUsage:()=>Wn,StreamReadUsage:()=>Xn,StringKeyframeTrack:()=>Th,SubtractEquation:()=>V,SubtractiveBlending:()=>z,TOUCH:()=>w,TangentSpaceNormalMap:()=>Sn,TetrahedronBufferGeometry:()=>Zc,TetrahedronGeometry:()=>Zc,TextBufferGeometry:()=>Kc,TextGeometry:()=>Kc,Texture:()=>yr,TextureLoader:()=>zh,TorusBufferGeometry:()=>Qc,TorusGeometry:()=>Qc,TorusKnotBufferGeometry:()=>$c,TorusKnotGeometry:()=>$c,Triangle:()=>Bi,TriangleFanDrawMode:()=>pn,TriangleStripDrawMode:()=>dn,TrianglesDrawMode:()=>hn,TubeBufferGeometry:()=>eh,TubeGeometry:()=>eh,UVMapping:()=>be,Uint16Attribute:()=>function(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new na(e,t)},Uint16BufferAttribute:()=>na,Uint32Attribute:()=>function(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ia(e,t)},Uint32BufferAttribute:()=>ia,Uint8Attribute:()=>function(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new $i(e,t)},Uint8BufferAttribute:()=>$i,Uint8ClampedAttribute:()=>function(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new ea(e,t)},Uint8ClampedBufferAttribute:()=>ea,Uniform:()=>$d,UniformsLib:()=>ao,UniformsUtils:()=>Ha,UnsignedByteType:()=>He,UnsignedInt248Type:()=>Qe,UnsignedIntType:()=>qe,UnsignedShort4444Type:()=>Je,UnsignedShort5551Type:()=>Ze,UnsignedShort565Type:()=>Ke,UnsignedShortType:()=>We,VSMShadowMap:()=>R,Vector2:()=>pr,Vector3:()=>Tr,Vector4:()=>_r,VectorKeyframeTrack:()=>Eh,Vertex:()=>function(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Tr(e,t,n)},VertexColors:()=>Zp,VideoTexture:()=>Gu,WebGL1Renderer:()=>Ol,WebGLCubeRenderTarget:()=>Xa,WebGLMultipleRenderTargets:()=>wr,WebGLMultisampleRenderTarget:()=>Mr,WebGLRenderTarget:()=>br,WebGLRenderTargetCube:()=>function(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Xa(e,n)},WebGLRenderer:()=>Nl,WebGLUtils:()=>Ll,WireframeGeometry:()=>th,WireframeHelper:()=>function(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Iu(new th(e.geometry),new Su({color:void 0!==t?t:16777215}))},WrapAroundEnding:()=>ln,XHRLoader:()=>function(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ih(e)},ZeroCurvatureEnding:()=>on,ZeroFactor:()=>X,ZeroSlopeEnding:()=>sn,ZeroStencilOp:()=>En,sRGBEncoding:()=>mn});for(var _="131",b={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},w={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},M=0,S=1,T=2,E=3,A=0,L=1,k=2,R=3,C=0,P=1,I=2,D=1,N=2,O=0,F=1,B=2,z=3,U=4,H=5,G=100,V=101,W=102,j=103,q=104,X=200,Y=201,J=202,Z=203,K=204,Q=205,$=206,ee=207,te=208,ne=209,re=210,ie=0,ae=1,oe=2,se=3,le=4,ue=5,ce=6,he=7,de=0,pe=1,fe=2,me=0,ve=1,ge=2,ye=3,xe=4,_e=5,be=300,we=301,Me=302,Se=303,Te=304,Ee=306,Ae=307,Le=1e3,ke=1001,Re=1002,Ce=1003,Pe=1004,Ie=1004,De=1005,Ne=1005,Oe=1006,Fe=1007,Be=1007,ze=1008,Ue=1008,He=1009,Ge=1010,Ve=1011,We=1012,je=1013,qe=1014,Xe=1015,Ye=1016,Je=1017,Ze=1018,Ke=1019,Qe=1020,$e=1021,et=1022,tt=1023,nt=1024,rt=1025,it=tt,at=1026,ot=1027,st=1028,lt=1029,ut=1030,ct=1031,ht=1032,dt=1033,pt=33776,ft=33777,mt=33778,vt=33779,gt=35840,yt=35841,xt=35842,_t=35843,bt=36196,wt=37492,Mt=37496,St=37808,Tt=37809,Et=37810,At=37811,Lt=37812,kt=37813,Rt=37814,Ct=37815,Pt=37816,It=37817,Dt=37818,Nt=37819,Ot=37820,Ft=37821,Bt=36492,zt=37840,Ut=37841,Ht=37842,Gt=37843,Vt=37844,Wt=37845,jt=37846,qt=37847,Xt=37848,Yt=37849,Jt=37850,Zt=37851,Kt=37852,Qt=37853,$t=2200,en=2201,tn=2202,nn=2300,rn=2301,an=2302,on=2400,sn=2401,ln=2402,un=2500,cn=2501,hn=0,dn=1,pn=2,fn=3e3,mn=3001,vn=3007,gn=3002,yn=3003,xn=3004,_n=3005,bn=3006,wn=3200,Mn=3201,Sn=0,Tn=1,En=0,An=7680,Ln=7681,kn=7682,Rn=7683,Cn=34055,Pn=34056,In=5386,Dn=512,Nn=513,On=514,Fn=515,Bn=516,zn=517,Un=518,Hn=519,Gn=35044,Vn=35048,Wn=35040,jn=35045,qn=35049,Xn=35041,Yn=35046,Jn=35050,Zn=35042,Kn="100",Qn="300 es",$n=function(){function e(){g(this,e)}return x(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){void 0!==this._listeners&&(void 0===(e=this._listeners[e])||-1!==(t=e.indexOf(t))&&e.splice(t,1))}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e);e.target=null}}}}]),e}(),er=[],tr=0;tr<256;tr++)er[tr]=(tr<16?"0":"")+tr.toString(16);var nr=1234567,rr=Math.PI/180,ir=180/Math.PI;function ar(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(er[255&e]+er[e>>8&255]+er[e>>16&255]+er[e>>24&255]+"-"+er[255&t]+er[t>>8&255]+"-"+er[t>>16&15|64]+er[t>>24&255]+"-"+er[63&n|128]+er[n>>8&255]+"-"+er[n>>16&255]+er[n>>24&255]+er[255&r]+er[r>>8&255]+er[r>>16&255]+er[r>>24&255]).toUpperCase()}function or(e,t,n){return Math.max(t,Math.min(n,e))}function sr(e,t){return(e%t+t)%t}function lr(e,t,n){return(1-n)*e+n*t}function ur(e){return 0==(e&e-1)&&0!==e}function cr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function hr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var dr=Object.freeze({__proto__:null,DEG2RAD:rr,RAD2DEG:ir,generateUUID:ar,clamp:or,euclideanModulo:sr,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:lr,damp:function(e,t,n,r){return lr(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(sr(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return((nr=16807*(nr=void 0!==e?e%2147483647:nr)%2147483647)-1)/2147483646},degToRad:function(e){return e*rr},radToDeg:function(e){return e*ir},isPowerOfTwo:ur,ceilPowerOfTwo:cr,floorPowerOfTwo:hr,setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),p=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*f,l*p,s*u);break;case"YXY":e.set(l*p,s*c,l*f,s*u);break;case"ZYZ":e.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}}),pr=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;g(this,e),this.x=t,this.y=n}return x(e,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y;return e=e.elements,this.x=e[0]*t+e[3]*n+e[6],this.y=e[1]*t+e[4]*n+e[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x;return t*t+(e=this.y-e.y)*e}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x;return t=this.y-e.y,this.x=i*n-t*r+e.x,this.y=i*r+t*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}}]),e}();pr.prototype.isVector2=!0;var fr,mr=function(){function e(){g(this,e),this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}return x(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements;return e=e.elements,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){return e=e.elements,this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=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=r[0],m=r[3],v=r[6],g=r[1],y=r[4];return e=r[7],t=r[2],n=r[5],r=r[8],i[0]=a*f+o*g+s*t,i[3]=a*m+o*y+s*n,i[6]=a*v+o*e+s*r,i[1]=l*f+u*g+c*t,i[4]=l*m+u*y+c*n,i[7]=l*v+u*e+c*r,i[2]=h*f+d*g+p*t,i[5]=h*m+d*y+p*n,i[8]=h*v+d*e+p*r,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e,t=(e=this.elements)[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7];return t*a*(e=e[8])-t*o*l-n*i*e+n*o*s+r*i*l-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*i,d=l*i-a*s,p=t*c+n*h+r*d;return 0==p?this.set(0,0,0,0,0,0,0,0,0):(p=1/p,e[0]=c*p,e[1]=(r*l-u*n)*p,e[2]=(o*n-r*a)*p,e[3]=h*p,e[4]=(u*t-r*s)*p,e[5]=(r*i-o*t)*p,e[6]=d*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*i)*p,this)}},{key:"transpose",value:function(){var e=this.elements,t=e[1];return 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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i);return i=Math.sin(i),this.set(n*s,n*i,-n*(s*a+i*o)+a+e,-r*i,r*s,-r*(-i*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}},{key:"rotate",value:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4];return e=r[7],r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*e,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*e,this}},{key:"translate",value:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}();mr.prototype.isMatrix3=!0;var vr=function(){function e(){g(this,e)}return x(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t=e instanceof HTMLCanvasElement?e:((fr=void 0===fr?document.createElementNS("http://www.w3.org/1999/xhtml","canvas"):fr).width=e.width,fr.height=e.height,t=fr.getContext("2d"),e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),fr);return 2048<t.width||2048<t.height?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}]),e}(),gr=0,yr=function(){h(t,$n);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:t.DEFAULT_IMAGE,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.DEFAULT_MAPPING,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ke,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:ke,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:Oe,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:ze,u=6<arguments.length&&void 0!==arguments[6]?arguments[6]:tt,c=7<arguments.length&&void 0!==arguments[7]?arguments[7]:He,h=8<arguments.length&&void 0!==arguments[8]?arguments[8]:1,d=9<arguments.length&&void 0!==arguments[9]?arguments[9]:fn;return g(this,t),n=e.call(this),Object.defineProperty(m(n),"id",{value:gr++}),n.uuid=ar(),n.name="",n.image=r,n.mipmaps=[],n.mapping=i,n.wrapS=a,n.wrapT=o,n.magFilter=s,n.minFilter=l,n.anisotropy=h,n.format=u,n.internalFormat=null,n.type=c,n.offset=new pr(0,0),n.repeat=new pr(1,1),n.center=new pr(0,0),n.rotation=0,n.matrixAutoUpdate=!0,n.matrix=new mr,n.generateMipmaps=!0,n.premultiplyAlpha=!1,n.flipY=!0,n.unpackAlignment=4,n.encoding=d,n.version=0,n.onUpdate=null,n.isRenderTargetTexture=!1,n}return x(t,[{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=ar()),!t&&void 0===e.images[r.uuid]){if(Array.isArray(r))for(var i=[],a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(xr(r[a].image)):i.push(xr(r[a]));else i=xr(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==be)return e;if(e.applyMatrix3(this.matrix),e.x<0||1<e.x)switch(this.wrapS){case Le:e.x=e.x-Math.floor(e.x);break;case ke:e.x=e.x<0?0:1;break;case Re:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||1<e.y)switch(this.wrapT){case Le:e.y=e.y-Math.floor(e.y);break;case ke:e.y=e.y<0?0:1;break;case Re:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),t}();function xr(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vr.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}yr.DEFAULT_IMAGE=void 0,yr.DEFAULT_MAPPING=be,yr.prototype.isTexture=!0;var _r=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;g(this,e),this.x=t,this.y=n,this.z=r,this.w=i}return x(e,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r+e[12]*i,this.y=e[1]*t+e[5]*n+e[9]*r+e[13]*i,this.z=e[2]*t+e[6]*n+e[10]*r+e[14]*i,this.w=e[3]*t+e[7]*n+e[11]*r+e[15]*i,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i=(y=e.elements)[0],a=y[4],o=y[8],s=y[1],l=y[5],u=y[9],c=y[2],h=y[6],d=y[10];if(Math.abs(a-s)<.01&&Math.abs(o-c)<.01&&Math.abs(u-h)<.01){if(Math.abs(a+s)<.1&&Math.abs(o+c)<.1&&Math.abs(u+h)<.1&&Math.abs(i+l+d-3)<.1)return this.set(1,0,0,0),this;var p=Math.PI,f=(i+1)/2,m=(l+1)/2,v=(d+1)/2,g=(a+s)/4,y=(e=(o+c)/4,(u+h)/4);return m<f&&v<f?r=f<.01?(t=0,n=.707106781):(n=g/(t=Math.sqrt(f)),e/t):v<m?r=m<.01?(n=0,t=.707106781):(t=g/(n=Math.sqrt(m)),y/n):v<.01?(n=t=.707106781,r=0):(t=e/(r=Math.sqrt(v)),n=y/r),this.set(t,n,r,p),this}return p=Math.sqrt((h-u)*(h-u)+(o-c)*(o-c)+(s-a)*(s-a)),Math.abs(p)<.001&&(p=1),this.x=(h-u)/p,this.y=(o-c)/p,this.z=(s-a)/p,this.w=Math.acos((i+l+d-1)/2),this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}]),e}();_r.prototype.isVector4=!0;var br=function(){h(t,$n);var e=p(t);function t(n,r){var i,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return g(this,t),(i=e.call(this)).width=n,i.height=r,i.depth=1,i.scissor=new _r(0,0,n,r),i.scissorTest=!1,i.viewport=new _r(0,0,n,r),i.texture=new yr(void 0,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.image={width:n,height:r,depth:1},i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:Oe,i.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,i.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,i.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,i}return x(t,[{key:"setTexture",value:function(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}},{key:"setSize",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),t}();br.prototype.isWebGLRenderTarget=!0;var wr=function(){h(t,br);var e=p(t);function t(n,r,i){g(this,t);var a,o=(a=e.call(this,n,r)).texture;a.texture=[];for(var s=0;s<i;s++)a.texture[s]=o.clone();return a}return x(t,[{key:"setSize",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}},{key:"copy",value:function(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture;for(var t=this.texture.length=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}}]),t}();wr.prototype.isWebGLMultipleRenderTargets=!0;var Mr=function(){h(t,br);var e=p(t);function t(n,r,i){return g(this,t),(i=e.call(this,n,r,i)).samples=4,i}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.samples=e.samples,this}}]),t}();Mr.prototype.isWebGLMultisampleRenderTarget=!0;var Sr=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;g(this,e),this._x=t,this._y=n,this._z=r,this._w=i}return x(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=(e=Math.sin,o(n/2)),l=o(r/2),u=o(i/2),c=e(n/2),h=e(r/2),d=e(i/2);switch(a){case"XYZ":this._x=c*l*u+s*h*d,this._y=s*h*u-c*l*d,this._z=s*l*d+c*h*u,this._w=s*l*u-c*h*d;break;case"YXZ":this._x=c*l*u+s*h*d,this._y=s*h*u-c*l*d,this._z=s*l*d-c*h*u,this._w=s*l*u+c*h*d;break;case"ZXY":this._x=c*l*u-s*h*d,this._y=s*h*u+c*l*d,this._z=s*l*d+c*h*u,this._w=s*l*u-c*h*d;break;case"ZYX":this._x=c*l*u-s*h*d,this._y=s*h*u+c*l*d,this._z=s*l*d-c*h*u,this._w=s*l*u+c*h*d;break;case"YZX":this._x=c*l*u+s*h*d,this._y=s*h*u+c*l*d,this._z=s*l*d-c*h*u,this._w=s*l*u-c*h*d;break;case"XZY":this._x=c*l*u-s*h*d,this._y=s*h*u-c*l*d,this._z=s*l*d+c*h*u,this._w=s*l*u+c*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2;return t=Math.sin(n),this._x=e.x*t,this._y=e.y*t,this._z=e.z*t,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t,n,r=(n=e.elements)[0],i=n[4],a=n[8],o=n[1],s=n[5],l=n[9],u=n[2],c=n[6];return 0<(n=r+s+(e=n[10]))?(n=.5/Math.sqrt(n+1),this._w=.25/n,this._x=(c-l)*n,this._y=(a-u)*n,this._z=(o-i)*n):s<r&&e<r?(t=2*Math.sqrt(1+r-s-e),this._w=(c-l)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+u)/t):e<s?(t=2*Math.sqrt(1+s-r-e),this._w=(a-u)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(l+c)/t):(s=2*Math.sqrt(1+e-r-s),this._w=(o-i)/s,this._x=(a+u)/s,this._y=(l+c)/s,this._z=.25*s),this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(or(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);return 0===n||(n=Math.min(1,t/n),this.slerp(e,n)),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y;return e=t._z,t=t._w,this._x=n*t+a*o+r*e-i*s,this._y=r*t+a*s+i*o-n*e,this._z=i*t+a*e+n*s-r*o,this._w=a*t-n*o-r*s-i*e,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=n,this._y=r,this._z=i,this;if((e=1-o*o)<=Number.EPSILON){var s=1-t;return this._w=s*a+t*this._w,this._x=s*n+t*this._x,this._y=s*r+t*this._y,this._z=s*i+t*this._z,this.normalize(),this._onChangeCallback(),this}return s=Math.sqrt(e),e=Math.atan2(s,o),o=Math.sin((1-t)*e)/s,s=Math.sin(t*e)/s,this._w=a*o+this._w*s,this._x=n*o+this._x*s,this._y=r*o+this._y*s,this._z=i*o+this._z*s,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){this.copy(e).slerp(t,n)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}}],[{key:"slerp",value:function(e,t,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,r)}},{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];return 0===o?(e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c)):1===o?(e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f)):(c===f&&s===h&&l===d&&u===p||(n=1-o,i=0<=(r=s*h+l*d+u*p+c*f)?1:-1,(a=1-r*r)>Number.EPSILON&&(a=Math.sqrt(a),r=Math.atan2(a,r*i),n=Math.sin(n*r)/a,o=Math.sin(o*r)/a),s=s*n+h*(i*=o),l=l*n+d*i,u=u*n+p*i,c=c*n+f*i,n===1-o&&(s*=o=1/Math.sqrt(s*s+l*l+u*u+c*c),l*=o,u*=o,c*=o)),e[t]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c))}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],u=n[r+3],c=i[a];return n=i[a+1],r=i[a+2],a=i[a+3],e[t]=o*a+u*c+s*r-l*n,e[t+1]=s*a+u*n+l*c-o*r,e[t+2]=l*a+u*r+o*n-s*c,e[t+3]=u*a-o*c-s*n-l*r,e}}]),e}();Sr.prototype.isQuaternion=!0;var Tr=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;g(this,e),this.x=t,this.y=n,this.z=r}return x(e,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ar.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Ar.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[3]*n+e[6]*r,this.y=e[1]*t+e[4]*n+e[7]*r,this.z=e[2]*t+e[5]*n+e[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return e=1/(i[3]*t+i[7]*n+i[11]*r+i[15]),this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*e,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*e,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*e,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,u=s*n+o*t-i*r;return e=s*r+i*n-a*t,r=-i*t-a*n-o*r,this.x=l*s+r*-i+u*-o-e*-a,this.y=u*s+r*-a+e*-i-l*-o,this.z=e*s+r*-o+l*-a-u*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z;return e=e.elements,this.x=e[0]*t+e[4]*n+e[8]*r,this.y=e[1]*t+e[5]*n+e[9]*r,this.z=e[2]*t+e[6]*n+e[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x;return e=t.y,t=t.z,this.x=r*t-i*e,this.y=i*a-n*t,this.z=n*e-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();return 0===t?this.set(0,0,0):(t=e.dot(this)/t,this.copy(e).multiplyScalar(t))}},{key:"projectOnPlane",value:function(e){return Er.copy(this).projectOnVector(e),this.sub(Er)}},{key:"reflect",value:function(e){return this.sub(Er.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:(t=this.dot(e)/t,Math.acos(or(t,-1,1)))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n+(e=this.z-e.z)*e}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){return e=e.elements,this.x=e[12],this.y=e[13],this.z=e[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length();return e=this.setFromMatrixColumn(e,2).length(),this.x=t,this.y=n,this.z=e,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}]),e}();Tr.prototype.isVector3=!0;var Er=new Tr,Ar=new Sr,Lr=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr(1/0,1/0,1/0),n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr(-1/0,-1/0,-1/0);g(this,e),this.min=t,this.max=n}return x(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var u=e[s],c=e[s+1],h=e[s+2];u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),i<u&&(i=u),a<c&&(a=c),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var u=e.getX(s),c=e.getY(s),h=e.getZ(s);u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),i<u&&(i=u),a<c&&(a=c),o<h&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){return t=Rr.copy(t).multiplyScalar(.5),this.min.copy(e).sub(t),this.max.copy(e).add(t),this}},{key:"setFromObject",value:function(e){return this.makeEmpty(),this.expandByObject(e)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),Cr.copy(t.boundingBox),Cr.applyMatrix4(e.matrixWorld),this.union(Cr));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,Rr),Rr.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n=0<e.normal.x?(t=e.normal.x*this.min.x,e.normal.x*this.max.x):(t=e.normal.x*this.max.x,e.normal.x*this.min.x);return 0<e.normal.y?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){return!this.isEmpty()&&(this.getCenter(Br),zr.subVectors(this.max,Br),Pr.subVectors(e.a,Br),Ir.subVectors(e.b,Br),Dr.subVectors(e.c,Br),Nr.subVectors(Ir,Pr),Or.subVectors(Dr,Ir),Fr.subVectors(Pr,Dr),!!Gr([0,-Nr.z,Nr.y,0,-Or.z,Or.y,0,-Fr.z,Fr.y,Nr.z,0,-Nr.x,Or.z,0,-Or.x,Fr.z,0,-Fr.x,-Nr.y,Nr.x,0,-Or.y,Or.x,0,-Fr.y,Fr.x,0],Pr,Ir,Dr,zr)&&!!Gr([1,0,0,0,1,0,0,0,1],Pr,Ir,Dr,zr)&&(Ur.crossVectors(Nr,Or),Gr([Ur.x,Ur.y,Ur.z],Pr,Ir,Dr,zr)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Rr.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return this.getCenter(e.center),e.radius=.5*this.getSize(Rr).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(kr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),kr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),kr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),kr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),kr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),kr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),kr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),kr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(kr)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}();Lr.prototype.isBox3=!0;var kr=[new Tr,new Tr,new Tr,new Tr,new Tr,new Tr,new Tr,new Tr],Rr=new Tr,Cr=new Lr,Pr=new Tr,Ir=new Tr,Dr=new Tr,Nr=new Tr,Or=new Tr,Fr=new Tr,Br=new Tr,zr=new Tr,Ur=new Tr,Hr=new Tr;function Gr(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){Hr.fromArray(e,a);var s=i.x*Math.abs(Hr.x)+i.y*Math.abs(Hr.y)+i.z*Math.abs(Hr.z),l=t.dot(Hr),u=n.dot(Hr),c=r.dot(Hr);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Vr=new Lr,Wr=new Tr,jr=new Tr,qr=new Tr,Xr=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;g(this,e),this.center=t,this.radius=n}return x(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Vr.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){qr.subVectors(e,this.center);var t=qr.lengthSq();return t>this.radius*this.radius&&(t=.5*((e=Math.sqrt(t))-this.radius),this.center.add(qr.multiplyScalar(t/e)),this.radius+=t),this}},{key:"union",value:function(e){return jr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Wr.copy(e.center).add(jr)),this.expandByPoint(Wr.copy(e.center).sub(jr)),this}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Yr=new Tr,Jr=new Tr,Zr=new Tr,Kr=new Tr,Qr=new Tr,$r=new Tr,ei=new Tr,ti=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr(0,0,-1);g(this,e),this.origin=t,this.direction=n}return x(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Yr)),this}},{key:"closestPointToPoint",value:function(e,t){return t.subVectors(e,this.origin),(e=t.dot(this.direction))<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Yr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Yr.copy(this.direction).multiplyScalar(t).add(this.origin),Yr.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){Jr.copy(e).add(t).multiplyScalar(.5),Zr.copy(t).sub(e).normalize(),Kr.copy(this.origin).sub(Jr);var i,a,o=.5*e.distanceTo(t),s=-this.direction.dot(Zr),l=Kr.dot(this.direction),u=-Kr.dot(Zr),c=Kr.lengthSq();return c=0<(e=Math.abs(1-s*s))?(a=s*l-u,t=o*e,0<=(i=s*u-l)?-t<=a?a<=t?(i*=e=1/e)*(i+s*(a*=e)+2*l)+a*(s*i+a+2*u)+c:(a=o,-(i=Math.max(0,-(s*a+l)))*i+a*(a+2*u)+c):(a=-o,-(i=Math.max(0,-(s*a+l)))*i+a*(a+2*u)+c):a<=-t?-(i=Math.max(0,-(-s*o+l)))*i+(a=0<i?-o:Math.min(Math.max(-o,-u),o))*(a+2*u)+c:a<=t?(i=0,(a=Math.min(Math.max(-o,-u),o))*(a+2*u)+c):-(i=Math.max(0,-(s*o+l)))*i+(a=0<i?o:Math.min(Math.max(-o,-u),o))*(a+2*u)+c):(a=0<s?-o:o,-(i=Math.max(0,-(s*a+l)))*i+a*(a+2*u)+c),n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Zr).multiplyScalar(a).add(Jr),c}},{key:"intersectSphere",value:function(e,t){Yr.subVectors(e.center,this.origin);var n=Yr.dot(this.direction),r=Yr.dot(Yr)-n*n;return(e=e.radius*e.radius)<r?null:(r=n-(e=Math.sqrt(e-r)),e=n+e,r<0&&e<0?null:r<0?this.at(e,t):this.at(r,t))}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:0<=(t=-(this.origin.dot(e.normal)+e.constant)/t)?t:null}},{key:"intersectPlane",value:function(e,t){return null===(e=this.distanceToPlane(e))?null:this.at(e,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z,l=this.origin;return a=0<=a?(n=(e.min.x-l.x)*a,(e.max.x-l.x)*a):(n=(e.max.x-l.x)*a,(e.min.x-l.x)*a),(o=0<=o?(r=(e.min.y-l.y)*o,(e.max.y-l.y)*o):(r=(e.max.y-l.y)*o,(e.min.y-l.y)*o))<n||a<r?null:((n<r||n!=n)&&(n=r),(o<a||a!=a)&&(a=o),(s=0<=s?(i=(e.min.z-l.z)*s,(e.max.z-l.z)*s):(i=(e.max.z-l.z)*s,(e.min.z-l.z)*s))<n||a<i?null:((n<i||n!=n)&&(n=i),(a=s<a||a!=a?s:a)<0?null:this.at(0<=n?n:a,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Yr)}},{key:"intersectTriangle",value:function(e,t,n,r,i){if(Qr.subVectors(t,e),$r.subVectors(n,e),ei.crossVectors(Qr,$r),0<(n=this.direction.dot(ei))){if(r)return null;a=1}else{if(!(n<0))return null;a=-1,n=-n}if(Kr.subVectors(this.origin,e),(r=a*this.direction.dot($r.crossVectors(Kr,$r)))<0)return null;if((e=a*this.direction.dot(Qr.cross(Kr)))<0)return null;if(n<r+e)return null;var a=-a*Kr.dot(ei);return a<0?null:this.at(a/n,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),ni=function(){function e(){g(this,e),this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}return x(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,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}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements;return e=e.elements,t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],this}},{key:"copyPosition",value:function(e){var t=this.elements;return e=e.elements,t[12]=e[12],t[13]=e[13],t[14]=e[14],this}},{key:"setFromMatrix3",value:function(e){return e=e.elements,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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/ri.setFromMatrixColumn(e,0).length(),i=1/ri.setFromMatrixColumn(e,1).length();return e=1/ri.setFromMatrixColumn(e,2).length(),t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*e,t[9]=n[9]*e,t[10]=n[10]*e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t,n,r,i,a,o,s,l,u,c,h,d=this.elements,p=e.x,f=e.y,m=e.z,v=Math.cos(p),g=Math.sin(p),y=Math.cos(f),x=Math.sin(f);return p=Math.cos(m),f=Math.sin(m),"XYZ"===e.order?(t=v*p,r=v*f,n=g*p,m=g*f,d[0]=y*p,d[4]=-y*f,d[8]=x,d[1]=r+n*x,d[5]=t-m*x,d[9]=-g*y,d[2]=m-t*x,d[6]=n+r*x,d[10]=v*y):"YXZ"===e.order?(t=y*f,n=x*p,d[0]=(i=y*p)+(r=x*f)*g,d[4]=n*g-t,d[8]=v*x,d[1]=v*f,d[5]=v*p,d[9]=-g,d[2]=t*g-n,d[6]=r+i*g,d[10]=v*y):"ZXY"===e.order?(i=y*f,a=x*p,d[0]=(s=y*p)-(o=x*f)*g,d[4]=-v*f,d[8]=a+i*g,d[1]=i+a*g,d[5]=v*p,d[9]=o-s*g,d[2]=-v*x,d[6]=g,d[10]=v*y):"ZYX"===e.order?(a=v*p,o=v*f,l=g*p,s=g*f,d[0]=y*p,d[4]=l*x-o,d[8]=a*x+s,d[1]=y*f,d[5]=s*x+a,d[9]=o*x-l,d[2]=-x,d[6]=g*y,d[10]=v*y):"YZX"===e.order?(c=v*y,l=v*x,u=g*y,h=g*x,d[0]=y*p,d[4]=h-c*f,d[8]=u*f+l,d[1]=f,d[5]=v*p,d[9]=-g*p,d[2]=-x*p,d[6]=l*f+u,d[10]=c-h*f):"XZY"===e.order&&(u=v*y,c=v*x,h=g*y,e=g*x,d[0]=y*p,d[4]=-f,d[8]=x*p,d[1]=u*f+e,d[5]=v*p,d[9]=c*f-h,d[2]=h*f-c,d[6]=g*p,d[10]=e*f+u),d[3]=0,d[7]=0,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(ai,e,oi)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return ui.subVectors(e,t),0===ui.lengthSq()&&(ui.z=1),ui.normalize(),si.crossVectors(n,ui),0===si.lengthSq()&&(1===Math.abs(n.z)?ui.x+=1e-4:ui.z+=1e-4,ui.normalize(),si.crossVectors(n,ui)),si.normalize(),li.crossVectors(ui,si),r[0]=si.x,r[4]=li.x,r[8]=ui.x,r[1]=si.y,r[5]=li.y,r[9]=ui.y,r[2]=si.z,r[6]=li.z,r[10]=ui.z,this}},{key:"multiply",value:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=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],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],k=r[2],R=r[6],C=r[10],P=r[14];return e=r[3],t=r[7],n=r[11],r=r[15],i[0]=a*b+o*T+s*k+l*e,i[4]=a*w+o*E+s*R+l*t,i[8]=a*M+o*A+s*C+l*n,i[12]=a*S+o*L+s*P+l*r,i[1]=u*b+c*T+h*k+d*e,i[5]=u*w+c*E+h*R+d*t,i[9]=u*M+c*A+h*C+d*n,i[13]=u*S+c*L+h*P+d*r,i[2]=p*b+f*T+m*k+v*e,i[6]=p*w+f*E+m*R+v*t,i[10]=p*M+f*A+m*C+v*n,i[14]=p*S+f*L+m*P+v*r,i[3]=g*b+y*T+x*k+_*e,i[7]=g*w+y*E+x*R+_*t,i[11]=g*M+y*A+x*C+_*n,i[15]=g*S+y*L+x*P+_*r,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*l*c-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*u-i*s*u)+e[11]*(+t*l*c-t*o*d-i*a*c+n*a*d+i*o*u-n*l*u)+e[15]*(-r*o*u-t*s*c+t*o*h+r*a*c-n*a*h+n*s*u)}},{key:"transpose",value:function(){var e=this.elements,t=e[1];return 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}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],v=e[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,x=u*f*l-p*c*l+p*o*d-a*f*d-u*o*v+a*c*v,_=p*c*s-u*f*s-p*o*h+a*f*h+u*o*m-a*c*m,b=t*g+n*y+r*x+i*_;return 0==b?this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0):(b=1/b,e[0]=g*b,e[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*v-n*h*v)*b,e[2]=(o*m*i-f*s*i+f*r*l-n*m*l-o*r*v+n*s*v)*b,e[3]=(c*s*i-o*h*i-c*r*l+n*h*l+o*r*d-n*s*d)*b,e[4]=y*b,e[5]=(u*m*i-p*h*i+p*r*d-t*m*d-u*r*v+t*h*v)*b,e[6]=(p*s*i-a*m*i-p*r*l+t*m*l+a*r*v-t*s*v)*b,e[7]=(a*h*i-u*s*i+u*r*l-t*h*l-a*r*d+t*s*d)*b,e[8]=x*b,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*v-t*c*v)*b,e[10]=(a*f*i-p*o*i+p*n*l-t*f*l-a*n*v+t*o*v)*b,e[11]=(u*o*i-a*c*i-u*n*l+t*c*l+a*n*d-t*o*d)*b,e[12]=_*b,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*m+t*c*m)*b,e[14]=(p*o*r-a*f*r-p*n*s+t*f*s+a*n*m-t*o*m)*b,e[15]=(a*c*r-u*o*r+u*n*s-t*c*s-a*n*h+t*o*h)*b,this)}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y;return e=e.z,t[0]*=n,t[4]*=r,t[8]*=e,t[1]*=n,t[5]*=r,t[9]*=e,t[2]*=n,t[6]*=r,t[10]*=e,t[3]*=n,t[7]*=r,t[11]*=e,this}},{key:"getMaxScaleOnAxis",value:function(){var e=(n=this.elements)[0]*n[0]+n[1]*n[1]+n[2]*n[2],t=n[4]*n[4]+n[5]*n[5]+n[6]*n[6],n=n[8]*n[8]+n[9]*n[9]+n[10]*n[10];return Math.sqrt(Math.max(e,t,n))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(1,0,0,0,0,t,-e,0,0,e,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,0,e,0,0,1,0,0,-e,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e);return e=Math.sin(e),this.set(t,-e,0,0,e,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z;return t=i*a,e=i*o,this.set(t*a+n,t*o-r*s,t*s+r*o,0,t*o+r*s,e*o+n,e*s-r*a,0,t*s-r*o,e*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i*(h=i+i),u=i*(d=a+a),c=i*(p=o+o),h=(t=a*d,i=a*p,a=o*p,o=s*h,s*d),d=s*p,p=(s=n.x,n.y);return n=n.z,r[0]=(1-(t+a))*s,r[1]=(u+d)*s,r[2]=(c-h)*s,r[3]=0,r[4]=(u-d)*p,r[5]=(1-(l+a))*p,r[6]=(i+o)*p,r[7]=0,r[8]=(c+h)*n,r[9]=(i-o)*n,r[10]=(1-(l+t))*n,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=ri.set(r[0],r[1],r[2]).length(),a=ri.set(r[4],r[5],r[6]).length(),o=ri.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],ii.copy(this);var s=1/i;return e=1/a,r=1/o,ii.elements[0]*=s,ii.elements[1]*=s,ii.elements[2]*=s,ii.elements[4]*=e,ii.elements[5]*=e,ii.elements[6]*=e,ii.elements[8]*=r,ii.elements[9]*=r,ii.elements[10]*=r,t.setFromRotationMatrix(ii),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(n-r),l=(t+e)/(t-e);return n=(n+r)/(n-r),r=-(a+i)/(a-i),a=-2*a*i/(a-i),o[0]=2*i/(t-e),o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=s,o[9]=n,o[13]=0,o[2]=0,o[6]=0,o[10]=r,o[14]=a,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),u=1/(a-i);return e=(t+e)*s,r=(n+r)*l,i=(a+i)*u,o[0]=2*s,o[4]=0,o[8]=0,o[12]=-e,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-r,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-i,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}();ni.prototype.isMatrix4=!0;var ri=new Tr,ii=new ni,ai=new Tr(0,0,0),oi=new Tr(1,1,1),si=new Tr,li=new Tr,ui=new Tr,ci=new ni,hi=new Sr,di=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:e.DefaultOrder;g(this,e),this._x=t,this._y=n,this._z=r,this._order=i}return x(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order,n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=(e=e.elements)[0],i=e[4],a=e[8],o=e[1],s=e[5],l=e[9],u=e[2],c=e[6],h=e[10];switch(t){case"XYZ":this._y=Math.asin(or(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-i,r)):(this._x=Math.atan2(c,s),this._z=0);break;case"YXZ":this._x=Math.asin(-or(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(o,s)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(or(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-i,s)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-or(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(c,h),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-i,s));break;case"YZX":this._z=Math.asin(or(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,s),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-or(i,-1,1)),Math.abs(i)<.9999999?(this._x=Math.atan2(c,s),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return ci.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ci,t,n)}},{key:"setFromVector3",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return hi.setFromEuler(this),this.setFromQuaternion(hi,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"toVector3",value:function(e){return e?e.set(this._x,this._y,this._z):new Tr(this._x,this._y,this._z)}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}}]),e}();di.prototype.isEuler=!0,di.DefaultOrder="XYZ",di.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var pi=function(){function e(){g(this,e),this.mask=1}return x(e,[{key:"set",value:function(e){this.mask=1<<e|0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}}]),e}(),fi=0,mi=new Tr,vi=new Sr,gi=new ni,yi=new Tr,xi=new Tr,_i=new Tr,bi=new Sr,wi=new Tr(1,0,0),Mi=new Tr(0,1,0),Si=new Tr(0,0,1),Ti={type:"added"},Ei={type:"removed"},Ai=function(){h(t,$n);var e=p(t);function t(){var n;g(this,t),n=e.call(this),Object.defineProperty(m(n),"id",{value:fi++}),n.uuid=ar(),n.name="",n.type="Object3D",n.parent=null,n.children=[],n.up=t.DefaultUp.clone();var r=new Tr,i=new di,a=new Sr,o=new Tr(1,1,1);return i._onChange((function(){a.setFromEuler(i,!1)})),a._onChange((function(){i.setFromQuaternion(a,void 0,!1)})),Object.defineProperties(m(n),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new ni},normalMatrix:{value:new mr}}),n.matrix=new ni,n.matrixWorld=new ni,n.matrixAutoUpdate=t.DefaultMatrixAutoUpdate,n.matrixWorldNeedsUpdate=!1,n.layers=new pi,n.visible=!0,n.castShadow=!1,n.receiveShadow=!1,n.frustumCulled=!0,n.renderOrder=0,n.animations=[],n.userData={},n}return x(t,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return vi.setFromAxisAngle(e,t),this.quaternion.multiply(vi),this}},{key:"rotateOnWorldAxis",value:function(e,t){return vi.setFromAxisAngle(e,t),this.quaternion.premultiply(vi),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(wi,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(Mi,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(Si,e)}},{key:"translateOnAxis",value:function(e,t){return mi.copy(e).applyQuaternion(this.quaternion),this.position.add(mi.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(wi,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(Mi,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(Si,e)}},{key:"localToWorld",value:function(e){return e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return e.applyMatrix4(gi.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?yi.copy(e):yi.set(e,t,n),n=this.parent,this.updateWorldMatrix(!0,!1),xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gi.lookAt(xi,yi,this.up):gi.lookAt(yi,xi,this.up),this.quaternion.setFromRotationMatrix(gi),n&&(gi.extractRotation(n.matrixWorld),vi.setFromRotationMatrix(gi),this.quaternion.premultiply(vi.invert()))}},{key:"add",value:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),(e.parent=this).children.push(e),e.dispatchEvent(Ti)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}},{key:"remove",value:function(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Ei)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(Ei)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),gi.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),gi.multiply(e.parent.matrixWorld)),e.applyMatrix4(gi),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,e,_i),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,bi,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e=!(this.matrixWorldNeedsUpdate=!1));for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&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===t)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r,i,a,o,s,l={};function u(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(l.uuid=this.uuid,l.type=this.type,""!==this.name&&(l.name=this.name),!0===this.castShadow&&(l.castShadow=!0),!0===this.receiveShadow&&(l.receiveShadow=!0),!1===this.visible&&(l.visible=!1),!1===this.frustumCulled&&(l.frustumCulled=!1),0!==this.renderOrder&&(l.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(l.matrixAutoUpdate=!1),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(l.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(l.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=u(e.geometries,this.geometry);var c=this.geometry.parameters;if(void 0!==c&&void 0!==c.shapes){var h=c.shapes;if(Array.isArray(h))for(var d=0,p=h.length;d<p;d++){var f=h[d];u(e.shapes,f)}else u(e.shapes,h)}}if(this.isSkinnedMesh&&(l.bindMode=this.bindMode,l.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(u(e.skeletons,this.skeleton),l.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var m=[],v=0,g=this.material.length;v<g;v++)m.push(u(e.materials,this.material[v]));l.material=m}else l.material=u(e.materials,this.material);if(0<this.children.length){l.children=[];for(var y=0;y<this.children.length;y++)l.children.push(this.children[y].toJSON(e).object)}if(0<this.animations.length){l.animations=[];for(var x=0;x<this.animations.length;x++){var _=this.animations[x];l.animations.push(u(e.animations,_))}}return t&&(r=b(e.geometries),i=b(e.materials),a=b(e.textures),o=b(e.images),s=b(e.shapes),c=b(e.skeletons),t=b(e.animations),0<r.length&&(n.geometries=r),0<i.length&&(n.materials=i),0<a.length&&(n.textures=a),0<o.length&&(n.images=o),0<s.length&&(n.shapes=s),0<c.length&&(n.skeletons=c),0<t.length&&(n.animations=t)),n.object=l,n;function b(e){var t,n=[];for(t in e){var r=e[t];delete r.metadata,n.push(r)}return n}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}]),t}();Ai.DefaultUp=new Tr(0,1,0),Ai.DefaultMatrixAutoUpdate=!0,Ai.prototype.isObject3D=!0;var Li=new Tr,ki=new Tr,Ri=new Tr,Ci=new Tr,Pi=new Tr,Ii=new Tr,Di=new Tr,Ni=new Tr,Oi=new Tr,Fi=new Tr,Bi=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Tr;g(this,e),this.a=t,this.b=n,this.c=r}return x(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return Li.subVectors(this.c,this.b),ki.subVectors(this.a,this.b),.5*Li.cross(ki).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return e.getUV(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n=this.a,r=this.b,i=this.c;Pi.subVectors(r,n),Ii.subVectors(i,n),Ni.subVectors(e,n);var a=Pi.dot(Ni),o=Ii.dot(Ni);if(a<=0&&o<=0)return t.copy(n);Oi.subVectors(e,r);var s=Pi.dot(Oi),l=Ii.dot(Oi);if(0<=s&&l<=s)return t.copy(r);var u=a*l-s*o;if(u<=0&&0<=a&&s<=0)return h=a/(a-s),t.copy(n).addScaledVector(Pi,h);Fi.subVectors(e,i);var c=Pi.dot(Fi);if(0<=(e=Ii.dot(Fi))&&c<=e)return t.copy(i);if((a=c*o-a*e)<=0&&0<=o&&e<=0)return d=o/(o-e),t.copy(n).addScaledVector(Ii,d);if((o=s*e-c*l)<=0&&0<=l-s&&0<=c-e)return Di.subVectors(i,r),d=(l-s)/(l-s+(c-e)),t.copy(r).addScaledVector(Di,d);var h=a*(o=1/(o+a+u)),d=u*o;return t.copy(n).addScaledVector(Pi,h).addScaledVector(Ii,d)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){return r.subVectors(n,t),Li.subVectors(e,t),r.cross(Li),0<(t=r.lengthSq())?r.multiplyScalar(1/Math.sqrt(t)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Li.subVectors(r,t),ki.subVectors(n,t),Ri.subVectors(e,t);var a=Li.dot(Li),o=Li.dot(ki);return r=Li.dot(Ri),n=ki.dot(ki),e=ki.dot(Ri),0==(t=a*n-o*o)?i.set(-2,-1,-1):(n=(n*r-o*e)*(t=1/t),t*=a*e-o*r,i.set(1-n-t,t,n))}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,Ci),0<=Ci.x&&0<=Ci.y&&Ci.x+Ci.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Ci),s.set(0,0),s.addScaledVector(i,Ci.x),s.addScaledVector(a,Ci.y),s.addScaledVector(o,Ci.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Li.subVectors(n,t),ki.subVectors(e,t),Li.cross(ki).dot(r)<0}}]),e}(),zi=0,Ui=function(){h(t,$n);var e=p(t);function t(){var n;return g(this,t),n=e.call(this),Object.defineProperty(m(n),"id",{value:zi++}),n.uuid=ar(),n.name="",n.type="Material",n.fog=!0,n.blending=F,n.side=C,n.vertexColors=!1,n.opacity=1,n.transparent=!1,n.blendSrc=K,n.blendDst=Q,n.blendEquation=G,n.blendSrcAlpha=null,n.blendDstAlpha=null,n.blendEquationAlpha=null,n.depthFunc=se,n.depthTest=!0,n.depthWrite=!0,n.stencilWriteMask=255,n.stencilFunc=Hn,n.stencilRef=0,n.stencilFuncMask=255,n.stencilFail=An,n.stencilZFail=An,n.stencilZPass=An,n.stencilWrite=!1,n.clippingPlanes=null,n.clipIntersection=!1,n.clipShadows=!1,n.shadowSide=null,n.colorWrite=!0,n.precision=null,n.polygonOffset=!1,n.polygonOffsetFactor=0,n.polygonOffsetUnits=0,n.dithering=!1,n.alphaTest=0,n.alphaToCoverage=!1,n.premultipliedAlpha=!1,n.visible=!0,n.toneMapped=!0,n.userData={},n.version=0,n}return x(t,[{key:"onBuild",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n,r=e[t];void 0!==r?"shading"!==t?void 0!==(n=this[t])?n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material."):(console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===D):console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t,n=[];for(t in e){var r=e[t];delete r.metadata,n.push(r)}return n}return n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),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.specularTint&&this.specularTint.isColor&&(n.specularTint=this.specularTint.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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(n.specularTintMap=this.specularTintMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).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(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(n.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==F&&(n.blending=this.blending),this.side!==C&&(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,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),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),0<this.alphaTest&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),1<this.wireframeLinewidth&&(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),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t&&(t=r(e.textures),e=r(e.images),0<t.length&&(n.textures=t),0<e.length&&(n.images=e)),n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t)for(var r=t.length,i=(n=new Array(r),0);i!==r;++i)n[i]=t[i].clone();return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),t}();Ui.prototype.isMaterial=!0;var 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},Gi={h:0,s:0,l:0},Vi={h:0,s:0,l:0};function Wi(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function ji(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function qi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Xi=function(){function e(t,n,r){return g(this,e),void 0===n&&void 0===r?this.set(t):this.setRGB(t,n,r)}return x(e,[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}},{key:"setRGB",value:function(e,t,n){return this.r=e,this.g=t,this.b=n,this}},{key:"setHSL",value:function(e,t,n){return e=sr(e,1),t=or(t,0,1),n=or(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=Wi(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=Wi(t,n,e),this.b=Wi(t,n,e-1/3)),this}},{key:"setStyle",value:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(l=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var n,r=l[1],i=l[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,t(n[4]),this;if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,t(n[4]),this;break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){var a=parseFloat(n[1])/360,o=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100;return t(n[4]),this.setHSL(a,o,s)}}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(e)){var l=(r=l[1]).length;if(3===l)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,this}return e&&0<e.length?this.setColorName(e):this}},{key:"setColorName",value:function(e){var t=Hi[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copyGammaToLinear",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2;return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}},{key:"copyLinearToGamma",value:function(e){var t=0<(t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2)?1/t:1;return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}},{key:"convertGammaToLinear",value:function(e){return this.copyGammaToLinear(this,e),this}},{key:"convertLinearToGamma",value:function(e){return this.copyLinearToGamma(this,e),this}},{key:"copySRGBToLinear",value:function(e){return this.r=ji(e.r),this.g=ji(e.g),this.b=ji(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=qi(e.r),this.g=qi(e.g),this.b=qi(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}},{key:"getHexString",value:function(){return("000000"+this.getHex().toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t,n=this.r,r=this.g,i=this.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(o+a)/2;if(o===a)u=t=0;else{var l=a-o,u=s<=.5?l/(a+o):l/(2-a-o);switch(a){case n:t=(r-i)/l+(r<i?6:0);break;case r:t=(i-n)/l+2;break;case i:t=(n-r)/l+4}t/=6}return e.h=t,e.s=u,e.l=s,e}},{key:"getStyle",value:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Gi),Gi.h+=e,Gi.s+=t,Gi.l+=n,this.setHSL(Gi.h,Gi.s,Gi.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Gi),e.getHSL(Vi);var n=lr(Gi.h,Vi.h,t);return e=lr(Gi.s,Vi.s,t),t=lr(Gi.l,Vi.l,t),this.setHSL(n,e,t),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),!0===e.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}},{key:"toJSON",value:function(){return this.getHex()}}]),e}();Xi.NAMES=Hi,Xi.prototype.isColor=!0,Xi.prototype.r=1,Xi.prototype.g=1,Xi.prototype.b=1;var Yi=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshBasicMaterial",r.color=new Xi(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=de,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();Yi.prototype.isMeshBasicMaterial=!0;var Ji=new Tr,Zi=new pr,Ki=function(){function e(t,n,r){if(g(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===r,this.usage=Gn,this.updateRange={offset:0,count:-1},this.version=0}return x(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"copyColorsArray",value:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Xi),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this}},{key:"copyVector2sArray",value:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new pr),t[n++]=a.x,t[n++]=a.y}return this}},{key:"copyVector3sArray",value:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Tr),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this}},{key:"copyVector4sArray",value:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new _r),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)Zi.fromBufferAttribute(this,t),Zi.applyMatrix3(e),this.setXY(t,Zi.x,Zi.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)Ji.fromBufferAttribute(this,r),Ji.applyMatrix3(e),this.setXYZ(r,Ji.x,Ji.y,Ji.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)Ji.x=this.getX(t),Ji.y=this.getY(t),Ji.z=this.getZ(t),Ji.applyMatrix4(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Ji.x=this.getX(t),Ji.y=this.getY(t),Ji.z=this.getZ(t),Ji.applyNormalMatrix(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Ji.x=this.getX(t),Ji.y=this.getY(t),Ji.z=this.getZ(t),Ji.transformDirection(e),this.setXYZ(t,Ji.x,Ji.y,Ji.z);return this}},{key:"set",value:function(e){return this.array.set(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0),this}},{key:"getX",value:function(e){return this.array[e*this.itemSize]}},{key:"setX",value:function(e,t){return this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){return this.array[e*this.itemSize+1]}},{key:"setY",value:function(e,t){return this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){return this.array[e*this.itemSize+2]}},{key:"setZ",value:function(e,t){return this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){return this.array[e*this.itemSize+3]}},{key:"setW",value:function(e,t){return this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Gn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}();Ki.prototype.isBufferAttribute=!0;var Qi=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Int8Array(n),r,i)}return t}(),$i=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Uint8Array(n),r,i)}return t}(),ea=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Uint8ClampedArray(n),r,i)}return t}(),ta=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Int16Array(n),r,i)}return t}(),na=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Uint16Array(n),r,i)}return t}(),ra=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Int32Array(n),r,i)}return t}(),ia=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Uint32Array(n),r,i)}return t}(),aa=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Uint16Array(n),r,i)}return t}();aa.prototype.isFloat16BufferAttribute=!0;var oa=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Float32Array(n),r,i)}return t}(),sa=function(){h(t,Ki);var e=p(t);function t(n,r,i){return g(this,t),e.call(this,new Float64Array(n),r,i)}return t}();function la(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}var ua={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ca(e,t){return new ua[e](t)}var ha=0,da=new ni,pa=new Ai,fa=new Tr,ma=new Lr,va=new Lr,ga=new Tr,ya=function(){h(t,$n);var e=p(t);function t(){var n;return g(this,t),n=e.call(this),Object.defineProperty(m(n),"id",{value:ha++}),n.uuid=ar(),n.name="",n.type="BufferGeometry",n.index=null,n.attributes={},n.morphAttributes={},n.morphTargetsRelative=!1,n.groups=[],n.boundingBox=null,n.boundingSphere=null,n.drawRange={start:0,count:1/0},n.userData={},n}return x(t,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(65535<la(e)?ia:na)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){this.groups.push({start:e,count:t,materialIndex:2<arguments.length&&void 0!==arguments[2]?arguments[2]:0})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;return void 0!==n&&(t=(new mr).getNormalMatrix(e),n.applyNormalMatrix(t),n.needsUpdate=!0),void 0!==(n=this.attributes.tangent)&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return da.makeRotationFromQuaternion(e),this.applyMatrix4(da),this}},{key:"rotateX",value:function(e){return da.makeRotationX(e),this.applyMatrix4(da),this}},{key:"rotateY",value:function(e){return da.makeRotationY(e),this.applyMatrix4(da),this}},{key:"rotateZ",value:function(e){return da.makeRotationZ(e),this.applyMatrix4(da),this}},{key:"translate",value:function(e,t,n){return da.makeTranslation(e,t,n),this.applyMatrix4(da),this}},{key:"scale",value:function(e,t,n){return da.makeScale(e,t,n),this.applyMatrix4(da),this}},{key:"lookAt",value:function(e){return pa.lookAt(e),pa.updateMatrix(),this.applyMatrix4(pa.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(fa).negate(),this.translate(fa.x,fa.y,fa.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new oa(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Lr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.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 Tr(-1/0,-1/0,-1/0),new Tr(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];ma.setFromBufferAttribute(i),this.morphTargetsRelative?(ga.addVectors(this.boundingBox.min,ma.min),this.boundingBox.expandByPoint(ga),ga.addVectors(this.boundingBox.max,ma.max),this.boundingBox.expandByPoint(ga)):(this.boundingBox.expandByPoint(ma.min),this.boundingBox.expandByPoint(ma.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)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new Xr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.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 Tr,1/0);if(e){var n=this.boundingSphere.center;if(ma.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];va.setFromBufferAttribute(a),this.morphTargetsRelative?(ga.addVectors(ma.min,va.min),ma.expandByPoint(ga),ga.addVectors(ma.max,va.max),ma.expandByPoint(ga)):(ma.expandByPoint(va.min),ma.expandByPoint(va.max))}ma.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)ga.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(ga));if(t)for(var u=0,c=t.length;u<c;u++)for(var h=t[u],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)ga.fromBufferAttribute(h,p),d&&(fa.fromBufferAttribute(e,p),ga.add(fa)),o=Math.max(o,n.distanceToSquared(ga));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)}}},{key:"computeFaceNormals",value:function(){}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,r=t.position.array,i=t.normal.array,a=t.uv.array,o=r.length/3;void 0===t.tangent&&this.setAttribute("tangent",new Ki(new Float32Array(4*o),4));for(var s=t.tangent.array,l=[],u=[],c=0;c<o;c++)l[c]=new Tr,u[c]=new Tr;for(var h=new Tr,d=new Tr,p=new Tr,f=new pr,m=new pr,v=new pr,g=new Tr,y=new Tr,x=this.groups,_=0,b=(x=0===x.length?[{start:0,count:n.length}]:x).length;_<b;++_)for(var w=x[_],M=w.start,S=M,T=M+w.count;S<T;S+=3)!function(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),p.fromArray(r,3*n),f.fromArray(a,2*e),m.fromArray(a,2*t),v.fromArray(a,2*n),d.sub(h),p.sub(h),m.sub(f),v.sub(f);var i=1/(m.x*v.y-v.x*m.y);isFinite(i)&&(g.copy(d).multiplyScalar(v.y).addScaledVector(p,-m.y).multiplyScalar(i),y.copy(p).multiplyScalar(m.x).addScaledVector(d,-v.x).multiplyScalar(i),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y))}(n[S+0],n[S+1],n[S+2]);for(var E=new Tr,A=new Tr,L=new Tr,k=new Tr,R=0,C=x.length;R<C;++R)for(var P=x[R],I=P.start,D=I,N=I+P.count;D<N;D+=3)O(n[D+0]),O(n[D+1]),O(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(e){L.fromArray(i,3*e),k.copy(L);var t=l[e];E.copy(t),E.sub(L.multiplyScalar(L.dot(t))).normalize(),A.crossVectors(k,t),t=A.dot(u[e])<0?-1:1,s[4*e]=E.x,s[4*e+1]=E.y,s[4*e+2]=E.z,s[4*e+3]=t}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new Ki(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Tr,o=new Tr,s=new Tr,l=new Tr,u=new Tr,c=new Tr,h=new Tr,d=new Tr;if(e)for(var p=0,f=e.count;p<f;p+=3){var m=e.getX(p+0),v=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,m),o.fromBufferAttribute(t,v),s.fromBufferAttribute(t,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,x=t.count;y<x;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,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}}},{key:"merge",value:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n,r=this.attributes;for(n in r)if(void 0!==e.attributes[n])for(var i=r[n].array,a=(o=e.attributes[n]).array,o=o.itemSize*t,s=Math.min(a.length,i.length-o),l=0,u=o;l<s;l++,u++)i[u]=a[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)ga.fromBufferAttribute(e,t),ga.normalize(),e.setXYZ(t,ga.x,ga.y,ga.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,l=0,u=t.length;l<u;l++){o=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*r;for(var c=0;c<r;c++)a[s++]=n[o++]}return new Ki(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var n,r=new t,i=this.index.array,a=this.attributes;for(n in a){var o=e(a[n],i);r.setAttribute(n,o)}var s,l=this.morphAttributes;for(s in l){for(var u=[],c=l[s],h=0,d=c.length;h<d;h++){var p=e(c[h],i);u.push(p)}r.morphAttributes[s]=u}r.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,m=0,v=f.length;m<v;m++){var g=f[m];r.addGroup(g.start,g.count,g.materialIndex)}return r}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t,n=this.parameters;for(t in n)void 0!==n[t]&&(e[t]=n[t]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i,a=this.attributes;for(i in a){var o=a[i];e.data.attributes[i]=o.toJSON(e.data)}var s,l={},u=!1;for(s in this.morphAttributes){for(var c=this.morphAttributes[s],h=[],d=0,p=c.length;d<p;d++){var f=c[d];h.push(f.toJSON(e.data))}0<h.length&&(l[s]=h,u=!0)}return u&&(e.data.morphAttributes=l,e.data.morphTargetsRelative=this.morphTargetsRelative),0<(r=this.groups).length&&(e.data.groups=JSON.parse(JSON.stringify(r))),null!==(r=this.boundingSphere)&&(e.data.boundingSphere={center:r.center.toArray(),radius:r.radius}),e}},{key:"clone",value:function(){return(new t).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r,i=e.attributes;for(r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o,s=e.morphAttributes;for(o in s){for(var l=[],u=s[o],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[o]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,p=0,f=d.length;p<f;p++){var m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}return null!==(n=e.boundingBox)&&(this.boundingBox=n.clone()),null!==(n=e.boundingSphere)&&(this.boundingSphere=n.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),t}();ya.prototype.isBufferGeometry=!0;var xa=new ni,_a=new ti,ba=new Xr,wa=new Tr,Ma=new Tr,Sa=new Tr,Ta=new Tr,Ea=new Tr,Aa=new Tr,La=new Tr,ka=new Tr,Ra=new Tr,Ca=new pr,Pa=new pr,Ia=new pr,Da=new Tr,Na=new Tr,Oa=function(){h(t,Ai);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ya,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Yi;return g(this,t),(n=e.call(this)).type="Mesh",n.geometry=r,n.material=i,n.updateMorphTargets(),n}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),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}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0<n.length){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else void 0!==(e=e.morphTargets)&&0<e.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r&&(null===n.boundingSphere&&n.computeBoundingSphere(),ba.copy(n.boundingSphere),ba.applyMatrix4(i),!1!==e.ray.intersectsSphere(ba)&&(xa.copy(i).invert(),_a.copy(e.ray).applyMatrix4(xa),null===n.boundingBox||!1!==_a.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var a=n.index,o=n.attributes.position,s=n.morphAttributes.position,l=n.morphTargetsRelative,u=n.attributes.uv,c=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==a)if(Array.isArray(r))for(var p=0,f=h.length;p<f;p++)for(var m=h[p],v=r[m.materialIndex],g=Math.max(m.start,d.start),y=Math.min(m.start+m.count,d.start+d.count);g<y;g+=3){var x,_=a.getX(g),b=a.getX(g+1),w=a.getX(g+2);(x=Fa(this,v,e,_a,o,s,l,u,c,_,b,w))&&(x.faceIndex=Math.floor(g/3),x.face.materialIndex=m.materialIndex,t.push(x))}else for(var M=Math.max(0,d.start),S=Math.min(a.count,d.start+d.count);M<S;M+=3){var T=a.getX(M),E=a.getX(M+1),A=a.getX(M+2);(x=Fa(this,r,e,_a,o,s,l,u,c,T,E,A))&&(x.faceIndex=Math.floor(M/3),t.push(x))}else if(void 0!==o)if(Array.isArray(r))for(var L=0,k=h.length;L<k;L++)for(var R=h[L],C=r[R.materialIndex],P=Math.max(R.start,d.start),I=Math.min(R.start+R.count,d.start+d.count);P<I;P+=3)(x=Fa(this,C,e,_a,o,s,l,u,c,P,P+1,P+2))&&(x.faceIndex=Math.floor(P/3),x.face.materialIndex=R.materialIndex,t.push(x));else for(var D=Math.max(0,d.start),N=Math.min(o.count,d.start+d.count);D<N;D+=3)(x=Fa(this,r,e,_a,o,s,l,u,c,D,D+1,D+2))&&(x.faceIndex=Math.floor(D/3),t.push(x))}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}]),t}();function Fa(e,t,n,r,i,a,o,s,l,u,c,h){wa.fromBufferAttribute(i,u),Ma.fromBufferAttribute(i,c),Sa.fromBufferAttribute(i,h);var d,p,f,m=e.morphTargetInfluences;if(a&&m){La.set(0,0,0),ka.set(0,0,0),Ra.set(0,0,0);for(var v=0,g=a.length;v<g;v++){var y=m[v],x=a[v];0!==y&&(Ta.fromBufferAttribute(x,u),Ea.fromBufferAttribute(x,c),Aa.fromBufferAttribute(x,h),o?(La.addScaledVector(Ta,y),ka.addScaledVector(Ea,y),Ra.addScaledVector(Aa,y)):(La.addScaledVector(Ta.sub(wa),y),ka.addScaledVector(Ea.sub(Ma),y),Ra.addScaledVector(Aa.sub(Sa),y)))}wa.add(La),Ma.add(ka),Sa.add(Ra)}return e.isSkinnedMesh&&(e.boneTransform(u,wa),e.boneTransform(c,Ma),e.boneTransform(h,Sa)),f=e,d=n,p=r,i=wa,e=Ma,n=Sa,r=Da,(f=null===(t=(t=t).side===P?p.intersectTriangle(n,e,i,!0,r):p.intersectTriangle(i,e,n,t.side!==I,r))?null:(Na.copy(r),Na.applyMatrix4(f.matrixWorld),(r=d.ray.origin.distanceTo(Na))<d.near||r>d.far?null:{distance:r,point:Na.clone(),object:f}))&&(s&&(Ca.fromBufferAttribute(s,u),Pa.fromBufferAttribute(s,c),Ia.fromBufferAttribute(s,h),f.uv=Bi.getUV(Da,wa,Ma,Sa,Ca,Pa,Ia,new pr)),l&&(Ca.fromBufferAttribute(l,u),Pa.fromBufferAttribute(l,c),Ia.fromBufferAttribute(l,h),f.uv2=Bi.getUV(Da,wa,Ma,Sa,Ca,Pa,Ia,new pr)),l={a:u,b:c,c:h,normal:new Tr,materialIndex:0},Bi.getNormal(wa,Ma,Sa,l.normal),f.face=l),f}Oa.prototype.isMesh=!0;var Ba=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;g(this,t),(n=e.call(this)).type="BoxGeometry",n.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=m(n),c=(o=Math.floor(o),s=Math.floor(s),l=Math.floor(l),[]),h=[],d=[],p=[],f=0,v=0;function y(e,t,n,r,i,a,o,s,l,m,g){for(var y=a/l,x=o/m,_=a/2,b=o/2,w=s/2,M=l+1,S=m+1,T=0,E=0,A=new Tr,L=0;L<S;L++)for(var k=L*x-b,R=0;R<M;R++)A[e]=(R*y-_)*r,A[t]=k*i,A[n]=w,h.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=0<s?1:-1,d.push(A.x,A.y,A.z),p.push(R/l),p.push(1-L/m),T+=1;for(var C=0;C<m;C++)for(var P=0;P<l;P++){var I=f+P+M*C,D=f+P+M*(C+1),N=f+(P+1)+M*(C+1),O=f+(P+1)+M*C;c.push(I,D,O),c.push(D,N,O),E+=6}u.addGroup(v,E,g),v+=E,f+=T}return y("z","y","x",-1,-1,a,i,r,l,s,0),y("z","y","x",1,-1,a,i,-r,l,s,1),y("x","z","y",1,1,r,a,i,o,l,2),y("x","z","y",1,-1,r,a,-i,o,l,3),y("x","y","z",1,-1,r,i,a,o,s,4),y("x","y","z",-1,-1,r,i,-a,o,s,5),n.setIndex(c),n.setAttribute("position",new oa(h,3)),n.setAttribute("normal",new oa(d,3)),n.setAttribute("uv",new oa(p,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),t}();function za(e){var t,n={};for(t in e)for(var r in n[t]={},e[t]){var i=e[t][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?n[t][r]=i.clone():Array.isArray(i)?n[t][r]=i.slice():n[t][r]=i}return n}function Ua(e){for(var t={},n=0;n<e.length;n++){var r,i=za(e[n]);for(r in i)t[r]=i[r]}return t}var Ha={clone:za,merge:Ua},Ga=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="ShaderMaterial",r.defines={},r.uniforms={},r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==n&&(void 0!==n.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),r.setValues(n)),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=za(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}},{key:"toJSON",value:function(e){var n,r=l(v(t.prototype),"toJSON",this).call(this,e);for(n in r.glslVersion=this.glslVersion,r.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?r.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?r.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?r.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?r.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?r.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?r.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?r.uniforms[n]={type:"m4",value:i.toArray()}:r.uniforms[n]={value:i}}0<Object.keys(this.defines).length&&(r.defines=this.defines),r.vertexShader=this.vertexShader,r.fragmentShader=this.fragmentShader;var a,o={};for(a in this.extensions)!0===this.extensions[a]&&(o[a]=!0);return 0<Object.keys(o).length&&(r.extensions=o),r}}]),t}();Ga.prototype.isShaderMaterial=!0;var Va=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="Camera",n.matrixWorldInverse=new ni,n.projectionMatrix=new ni,n.projectionMatrixInverse=new ni,n}return x(t,[{key:"copy",value:function(e,n){return l(v(t.prototype),"copy",this).call(this,e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){l(v(t.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,n){l(v(t.prototype),"updateWorldMatrix",this).call(this,e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}();Va.prototype.isCamera=!0;var Wa=function(){h(t,Va);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:50,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2e3;return g(this,t),(n=e.call(this)).type="PerspectiveCamera",n.fov=r,n.zoom=1,n.near=a,n.far=o,n.focus=10,n.aspect=i,n.view=null,n.filmGauge=35,n.filmOffset=0,n.updateProjectionMatrix(),n}return x(t,[{key:"copy",value:function(e,n){return l(v(t.prototype),"copy",this).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}},{key:"setFocalLength",value:function(e){e=.5*this.getFilmHeight()/e,this.fov=2*ir*Math.atan(e),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*rr*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*ir*Math.atan(Math.tan(.5*rr*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e,t=this.near,n=t*Math.tan(.5*rr*this.fov)/this.zoom,r=2*n,i=this.aspect*r,a=-.5*i,o=this.view;null!==this.view&&this.view.enabled&&(e=o.fullWidth,s=o.fullHeight,a+=o.offsetX*i/e,n-=o.offsetY*r/s,i*=o.width/e,r*=o.height/s);var s=this.filmOffset;0!==s&&(a+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+i,n,n-r,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}]),t}();Wa.prototype.isPerspectiveCamera=!0;var ja=function(){h(t,Ai);var e=p(t);function t(n,r,i){var a;return g(this,t),(a=e.call(this)).type="CubeCamera",!0!==i.isWebGLCubeRenderTarget?(console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),f(a)):(a.renderTarget=i,(i=new Wa(90,1,n,r)).layers=a.layers,i.up.set(0,-1,0),i.lookAt(new Tr(1,0,0)),a.add(i),(i=new Wa(90,1,n,r)).layers=a.layers,i.up.set(0,-1,0),i.lookAt(new Tr(-1,0,0)),a.add(i),(i=new Wa(90,1,n,r)).layers=a.layers,i.up.set(0,0,1),i.lookAt(new Tr(0,1,0)),a.add(i),(i=new Wa(90,1,n,r)).layers=a.layers,i.up.set(0,0,-1),i.lookAt(new Tr(0,-1,0)),a.add(i),(i=new Wa(90,1,n,r)).layers=a.layers,i.up.set(0,-1,0),i.lookAt(new Tr(0,0,1)),a.add(i),(r=new Wa(90,1,n,r)).layers=a.layers,r.up.set(0,-1,0),r.lookAt(new Tr(0,0,-1)),a.add(r),a)}return x(t,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),6!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e)||o(e,6)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this.children),i=r[0],a=r[1],s=r[2],l=r[3],u=r[4],c=r[5],h=e.xr.enabled,d=e.getRenderTarget();e.xr.enabled=!1,r=n.texture.generateMipmaps,n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,l),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=r,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(d),e.xr.enabled=h}}]),t}(),qa=function(){h(t,yr);var e=p(t);function t(n,r,i,a,o,s,l,u,c,h){return g(this,t),(h=e.call(this,n=void 0!==n?n:[],r=void 0!==r?r:we,i,a,o,s,l=void 0!==l?l:et,u,c,h)).flipY=!1,h}return x(t,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),t}();qa.prototype.isCubeTexture=!0;var Xa=function(){h(t,br);var e=p(t);function t(n,r,i){return g(this,t),Number.isInteger(r)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),r=i),(n=e.call(this,n,n,r)).texture=new qa(void 0,(r=r||{}).mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),n.texture.isRenderTargetTexture=!0,n.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,n.texture.minFilter=void 0!==r.minFilter?r.minFilter:Oe,n.texture._needsFlipEnvMap=!1,n}return x(t,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.format=tt,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n="\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",r=new Ba(5,5,5);return(n=new Ga({name:"CubemapFromEquirect",uniforms:za({tEquirect:{value:null}}),vertexShader:"\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",fragmentShader:n,side:P,blending:O})).uniforms.tEquirect.value=t,r=new Oa(r,n),n=t.minFilter,t.minFilter===ze&&(t.minFilter=Oe),new ja(1,10,this).update(e,r),t.minFilter=n,r.geometry.dispose(),r.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),t}();Xa.prototype.isWebGLCubeRenderTarget=!0;var Ya=new Tr,Ja=new Tr,Za=new mr,Ka=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr(1,0,0),n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;g(this,e),this.normal=t,this.constant=n}return x(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){return t=Ya.subVectors(n,t).cross(Ja.subVectors(e,t)).normalize(),this.setFromNormalAndCoplanarPoint(t,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){var n=e.delta(Ya),r=this.normal.dot(n);return 0===r?0===this.distanceToPoint(e.start)?t.copy(e.start):null:(r=-(e.start.dot(this.normal)+this.constant)/r)<0||1<r?null:t.copy(n).multiplyScalar(r).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start);return e=this.distanceToPoint(e.end),t<0&&0<e||e<0&&0<t}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){return t=t||Za.getNormalMatrix(e),e=this.coplanarPoint(Ya).applyMatrix4(e),t=this.normal.applyMatrix3(t).normalize(),this.constant=-e.dot(t),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();Ka.prototype.isPlane=!0;var Qa=new Xr,$a=new Tr,eo=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Ka,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Ka,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ka,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new Ka,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:new Ka,o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:new Ka;g(this,e),this.planes=[t,n,r,i,a,o]}return x(e,[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=(v=e.elements)[0],r=v[1],i=v[2],a=v[3],o=v[4],s=v[5],l=v[6],u=v[7],c=v[8],h=v[9],d=v[10],p=v[11],f=v[12],m=v[13],v=(e=v[14],v[15]);return t[0].setComponents(a-n,u-o,p-c,v-f).normalize(),t[1].setComponents(a+n,u+o,p+c,v+f).normalize(),t[2].setComponents(a+r,u+s,p+h,v+m).normalize(),t[3].setComponents(a-r,u-s,p-h,v-m).normalize(),t[4].setComponents(a-i,u-l,p-d,v-e).normalize(),t[5].setComponents(a+i,u+l,p+d,v+e).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Qa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Qa)}},{key:"intersectsSprite",value:function(e){return Qa.center.set(0,0,0),Qa.radius=.7071067811865476,Qa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Qa)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)<r)return!1;return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if($a.x=(0<r.normal.x?e.max:e.min).x,$a.y=(0<r.normal.y?e.max:e.min).y,$a.z=(0<r.normal.z?e.max:e.min).z,r.distanceToPoint($a)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function to(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function no(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){var a,o,s,l,u,c;t.isGLBufferAttribute?(!(c=r.get(t))||c.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}):(t.isInterleavedBufferAttribute&&(t=t.data),void 0===(a=r.get(t))?r.set(t,(s=i,l=(o=t).array,u=o.usage,c=e.createBuffer(),e.bindBuffer(s,c),e.bufferData(s,l,u),o.onUploadCallback(),u=5126,l instanceof Float32Array?u=5126:l instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):l instanceof Uint16Array?o.isFloat16BufferAttribute?n?u=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):u=5123:l instanceof Int16Array?u=5122:l instanceof Uint32Array?u=5125:l instanceof Int32Array?u=5124:l instanceof Int8Array?u=5120:(l instanceof Uint8Array||l instanceof Uint8ClampedArray)&&(u=5121),{buffer:c,type:u,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version})):a.version<t.version&&(u=a.buffer,l=i,i=(o=t).array,o=o.updateRange,e.bindBuffer(l,u),-1===o.count?e.bufferSubData(l,0,i):(n?e.bufferSubData(l,o.offset*i.BYTES_PER_ELEMENT,i,o.offset,o.count):e.bufferSubData(l,o.offset*i.BYTES_PER_ELEMENT,i.subarray(o.offset,o.offset+o.count)),o.count=-1),a.version=t.version))}}}var ro=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;g(this,t),(n=e.call(this)).type="PlaneGeometry",n.parameters={width:r,height:i,widthSegments:a,heightSegments:o};for(var s=r/2,l=i/2,u=Math.floor(a),c=Math.floor(o),h=u+1,d=c+1,p=r/u,f=i/c,m=[],v=[],y=[],x=[],_=0;_<d;_++)for(var b=_*f-l,w=0;w<h;w++)v.push(w*p-s,-b,0),y.push(0,0,1),x.push(w/u),x.push(1-_/c);for(var M=0;M<c;M++)for(var S=0;S<u;S++){var T=S+h*(M+1),E=S+1+h*(M+1),A=S+1+h*M;m.push(S+h*M,T,A),m.push(T,E,A)}return n.setIndex(m),n.setAttribute("position",new oa(v,3)),n.setAttribute("normal",new oa(y,3)),n.setAttribute("uv",new oa(x,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.width,e.height,e.widthSegments,e.heightSegments)}}]),t}(),io={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\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:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in vec3 f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( f90 - f0 ) * fresnel + f0;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in vec3 f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat 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}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, vec3( 1.0 ), dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\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( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#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; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\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}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.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\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\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\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + 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 ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_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\ntransformedNormal = normalMatrix * transformedNormal;\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, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\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#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\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 )\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 )\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:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\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\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",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 texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D 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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\t#ifdef SPECULAR\n\t\tvec3 specularIntensityFactor = vec3( specularIntensity );\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularColorF90 = mix( specularIntensityFactor, vec3( 1.0 ), metalnessFactor );\n\t#else\n\t\tvec3 specularIntensityFactor = vec3( 1.0 );\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularColorF90 = vec3( 1.0 );\n\t#endif\n\tmaterial.specularColor = mix( min( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularColorF90 = vec3( 1.0 );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n\tvec3 specularColorF90;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), vec3( 1.0 ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularColorF90, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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 CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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\tgetPointDirectLightIrradiance( 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 *= all( bvec2( 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\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\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ 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\tgetDirectionalDirectLightIrradiance( 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 *= all( bvec2( 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 );\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 );\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, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\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\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\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, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 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 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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\tvarying vec4 vSpotShadowCoord[ 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\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:"#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\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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 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:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\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, vSpotShadowCoord[ 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\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",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, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\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 toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(  1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,  1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,  1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\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 vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, 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(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, 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\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",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}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\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}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\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}",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}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\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}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_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}",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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_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\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#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}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#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\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 <fog_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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#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\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 <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 <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t\t#ifdef USE_TANGENT\n\t\t\tvTangent = normalize( transformedTangent );\n\t\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t\t#endif\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\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <transmission_pars_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 <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <packing>\n#include <uv_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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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 <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#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\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( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",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>\nvoid main() {\n\t#include <color_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}",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 <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\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}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <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 <shadowmap_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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},ao={common:{diffuse:{value:new Xi(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new mr},uv2Transform:{value:new mr},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new pr(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Xi(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:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{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 Xi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new mr}},sprite:{diffuse:{value:new Xi(16777215)},opacity:{value:1},center:{value:new pr(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new mr}}},oo={basic:{uniforms:Ua([ao.common,ao.specularmap,ao.envmap,ao.aomap,ao.lightmap,ao.fog]),vertexShader:io.meshbasic_vert,fragmentShader:io.meshbasic_frag},lambert:{uniforms:Ua([ao.common,ao.specularmap,ao.envmap,ao.aomap,ao.lightmap,ao.emissivemap,ao.fog,ao.lights,{emissive:{value:new Xi(0)}}]),vertexShader:io.meshlambert_vert,fragmentShader:io.meshlambert_frag},phong:{uniforms:Ua([ao.common,ao.specularmap,ao.envmap,ao.aomap,ao.lightmap,ao.emissivemap,ao.bumpmap,ao.normalmap,ao.displacementmap,ao.fog,ao.lights,{emissive:{value:new Xi(0)},specular:{value:new Xi(1118481)},shininess:{value:30}}]),vertexShader:io.meshphong_vert,fragmentShader:io.meshphong_frag},standard:{uniforms:Ua([ao.common,ao.envmap,ao.aomap,ao.lightmap,ao.emissivemap,ao.bumpmap,ao.normalmap,ao.displacementmap,ao.roughnessmap,ao.metalnessmap,ao.fog,ao.lights,{emissive:{value:new Xi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:io.meshphysical_vert,fragmentShader:io.meshphysical_frag},toon:{uniforms:Ua([ao.common,ao.aomap,ao.lightmap,ao.emissivemap,ao.bumpmap,ao.normalmap,ao.displacementmap,ao.gradientmap,ao.fog,ao.lights,{emissive:{value:new Xi(0)}}]),vertexShader:io.meshtoon_vert,fragmentShader:io.meshtoon_frag},matcap:{uniforms:Ua([ao.common,ao.bumpmap,ao.normalmap,ao.displacementmap,ao.fog,{matcap:{value:null}}]),vertexShader:io.meshmatcap_vert,fragmentShader:io.meshmatcap_frag},points:{uniforms:Ua([ao.points,ao.fog]),vertexShader:io.points_vert,fragmentShader:io.points_frag},dashed:{uniforms:Ua([ao.common,ao.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:io.linedashed_vert,fragmentShader:io.linedashed_frag},depth:{uniforms:Ua([ao.common,ao.displacementmap]),vertexShader:io.depth_vert,fragmentShader:io.depth_frag},normal:{uniforms:Ua([ao.common,ao.bumpmap,ao.normalmap,ao.displacementmap,{opacity:{value:1}}]),vertexShader:io.normal_vert,fragmentShader:io.normal_frag},sprite:{uniforms:Ua([ao.sprite,ao.fog]),vertexShader:io.sprite_vert,fragmentShader:io.sprite_frag},background:{uniforms:{uvTransform:{value:new mr},t2D:{value:null}},vertexShader:io.background_vert,fragmentShader:io.background_frag},cube:{uniforms:Ua([ao.envmap,{opacity:{value:1}}]),vertexShader:io.cube_vert,fragmentShader:io.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:io.equirect_vert,fragmentShader:io.equirect_frag},distanceRGBA:{uniforms:Ua([ao.common,ao.displacementmap,{referencePosition:{value:new Tr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:io.distanceRGBA_vert,fragmentShader:io.distanceRGBA_frag},shadow:{uniforms:Ua([ao.lights,ao.fog,{color:{value:new Xi(0)},opacity:{value:1}}]),vertexShader:io.shadow_vert,fragmentShader:io.shadow_frag}};function so(e,t,n,r,i){var a,o,s=new Xi(0),l=0,u=null,c=0,h=null;function d(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return s},setClearColor:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;s.set(e),d(s,l=t)},getClearAlpha:function(){return l},setClearAlpha:function(e){d(s,l=e)},render:function(n,i){var p=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=t.get(f)),null===(f=(i=(i=e.xr).getSession&&i.getSession())&&"additive"===i.environmentBlendMode?null:f)?d(s,l):f&&f.isColor&&(d(f,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.mapping===Ee)?(void 0===o&&((o=new Oa(new Ba(1,1,1),new Ga({name:"BackgroundCubeMaterial",uniforms:za(oo.cube.uniforms),vertexShader:oo.cube.vertexShader,fragmentShader:oo.cube.fragmentShader,side:P,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(o)),o.material.uniforms.envMap.value=f,o.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,u===f&&c===f.version&&h===e.toneMapping||(o.material.needsUpdate=!0,c=(u=f).version,h=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):f&&f.isTexture&&(void 0===a&&((a=new Oa(new ro(2,2),new Ga({name:"BackgroundMaterial",uniforms:za(oo.background.uniforms),vertexShader:oo.background.vertexShader,fragmentShader:oo.background.fragmentShader,side:C,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),!0===(a.material.uniforms.t2D.value=f).matrixAutoUpdate&&f.updateMatrix(),a.material.uniforms.uvTransform.value.copy(f.matrix),u===f&&c===f.version&&h===e.toneMapping||(a.material.needsUpdate=!0,c=(u=f).version,h=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function lo(e,t,n,r){var i=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=d(null),u=l;function c(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function h(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function d(e){for(var t=[],n=[],r=[],a=0;a<i;a++)t[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function f(e){m(e,0)}function m(n,i){var a=u.newAttributes,o=u.enabledAttributes,s=u.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==i&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function v(){for(var t=u.newAttributes,n=u.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function g(t,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,a,o,s):e.vertexAttribIPointer(t,n,i,o,s)}function y(){x(),u!==l&&c((u=l).object)}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,h,y,x){var _,b=!1;o?(_=function(t,n,i){var o=!0===i.wireframe;return void 0===(i=s[t.id])&&(i={},s[t.id]=i),void 0===(t=i[n.id])&&(t={},i[n.id]=t),void 0===(n=t[o])&&(n=d(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),t[o]=n),n}(y,h,l),u!==_&&c((u=_).object),(b=function(e,t){var n,r=u.attributes,i=e.attributes,a=0;for(n in i){var o=r[n],s=i[n];if(void 0===o)return!0;if(o.attribute!==s)return!0;if(o.data!==s.data)return!0;a++}return u.attributesNum!==a||u.index!==t}(y,x))&&function(e,t){var n,r={},i=e.attributes,a=0;for(n in i){var o=i[n],s={};(s.attribute=o).data&&(s.data=o.data),r[n]=s,a++}u.attributes=r,u.attributesNum=a,u.index=t}(y,x)):(_=!0===l.wireframe,u.geometry===y.id&&u.program===h.id&&u.wireframe===_||(u.geometry=y.id,u.program=h.id,u.wireframe=_,b=!0)),!0===i.isInstancedMesh&&(b=!0),null!==x&&n.update(x,34963),b&&(function(i,a,o,s){if(!1!==r.isWebGL2||!i.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){p();var l,u=s.attributes,c=o.getAttributes(),h=a.defaultAttributeValues;for(l in c){var d=c[l];if(0<=d){var y=u[l];if(void 0!==y){var x,_,b,w,M,S=y.normalized,T=y.itemSize,E=n.get(y);void 0!==E&&(x=E.buffer,_=E.type,b=E.bytesPerElement,y.isInterleavedBufferAttribute?(M=(w=y.data).stride,E=y.offset,w&&w.isInstancedInterleavedBuffer?(m(d,w.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=w.meshPerAttribute*w.count)):f(d),e.bindBuffer(34962,x),g(d,T,_,S,M*b,E*b)):(y.isInstancedBufferAttribute?(m(d,y.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=y.meshPerAttribute*y.count)):f(d),e.bindBuffer(34962,x),g(d,T,_,S,0,0)))}else if("instanceMatrix"===l)void 0!==(S=n.get(i.instanceMatrix))&&(L=S.buffer,A=S.type,m(d+0,1),m(d+1,1),m(d+2,1),m(d+3,1),e.bindBuffer(34962,L),e.vertexAttribPointer(d+0,4,A,!1,64,0),e.vertexAttribPointer(d+1,4,A,!1,64,16),e.vertexAttribPointer(d+2,4,A,!1,64,32),e.vertexAttribPointer(d+3,4,A,!1,64,48));else if("instanceColor"===l){var A,L=n.get(i.instanceColor);void 0!==L&&(A=L.buffer,L=L.type,m(d,1),e.bindBuffer(34962,A),e.vertexAttribPointer(d,3,L,!1,12,0))}else if(void 0!==h){var k=h[l];if(void 0!==k)switch(k.length){case 2:e.vertexAttrib2fv(d,k);break;case 3:e.vertexAttrib3fv(d,k);break;case 4:e.vertexAttrib4fv(d,k);break;default:e.vertexAttrib1fv(d,k)}}}}v()}}(i,l,h,y),null!==x&&e.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){for(var e in y(),s){var t,n=s[e];for(t in n){var r,i=n[t];for(r in i)h(i[r].object),delete i[r];delete n[t]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t,n=s[e.id];for(t in n){var r,i=n[t];for(r in i)h(i[r].object),delete i[r];delete n[t]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s)if(void 0!==(t=s[t])[e.id]){var n,r=t[e.id];for(n in r)h(r[n].object),delete r[n];delete t[e.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:v}}function uo(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,r,o,s),n.update(o,i,s)}}}function co(e,t,n){var r;function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(35633,36338).precision&&0<e.getShaderPrecisionFormat(35632,36338).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(35633,36337).precision&&0<e.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp";(s=i(o))!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var s,l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660);return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){return void 0!==r?r:r=!0===t.has("EXT_texture_filter_anisotropic")?(n=t.get("EXT_texture_filter_anisotropic"),e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)):0;var n},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(3379),maxCubemapSize:e.getParameter(34076),maxAttributes:e.getParameter(34921),maxVertexUniforms:e.getParameter(36347),maxVaryings:e.getParameter(36348),maxFragmentUniforms:e.getParameter(36349),vertexTextures:s=0<h,floatFragmentTextures:n=a||t.has("OES_texture_float"),floatVertexTextures:s&&n,maxSamples:a?e.getParameter(36183):0}}function ho(e){var t=this,n=null,r=0,i=!1,a=!1,o=new Ka,s=new mr,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=0<r),t.numPlanes=r,t.numIntersection=0}function c(e,n,r,i){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){i=r+4*a;var c=n.matrixWorldInverse;s.getNormalMatrix(c),(null===u||u.length<i)&&(u=new Float32Array(i));for(var h=0,d=r;h!==a;++h,d+=4)o.copy(e[h]).applyMatrix4(c,s),o.normal.toArray(u,d),u[d+3]=o.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){var o=0!==e.length||t||0!==r||i;return i=t,n=c(e,a,0),r=e.length,o},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1,u()},this.setState=function(t,o,s){var h=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows;if(t=e.get(t),!i||null===h||0===h.length||a&&!p)a?c(null):u();else{var f=4*(p=a?0:r),m=t.clippingState||null;l.value=m,m=c(h,o,f,s);for(var v=0;v!==f;++v)m[v]=n[v];t.clippingState=m,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=p}}}function po(e){var t=new WeakMap;function n(e,t){return t===Se?e.mapping=we:t===Te&&(e.mapping=Me),e}function r(e){var n=e.target;n.removeEventListener("dispose",r),void 0!==(e=t.get(n))&&(t.delete(n),e.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(a===Se||a===Te){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;return o&&0<o.height?(a=e.getRenderTarget(),(o=new Xa(o.height/2)).fromEquirectangularTexture(e,i),t.set(i,o),e.setRenderTarget(a),i.addEventListener("dispose",r),n(o.texture,i.mapping)):null}}return i},dispose:function(){t=new WeakMap}}}oo.physical={uniforms:Ua([oo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new pr(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Xi(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new pr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new Xi(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new Xi(1,1,1)},specularTintMap:{value:null}}]),vertexShader:io.meshphysical_vert,fragmentShader:io.meshphysical_frag};var fo=function(){h(t,Va);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-1,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.1,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2e3;return g(this,t),(n=e.call(this)).type="OrthographicCamera",n.zoom=1,n.view=null,n.left=r,n.right=i,n.top=a,n.bottom=o,n.near=s,n.far=l,n.updateProjectionMatrix(),n}return x(t,[{key:"copy",value:function(e,n){return l(v(t.prototype),"copy",this).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}},{key:"setViewOffset",value:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e;n=r+t,e=r-t,null!==this.view&&this.view.enabled&&(r=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom,a=(i+=r*this.view.offsetX)+r*this.view.width,e=(n-=t*this.view.offsetY)-t*this.view.height),this.projectionMatrix.makeOrthographic(i,a,n,e,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}]),t}();fo.prototype.isOrthographicCamera=!0;var mo=function(){h(t,Ga);var e=p(t);function t(n){return g(this,t),(n=e.call(this,n)).type="RawShaderMaterial",n}return t}();mo.prototype.isRawShaderMaterial=!0;var vo=Math.pow(2,8),go=[.125,.215,.35,.446,.526,.582],yo=5+go.length,xo=(c(Wd={},fn,0),c(Wd,mn,1),c(Wd,gn,2),c(Wd,xn,3),c(Wd,_n,4),c(Wd,bn,5),c(Wd,vn,6),Wd),_o=new Yi({side:P,depthWrite:!1,depthTest:!1}),bo=new Oa(new Ba,_o),wo=new fo,Mo=(qd=function(){for(var e=[],t=[],n=[],r=8,i=0;i<yo;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;4<i?o=go[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=[a=-(o=1/(a-1))/2,a,o=1+o/2,a,o,o,a,a,o,o,a,o],l=new Float32Array(108),u=new Float32Array(72),c=new Float32Array(36),h=0;h<6;h++){var d=h%3*2/3-1,p=2<h?0:-1;l.set([d,p,0,d+2/3,p,0,d+2/3,1+p,0,d,p,0,d+2/3,1+p,0,d,1+p,0],18*h),u.set(s,12*h),c.set([h,h,h,h,h,h],6*h)}(o=new ya).setAttribute("position",new Ki(l,3)),o.setAttribute("uv",new Ki(u,2)),o.setAttribute("faceIndex",new Ki(c,1)),e.push(o),4<r&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}())._lodPlanes,So=qd._sizeLods,To=qd._sigmas,Eo=new Xi,Ao=null,Lo=(t=1/(n=(1+Math.sqrt(5))/2),[new Tr(1,1,1),new Tr(-1,1,1),new Tr(1,1,-1),new Tr(-1,1,-1),new Tr(0,n,t),new Tr(0,n,-t),new Tr(t,0,n),new Tr(-t,0,n),new Tr(n,t,0),new Tr(-n,t,0)]);function ko(e){var t=Math.max(e.r,e.g,e.b);return t=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127),e.multiplyScalar(Math.pow(2,-t)),(t+128)/255}var Ro=function(){function e(t){var n;g(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(n=new Float32Array(20),t=new Tr(0,1,0),new mo({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:xo[fn]},outputEncoding:{value:xo[fn]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:O,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}return x(e,[{key:"fromScene",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:100;Ao=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),0<t&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){return this._fromTexture(e)}},{key:"fromCubemap",value:function(e){return this._fromTexture(e)}},{key:"compileCubemapShader",value:function(){null===this._cubemapShader&&(this._cubemapShader=Do(),this._compileMaterial(this._cubemapShader))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectShader&&(this._equirectShader=Io(),this._compileMaterial(this._equirectShader))}},{key:"dispose",value:function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Mo.length;e++)Mo[e].dispose()}},{key:"_cleanup",value:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Ao),e.scissorTest=!1,Po(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e){Ao=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}},{key:"_allocateTargets",value:function(e){var t={magFilter:Ce,minFilter:Ce,generateMipmaps:!1,type:He,format:it,encoding:void 0===(n=e)||n.type!==He||n.encoding!==fn&&n.encoding!==mn&&n.encoding!==vn?gn:e.encoding,depthBuffer:!1},n=Co(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Co(t),n}},{key:"_compileMaterial",value:function(e){e=new Oa(Mo[0],e),this._renderer.compile(e,wo)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new Wa(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.outputEncoding;t=s.toneMapping,s.getClearColor(Eo),s.toneMapping=me,s.outputEncoding=fn;var c,h=s.autoClear=!1;(n=e.background)?n.isColor&&(_o.color.copy(n).convertSRGBToLinear(),e.background=null,c=ko(_o.color),_o.opacity=c,h=!0):(_o.color.copy(Eo).convertSRGBToLinear(),c=ko(_o.color),_o.opacity=c,h=!0);for(var d=0;d<6;d++){var p=d%3;0==p?(i.up.set(0,a[d],0),i.lookAt(o[d],0,0)):1==p?(i.up.set(0,0,a[d]),i.lookAt(0,o[d],0)):(i.up.set(0,a[d],0),i.lookAt(0,0,o[d])),Po(r,p*vo,2<d?vo:0,vo,vo),s.setRenderTarget(r),h&&s.render(bo,i),s.render(e,i)}s.toneMapping=t,s.outputEncoding=u,s.autoClear=l}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Do()):null==this._equirectShader&&(this._equirectShader=Io());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new Oa(Mo[0],r);((r=r.uniforms).envMap.value=e).isCubeTexture||r.texelSize.value.set(1/e.image.width,1/e.image.height),r.inputEncoding.value=xo[e.encoding],r.outputEncoding.value=xo[t.texture.encoding],Po(t,0,0,3*vo,2*vo),n.setRenderTarget(t),n.render(i,wo)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<yo;r++){var i=Math.sqrt(To[r]*To[r]-To[r-1]*To[r-1]);this._blur(e,r-1,r,i,Lo[(r-1)%Lo.length])}t.autoClear=n}},{key:"_blur",value:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(e,t,n,r,i,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 Oa(Mo[r],l),c=l.uniforms,h=(l=So[n]-1,i/(l=isFinite(i)?Math.PI/(2*l):2*Math.PI/39)),d=isFinite(i)?1+Math.floor(3*h):20;20<d&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(d," samples when the maximum is set to ").concat(20));for(var p=[],f=0,m=0;m<20;++m){var v=m/h;v=Math.exp(-v*v/2),p.push(v),0==m?f+=v:m<d&&(f+=2*v)}for(var g=0;g<p.length;g++)p[g]=p[g]/f;c.envMap.value=e.texture,c.samples.value=d,c.weights.value=p,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o),c.dTheta.value=l,c.mipInt.value=8-n,c.inputEncoding.value=xo[e.texture.encoding],c.outputEncoding.value=xo[e.texture.encoding],e=So[r],Po(t,3*Math.max(0,vo-2*e),(0===r?0:2*vo)+2*e*(4<r?r-8+4:0),3*e,2*e),s.setRenderTarget(t),s.render(u,wo)}}]),e}();function Co(e){return(e=new br(3*vo,3*vo,e)).texture.mapping=Ee,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Po(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Io(){var e=new pr(1,1);return new mo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:xo[fn]},outputEncoding:{value:xo[fn]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:O,depthTest:!1,depthWrite:!1})}function Do(){return new mo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:xo[fn]},outputEncoding:{value:xo[fn]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:O,depthTest:!1,depthWrite:!1})}function No(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r),void 0!==(e=t.get(n))&&(e.delete(n),e.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping,o=a===Se||a===Te,s=a===we||a===Me;if(o||s)return t.has(i)?t.get(i).texture:(a=i.image,o&&a&&0<a.height||s&&a&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(a)?(a=e.getRenderTarget(),null===n&&(n=new Ro(e)),o=o?n.fromEquirectangular(i):n.fromCubemap(i),t.set(i,o),e.setRenderTarget(a),i.addEventListener("dispose",r),o.texture):null)}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Oo(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r}return{has:function(e){return null!==n(e)},init:function(e){e.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")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Fo(e,t,n,r){var i={},a=new WeakMap;function o(e){var s,l=e.target;for(s in null!==l.index&&t.remove(l.index),l.attributes)t.remove(l.attributes[s]);l.removeEventListener("dispose",o),delete i[l.id],(e=a.get(l))&&(t.remove(e),a.delete(l)),r.releaseStatesOfGeometry(l),!0===l.isInstancedBufferGeometry&&delete l._maxInstanceCount,n.memory.geometries--}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(e){var n,r=e.attributes;for(n in r)t.update(r[n],34962);var i,a=e.morphAttributes;for(i in a)for(var o=a[i],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var n,r=a.get(e);return(!r||null!==(n=e.index)&&r.version<n.version)&&function(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r)for(var s=r.array,l=(o=r.version,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=i.array;o=i.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)}}(p=new(65535<la(n)?ia:na)(n,1)).version=o,(o=a.get(e))&&t.remove(o),a.set(e,p)}(e),a.get(e)}}}function Bo(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i,1)},this.renderInstances=function(r,l,u){if(0!==u){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,l,a,r*o,u),n.update(l,i,u)}}}function zo(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Uo(e,t){return e[0]-t[0]}function Ho(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Go(e){for(var t={},n=new Float32Array(8),r=[],i=0;i<8;i++)r[i]=[i,0];return{update:function(i,a,o,s){var l=i.morphTargetInfluences,u=void 0===l?0:l.length;if(void 0===(c=t[a.id])||c.length!==u){for(var c=[],h=0;h<u;h++)c[h]=[h,0];t[a.id]=c}for(var d=0;d<u;d++){var p=c[d];p[0]=d,p[1]=l[d]}c.sort(Ho);for(var f=0;f<8;f++)f<u&&c[f][1]?(r[f][0]=c[f][0],r[f][1]=c[f][1]):(r[f][0]=Number.MAX_SAFE_INTEGER,r[f][1]=0);r.sort(Uo);for(var m=a.morphAttributes.position,v=a.morphAttributes.normal,g=0,y=0;y<8;y++){var x=(_=r[y])[0],_=_[1];x!==Number.MAX_SAFE_INTEGER&&_?(m&&a.getAttribute("morphTarget"+y)!==m[x]&&a.setAttribute("morphTarget"+y,m[x]),v&&a.getAttribute("morphNormal"+y)!==v[x]&&a.setAttribute("morphNormal"+y,v[x]),g+=n[y]=_):(m&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),n[y]=0)}i=a.morphTargetsRelative?1:1-g,s.getUniforms().setValue(e,"morphTargetBaseInfluence",i),s.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Vo(e,t,n,r){var i=new WeakMap;function a(e){(e=e.target).removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(e){var o=r.render.frame,s=e.geometry;return s=t.get(e,s),i.get(s)!==o&&(t.update(s),i.set(s,o)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),s},dispose:function(){i=new WeakMap}}}var Wo=function(){h(t,yr);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;return g(this,t),(n=e.call(this,null)).image={data:r,width:i,height:a,depth:o},n.magFilter=Ce,n.minFilter=Ce,n.wrapR=ke,n.generateMipmaps=!1,n.flipY=!1,n.unpackAlignment=1,n.needsUpdate=!0,n}return t}();Wo.prototype.isDataTexture2DArray=!0;var jo=function(){h(t,yr);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;return g(this,t),(n=e.call(this,null)).image={data:r,width:i,height:a,depth:o},n.magFilter=Ce,n.minFilter=Ce,n.wrapR=ke,n.generateMipmaps=!1,n.flipY=!1,n.unpackAlignment=1,n.needsUpdate=!0,n}return t}();jo.prototype.isDataTexture3D=!0;var qo=new yr,Xo=new Wo,Yo=new jo,Jo=new qa,Zo=[],Ko=[],Qo=new Float32Array(16),$o=new Float32Array(9),es=new Float32Array(4);function ts(e,t,n){var r=e[0];if(r<=0||0<r)return e;var i=t*n,a=Zo[i];if(void 0===a&&(a=new Float32Array(i),Zo[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)e[o].toArray(a,s+=n)}return a}function ns(e,t){if(e.length===t.length){for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return;return 1}}function rs(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function is(e,t){var n=Ko[t];void 0===n&&(n=new Int32Array(t),Ko[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function as(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function os(e,t){var n=this.cache;void 0!==t.x?n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y):ns(n,t)||(e.uniform2fv(this.addr,t),rs(n,t))}function ss(e,t){var n=this.cache;void 0!==t.x?n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z):void 0!==t.r?n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b):ns(n,t)||(e.uniform3fv(this.addr,t),rs(n,t))}function ls(e,t){var n=this.cache;void 0!==t.x?n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w):ns(n,t)||(e.uniform4fv(this.addr,t),rs(n,t))}function us(e,t){var n=this.cache,r=t.elements;void 0===r?ns(n,t)||(e.uniformMatrix2fv(this.addr,!1,t),rs(n,t)):ns(n,r)||(es.set(r),e.uniformMatrix2fv(this.addr,!1,es),rs(n,r))}function cs(e,t){var n=this.cache,r=t.elements;void 0===r?ns(n,t)||(e.uniformMatrix3fv(this.addr,!1,t),rs(n,t)):ns(n,r)||($o.set(r),e.uniformMatrix3fv(this.addr,!1,$o),rs(n,r))}function hs(e,t){var n=this.cache,r=t.elements;void 0===r?ns(n,t)||(e.uniformMatrix4fv(this.addr,!1,t),rs(n,t)):ns(n,r)||(Qo.set(r),e.uniformMatrix4fv(this.addr,!1,Qo),rs(n,r))}function ds(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function ps(e,t){var n=this.cache;ns(n,t)||(e.uniform2iv(this.addr,t),rs(n,t))}function fs(e,t){var n=this.cache;ns(n,t)||(e.uniform3iv(this.addr,t),rs(n,t))}function ms(e,t){var n=this.cache;ns(n,t)||(e.uniform4iv(this.addr,t),rs(n,t))}function vs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function gs(e,t){var n=this.cache;ns(n,t)||(e.uniform2uiv(this.addr,t),rs(n,t))}function ys(e,t){var n=this.cache;ns(n,t)||(e.uniform3uiv(this.addr,t),rs(n,t))}function xs(e,t){var n=this.cache;ns(n,t)||(e.uniform4uiv(this.addr,t),rs(n,t))}function _s(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||qo,i)}function bs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Yo,i)}function ws(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||Jo,i)}function Ms(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Xo,i)}function Ss(e,t){e.uniform1fv(this.addr,t)}function Ts(e,t){t=ts(t,this.size,2),e.uniform2fv(this.addr,t)}function Es(e,t){t=ts(t,this.size,3),e.uniform3fv(this.addr,t)}function As(e,t){t=ts(t,this.size,4),e.uniform4fv(this.addr,t)}function Ls(e,t){t=ts(t,this.size,4),e.uniformMatrix2fv(this.addr,!1,t)}function ks(e,t){t=ts(t,this.size,9),e.uniformMatrix3fv(this.addr,!1,t)}function Rs(e,t){t=ts(t,this.size,16),e.uniformMatrix4fv(this.addr,!1,t)}function Cs(e,t){e.uniform1iv(this.addr,t)}function Ps(e,t){e.uniform2iv(this.addr,t)}function Is(e,t){e.uniform3iv(this.addr,t)}function Ds(e,t){e.uniform4iv(this.addr,t)}function Ns(e,t){e.uniform1uiv(this.addr,t)}function Os(e,t){e.uniform2uiv(this.addr,t)}function Fs(e,t){e.uniform3uiv(this.addr,t)}function Bs(e,t){e.uniform4uiv(this.addr,t)}function zs(e,t,n){var r=t.length,i=is(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||qo,i[a])}function Us(e,t,n){var r=t.length,i=is(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||Jo,i[a])}function Hs(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return as;case 35664:return os;case 35665:return ss;case 35666:return ls;case 35674:return us;case 35675:return cs;case 35676:return hs;case 5124:case 35670:return ds;case 35667:case 35671:return ps;case 35668:case 35672:return fs;case 35669:case 35673:return ms;case 5125:return vs;case 36294:return gs;case 36295:return ys;case 36296:return xs;case 35678:case 36198:case 36298:case 36306:case 35682:return _s;case 35679:case 36299:case 36307:return bs;case 35680:case 36300:case 36308:case 36293:return ws;case 36289:case 36303:case 36311:case 36292:return Ms}}(t.type)}function Gs(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ss;case 35664:return Ts;case 35665:return Es;case 35666:return As;case 35674:return Ls;case 35675:return ks;case 35676:return Rs;case 5124:case 35670:return Cs;case 35667:case 35671:return Ps;case 35668:case 35672:return Is;case 35669:case 35673:return Ds;case 5125:return Ns;case 36294:return Os;case 36295:return Fs;case 36296:return Bs;case 35678:case 36198:case 36298:case 36306:case 35682:return zs;case 35680:case 36300:case 36308:case 36293:return Us}}(t.type)}function Vs(e){this.id=e,this.seq=[],this.map={}}Gs.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),rs(t,e)},Vs.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Ws=/(\w+)(\])?(\[|\.)?/g;function js(e,t){e.seq.push(t),e.map[t.id]=t}function qs(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);!function(e,t,n){var r=e.name,i=r.length;for(Ws.lastIndex=0;;){var a=Ws.exec(r),o=Ws.lastIndex,s=a[1];if("]"===a[2]&&(s|=0),void 0===(a=a[3])||"["===a&&o+2===i){js(n,new(void 0===a?Hs:Gs)(s,e,t));break}void 0===(a=n.map[s])&&js(n,a=new Vs(s)),n=a}}(i,e.getUniformLocation(t,i.name),this)}}function Xs(e,t,n){return t=e.createShader(t),e.shaderSource(t,n),e.compileShader(t),t}qs.prototype.setValue=function(e,t,n,r){void 0!==(t=this.map[t])&&t.setValue(e,n,r)},qs.prototype.setOptional=function(e,t,n){void 0!==(t=t[n])&&this.setValue(e,n,t)},qs.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},qs.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Ys=0;function Js(e){switch(e){case fn:return["Linear","( value )"];case mn:return["sRGB","( value )"];case gn:return["RGBE","( value )"];case xn:return["RGBM","( value, 7.0 )"];case _n:return["RGBM","( value, 16.0 )"];case bn:return["RGBD","( value, 256.0 )"];case vn:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case yn:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function Zs(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Ks(e,t){return"vec4 "+e+"( vec4 value ) { return "+(t=Js(t))[0]+"ToLinear"+t[1]+"; }"}function Qs(e){return""!==e}function $s(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function el(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var tl=/^[ \t]*#include +<([\w\d./]+)>/gm;function nl(e){return e.replace(tl,rl)}function rl(e,t){var n=io[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return nl(n)}var il=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,al=/#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 ol(e){return e.replace(al,ll).replace(il,sl)}function sl(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ll(0,t,n,r)}function ll(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function ul(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function cl(e,t,n,r){var i,a,o,s,l,u,c=e.getContext(),h=n.defines,d=n.vertexShader,p=n.fragmentShader,f=(x="SHADOWMAP_TYPE_BASIC",(y=n).shadowMapType===L?x="SHADOWMAP_TYPE_PCF":y.shadowMapType===k?x="SHADOWMAP_TYPE_PCF_SOFT":y.shadowMapType===R&&(x="SHADOWMAP_TYPE_VSM"),x),m=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case we:case Me:t="ENVMAP_TYPE_CUBE";break;case Ee:case Ae:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),v=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case Me:case Ae:t="ENVMAP_MODE_REFRACTION"}return t}(n),g=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case de:t="ENVMAP_BLENDING_MULTIPLY";break;case pe:t="ENVMAP_BLENDING_MIX";break;case fe:t="ENVMAP_BLENDING_ADD"}return t}(n),y=0<e.gammaFactor?e.gammaFactor:1,x=n.isWebGL2?"":[(_=n).extensionDerivatives||_.envMapCubeUV||_.bumpMap||_.tangentSpaceNormalMap||_.clearcoatNormalMap||_.flatShading||"physical"===_.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(_.extensionFragDepth||_.logarithmicDepthBuffer)&&_.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",_.extensionDrawBuffers&&_.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(_.extensionShaderTextureLOD||_.envMap||0<_.transmission)&&_.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Qs).join("\n"),_=function(e){var t,n=[];for(t in e){var r=e[t];!1!==r&&n.push("#define "+t+" "+r)}return n.join("\n")}(h),b=c.createProgram();return h=n.glslVersion?"#version "+n.glslVersion+"\n":"",n.isRawShaderMaterial?(0<(i=[_].filter(Qs).join("\n")).length&&(i+="\n"),0<(a=[x,_].filter(Qs).join("\n")).length&&(a+="\n")):(i=[ul(n),"#define SHADER_NAME "+n.shaderName,_,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+v:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Qs).join("\n"),a=[x,ul(n),"#define SHADER_NAME "+n.shaderName,_,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+y,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+v:"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==me?"#define TONE_MAPPING":"",n.toneMapping!==me?io.tonemapping_pars_fragment:"",n.toneMapping!==me?function(e,t){var n;switch(t){case ve:n="Linear";break;case ge:n="Reinhard";break;case ye:n="OptimizedCineon";break;case xe:n="ACESFilmic";break;case _e:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 toneMapping( vec3 color ) { return "+n+"ToneMapping( color ); }"}(0,n.toneMapping):"",n.dithering?"#define DITHERING":"",io.encodings_pars_fragment,n.map?Ks("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ks("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ks("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ks("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularTintMap?Ks("specularTintMapTexelToLinear",n.specularTintMapEncoding):"",n.lightMap?Ks("lightMapTexelToLinear",n.lightMapEncoding):"",(o="linearToOutputTexel",s=Js(s=n.outputEncoding),"vec4 "+o+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Qs).join("\n")),d=el(d=$s(d=nl(d),n),n),p=el(p=$s(p=nl(p),n),n),d=ol(d),p=ol(p),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(h="#version 300 es\n",i=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Qn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Qn?"":"#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"+a),v=h+a+p,g=Xs(c,35633,h+i+d),f=Xs(c,35632,v),c.attachShader(b,g),c.attachShader(b,f),void 0!==n.index0AttributeName?c.bindAttribLocation(b,0,n.index0AttributeName):!0===n.morphTargets&&c.bindAttribLocation(b,0,"position"),c.linkProgram(b),e.debug.checkShaderErrors&&(o=c.getProgramInfoLog(b).trim(),s=c.getShaderInfoLog(g).trim(),p=c.getShaderInfoLog(f).trim(),!(d=h=!0)===c.getProgramParameter(b,35714)?(h=!1,v=Zs(c,g,"vertex"),e=Zs(c,f,"fragment"),console.error("THREE.WebGLProgram: shader error: ",c.getError(),"35715",c.getProgramParameter(b,35715),"gl.getProgramInfoLog",o,v,e)):""!==o?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",o):""!==s&&""!==p||(d=!1),d&&(this.diagnostics={runnable:h,programLog:o,vertexShader:{log:s,prefix:i},fragmentShader:{log:p,prefix:a}})),c.deleteShader(g),c.deleteShader(f),this.getUniforms=function(){return l=void 0===l?new qs(c,b):l},this.getAttributes=function(){return u=void 0===u?function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(c,b):u},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(b),this.program=void 0},this.name=n.shaderName,this.id=Ys++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=g,this.fragmentShader=f,this}function hl(e,t,n,r,i,a,o){var s=[],l=i.isWebGL2,u=i.logarithmicDepthBuffer,c=i.floatVertexTextures,h=i.maxVertexUniforms,d=i.vertexTextures,p=i.precision,f={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","specularIntensityMap","specularTintMap","specularTintMapEncoding","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];function v(e){return e&&e.isTexture?e.encoding:e&&e.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e.texture.encoding):fn}return{getParameters:function(a,s,m,g,y){var x,_,b=g.fog,w=a.isMeshStandardMaterial?g.environment:null,M=(g=(a.isMeshStandardMaterial?n:t).get(a.envMap||w),w=f[a.type],y.isSkinnedMesh?(M=(_=y).skeleton.bones,c?1024:(_=Math.floor((h-20)/4),(_=Math.min(_,M.length))<M.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+M.length+" bones. This GPU supports "+_+"."),0):_)):0);null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."),_=w?(x=(S=oo[w]).vertexShader,S.fragmentShader):(x=a.vertexShader,a.fragmentShader);var S=e.getRenderTarget();return{isWebGL2:l,shaderID:w,shaderName:a.type,vertexShader:x,fragmentShader:_,defines:a.defines,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null!==S?v(S.texture):e.outputEncoding,map:!!a.map,mapEncoding:v(a.map),matcap:!!a.matcap,matcapEncoding:v(a.matcap),envMap:!!g,envMapMode:g&&g.mapping,envMapEncoding:v(g),envMapCubeUV:!!g&&(g.mapping===Ee||g.mapping===Ae),lightMap:!!a.lightMap,lightMapEncoding:v(a.lightMap),aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,emissiveMapEncoding:v(a.emissiveMap),bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===Tn,tangentSpaceNormalMap:a.normalMapType===Sn,clearcoatMap:!!a.clearcoatMap,clearcoatRoughnessMap:!!a.clearcoatRoughnessMap,clearcoatNormalMap:!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularTintMap:!!a.specularTintMap,specularTintMapEncoding:v(a.specularTintMap),alphaMap:!!a.alphaMap,gradientMap:!!a.gradientMap,sheen:!!a.sheen,transmission:!!a.transmission,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap||!a.displacementMap),fog:!!b,useFog:a.fog,fogExp2:b&&b.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===y.isSkinnedMesh&&0<M,maxBones:M,useVertexTexture:c,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&0<m.length,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:me,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,alphaTest:a.alphaTest,doubleSided:a.side===I,flipSided:a.side===P,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(!1===t.isRawShaderMaterial){for(var i=0;i<m.length;i++)n.push(t[m[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t=f[e.type];return t?(t=oo[t],Ha.clone(t.uniforms)):e.uniforms},acquireProgram:function(t,n){for(var r,i=0,o=s.length;i<o;i++){var l=s[i];if(l.cacheKey===n){++(r=l).usedTimes;break}}return void 0===r&&(r=new cl(e,n,t,a),s.push(r)),r},releaseProgram:function(e){var t;0==--e.usedTimes&&(t=s.indexOf(e),s[t]=s[s.length-1],s.pop(),e.destroy())},programs:s}}function dl(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&e.set(t,n={}),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function pl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function fl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function ml(e){var t=[],n=0,r=[],i=[],a=[],o={id:-1};function s(r,i,a,s,l,u){var c=t[n],h=e.get(a);return void 0===c?(c={id:r.id,object:r,geometry:i,material:a,program:h.program||o,groupOrder:s,renderOrder:r.renderOrder,z:l,group:u},t[n]=c):(c.id=r.id,c.object=r,c.geometry=i,c.material=a,c.program=h.program||o,c.groupOrder=s,c.renderOrder=r.renderOrder,c.z=l,c.group=u),n++,c}return{opaque:r,transmissive:i,transparent:a,init:function(){n=0,r.length=0,i.length=0,a.length=0},push:function(e,t,n,o,l,u){u=s(e,t,n,o,l,u),(0<n.transmission?i:!0===n.transparent?a:r).push(u)},unshift:function(e,t,n,o,l,u){u=s(e,t,n,o,l,u),(0<n.transmission?i:!0===n.transparent?a:r).unshift(u)},finish:function(){for(var e=n,r=t.length;e<r;e++){var i=t[e];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(e,t){1<r.length&&r.sort(e||pl),1<i.length&&i.sort(t||fl),1<a.length&&a.sort(t||fl)}}}function vl(e){var t=new WeakMap;return{get:function(n,r){var i;return!1===t.has(n)?(i=new ml(e),t.set(n,[i])):r>=t.get(n).length?(i=new ml(e),t.get(n).push(i)):i=t.get(n)[r],i},dispose:function(){t=new WeakMap}}}function gl(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Tr,color:new Xi};break;case"SpotLight":n={position:new Tr,direction:new Tr,color:new Xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Tr,color:new Xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Tr,skyColor:new Xi,groundColor:new Xi};break;case"RectAreaLight":n={color:new Xi,position:new Tr,halfWidth:new Tr,halfHeight:new Tr}}return e[t.id]=n}}}var yl=0;function xl(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function _l(e,t){for(var n,r=new gl,i=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pr,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},o=0;o<9;o++)a.probe.push(new Tr);var s=new Tr,l=new ni,u=new ni;return{setup:function(n){for(var o=0,s=0,l=0,u=0;u<9;u++)a.probe[u].set(0,0,0);var c=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0;n.sort(xl);for(var y=0,x=n.length;y<x;y++){var _,b,w,M,S,T=n[y],E=T.color,A=T.intensity,L=T.distance,k=T.shadow&&T.shadow.map?T.shadow.map.texture:null;if(T.isAmbientLight)o+=E.r*A,s+=E.g*A,l+=E.b*A;else if(T.isLightProbe)for(var R=0;R<9;R++)a.probe[R].addScaledVector(T.sh.coefficients[R],A);else T.isDirectionalLight?((w=r.get(T)).color.copy(T.color).multiplyScalar(T.intensity),T.castShadow&&(_=T.shadow,(b=i.get(T)).shadowBias=_.bias,b.shadowNormalBias=_.normalBias,b.shadowRadius=_.radius,b.shadowMapSize=_.mapSize,a.directionalShadow[c]=b,a.directionalShadowMap[c]=k,a.directionalShadowMatrix[c]=T.shadow.matrix,m++),a.directional[c]=w,c++):T.isSpotLight?((b=r.get(T)).position.setFromMatrixPosition(T.matrixWorld),b.color.copy(E).multiplyScalar(A),b.distance=L,b.coneCos=Math.cos(T.angle),b.penumbraCos=Math.cos(T.angle*(1-T.penumbra)),b.decay=T.decay,T.castShadow&&(w=T.shadow,(L=i.get(T)).shadowBias=w.bias,L.shadowNormalBias=w.normalBias,L.shadowRadius=w.radius,L.shadowMapSize=w.mapSize,a.spotShadow[d]=L,a.spotShadowMap[d]=k,a.spotShadowMatrix[d]=T.shadow.matrix,g++),a.spot[d]=b,d++):T.isRectAreaLight?((M=r.get(T)).color.copy(E).multiplyScalar(A),M.halfWidth.set(.5*T.width,0,0),M.halfHeight.set(0,.5*T.height,0),a.rectArea[p]=M,p++):T.isPointLight?((S=r.get(T)).color.copy(T.color).multiplyScalar(T.intensity),S.distance=T.distance,S.decay=T.decay,T.castShadow&&(E=T.shadow,(M=i.get(T)).shadowBias=E.bias,M.shadowNormalBias=E.normalBias,M.shadowRadius=E.radius,M.shadowMapSize=E.mapSize,M.shadowCameraNear=E.camera.near,M.shadowCameraFar=E.camera.far,a.pointShadow[h]=M,a.pointShadowMap[h]=k,a.pointShadowMatrix[h]=T.shadow.matrix,v++),a.point[h]=S,h++):T.isHemisphereLight&&((S=r.get(T)).skyColor.copy(T.color).multiplyScalar(A),S.groundColor.copy(T.groundColor).multiplyScalar(A),a.hemi[f]=S,f++)}0<p&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=ao.LTC_FLOAT_1,a.rectAreaLTC2=ao.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=ao.LTC_HALF_1,a.rectAreaLTC2=ao.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=o,a.ambient[1]=s,a.ambient[2]=l;var C=a.hash;C.directionalLength===c&&C.pointLength===h&&C.spotLength===d&&C.rectAreaLength===p&&C.hemiLength===f&&C.numDirectionalShadows===m&&C.numPointShadows===v&&C.numSpotShadows===g||(a.directional.length=c,a.spot.length=d,a.rectArea.length=p,a.point.length=h,a.hemi.length=f,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=v,a.pointShadowMap.length=v,a.spotShadow.length=g,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=v,a.spotShadowMatrix.length=g,C.directionalLength=c,C.pointLength=h,C.spotLength=d,C.rectAreaLength=p,C.hemiLength=f,C.numDirectionalShadows=m,C.numPointShadows=v,C.numSpotShadows=g,a.version=yl++)},setupView:function(e,t){for(var n=0,r=0,i=0,o=0,c=0,h=t.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f,m,v,g=e[d];g.isDirectionalLight?((f=a.directional[n]).direction.setFromMatrixPosition(g.matrixWorld),s.setFromMatrixPosition(g.target.matrixWorld),f.direction.sub(s),f.direction.transformDirection(h),n++):g.isSpotLight?((m=a.spot[i]).position.setFromMatrixPosition(g.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(g.matrixWorld),s.setFromMatrixPosition(g.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),i++):g.isRectAreaLight?((m=a.rectArea[o]).position.setFromMatrixPosition(g.matrixWorld),m.position.applyMatrix4(h),u.identity(),l.copy(g.matrixWorld),l.premultiply(h),u.extractRotation(l),m.halfWidth.set(.5*g.width,0,0),m.halfHeight.set(0,.5*g.height,0),m.halfWidth.applyMatrix4(u),m.halfHeight.applyMatrix4(u),o++):g.isPointLight?((v=a.point[r]).position.setFromMatrixPosition(g.matrixWorld),v.position.applyMatrix4(h),r++):g.isHemisphereLight&&((v=a.hemi[c]).direction.setFromMatrixPosition(g.matrixWorld),v.direction.transformDirection(h),v.direction.normalize(),c++)}},state:a}}function bl(e,t){var n=new _l(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function wl(e,t){var n=new WeakMap;return{get:function(r){var i,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!1===n.has(r)?(i=new bl(e,t),n.set(r,[i])):a>=n.get(r).length?(i=new bl(e,t),n.get(r).push(i)):i=n.get(r)[a],i},dispose:function(){n=new WeakMap}}}var Ml=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshDepthMaterial",r.depthPacking=wn,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();Ml.prototype.isMeshDepthMaterial=!0;var Sl=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshDistanceMaterial",r.referencePosition=new Tr,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.fog=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),t}();function Tl(e,t,n){var r=new eo,i=new pr,a=new pr,o=new _r,s=new Ml({depthPacking:Mn}),l=new Sl,u={},c=n.maxTextureSize,h={0:P,1:C,2:I},d=new Ga({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new pr},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 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, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1,(n=new ya).setAttribute("position",new Ki(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new Oa(n,d),m=this;function v(t,n,r,i,a,o,c){var d,p=null,f=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;return p=void 0!==f?f:!0===i.isPointLight?l:s,e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length&&(d=p.uuid,t=r.uuid,void 0===(f=u[d])&&(u[d]=f={}),void 0===(d=f[t])&&(d=p.clone(),f[t]=d),p=d),p.visible=r.visible,p.wireframe=r.wireframe,p.side=c===R?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:h[r.side],p.clipShadows=r.clipShadows,p.clippingPlanes=r.clippingPlanes,p.clipIntersection=r.clipIntersection,p.wireframeLinewidth=r.wireframeLinewidth,p.linewidth=r.linewidth,!0===i.isPointLight&&!0===p.isMeshDistanceMaterial&&(p.referencePosition.setFromMatrixPosition(i.matrixWorld),p.nearDistance=a,p.farDistance=o),p}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=L,this.render=function(n,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==n.length){var u=e.getRenderTarget(),h=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.state;y.setBlending(O),y.buffers.color.setClear(1,1,1,1),y.buffers.depth.setTest(!0),y.setScissorTest(!1);for(var x,_=0,b=n.length;_<b;_++){var w=n[_],M=w.shadow;if(void 0!==M){if(!1!==M.autoUpdate||!1!==M.needsUpdate){i.copy(M.mapSize);var S,T=M.getFrameExtents();i.multiply(T),a.copy(M.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/T.x),i.x=a.x*T.x,M.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/T.y),i.y=a.y*T.y,M.mapSize.y=a.y)),null!==M.map||M.isPointLightShadow||this.type!==R||(M.map=new br(i.x,i.y,S={minFilter:Oe,magFilter:Oe,format:tt}),M.map.texture.name=w.name+".shadowMap",M.mapPass=new br(i.x,i.y,S),M.camera.updateProjectionMatrix()),null===M.map&&(M.map=new br(i.x,i.y,{minFilter:Ce,magFilter:Ce,format:tt}),M.map.texture.name=w.name+".shadowMap",M.camera.updateProjectionMatrix()),e.setRenderTarget(M.map),e.clear();for(var E=M.getViewportCount(),A=0;A<E;A++){var L=M.getViewport(A);o.set(a.x*L.x,a.y*L.y,a.x*L.z,a.y*L.w),y.viewport(o),M.updateMatrices(w,A),r=M.getFrustum(),function n(i,a,o,s,l){if(!1!==i.visible){var u=i.layers.test(a.layers);if(u&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===R)&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);var c=t.update(i),h=i.material;if(Array.isArray(h))for(var d=c.groups,p=0,f=d.length;p<f;p++){var m=d[p],g=h[m.materialIndex];g&&g.visible&&(g=v(i,0,g,s,o.near,o.far,l),e.renderBufferDirect(o,null,c,g,i,m))}else h.visible&&(u=v(i,0,h,s,o.near,o.far,l),e.renderBufferDirect(o,null,c,u,i,null))}for(var y=i.children,x=0,_=y.length;x<_;x++)n(y[x],a,o,s,l)}}(s,l,M.camera,w,this.type)}M.isPointLightShadow||this.type!==R||(x=M,T=l,S=void 0,S=t.update(f),d.uniforms.shadow_pass.value=x.map.texture,d.uniforms.resolution.value=x.mapSize,d.uniforms.radius.value=x.radius,e.setRenderTarget(x.mapPass),e.clear(),e.renderBufferDirect(T,null,S,d,f,null),p.uniforms.shadow_pass.value=x.mapPass.texture,p.uniforms.resolution.value=x.mapSize,p.uniforms.radius.value=x.radius,e.setRenderTarget(x.map),e.clear(),e.renderBufferDirect(T,null,S,p,f,null)),M.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",w,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(u,h,g)}}}function El(e,t,n){var r=n.isWebGL2,i=new function(){var t=!1,n=new _r,r=null,i=new _r(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){(e?ve:ge)(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case ie:e.depthFunc(512);break;case ae:e.depthFunc(519);break;case oe:e.depthFunc(513);break;case se:e.depthFunc(515);break;case le:e.depthFunc(514);break;case ue:e.depthFunc(518);break;case ce:e.depthFunc(516);break;case he:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,i=r=n=null}}},o=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(e){t||(e?ve:ge)(2960)},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&l===r||(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,u=l=s=o=a=i=r=n=null}}},s={},l=null,u={},h=null,d=!1,p=null,f=null,m=null,v=null,g=null,y=null,x=null,_=!1,b=null,w=null,E=null,A=null,L=null,k=e.getParameter(35661),R=!1,C=0;-1!==(n=e.getParameter(7938)).indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(n)[1]),R=1<=C):-1!==n.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(n)[1]),R=2<=C);var D=null,N={},de=(n=e.getParameter(3088),C=e.getParameter(2978),(new _r).fromArray(n)),pe=(new _r).fromArray(C);function fe(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var me={};function ve(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function ge(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}me[3553]=fe(3553,3553,1),me[34067]=fe(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ve(2929),a.setFunc(se),we(!1),Me(S),ve(2884),be(O);var ye,xe=(c(C={},G,32774),c(C,V,32778),c(C,W,32779),C);r?(xe[j]=32775,xe[q]=32776):null!==(ye=t.get("EXT_blend_minmax"))&&(xe[j]=ye.MIN_EXT,xe[q]=ye.MAX_EXT);var _e=(c(ye={},X,0),c(ye,Y,1),c(ye,J,768),c(ye,K,770),c(ye,re,776),c(ye,te,774),c(ye,$,772),c(ye,Z,769),c(ye,Q,771),c(ye,ne,775),c(ye,ee,773),ye);function be(t,n,r,i,a,o,s,l){if(t!==O){if(!1===d&&(ve(3042),d=!0),t===H)a=a||n,o=o||r,s=s||i,n===f&&a===g||(e.blendEquationSeparate(xe[n],xe[a]),f=n,g=a),r===m&&i===v&&o===y&&s===x||(e.blendFuncSeparate(_e[r],_e[i],_e[o],_e[s]),m=r,v=i,y=o,x=s),p=t,_=null;else if(t!==p||l!==_){if(f===G&&g===G||(e.blendEquation(32774),g=f=G),l)switch(t){case F:e.blendFuncSeparate(1,771,1,771);break;case B:e.blendFunc(1,1);break;case z:e.blendFuncSeparate(0,0,769,771);break;case U:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case F:e.blendFuncSeparate(770,771,1,771);break;case B:e.blendFunc(770,1);break;case z:e.blendFunc(0,769);break;case U:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=y=v=m=null,p=t,_=l}}else!0===d&&(ge(3042),d=!1)}function we(t){b!==t&&(t?e.frontFace(2304):e.frontFace(2305),b=t)}function Me(t){t!==M?(ve(2884),t!==w&&(t===S?e.cullFace(1029):t===T?e.cullFace(1028):e.cullFace(1032))):ge(2884),w=t}function Se(t,n,r){t?(ve(32823),A===n&&L===r||(e.polygonOffset(n,r),A=n,L=r)):ge(32823)}function Te(t){D!==(t=void 0===t?33984+k-1:t)&&(e.activeTexture(t),D=t)}return{buffers:{color:i,depth:a,stencil:o},enable:ve,disable:ge,bindFramebuffer:function(t,n){return null===n&&null!==l&&(n=l),u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n,r&&(36009===t&&(u[36160]=n),36160===t&&(u[36009]=n)),!0)},bindXRFramebuffer:function(t){t!==l&&(e.bindFramebuffer(36160,t),l=t)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:be,setMaterial:function(e,t){(e.side===I?ge:ve)(2884);var n=e.side===P;we(n=t?!n:n),e.blending===F&&!1===e.transparent?be(O):be(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite),n=e.stencilWrite,o.setTest(n),n&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Se(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),(!0===e.alphaToCoverage?ve:ge)(32926)},setFlipSided:we,setCullFace:Me,setLineWidth:function(t){t!==E&&(R&&e.lineWidth(t),E=t)},setPolygonOffset:Se,setScissorTest:function(e){(e?ve:ge)(3089)},activeTexture:Te,bindTexture:function(t,n){null===D&&Te();var r=N[D];void 0===r&&(N[D]=r={type:void 0,texture:void 0}),r.type===t&&r.texture===n||(e.bindTexture(t,n||me[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=N[D];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===de.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),de.copy(t))},viewport:function(t){!1===pe.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),pe.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===r&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},N={},_=d=!(u={}),L=A=E=w=b=x=y=g=v=m=f=p=h=l=D=null,de.set(0,0,e.canvas.width,e.canvas.height),pe.set(0,0,e.canvas.width,e.canvas.height),i.reset(),a.reset(),o.reset()}}}function Al(e,t,n,r,i,a,o){var s,l,u=i.isWebGL2,h=i.maxTextures,d=i.maxCubemapSize,p=i.maxTextureSize,f=i.maxSamples,m=new WeakMap,v=!1;try{v="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(s){}function g(e,t){return v?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(e,t,n,r){var i=1;return(i=e.width>r||e.height>r?r/Math.max(e.width,e.height):i)<1||!0===t?"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?(t=(r=t?hr:Math.floor)(i*e.width),i=r(i*e.height),void 0===l&&(l=g(t,i)),(n=n?g(t,i):l).width=t,n.height=i,n.getContext("2d").drawImage(e,0,0,t,i),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+t+"x"+i+")."),n):("data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e):e}function x(e){return ur(e.width)&&ur(e.height)}function _(e,t){return e.generateMipmaps&&t&&e.minFilter!==Ce&&e.minFilter!==Oe}function b(t,n,i,a,o){o=4<arguments.length&&void 0!==o?o:1,e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log2(Math.max(i,a,o))}function w(n,r,i){if(!1===u)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}return n=r,6403===r&&(5126===i&&(n=33326),5131===i&&(n=33325),5121===i&&(n=33321)),6407===r&&(5126===i&&(n=34837),5131===i&&(n=34843),5121===i&&(n=32849)),6408===r&&(5126===i&&(n=34836),5131===i&&(n=34842),5121===i&&(n=32856)),33325!==n&&33326!==n&&34842!==n&&34836!==n||t.get("EXT_color_buffer_float"),n}function M(e){return e===Ce||e===Pe||e===De?9728:9729}function S(t){var n,i=t.target;i.removeEventListener("dispose",S),n=i,void 0!==(t=r.get(n)).__webglInit&&(e.deleteTexture(t.__webglTexture),r.remove(n)),i.isVideoTexture&&m.delete(i),o.memory.textures--}function T(t){(t=t.target).removeEventListener("dispose",T),function(t){var n=t.texture,i=r.get(t),a=r.get(n);if(t){if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&e.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(var l=0,u=n.length;l<u;l++){var c=r.get(n[l]);c.__webglTexture&&(e.deleteTexture(c.__webglTexture),o.memory.textures--),r.remove(n[l])}r.remove(n),r.remove(t)}}(t)}var E=0;function A(e,t){var i,a=r.get(e);if(e.isVideoTexture&&(s=e,i=o.render.frame,m.get(s)!==i&&(m.set(s,i),s.update())),0<e.version&&a.__version!==e.version){var s=e.image;if(void 0===s)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==s.complete)return void I(a,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,a.__webglTexture)}function L(t,i){var o=r.get(t);0<t.version&&o.__version!==t.version?function(t,r,i){if(6===r.image.length){P(t,r),n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),s=r.image[0]&&r.image[0].isDataTexture,l=[],c=0;c<6;c++)l[c]=o||s?s?r.image[c].image:r.image[c]:y(r.image[c],!1,!0,d);var h,p=l[0],f=(i=x(p)||u,a.convert(r.format)),m=a.convert(r.type),v=w(r.internalFormat,f,m);if(C(34067,r,i),o){for(var g=0;g<6;g++){h=l[g].mipmaps;for(var M=0;M<h.length;M++){var S=h[M];r.format!==tt&&r.format!==et?null!==f?n.compressedTexImage2D(34069+g,M,v,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+g,M,v,S.width,S.height,0,f,m,S.data)}}t.__maxMipLevel=h.length-1}else{h=r.mipmaps;for(var T=0;T<6;T++)if(s){n.texImage2D(34069+T,0,v,l[T].width,l[T].height,0,f,m,l[T].data);for(var E=0;E<h.length;E++){var A=h[E].image[T].image;n.texImage2D(34069+T,E+1,v,A.width,A.height,0,f,m,A.data)}}else{n.texImage2D(34069+T,0,v,f,m,l[T]);for(var L=0;L<h.length;L++){var k=h[L];n.texImage2D(34069+T,L+1,v,f,m,k.image[T])}}t.__maxMipLevel=h.length}_(r,i)&&b(34067,r,p.width,p.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}}(o,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))}var k=(c(s={},Le,10497),c(s,ke,33071),c(s,Re,33648),s),R=(c(s={},Ce,9728),c(s,Pe,9984),c(s,De,9986),c(s,Oe,9729),c(s,Fe,9985),c(s,ze,9987),s);function C(n,a,o){o?(e.texParameteri(n,10242,k[a.wrapS]),e.texParameteri(n,10243,k[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,k[a.wrapR]),e.texParameteri(n,10240,R[a.magFilter]),e.texParameteri(n,10241,R[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===ke&&a.wrapT===ke||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,M(a.magFilter)),e.texParameteri(n,10241,M(a.minFilter)),a.minFilter!==Ce&&a.minFilter!==Oe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")&&(o=t.get("EXT_texture_filter_anisotropic"),a.type===Xe&&!1===t.has("OES_texture_float_linear")||!1===u&&a.type===Ye&&!1===t.has("OES_texture_half_float_linear")||(1<a.anisotropy||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy))}function P(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",S),t.__webglTexture=e.createTexture(),o.memory.textures++)}function I(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),P(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0),l=r,i=!u&&(l.wrapS!==ke||l.wrapT!==ke||l.minFilter!==Ce&&l.minFilter!==Oe)&&!1===x(r.image);var s,l=y(r.image,i,!1,p),c=(i=x(l)||u,a.convert(r.format)),h=a.convert(r.type),d=w(r.internalFormat,c,h);C(o,r,i);var f=r.mipmaps;if(r.isDepthTexture)d=6402,u?d=r.type===Xe?36012:r.type===qe?33190:r.type===Qe?35056:33189:r.type===Xe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===at&&6402===d&&r.type!==We&&r.type!==qe&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=We,h=a.convert(r.type)),r.format===ot&&6402===d&&(d=34041,r.type!==Qe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Qe,h=a.convert(r.type))),n.texImage2D(3553,0,d,l.width,l.height,0,c,h,null);else if(r.isDataTexture)if(0<f.length&&i){for(var m=0,v=f.length;m<v;m++)s=f[m],n.texImage2D(3553,m,d,s.width,s.height,0,c,h,s.data);r.generateMipmaps=!1,t.__maxMipLevel=f.length-1}else n.texImage2D(3553,0,d,l.width,l.height,0,c,h,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(var g=0,M=f.length;g<M;g++)s=f[g],r.format!==tt&&r.format!==et?null!==c?n.compressedTexImage2D(3553,g,d,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,g,d,s.width,s.height,0,c,h,s.data);t.__maxMipLevel=f.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,d,l.width,l.height,l.depth,0,c,h,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,d,l.width,l.height,l.depth,0,c,h,l.data),t.__maxMipLevel=0;else if(0<f.length&&i){for(var S=0,T=f.length;S<T;S++)s=f[S],n.texImage2D(3553,S,d,c,h,s);r.generateMipmaps=!1,t.__maxMipLevel=f.length-1}else n.texImage2D(3553,0,d,c,h,l),t.__maxMipLevel=0;_(r,i)&&b(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(t,i,o,s,l){var u=a.convert(o.format),c=a.convert(o.type),h=w(o.internalFormat,u,c);32879===l||35866===l?n.texImage3D(l,0,h,i.width,i.height,i.depth,0,u,c,null):n.texImage2D(l,0,h,i.width,i.height,0,u,c,null),n.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,s,l,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function N(t,n,r){var i,o,s;e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer?(o=33189,r?((i=n.depthTexture)&&i.isDepthTexture&&(i.type===Xe?o=36012:i.type===qe&&(o=33190)),i=F(n),e.renderbufferStorageMultisample(36161,i,o,n.width,n.height)):e.renderbufferStorage(36161,o,n.width,n.height),e.framebufferRenderbuffer(36160,36096,36161,t)):n.depthBuffer&&n.stencilBuffer?(r?(s=F(n),e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)):(o=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,s=a.convert(o.format),t=a.convert(o.type),t=w(o.internalFormat,s,t),r?(r=F(n),e.renderbufferStorageMultisample(36161,r,t,n.width,n.height)):e.renderbufferStorage(36161,t,n.width,n.height)),e.bindRenderbuffer(36161,null)}function O(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),A(i.depthTexture,0),t=r.get(i.depthTexture).__webglTexture,i.depthTexture.format===at)e.framebufferTexture2D(36160,36096,3553,t,0);else{if(i.depthTexture.format!==ot)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,t,0)}}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),N(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),N(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}function F(e){return u&&e.isWebGLMultisampleRenderTarget?Math.min(f,e.samples):0}var B=!1,z=!1;this.allocateTextureUnit=function(){var e=E;return h<=e&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=A,this.setTexture2DArray=function(e,t){var i=r.get(e);0<e.version&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);0<e.version&&i.__version!==e.version?I(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=L,this.setupRenderTarget=function(t){var s=t.texture,l=r.get(t),c=r.get(s);t.addEventListener("dispose",T),!0!==t.isWebGLMultipleRenderTargets&&(c.__webglTexture=e.createTexture(),c.__version=s.version,o.memory.textures++);var h,d=!0===t.isWebGLCubeRenderTarget,p=!0===t.isWebGLMultipleRenderTargets,f=!0===t.isWebGLMultisampleRenderTarget,m=s.isDataTexture3D||s.isDataTexture2DArray,v=x(t)||u;if(!u||s.format!==et||s.type!==Xe&&s.type!==Ye||(s.format=tt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),d){l.__webglFramebuffer=[];for(var g=0;g<6;g++)l.__webglFramebuffer[g]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),p)if(i.drawBuffers)for(var y=t.texture,M=0,S=y.length;M<S;M++){var E=r.get(y[M]);void 0===E.__webglTexture&&(E.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else f&&(u?(l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer),h=a.convert(s.format),f=a.convert(s.type),h=w(s.internalFormat,h,f),f=F(t),e.renderbufferStorageMultisample(36161,f,h,t.width,t.height),n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),N(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)):console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."));if(d){n.bindTexture(34067,c.__webglTexture),C(34067,s,v);for(var A=0;A<6;A++)D(l.__webglFramebuffer[A],t,s,36064,34069+A);_(s,v)&&b(34067,s,t.width,t.height),n.bindTexture(34067,null)}else if(p){for(var L=t.texture,k=0,R=L.length;k<R;k++){var P=L[k],I=r.get(P);n.bindTexture(3553,I.__webglTexture),C(3553,P,v),D(l.__webglFramebuffer,t,P,36064+k,3553),_(P,v)&&b(3553,P,t.width,t.height)}n.bindTexture(3553,null)}else p=3553,m&&(u?p=s.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(p,c.__webglTexture),C(p,s,v),D(l.__webglFramebuffer,t,s,36064,p),_(s,v)&&b(p,s,t.width,t.height,t.depth),n.bindTexture(p,null);t.depthBuffer&&O(t)},this.updateRenderTargetMipmap=function(e){for(var t=x(e)||u,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=0,o=i.length;a<o;a++){var s,l,c=i[a];_(c,t)&&(s=e.isWebGLCubeRenderTarget?34067:3553,l=r.get(c).__webglTexture,n.bindTexture(s,l),b(s,c,e.width,e.height),n.bindTexture(s,null))}},this.updateMultisampleRenderTarget=function(t){var i,a,o;t.isWebGLMultisampleRenderTarget&&(u?(i=t.width,a=t.height,o=16384,t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),t=r.get(t),n.bindFramebuffer(36008,t.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,t.__webglFramebuffer),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,t.__webglMultisampledFramebuffer)):console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."))},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),A(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),z=!0),e=e.texture),L(e,t)}}function Ll(e,t,n){var r=n.isWebGL2;return{convert:function(e){var n;if(e===He)return 5121;if(e===Je)return 32819;if(e===Ze)return 32820;if(e===Ke)return 33635;if(e===Ge)return 5120;if(e===Ve)return 5122;if(e===We)return 5123;if(e===je)return 5124;if(e===qe)return 5125;if(e===Xe)return 5126;if(e===Ye)return r?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(e===$e)return 6406;if(e===et)return 6407;if(e===tt)return 6408;if(e===nt)return 6409;if(e===rt)return 6410;if(e===at)return 6402;if(e===ot)return 34041;if(e===st)return 6403;if(e===lt)return 36244;if(e===ut)return 33319;if(e===ct)return 33320;if(e===ht)return 36248;if(e===dt)return 36249;if(e===pt||e===ft||e===mt||e===vt){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===pt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===ft)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===mt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===vt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===gt||e===yt||e===xt||e===_t){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===gt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===yt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===xt)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===_t)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===bt)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===wt||e===Mt)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(e===wt)return n.COMPRESSED_RGB8_ETC2;if(e===Mt)return n.COMPRESSED_RGBA8_ETC2_EAC}return e===St||e===Tt||e===Et||e===At||e===Lt||e===kt||e===Rt||e===Ct||e===Pt||e===It||e===Dt||e===Nt||e===Ot||e===Ft||e===zt||e===Ut||e===Ht||e===Gt||e===Vt||e===Wt||e===jt||e===qt||e===Xt||e===Yt||e===Jt||e===Zt||e===Kt||e===Qt?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:e===Bt?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===Qe?r?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}Sl.prototype.isMeshDistanceMaterial=!0;var kl=function(){h(t,Wa);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return g(this,t),(n=e.call(this)).cameras=r,n}return t}();kl.prototype.isArrayCamera=!0;var Rl=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="Group",n}return t}();Rl.prototype.isGroup=!0;var Cl={type:"move"},Pl=function(){function e(){g(this,e),this._targetRay=null,this._grip=null,this._hand=null}return x(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Rl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Rl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Tr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Tr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Rl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Tr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Tr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==s&&null!==(r=t.getPose(e.targetRaySpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),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,this.dispatchEvent(Cl)),u&&e.hand){a=!0;var c,h=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d,p=c.value,f=t.getJointPose(p,n);void 0===u.joints[p.jointName]&&((d=new Rl).matrixAutoUpdate=!1,d.visible=!1,u.joints[p.jointName]=d,u.add(d));var m=u.joints[p.jointName];null!==f&&(m.matrix.fromArray(f.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=f.radius),m.visible=null!==f}}catch(e){h.e(e)}finally{h.f()}var v=u.joints["index-finger-tip"],g=u.joints["thumb-tip"];g=v.position.distanceTo(g.position),u.inputState.pinching&&.025<g?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==i),null!==u&&(u.visible=null!==a),this}}]),e}(),Il=function(){h(t,$n);var e=p(t);function t(n,r){g(this,t);var i,o=m(i=e.call(this)),s=n.state,l=null,u=1,c=null,h="local-floor",d=null,p=null,f=null,v=null,y=null,x=[],_=new Map,b=new Wa;b.layers.enable(1),b.viewport=new _r;var w=new Wa;w.layers.enable(2),w.viewport=new _r;var M=[b,w],S=new kl;S.layers.enable(1),S.layers.enable(2);var T=null,E=null;function A(e){var t=_.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function L(){_.forEach((function(e,t){e.disconnect(t)})),_.clear(),E=T=null,s.bindXRFramebuffer(null),n.setRenderTarget(n.getRenderTarget()),D.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function k(e){for(var t=l.inputSources,n=0;n<x.length;n++)_.set(t[n],x[n]);for(var r=0;r<e.removed.length;r++){var i=e.removed[r],a=_.get(i);a&&(a.dispatchEvent({type:"disconnected",data:i}),_.delete(i))}for(var o=0;o<e.added.length;o++){var s=e.added[o],u=_.get(s);u&&u.dispatchEvent({type:"connected",data:s})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=x[e];return void 0===t&&(t=new Pl,x[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=x[e];return void 0===t&&(t=new Pl,x[e]=t),t.getGripSpace()},i.getHand=function(e){var t=x[e];return void 0===t&&(t=new Pl,x[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){u=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){h=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return c},i.getSession=function(){return l},i.setSession=function(){var e=a(regeneratorRuntime.mark((function e(t){var n,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(l=t)){e.next=22;break}if(l.addEventListener("select",A),l.addEventListener("selectstart",A),l.addEventListener("selectend",A),l.addEventListener("squeeze",A),l.addEventListener("squeezestart",A),l.addEventListener("squeezeend",A),l.addEventListener("end",L),l.addEventListener("inputsourceschange",k),!0!==(n=r.getContextAttributes()).xrCompatible)return e.next=14,r.makeXRCompatible();e.next=14;break;case 14:return void 0===l.renderState.layers?(i={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:u},y=new XRWebGLLayer(l,r,i),l.updateRenderState({baseLayer:y})):(a=0,n.antialias?(i={antialias:!0,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:u},y=new XRWebGLLayer(l,r,i),l.updateRenderState({layers:[y]})):(n.depth&&(a=n.stencil?34041:6402),a={colorFormat:n.alpha?6408:6407,depthFormat:a,scaleFactor:u},p=new XRWebGLBinding(l,r),v=p.createProjectionLayer(a),f=r.createFramebuffer(),l.updateRenderState({layers:[v]}))),e.next=17,l.requestReferenceSpace(h);case 17:c=e.sent,D.setContext(l),D.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"});case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var R=new Tr,C=new Tr;function P(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==l){S.near=w.near=b.near=e.near,S.far=w.far=b.far=e.far,T===S.near&&E===S.far||(l.updateRenderState({depthNear:S.near,depthFar:S.far}),T=S.near,E=S.far);var t=e.parent,n=S.cameras;P(S,t);for(var r=0;r<n.length;r++)P(n[r],t);S.matrixWorld.decompose(S.position,S.quaternion,S.scale),e.position.copy(S.position),e.quaternion.copy(S.quaternion),e.scale.copy(S.scale),e.matrix.copy(S.matrix),e.matrixWorld.copy(S.matrixWorld);for(var i=e.children,a=0,o=i.length;a<o;a++)i[a].updateMatrixWorld(!0);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),C.setFromMatrixPosition(n.matrixWorld);var r=R.distanceTo(C),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],c=(i=o*(c=(i[8]-1)/i[0]),a=o*(n=(a[8]+1)/a[0]),(n=r/(n-c))*-c);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(c),e.translateZ(n),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),o+=n,n=s+n,e.projectionMatrix.makePerspective(i-c,r-c+a,l*s/n*o,u*s/n*o,o,n)}(S,b,w):S.projectionMatrix.copy(b.projectionMatrix)}},i.getCamera=function(){return S},i.getFoveation=function(){return null!==v?v.fixedFoveation:null!==y?y.fixedFoveation:void 0},i.setFoveation=function(e){null!==v&&(v.fixedFoveation=e),null!==y&&void 0!==y.fixedFoveation&&(y.fixedFoveation=e)};var I=null,D=new to;return D.setAnimationLoop((function(e,t){if(null!==(d=t.getViewerPose(c))){var n=d.views;null!==y&&s.bindXRFramebuffer(y.framebuffer);var i=!1;n.length!==S.cameras.length&&(i=!(S.cameras.length=0));for(var a=0;a<n.length;a++){var o=n[a],u=null!==y?y.getViewport(o):(h=p.getViewSubImage(v,o),s.bindXRFramebuffer(f),void 0!==h.depthStencilTexture&&r.framebufferTexture2D(36160,36096,3553,h.depthStencilTexture,0),r.framebufferTexture2D(36160,36064,3553,h.colorTexture,0),h.viewport),h=M[a];h.matrix.fromArray(o.transform.matrix),h.projectionMatrix.fromArray(o.projectionMatrix),h.viewport.set(u.x,u.y,u.width,u.height),0===a&&S.matrix.copy(h.matrix),!0===i&&S.cameras.push(h)}}for(var m=l.inputSources,g=0;g<x.length;g++){var _=x[g],b=m[g];_.update(b,t,c)}I&&I(e,t)})),i.setAnimationLoop=function(e){I=e},i.dispose=function(){},i}return t}();function Dl(e){function t(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var r,i,a=e.get(n).envMap;a&&(t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,void 0!==(a=e.get(a).__maxMipLevel)&&(t.maxMipLevel.value=a)),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularTintMap&&(r=n.specularTintMap),void 0!==r&&(!0===(r=r.isWebGLRenderTarget?r.texture:r).matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?i=n.aoMap:n.lightMap&&(i=n.lightMap),void 0!==i&&(!0===(i=i.isWebGLRenderTarget?i.texture:i).matrixAutoUpdate&&i.updateMatrix(),t.uv2Transform.value.copy(i.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,n.side===P&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),n.side===P&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){var s,l,u,c;r.isMeshBasicMaterial?t(e,r):r.isMeshLambertMaterial?(t(e,r),u=e,(c=r).emissiveMap&&(u.emissiveMap.value=c.emissiveMap)):r.isMeshToonMaterial?(t(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===P&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===P&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshPhongMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===P&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===P&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshStandardMaterial?(t(e,r),r.isMeshPhysicalMaterial?function(e,t,r){n(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===P&&e.clearcoatNormalScale.value.negate()),e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),0<t.transmission&&(e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationTint.value.copy(t.attenuationTint),e.specularIntensity.value=t.specularIntensity,e.specularTint.value.copy(t.specularTint),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularTintMap&&(e.specularTintMap.value=t.specularTintMap)}(e,r,o):n(e,r)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===P&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===P&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),s=e,(l=r).displacementMap&&(s.displacementMap.value=l.displacementMap,s.displacementScale.value=l.displacementScale,s.displacementBias.value=l.displacementBias)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===P&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===P&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(s=r,(l=e).diffuse.value.copy(s.color),l.opacity.value=s.opacity,r.isLineDashedMaterial&&(l=r,(s=e).dashSize.value=l.dashSize,s.totalSize.value=l.dashSize+l.gapSize,s.scale.value=l.scale)):r.isPointsMaterial?function(e,t,n,r){var i;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?i=t.map:t.alphaMap&&(i=t.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,a):r.isSpriteMaterial?function(e,t){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Nl(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=void 0!==e.canvas?e.canvas:((c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).style.display="block",c),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",c=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,h=null,d=null,p=[],f=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=fn,this.physicallyCorrectLights=!1,this.toneMapping=me,this.toneMappingExposure=1;var m=this,v=!1,g=0,y=0,x=null,_=-1,b=null,w=new _r,M=new _r,S=null,T=t.width,E=t.height,A=1,L=null,k=null,R=new _r(0,0,T,E),D=new _r(0,0,T,E),N=!1,O=[],F=new eo,B=!1,z=!1,U=null,H=new ni,G=new Tr,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return null===x?A:1}var j,q,X,Y,J,Z,K,Q,$,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,pe,fe=n;function ve(e,n){for(var r=0;r<e.length;r++){var i=e[r];if(null!==(i=t.getContext(i,n)))return i}return null}try{var ge={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if(t.addEventListener("webglcontextlost",be,!1),t.addEventListener("webglcontextrestored",we,!1),null===fe){var ye=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&ye.shift(),null===(fe=ve(ye,ge)))throw ve(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===fe.getShaderPrecisionFormat&&(fe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(c){throw console.error("THREE.WebGLRenderer: "+c.message),c}function xe(){j=new Oo(fe),q=new co(fe,j,e),j.init(q),de=new Ll(0,j,q),X=new El(fe,j,q),O[0]=1029,Y=new zo,J=new dl,Z=new Al(fe,j,X,J,q,de,Y),K=new po(m),Q=new No(m),$=new no(fe,q),pe=new lo(fe,j,$,q),ee=new Fo(0,$,Y,pe),te=new Vo(0,ee,$,Y),ue=new Go(fe),oe=new ho(J),ne=new hl(m,K,Q,j,q,pe,oe),re=new Dl(J),ie=new vl(J),ae=new wl(j,q),le=new so(m,K,X,te,s),se=new Tl(m,te,q),ce=new uo(fe,j,Y,q),he=new Bo(fe,j,Y,q),Y.programs=ne.programs,m.capabilities=q,m.extensions=j,m.properties=J,m.renderLists=ie,m.shadowMap=se,m.state=X,m.info=Y}xe();var _e=new Il(m,fe);function be(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function we(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;var e=Y.autoReset,t=se.enabled,n=se.autoUpdate,r=se.needsUpdate,i=se.type;xe(),Y.autoReset=e,se.enabled=t,se.autoUpdate=n,se.needsUpdate=r,se.type=i}function Me(e){(e=e.target).removeEventListener("dispose",Me),function(e){void 0!==(e=J.get(e).programs)&&e.forEach((function(e){ne.releaseProgram(e)}))}(e=e),J.remove(e)}this.xr=_e,this.getContext=function(){return fe},this.getContextAttributes=function(){return fe.getContextAttributes()},this.forceContextLoss=function(){var e=j.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=j.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return A},this.setPixelRatio=function(e){void 0!==e&&(A=e,this.setSize(T,E,!1))},this.getSize=function(e){return e.set(T,E)},this.setSize=function(e,n,r){_e.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,E=n,t.width=Math.floor(e*A),t.height=Math.floor(n*A),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(T*A,E*A).floor()},this.setDrawingBufferSize=function(e,n,r){T=e,E=n,A=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(w)},this.getViewport=function(e){return e.copy(R)},this.setViewport=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),X.viewport(w.copy(R).multiplyScalar(A).floor())},this.getScissor=function(e){return e.copy(D)},this.setScissor=function(e,t,n,r){e.isVector4?D.set(e.x,e.y,e.z,e.w):D.set(e,t,n,r),X.scissor(M.copy(D).multiplyScalar(A).floor())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){X.setScissorTest(N=e)},this.setOpaqueSort=function(e){L=e},this.setTransparentSort=function(e){k=e},this.getClearColor=function(e){return e.copy(le.getClearColor())},this.setClearColor=function(){le.setClearColor.apply(le,arguments)},this.getClearAlpha=function(){return le.getClearAlpha()},this.setClearAlpha=function(){le.setClearAlpha.apply(le,arguments)},this.clear=function(e,t,n){var r=0;void 0!==e&&!e||(r|=16384),void 0!==t&&!t||(r|=256),void 0!==n&&!n||(r|=1024),fe.clear(r)},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(){t.removeEventListener("webglcontextlost",be,!1),t.removeEventListener("webglcontextrestored",we,!1),ie.dispose(),ae.dispose(),J.dispose(),K.dispose(),Q.dispose(),te.dispose(),pe.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",Te),_e.removeEventListener("sessionend",Ee),U&&(U.dispose(),U=null),Ae.stop()},this.renderBufferImmediate=function(e,t){pe.initAttributes();var n=J.get(e);e.hasPositions&&!n.position&&(n.position=fe.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=fe.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=fe.createBuffer()),e.hasColors&&!n.color&&(n.color=fe.createBuffer()),t=t.getAttributes(),e.hasPositions&&(fe.bindBuffer(34962,n.position),fe.bufferData(34962,e.positionArray,35048),pe.enableAttribute(t.position),fe.vertexAttribPointer(t.position,3,5126,!1,0,0)),e.hasNormals&&(fe.bindBuffer(34962,n.normal),fe.bufferData(34962,e.normalArray,35048),pe.enableAttribute(t.normal),fe.vertexAttribPointer(t.normal,3,5126,!1,0,0)),e.hasUvs&&(fe.bindBuffer(34962,n.uv),fe.bufferData(34962,e.uvArray,35048),pe.enableAttribute(t.uv),fe.vertexAttribPointer(t.uv,2,5126,!1,0,0)),e.hasColors&&(fe.bindBuffer(34962,n.color),fe.bufferData(34962,e.colorArray,35048),pe.enableAttribute(t.color),fe.vertexAttribPointer(t.color,3,5126,!1,0,0)),pe.disableUnusedAttributes(),fe.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=V);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=De(e,t,r,i);X.setMaterial(r,o);var l=n.index;if(e=n.attributes.position,null===l){if(void 0===e||0===e.count)return}else if(0===l.count)return;t=1,!0===r.wireframe&&(l=ee.getWireframeAttribute(n),t=2),void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||ue.update(i,n,r,s),pe.setup(i,r,s,n,l),o=ce,null!==l&&(u=$.get(l),(o=he).setIndex(u)),s=(null!==l?l:e).count;var u=n.drawRange.start*t;l=n.drawRange.count*t,e=null!==a?a.start*t:0,a=null!==a?a.count*t:1/0,t=Math.max(u,e),a=Math.min(s,u+l,e+a)-1,0!==(a=Math.max(0,a-t+1))&&(i.isMesh?!0===r.wireframe?(X.setLineWidth(r.wireframeLinewidth*W()),o.setMode(1)):o.setMode(4):i.isLine?(r=r.linewidth,X.setLineWidth((r=void 0===r?1:r)*W()),i.isLineSegments?o.setMode(1):i.isLineLoop?o.setMode(2):o.setMode(3)):i.isPoints?o.setMode(0):i.isSprite&&o.setMode(4),i.isInstancedMesh?o.renderInstances(t,a,i.count):n.isInstancedBufferGeometry?(n=Math.min(n.instanceCount,n._maxInstanceCount),o.renderInstances(t,a,n)):o.render(t,a))},this.compile=function(e,t){(d=ae.get(e)).init(),f.push(d),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(),e.traverse((function(t){var n=t.material;if(n)if(Array.isArray(n))for(var r=0;r<n.length;r++)Pe(n[r],e,t);else Pe(n,e,t)})),f.pop(),d=null};var Se=null;function Te(){Ae.stop()}function Ee(){Ae.start()}var Ae=new to;function Le(e,t,n){var r=!0===t.isScene?t.overrideMaterial:null;if(n.isArrayCamera)for(var i=n.cameras,a=0,o=i.length;a<o;a++){var s=i[a];X.viewport(w.copy(s.viewport)),d.setupLightsView(s);for(var l=0,u=e.length;l<u;l++){var c=(f=e[l]).object,h=f.geometry,p=null===r?f.material:r,f=f.group;c.layers.test(s.layers)&&Re(c,t,s,h,p,f)}}else for(var m=0,v=e.length;m<v;m++){var g=e[m];Re(g.object,t,n,g.geometry,null===r?g.material:r,g.group)}}function Re(e,t,n,r,i,a){var o,s;e.onBeforeRender(m,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject?(o=De(n,t,i,e),X.setMaterial(i),pe.reset(),s=o,e.render((function(e){m.renderBufferImmediate(e,s)}))):!0===i.transparent&&i.side===I?(i.side=P,i.needsUpdate=!0,m.renderBufferDirect(n,t,r,i,e,a),i.side=C,i.needsUpdate=!0,m.renderBufferDirect(n,t,r,i,e,a),i.side=I):m.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(m,t,n,r,i,a)}function Pe(e,t,n){!0!==t.isScene&&(t=V);var r=J.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=ne.getParameters(e,i.state,a,t,n);if(a=ne.getProgramCacheKey(s),n=r.programs,r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?Q:K).get(e.envMap||r.environment),void 0===n&&(e.addEventListener("dispose",Me),n=new Map,r.programs=n),void 0!==(t=n.get(a))){if(r.currentProgram===t&&r.lightsStateVersion===o)return Ie(e,s),t}else s.uniforms=ne.getUniforms(e),e.onBuild(s,m),e.onBeforeCompile(s,m),t=ne.acquireProgram(s,a),n.set(a,t),r.uniforms=s.uniforms;return a=r.uniforms,(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(a.clippingPlanes=oe.uniform),Ie(e,s),r.needsLights=(e=e).isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights,r.lightsStateVersion=o,r.needsLights&&(a.ambientLightColor.value=i.state.ambient,a.lightProbe.value=i.state.probe,a.directionalLights.value=i.state.directional,a.directionalLightShadows.value=i.state.directionalShadow,a.spotLights.value=i.state.spot,a.spotLightShadows.value=i.state.spotShadow,a.rectAreaLights.value=i.state.rectArea,a.ltc_1.value=i.state.rectAreaLTC1,a.ltc_2.value=i.state.rectAreaLTC2,a.pointLights.value=i.state.point,a.pointLightShadows.value=i.state.pointShadow,a.hemisphereLights.value=i.state.hemi,a.directionalShadowMap.value=i.state.directionalShadowMap,a.directionalShadowMatrix.value=i.state.directionalShadowMatrix,a.spotShadowMap.value=i.state.spotShadowMap,a.spotShadowMatrix.value=i.state.spotShadowMatrix,a.pointShadowMap.value=i.state.pointShadowMap,a.pointShadowMatrix.value=i.state.pointShadowMatrix),i=t.getUniforms(),a=qs.seqWithValue(i.seq,a),r.currentProgram=t,r.uniformsList=a,t}function Ie(e,t){(e=J.get(e)).outputEncoding=t.outputEncoding,e.instancing=t.instancing,e.skinning=t.skinning,e.morphTargets=t.morphTargets,e.morphNormals=t.morphNormals,e.numClippingPlanes=t.numClippingPlanes,e.numIntersection=t.numClipIntersection,e.vertexAlphas=t.vertexAlphas,e.vertexTangents=t.vertexTangents}function De(e,t,n,r){!0!==t.isScene&&(t=V),Z.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===x?m.outputEncoding:x.texture.encoding,s=(n.isMeshStandardMaterial?Q:K).get(n.envMap||a),l=!0===n.vertexColors&&!!r.geometry&&!!r.geometry.attributes.color&&4===r.geometry.attributes.color.itemSize,u=!!r.geometry&&!!r.geometry.attributes.tangent,c=!!r.geometry&&!!r.geometry.morphAttributes.position,h=!!r.geometry&&!!r.geometry.morphAttributes.normal,p=J.get(n);a=d.state.lights,!0===B&&(!0!==z&&e===b||(f=e===b&&n.id===_,oe.setState(n,e,f)));var f=!1;return n.version===p.__version?(p.needsLights&&p.lightsStateVersion!==a.state.version||p.outputEncoding!==o||r.isInstancedMesh&&!1===p.instancing||!r.isInstancedMesh&&!0===p.instancing||r.isSkinnedMesh&&!1===p.skinning||!r.isSkinnedMesh&&!0===p.skinning||p.envMap!==s||n.fog&&p.fog!==i||void 0!==p.numClippingPlanes&&(p.numClippingPlanes!==oe.numPlanes||p.numIntersection!==oe.numIntersection)||p.vertexAlphas!==l||p.vertexTangents!==u||p.morphTargets!==c||p.morphNormals!==h)&&(f=!0):(f=!0,p.__version=n.version),l=p.currentProgram,u=!1,c=!1,h=!1,f=(l=!0===f?Pe(n,t,r):l).getUniforms(),t=p.uniforms,X.useProgram(l.program)&&(h=c=u=!0),n.id!==_&&(_=n.id,c=!0),!u&&b===e||(f.setValue(fe,"projectionMatrix",e.projectionMatrix),q.logarithmicDepthBuffer&&f.setValue(fe,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),b!==e&&(b=e,h=c=!0),!(n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap)||void 0!==(u=f.map.cameraPosition)&&u.setValue(fe,G.setFromMatrixPosition(e.matrixWorld)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&f.setValue(fe,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&f.setValue(fe,"viewMatrix",e.matrixWorldInverse)),r.isSkinnedMesh&&(f.setOptional(fe,r,"bindMatrix"),f.setOptional(fe,r,"bindMatrixInverse"),(e=r.skeleton)&&(q.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),f.setValue(fe,"boneTexture",e.boneTexture,Z),f.setValue(fe,"boneTextureSize",e.boneTextureSize)):f.setOptional(fe,e,"boneMatrices"))),!c&&p.receiveShadow===r.receiveShadow||(p.receiveShadow=r.receiveShadow,f.setValue(fe,"receiveShadow",r.receiveShadow)),c&&(f.setValue(fe,"toneMappingExposure",m.toneMappingExposure),p.needsLights&&(c=h,(h=t).ambientLightColor.needsUpdate=c,h.lightProbe.needsUpdate=c,h.directionalLights.needsUpdate=c,h.directionalLightShadows.needsUpdate=c,h.pointLights.needsUpdate=c,h.pointLightShadows.needsUpdate=c,h.spotLights.needsUpdate=c,h.spotLightShadows.needsUpdate=c,h.rectAreaLights.needsUpdate=c,h.hemisphereLights.needsUpdate=c),i&&n.fog&&re.refreshFogUniforms(t,i),re.refreshMaterialUniforms(t,n,A,E,U),qs.upload(fe,p.uniformsList,t,Z)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(qs.upload(fe,p.uniformsList,t,Z),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&f.setValue(fe,"center",r.center),f.setValue(fe,"modelViewMatrix",r.modelViewMatrix),f.setValue(fe,"normalMatrix",r.normalMatrix),f.setValue(fe,"modelMatrix",r.matrixWorld),l}Ae.setAnimationLoop((function(e){Se&&Se(e)})),"undefined"!=typeof window&&Ae.setContext(window),this.setAnimationLoop=function(e){Se=e,_e.setAnimationLoop(e),null===e?Ae.stop():Ae.start()},_e.addEventListener("sessionstart",Te),_e.addEventListener("sessionend",Ee),this.render=function(e,t){var n,r,i;void 0===t||!0===t.isCamera?!0!==v&&(!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===_e.enabled&&!0===_e.isPresenting&&(!0===_e.cameraAutoUpdate&&_e.updateCamera(t),t=_e.getCamera()),!0===e.isScene&&e.onBeforeRender(m,e,t,x),(d=ae.get(e,f.length)).init(),f.push(d),H.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(H),z=this.localClippingEnabled,B=oe.init(this.clippingPlanes,z,t),(h=ie.get(e,p.length)).init(),p.push(h),function e(t,n,r,i){if(!1!==t.visible){var a=t.layers.test(n.layers);if(a)if(t.isGroup)r=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(n);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){var o;t.frustumCulled&&!F.intersectsSprite(t)||(i&&G.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H),o=te.update(t),(a=t.material).visible&&h.push(t,o,a,r,G.z,null))}else if(t.isImmediateRenderObject)i&&G.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H),h.push(t,null,t.material,r,G.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Y.render.frame&&(t.skeleton.update(),t.skeleton.frame=Y.render.frame),!t.frustumCulled||F.intersectsObject(t))){i&&G.setFromMatrixPosition(t.matrixWorld).applyMatrix4(H);var s=te.update(t),l=t.material;if(Array.isArray(l))for(var u=s.groups,c=0,p=u.length;c<p;c++){var f=u[c],m=l[f.materialIndex];m&&m.visible&&h.push(t,s,m,r,G.z,f)}else l.visible&&h.push(t,s,l,r,G.z,null)}for(var v=t.children,g=0,y=v.length;g<y;g++)e(v[g],n,r,i)}}(e,t,0,m.sortObjects),h.finish(),!0===m.sortObjects&&h.sort(L,k),!0===B&&oe.beginShadows(),i=d.state.shadowsArray,se.render(i,e,t),d.setupLights(),d.setupLightsView(t),!0===B&&oe.endShadows(),!0===this.info.autoReset&&this.info.reset(),le.render(h,e),n=h.opaque,r=h.transmissive,i=h.transparent,0<n.length&&Le(n,e,t),0<r.length&&function(e,t,n,r){null===U&&(a=!0===o&&!0===q.isWebGL2,U=new(a?Mr:br)(1024,1024,{generateMipmaps:!0,type:null!==de.convert(Ye)?Ye:He,minFilter:ze,magFilter:Ce,wrapS:ke,wrapT:ke}));var i=m.getRenderTarget();m.setRenderTarget(U),m.clear();var a=m.toneMapping;m.toneMapping=me,Le(e,n,r),m.toneMapping=a,Z.updateMultisampleRenderTarget(U),Z.updateRenderTargetMipmap(U),m.setRenderTarget(i),Le(t,n,r)}(n,r,e,t),0<i.length&&Le(i,e,t),null!==x&&(Z.updateMultisampleRenderTarget(x),Z.updateRenderTargetMipmap(x)),!0===e.isScene&&e.onAfterRender(m,e,t),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1),pe.resetDefaultState(),_=-1,b=null,f.pop(),d=0<f.length?f[f.length-1]:null,p.pop(),h=0<p.length?p[p.length-1]:null):console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTarget=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;g=t,y=n,(x=e)&&void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e);var r=null,i=!1,a=!1;if(S=e?(((o=e.texture).isDataTexture3D||o.isDataTexture2DArray)&&(a=!0),o=J.get(e).__webglFramebuffer,e.isWebGLCubeRenderTarget?(r=o[t],i=!0):r=e.isWebGLMultisampleRenderTarget?J.get(e).__webglMultisampledFramebuffer:o,w.copy(e.viewport),M.copy(e.scissor),e.scissorTest):(w.copy(R).multiplyScalar(A).floor(),M.copy(D).multiplyScalar(A).floor(),N),X.bindFramebuffer(36160,r)&&q.drawBuffers){var o=!1;if(e)if(e.isWebGLMultipleRenderTargets){if(r=e.texture,O.length!==r.length||36064!==O[0]){for(var s=0,l=r.length;s<l;s++)O[s]=36064+s;O.length=r.length,o=!0}}else 1===O.length&&36064===O[0]||(O[0]=36064,O.length=1,o=!0);else 1===O.length&&1029===O[0]||(O[0]=1029,O.length=1,o=!0);o&&(q.isWebGL2?fe.drawBuffers(O):j.get("WEBGL_draw_buffers").drawBuffersWEBGL(O))}X.viewport(w),X.scissor(M),X.setScissorTest(S),i?(i=J.get(e.texture),fe.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)):a&&(e=J.get(e.texture),fe.framebufferTextureLayer(36160,36064,e.__webglTexture,n||0,t||0))},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=J.get(e).__webglFramebuffer;if(s=e.isWebGLCubeRenderTarget&&void 0!==o?s[o]:s){X.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==tt&&de.convert(u)!==fe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===Ye&&(j.has("EXT_color_buffer_half_float")||q.isWebGL2&&j.has("EXT_color_buffer_float"));if(!(c===He||de.convert(c)===fe.getParameter(35738)||c===Xe&&(q.isWebGL2||j.has("OES_texture_float")||j.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===fe.checkFramebufferStatus(36160)?0<=t&&t<=e.width-r&&0<=n&&n<=e.height-i&&fe.readPixels(t,n,r,i,de.convert(u),de.convert(c),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{a=null!==x?J.get(x).__webglFramebuffer:null,X.bindFramebuffer(36160,a)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);r=de.convert(t.format),q.isWebGL2&&6408===(r=6407===r?32849:r)&&(r=32856),Z.setTexture2D(t,0),fe.copyTexImage2D(3553,n,r,e.x,e.y,i,a,0),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=de.convert(n.format),s=de.convert(n.type);Z.setTexture2D(n,0),fe.pixelStorei(37440,n.flipY),fe.pixelStorei(37441,n.premultiplyAlpha),fe.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?fe.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?fe.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):fe.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&fe.generateMipmap(3553),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0;if(m.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=de.convert(r.format),c=de.convert(r.type);if(r.isDataTexture3D)Z.setTexture3D(r,0),a=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(r,0),a=35866}fe.pixelStorei(37440,r.flipY),fe.pixelStorei(37441,r.premultiplyAlpha),fe.pixelStorei(3317,r.unpackAlignment);var h=fe.getParameter(3314),d=fe.getParameter(32878),p=fe.getParameter(3316),f=fe.getParameter(3315),v=fe.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;fe.pixelStorei(3314,g.width),fe.pixelStorei(32878,g.height),fe.pixelStorei(3316,e.min.x),fe.pixelStorei(3315,e.min.y),fe.pixelStorei(32877,e.min.z),n.isDataTexture||n.isDataTexture3D?fe.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),fe.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,g.data)):fe.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g),fe.pixelStorei(3314,h),fe.pixelStorei(32878,d),fe.pixelStorei(3316,p),fe.pixelStorei(3315,f),fe.pixelStorei(32877,v),0===i&&r.generateMipmaps&&fe.generateMipmap(a),X.unbindTexture()}},this.initTexture=function(e){Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){y=g=0,x=null,X.reset(),pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Ol=function(){h(t,Nl);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();Ol.prototype.isWebGL1Renderer=!0;var Fl=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:25e-5;g(this,e),this.name="",this.color=new Xi(t),this.density=n}return x(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}]),e}();Fl.prototype.isFogExp2=!0;var Bl=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3;g(this,e),this.name="",this.color=new Xi(t),this.near=n,this.far=r}return x(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}();Bl.prototype.isFog=!0;var zl=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="Scene",n.background=null,n.environment=null,n.fog=null,n.overrideMaterial=null,n.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:m(n)})),n}return x(t,[{key:"copy",value:function(e,n){return l(v(t.prototype),"copy",this).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()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){return e=l(v(t.prototype),"toJSON",this).call(this,e),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}]),t}();zl.prototype.isScene=!0;var Ul=function(){function e(t,n){g(this,e),this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Gn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ar()}return x(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"set",value:function(e){return this.array.set(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0),this}},{key:"clone",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ar()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer),e=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),(e=new this.constructor(e,this.stride)).setUsage(this.usage),e}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ar()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}();Ul.prototype.isInterleavedBuffer=!0;var Hl=new Tr,Gl=function(){function e(t,n,r){var i=3<arguments.length&&void 0!==arguments[3]&&arguments[3];g(this,e),this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=!0===i}return x(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)Hl.x=this.getX(t),Hl.y=this.getY(t),Hl.z=this.getZ(t),Hl.applyMatrix4(e),this.setXYZ(t,Hl.x,Hl.y,Hl.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Hl.x=this.getX(t),Hl.y=this.getY(t),Hl.z=this.getZ(t),Hl.applyNormalMatrix(e),this.setXYZ(t,Hl.x,Hl.y,Hl.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Hl.x=this.getX(t),Hl.y=this.getY(t),Hl.z=this.getZ(t),Hl.transformDirection(e),this.setXYZ(t,Hl.x,Hl.y,Hl.z);return this}},{key:"setX",value:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){return this.data.array[e*this.data.stride+this.offset]}},{key:"getY",value:function(e){return this.data.array[e*this.data.stride+this.offset+1]}},{key:"getZ",value:function(e){return this.data.array[e*this.data.stride+this.offset+2]}},{key:"getW",value:function(e){return this.data.array[e*this.data.stride+this.offset+3]}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},{key:"clone",value:function(t){if(void 0!==t)return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new Ki(new this.array.constructor(n),this.itemSize,this.normalized)}},{key:"toJSON",value:function(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)t.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}}]),e}();Gl.prototype.isInterleavedBufferAttribute=!0;var Vl,Wl=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="SpriteMaterial",r.color=new Xi(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();Wl.prototype.isSpriteMaterial=!0;var jl=new Tr,ql=new Tr,Xl=new Tr,Yl=new pr,Jl=new pr,Zl=new ni,Kl=new Tr,Ql=new Tr,$l=new Tr,eu=new pr,tu=new pr,nu=new pr,ru=function(){h(t,Ai);var e=p(t);function t(n){var r,i;return g(this,t),(r=e.call(this)).type="Sprite",void 0===Vl&&(Vl=new ya,i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Ul(i,5),Vl.setIndex([0,1,2,0,2,3]),Vl.setAttribute("position",new Gl(i,3,0,!1)),Vl.setAttribute("uv",new Gl(i,2,3,!1))),r.geometry=Vl,r.material=void 0!==n?n:new Wl,r.center=new pr(.5,.5),r}return x(t,[{key:"raycast",value:function(e,t){var n;null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ql.setFromMatrixScale(this.matrixWorld),Zl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Xl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ql.multiplyScalar(-Xl.z),0!==(i=this.material.rotation)&&(r=Math.cos(i),n=Math.sin(i));var r,i=this.center;iu(Kl.set(-.5,-.5,0),Xl,i,ql,n,r),iu(Ql.set(.5,-.5,0),Xl,i,ql,n,r),iu($l.set(.5,.5,0),Xl,i,ql,n,r),eu.set(0,0),tu.set(1,0),nu.set(1,1),null===e.ray.intersectTriangle(Kl,Ql,$l,!1,jl)&&(iu(Ql.set(-.5,.5,0),Xl,i,ql,n,r),tu.set(0,1),null===e.ray.intersectTriangle(Kl,$l,Ql,!1,jl))||(r=e.ray.origin.distanceTo(jl))<e.near||r>e.far||t.push({distance:r,point:jl.clone(),uv:Bi.getUV(jl,Kl,Ql,$l,eu,tu,nu,new pr),face:null,object:this})}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),t}();function iu(e,t,n,r,i,a){Yl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Jl.x=a*Yl.x-i*Yl.y,Jl.y=i*Yl.x+a*Yl.y):Jl.copy(Yl),e.copy(t),e.x+=Jl.x,e.y+=Jl.y,e.applyMatrix4(Zl)}ru.prototype.isSprite=!0;var au=new Tr,ou=new Tr,su=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this))._currentLevel=0,n.type="LOD",Object.defineProperties(m(n),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),n.autoUpdate=!0,n}return x(t,[{key:"copy",value:function(e){l(v(t.prototype),"copy",this).call(this,e,!1);for(var n=e.levels,r=0,i=n.length;r<i;r++){var a=n[r];this.addLevel(a.object.clone(),a.distance)}return this.autoUpdate=e.autoUpdate,this}},{key:"addLevel",value:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=(t=Math.abs(t),this.levels),r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this}},{key:"getCurrentLevel",value:function(){return this._currentLevel}},{key:"getObjectForDistance",value:function(e){var t=this.levels;if(0<t.length){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null}},{key:"raycast",value:function(e,t){var n;0<this.levels.length&&(au.setFromMatrixPosition(this.matrixWorld),n=e.ray.origin.distanceTo(au),this.getObjectForDistance(n).raycast(e,t))}},{key:"update",value:function(e){var t=this.levels;if(1<t.length){au.setFromMatrixPosition(e.matrixWorld),ou.setFromMatrixPosition(this.matrixWorld);var n,r,i=au.distanceTo(ou)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n<r&&i>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}}},{key:"toJSON",value:function(e){var n=l(v(t.prototype),"toJSON",this).call(this,e);!1===this.autoUpdate&&(n.object.autoUpdate=!1),n.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance})}return n}}]),t}(),lu=new Tr,uu=new _r,cu=new _r,hu=new Tr,du=new ni,pu=function(){h(t,Oa);var e=p(t);function t(n,r){return g(this,t),(r=e.call(this,n,r)).type="SkinnedMesh",r.bindMode="attached",r.bindMatrix=new ni,r.bindMatrixInverse=new ni,r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new _r,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!=1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){l(v(t.prototype),"updateMatrixWorld",this).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)}},{key:"boneTransform",value:function(e,t){var n=this.skeleton,r=this.geometry;uu.fromBufferAttribute(r.attributes.skinIndex,e),cu.fromBufferAttribute(r.attributes.skinWeight,e),lu.fromBufferAttribute(r.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a,o=cu.getComponent(i);0!==o&&(a=uu.getComponent(i),du.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(hu.copy(lu).applyMatrix4(du),o))}return t.applyMatrix4(this.bindMatrixInverse)}}]),t}();pu.prototype.isSkinnedMesh=!0;var fu=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="Bone",n}return t}();fu.prototype.isBone=!0;var mu=function(){h(t,yr);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,a=3<arguments.length?arguments[3]:void 0,o=4<arguments.length?arguments[4]:void 0,s=5<arguments.length?arguments[5]:void 0,l=6<arguments.length?arguments[6]:void 0,u=7<arguments.length?arguments[7]:void 0,c=8<arguments.length&&void 0!==arguments[8]?arguments[8]:Ce,h=9<arguments.length&&void 0!==arguments[9]?arguments[9]:Ce,d=10<arguments.length?arguments[10]:void 0,p=11<arguments.length?arguments[11]:void 0;return g(this,t),(p=e.call(this,null,s,l,u,c,h,a,o,d,p)).image={data:n,width:r,height:i},p.magFilter=c,p.minFilter=h,p.generateMipmaps=!1,p.flipY=!1,p.unpackAlignment=1,p.needsUpdate=!0,p}return t}();mu.prototype.isDataTexture=!0;var vu=new ni,gu=new ni,yu=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];g(this,e),this.uuid=ar(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return x(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new ni)}}},{key:"calculateInverses",value:function(){for(var e=this.boneInverses.length=0,t=this.bones.length;e<t;e++){var n=new ni;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];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))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:gu;vu.multiplyMatrices(o,t[i]),vu.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=cr(e=Math.sqrt(4*this.bones.length));e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new mu(t,e,e,tt,Xe);return this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,r=e.bones.length;n<r;n++){var i=e.bones[n],a=t[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new fu),this.bones.push(a),this.boneInverses.push((new ni).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,r=0,i=t.length;r<i;r++){var a=t[r];e.bones.push(a.uuid),a=n[r],e.boneInverses.push(a.toArray())}return e}}]),e}(),xu=new ni,_u=new ni,bu=[],wu=new Oa,Mu=function(){h(t,Oa);var e=p(t);function t(n,r,i){return g(this,t),(r=e.call(this,n,r)).instanceMatrix=new Ki(new Float32Array(16*i),16),r.instanceColor=null,r.count=i,r.frustumCulled=!1,r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,r=this.count;if(wu.geometry=this.geometry,wu.material=this.material,void 0!==wu.material)for(var i=0;i<r;i++){this.getMatrixAt(i,xu),_u.multiplyMatrices(n,xu),wu.matrixWorld=_u,wu.raycast(e,bu);for(var a=0,o=bu.length;a<o;a++){var s=bu[a];s.instanceId=i,s.object=this,t.push(s)}bu.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new Ki(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),t}();Mu.prototype.isInstancedMesh=!0;var Su=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="LineBasicMaterial",r.color=new Xi(16777215),r.linewidth=1,r.linecap="round",r.linejoin="round",r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}]),t}();Su.prototype.isLineBasicMaterial=!0;var Tu=new Tr,Eu=new Tr,Au=new ni,Lu=new ti,ku=new Xr,Ru=function(){h(t,Ai);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ya,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Su;return g(this,t),(n=e.call(this)).type="Line",n.geometry=r,n.material=i,n.updateMorphTargets(),n}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Tu.fromBufferAttribute(t,r-1),Eu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Tu.distanceTo(Eu);e.setAttribute("lineDistance",new oa(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ku.copy(n.boundingSphere),ku.applyMatrix4(r),ku.radius+=i,!1!==e.ray.intersectsSphere(ku)){Au.copy(r).invert(),Lu.copy(e.ray).applyMatrix4(Au);var o=(i/=(this.scale.x+this.scale.y+this.scale.z)/3)*i,s=new Tr,l=new Tr,u=new Tr,c=new Tr,h=this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position;if(null!==d)for(var f=Math.max(0,a.start),m=Math.min(d.count,a.start+a.count)-1;f<m;f+=h){var v=d.getX(f),g=d.getX(f+1);s.fromBufferAttribute(p,v),l.fromBufferAttribute(p,g),o<Lu.distanceSqToSegment(s,l,c,u)||(c.applyMatrix4(this.matrixWorld),(g=e.ray.origin.distanceTo(c))<e.near||g>e.far||t.push({distance:g,point:u.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(var y,x=Math.max(0,a.start),_=Math.min(p.count,a.start+a.count)-1;x<_;x+=h)s.fromBufferAttribute(p,x),l.fromBufferAttribute(p,x+1),o<Lu.distanceSqToSegment(s,l,c,u)||(c.applyMatrix4(this.matrixWorld),(y=e.ray.origin.distanceTo(c))<e.near||y>e.far||t.push({distance:y,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this}))}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0<n.length){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else void 0!==(e=e.morphTargets)&&0<e.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}]),t}();Ru.prototype.isLine=!0;var Cu=new Tr,Pu=new Tr,Iu=function(){h(t,Ru);var e=p(t);function t(n,r){return g(this,t),(r=e.call(this,n,r)).type="LineSegments",r}return x(t,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Cu.fromBufferAttribute(t,r),Pu.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Cu.distanceTo(Pu);e.setAttribute("lineDistance",new oa(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}]),t}();Iu.prototype.isLineSegments=!0;var Du=function(){h(t,Ru);var e=p(t);function t(n,r){return g(this,t),(r=e.call(this,n,r)).type="LineLoop",r}return t}();Du.prototype.isLineLoop=!0;var Nu=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="PointsMaterial",r.color=new Xi(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();Nu.prototype.isPointsMaterial=!0;var Ou=new ni,Fu=new ti,Bu=new Xr,zu=new Tr,Uu=function(){h(t,Ai);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ya,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Nu;return g(this,t),(n=e.call(this)).type="Points",n.geometry=r,n.material=i,n.updateMorphTargets(),n}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Bu.copy(n.boundingSphere),Bu.applyMatrix4(r),Bu.radius+=i,!1!==e.ray.intersectsSphere(Bu)){Ou.copy(r).invert(),Fu.copy(e.ray).applyMatrix4(Ou);var o=(i/=(this.scale.x+this.scale.y+this.scale.z)/3)*i;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position;if(null!==s)for(var u=Math.max(0,a.start),c=Math.min(s.count,a.start+a.count);u<c;u++){var h=s.getX(u);zu.fromBufferAttribute(l,h),Hu(zu,h,o,r,e,t,this)}else for(var d=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);d<p;d++)zu.fromBufferAttribute(l,d),Hu(zu,d,o,r,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0<n.length){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else void 0!==(e=e.morphTargets)&&0<e.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}]),t}();function Hu(e,t,n,r,i,a,o){var s=Fu.distanceSqToPoint(e);s<n&&(n=new Tr,Fu.closestPointToPoint(e,n),n.applyMatrix4(r),(r=i.ray.origin.distanceTo(n))<i.near||r>i.far||a.push({distance:r,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o}))}Uu.prototype.isPoints=!0;var Gu=function(){h(t,yr);var e=p(t);function t(n,r,i,a,o,s,l,u,c){g(this,t),(c=e.call(this,n,r,i,a,o,s,l,u,c)).format=void 0!==l?l:et,c.minFilter=void 0!==s?s:Oe,c.magFilter=void 0!==o?o:Oe,c.generateMipmaps=!1;var h=m(c);return"requestVideoFrameCallback"in n&&n.requestVideoFrameCallback((function e(){h.needsUpdate=!0,n.requestVideoFrameCallback(e)})),c}return x(t,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;0=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),t}();Gu.prototype.isVideoTexture=!0;var Vu=function(){h(t,yr);var e=p(t);function t(n,r,i,a,o,s,l,u,c,h,d,p){return g(this,t),(p=e.call(this,null,s,l,u,c,h,a,o,d,p)).image={width:r,height:i},p.mipmaps=n,p.flipY=!1,p.generateMipmaps=!1,p}return t}();Vu.prototype.isCompressedTexture=!0;var Wu=function(){h(t,yr);var e=p(t);function t(n,r,i,a,o,s,l,u,c){return g(this,t),(c=e.call(this,n,r,i,a,o,s,l,u,c)).needsUpdate=!0,c}return t}();Wu.prototype.isCanvasTexture=!0;var ju=function(){h(t,yr);var e=p(t);function t(n,r,i,a,o,s,l,u,c,h){if(g(this,t),(h=void 0!==h?h:at)!==at&&h!==ot)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return(c=e.call(this,null,a,o,s,l,u,h,i=void 0===(i=void 0===i&&h===at?We:i)&&h===ot?Qe:i,c)).image={width:n,height:r},c.magFilter=void 0!==l?l:Ce,c.minFilter=void 0!==u?u:Ce,c.flipY=!1,c.generateMipmaps=!1,c}return t}();ju.prototype.isDepthTexture=!0;var qu=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;g(this,t),(n=e.call(this)).type="CircleGeometry",n.parameters={radius:r,segments:i,thetaStart:a,thetaLength:o},i=Math.max(3,i);var s=[],l=[],u=[],c=[],h=new Tr,d=new pr;l.push(0,0,0),u.push(0,0,1),c.push(.5,.5);for(var p=0,f=3;p<=i;p++,f+=3){var m=a+p/i*o;h.x=r*Math.cos(m),h.y=r*Math.sin(m),l.push(h.x,h.y,h.z),u.push(0,0,1),d.x=(l[f]/r+1)/2,d.y=(l[f+1]/r+1)/2,c.push(d.x,d.y)}for(var v=1;v<=i;v++)s.push(v,v+1,0);return n.setIndex(s),n.setAttribute("position",new oa(l,3)),n.setAttribute("normal",new oa(u,3)),n.setAttribute("uv",new oa(c,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),t}(),Xu=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,l=5<arguments.length&&void 0!==arguments[5]&&arguments[5],u=6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,c=7<arguments.length&&void 0!==arguments[7]?arguments[7]:2*Math.PI;g(this,t),(n=e.call(this)).type="CylinderGeometry",n.parameters={radiusTop:r,radiusBottom:i,height:a,radialSegments:o,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};var h=m(n),d=(o=Math.floor(o),s=Math.floor(s),[]),p=[],f=[],v=[],y=0,x=[],_=a/2,b=0;function w(e){for(var t=y,n=new pr,a=new Tr,s=0,l=!0===e?r:i,m=!0===e?1:-1,g=1;g<=o;g++)p.push(0,_*m,0),f.push(0,m,0),v.push(.5,.5),y++;for(var x=y,w=0;w<=o;w++){var M=w/o*c+u,S=Math.cos(M);M=Math.sin(M),a.x=l*M,a.y=_*m,a.z=l*S,p.push(a.x,a.y,a.z),f.push(0,m,0),n.x=.5*S+.5,n.y=.5*M*m+.5,v.push(n.x,n.y),y++}for(var T=0;T<o;T++){var E=t+T,A=x+T;!0===e?d.push(A,A+1,E):d.push(A+1,A,E),s+=3}h.addGroup(b,s,!0===e?1:2),b+=s}return function(){for(var e=new Tr,t=new Tr,n=0,l=(i-r)/a,m=0;m<=s;m++){for(var g=[],w=m/s,M=w*(i-r)+r,S=0;S<=o;S++){var T=S/o,E=T*c+u,A=Math.sin(E);E=Math.cos(E),t.x=M*A,t.y=-w*a+_,t.z=M*E,p.push(t.x,t.y,t.z),e.set(A,l,E).normalize(),f.push(e.x,e.y,e.z),v.push(T,1-w),g.push(y++)}x.push(g)}for(var L=0;L<o;L++)for(var k=0;k<s;k++){var R=x[k][L],C=x[k+1][L],P=x[k+1][L+1],I=x[k][L+1];d.push(R,C,I),d.push(C,P,I),n+=6}h.addGroup(b,n,0),b+=n}(),!1===l&&(0<r&&w(!0),0<i&&w(!1)),n.setIndex(d),n.setAttribute("position",new oa(p,3)),n.setAttribute("normal",new oa(f,3)),n.setAttribute("uv",new oa(v,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),t}(),Yu=function(){h(t,Xu);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,s=4<arguments.length&&void 0!==arguments[4]&&arguments[4],l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,u=6<arguments.length&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return g(this,t),(n=e.call(this,0,r,i,a,o,s,l,u)).type="ConeGeometry",n.parameters={radius:r,height:i,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:l,thetaLength:u},n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),t}(),Ju=function(){h(t,ya);var e=p(t);function t(n,r){var i,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;g(this,t),(i=e.call(this)).type="PolyhedronGeometry",i.parameters={vertices:n,indices:r,radius:a,detail:o};var s=[],l=[];function u(e){s.push(e.x,e.y,e.z)}function c(e,t){e*=3,t.x=n[0+e],t.y=n[1+e],t.z=n[2+e]}function h(e,t,n,r){r<0&&1===e.x&&(l[t]=e.x-1),0===n.x&&0===n.z&&(l[t]=r/2/Math.PI+.5)}function d(e){return Math.atan2(e.z,-e.x)}return function(e){for(var t=new Tr,n=new Tr,i=new Tr,a=0;a<r.length;a+=3)c(r[a+0],t),c(r[a+1],n),c(r[a+2],i),function(e,t,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=e.clone().lerp(n,o/i),l=t.clone().lerp(n,o/i),c=i-o,h=0;h<=c;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/c)}for(var d=0;d<i;d++)for(var p=0;p<2*(i-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]))}}(t,n,i,e)}(o),function(e){for(var t=new Tr,n=0;n<s.length;n+=3)t.x=s[n+0],t.y=s[n+1],t.z=s[n+2],t.normalize().multiplyScalar(e),s[n+0]=t.x,s[n+1]=t.y,s[n+2]=t.z}(a),function(){for(var e=new Tr,t=0;t<s.length;t+=3){e.x=s[t+0],e.y=s[t+1],e.z=s[t+2];var n=d(e)/2/Math.PI+.5,r=function(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}(e)/Math.PI+.5;l.push(n,1-r)}(function(){for(var e=new Tr,t=new Tr,n=new Tr,r=new Tr,i=new pr,a=new pr,o=new pr,u=0,c=0;u<s.length;u+=9,c+=6){e.set(s[u+0],s[u+1],s[u+2]),t.set(s[u+3],s[u+4],s[u+5]),n.set(s[u+6],s[u+7],s[u+8]),i.set(l[c+0],l[c+1]),a.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(n).divideScalar(3);var p=d(r);h(i,c+0,e,p),h(a,c+2,t,p),h(o,c+4,n,p)}})(),function(){for(var e=0;e<l.length;e+=6){var t=l[e+0],n=l[e+2],r=l[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);.9<i&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}()}(),i.setAttribute("position",new oa(s,3)),i.setAttribute("normal",new oa(s.slice(),3)),i.setAttribute("uv",new oa(l,2)),0===o?i.computeVertexNormals():i.normalizeNormals(),i}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.vertices,e.indices,e.radius,e.details)}}]),t}(),Zu=function(){h(t,Ju);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;g(this,t);var i=(1+Math.sqrt(5))/2,a=1/i;return(a=e.call(this,[-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,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],n,r)).type="DodecahedronGeometry",a.parameters={radius:n,detail:r},a}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}]),t}(),Ku=new Tr,Qu=new Tr,$u=new Tr,ec=new Bi,tc=function(){h(t,ya);var e=p(t);function t(n,r){var i;if(g(this,t),(i=e.call(this)).type="EdgesGeometry",i.parameters={thresholdAngle:r},r=void 0!==r?r:1,!0===n.isGeometry)return console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),f(i);for(var a,o,s,l=Math.cos(rr*r),u=n.getIndex(),c=n.getAttribute("position"),h=(u||c).count,d=[0,0,0],p=["a","b","c"],m=new Array(3),v={},y=[],x=0;x<h;x+=3){u?(d[0]=u.getX(x),d[1]=u.getX(x+1),d[2]=u.getX(x+2)):(d[0]=x,d[1]=x+1,d[2]=x+2);var _=ec.a,b=ec.b,w=ec.c;if(_.fromBufferAttribute(c,d[0]),b.fromBufferAttribute(c,d[1]),w.fromBufferAttribute(c,d[2]),ec.getNormal($u),m[0]="".concat(_.x,",").concat(_.y,",").concat(_.z),m[1]="".concat(b.x,",").concat(b.y,",").concat(b.z),m[2]="".concat(w.x,",").concat(w.y,",").concat(w.z),m[0]!==m[1]&&m[1]!==m[2]&&m[2]!==m[0])for(var M=0;M<3;M++){var S=(M+1)%3,T=m[M],E=m[S],A=ec[p[M]],L=ec[p[S]],k="".concat(T,"_").concat(E);(T="".concat(E,"_").concat(T))in v&&v[T]?($u.dot(v[T].normal)<=l&&(y.push(A.x,A.y,A.z),y.push(L.x,L.y,L.z)),v[T]=null):k in v||(v[k]={index0:d[M],index1:d[S],normal:$u.clone()})}}for(a in v)v[a]&&(o=(s=v[a]).index0,s=s.index1,Ku.fromBufferAttribute(c,o),Qu.fromBufferAttribute(c,s),y.push(Ku.x,Ku.y,Ku.z),y.push(Qu.x,Qu.y,Qu.z));return i.setAttribute("position",new oa(y,3)),i}return t}(),nc=function(){function e(){g(this,e),this.type="Curve",this.arcLengthDivisions=200}return x(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){return e=this.getUtoTmapping(e),this.getPoint(e,t)}},{key:"getPoints",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){for(var n,r=this.getLengths(),i=0,a=r.length,o=t||e*r[a-1],s=0,l=a-1;s<=l;)if((n=r[i=Math.floor(s+(l-s)/2)]-o)<0)s=i+1;else{if(!(0<n)){l=i;break}l=i-1}return r[i=l]===o?i/(a-1):(i+(o-(e=r[i]))/(r[i+1]-e))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4;return 1<(e+=1e-4)&&(e=1),n=this.getPoint(n=n<0?0:n),e=this.getPoint(e),(t=t||new(n.isVector2?pr:Tr)).copy(e).sub(n).normalize(),t}},{key:"getTangentAt",value:function(e,t){return e=this.getUtoTmapping(e),this.getTangent(e,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Tr,r=[],i=[],a=[],o=new Tr,s=new ni,l=0;l<=e;l++)r[l]=this.getTangentAt(l/e,new Tr),r[l].normalize();i[0]=new Tr,a[0]=new Tr;var u=Number.MAX_VALUE,c=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);c<=u&&(u=c,n.set(1,0,0)),h<=u&&(u=h,n.set(0,1,0)),d<=u&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var p,f=1;f<=e;f++)i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON&&(o.normalize(),p=Math.acos(or(r[f-1].dot(r[f]),-1,1)),i[f].applyMatrix4(s.makeRotationAxis(o,p))),a[f].crossVectors(r[f],i[f]);if(!0===t){var m=Math.acos(or(i[0].dot(i[e]),-1,1));m/=e,0<r[0].dot(o.crossVectors(i[0],i[e]))&&(m=-m);for(var v=1;v<=e;v++)i[v].applyMatrix4(s.makeRotationAxis(r[v],m*v)),a[v].crossVectors(r[v],i[v])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),rc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=6<arguments.length&&void 0!==arguments[6]&&arguments[6],c=7<arguments.length&&void 0!==arguments[7]?arguments[7]:0;return g(this,t),(n=e.call(this)).type="EllipseCurve",n.aX=r,n.aY=i,n.xRadius=a,n.yRadius=o,n.aStartAngle=s,n.aEndAngle=l,n.aClockwise=u,n.aRotation=c,n}return x(t,[{key:"getPoint",value:function(e,t){for(var n=t||new pr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;r<i;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);return 0!==this.aRotation&&(t=Math.cos(this.aRotation),a=Math.sin(this.aRotation),s=(e=s-this.aX)*t-(o=l-this.aY)*a+this.aX,l=e*a+o*t+this.aY),n.set(s,l)}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).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}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).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}}]),t}();rc.prototype.isEllipseCurve=!0;var ic=function(){h(t,rc);var e=p(t);function t(n,r,i,a,o,s){return g(this,t),(s=e.call(this,n,r,i,i,a,o,s)).type="ArcCurve",s}return t}();function ac(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){n=-3*(e=i)+3*a-2*(t=o)-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){a=(t-e)/a-(n-e)/(a+o)+(n-t)/o,s=(n-t)/o-(r-t)/(o+s)+(r-n)/s,i(t,n,a*=o,s*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}ic.prototype.isArcCurve=!0;var oc=new Tr,sc=new ac,lc=new ac,uc=new ac,cc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"centripetal",o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:.5;return g(this,t),(n=e.call(this)).type="CatmullRomCurve3",n.points=r,n.closed=i,n.curveType=a,n.tension=o,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,n=this.points,r=n.length,i=(r-(this.closed?0:1))*e,a=Math.floor(i),o=i-a;this.closed?a+=0<a?0:(Math.floor(Math.abs(a)/r)+1)*r:0===o&&a===r-1&&(a=r-2,o=1);var s=this.closed||0<a?n[(a-1)%r]:(oc.subVectors(n[0],n[1]).add(n[0]),oc),l=n[a%r];return e=n[(a+1)%r],i=this.closed||a+2<r?n[(a+2)%r]:(oc.subVectors(n[r-1],n[r-2]).add(n[r-1]),oc),"centripetal"===this.curveType||"chordal"===this.curveType?(a="chordal"===this.curveType?.5:.25,n=Math.pow(s.distanceToSquared(l),a),(r=Math.pow(l.distanceToSquared(e),a))<1e-4&&(r=1),n<1e-4&&(n=r),(a=Math.pow(e.distanceToSquared(i),a))<1e-4&&(a=r),sc.initNonuniformCatmullRom(s.x,l.x,e.x,i.x,n,r,a),lc.initNonuniformCatmullRom(s.y,l.y,e.y,i.y,n,r,a),uc.initNonuniformCatmullRom(s.z,l.z,e.z,i.z,n,r,a)):"catmullrom"===this.curveType&&(sc.initCatmullRom(s.x,l.x,e.x,i.x,this.tension),lc.initCatmullRom(s.y,l.y,e.y,i.y,this.tension),uc.initCatmullRom(s.z,l.z,e.z,i.z,this.tension)),t.set(sc.calc(o),lc.calc(o),uc.calc(o)),t}},{key:"copy",value:function(e){l(v(t.prototype),"copy",this).call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);e.points=[];for(var n=0,r=this.points.length;n<r;n++){var i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){l(v(t.prototype),"fromJSON",this).call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push((new Tr).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),t}();function hc(e,t,n,r,i){var a=.5*(r-t);return(2*n-2*r+a+(t=.5*(i-n)))*(e*(i=e*e))+(-3*n+3*r-2*a-t)*i+a*e+n}function dc(e,t,n,r){return(i=1-(i=e))*i*t+2*(1-e)*e*n+e*e*r;var i}function pc(e,t,n,r,i){return(a=1-(a=e))*a*a*t+3*(t=1-e)*t*e*n+3*(1-e)*e*e*r+e*e*e*i;var a}cc.prototype.isCatmullRomCurve3=!0;var fc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new pr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new pr,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new pr;return g(this,t),(n=e.call(this)).type="CubicBezierCurve",n.v0=r,n.v1=i,n.v2=a,n.v3=o,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(pc(e,n.x,r.x,i.x,a.x),pc(e,n.y,r.y,i.y,a.y)),t}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),t}();fc.prototype.isCubicBezierCurve=!0;var mc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Tr,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new Tr;return g(this,t),(n=e.call(this)).type="CubicBezierCurve3",n.v0=r,n.v1=i,n.v2=a,n.v3=o,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(pc(e,n.x,r.x,i.x,a.x),pc(e,n.y,r.y,i.y,a.y),pc(e,n.z,r.z,i.z,a.z)),t}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),t}();mc.prototype.isCubicBezierCurve3=!0;var vc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new pr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr;return g(this,t),(n=e.call(this)).type="LineCurve",n.v1=r,n.v2=i,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e,t){return(t=t||new pr).copy(this.v2).sub(this.v1).normalize(),t}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),t}();vc.prototype.isLineCurve=!0;var gc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr;return g(this,t),(n=e.call(this)).type="LineCurve3",n.isLineCurve3=!0,n.v1=r,n.v2=i,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),t}(),yc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new pr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new pr;return g(this,t),(n=e.call(this)).type="QuadraticBezierCurve",n.v0=r,n.v1=i,n.v2=a,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr,n=this.v0,r=this.v1,i=this.v2;return t.set(dc(e,n.x,r.x,i.x),dc(e,n.y,r.y,i.y)),t}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),t}();yc.prototype.isQuadraticBezierCurve=!0;var xc=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Tr;return g(this,t),(n=e.call(this)).type="QuadraticBezierCurve3",n.v0=r,n.v1=i,n.v2=a,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr,n=this.v0,r=this.v1,i=this.v2;return t.set(dc(e,n.x,r.x,i.x),dc(e,n.y,r.y,i.y),dc(e,n.z,r.z,i.z)),t}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),t}();xc.prototype.isQuadraticBezierCurve3=!0;var _c=function(){h(t,nc);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return g(this,t),(n=e.call(this)).type="SplineCurve",n.points=r,n}return x(t,[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr,n=this.points,r=(a=(n.length-1)*e)-(o=Math.floor(a)),i=n[0===o?o:o-1],a=(e=n[o],n[o>n.length-2?n.length-1:o+1]),o=n[o>n.length-3?n.length-1:o+2];return t.set(hc(r,i.x,e.x,a.x,o.x),hc(r,i.y,e.y,a.y,o.y)),t}},{key:"copy",value:function(e){l(v(t.prototype),"copy",this).call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);e.points=[];for(var n=0,r=this.points.length;n<r;n++){var i=this.points[n];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){l(v(t.prototype),"fromJSON",this).call(this,e),this.points=[];for(var n=0,r=e.points.length;n<r;n++){var i=e.points[n];this.points.push((new pr).fromArray(i))}return this}}]),t}();_c.prototype.isSplineCurve=!0;var bc=Object.freeze({__proto__:null,ArcCurve:ic,CatmullRomCurve3:cc,CubicBezierCurve:fc,CubicBezierCurve3:mc,EllipseCurve:rc,LineCurve:vc,LineCurve3:gc,QuadraticBezierCurve:yc,QuadraticBezierCurve3:xc,SplineCurve:_c});function wc(e,t,n,r,i){var a,o;if(i===0<function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r))for(a=t;a<n;a+=r)o=Nc(a,e[a],e[a+1],o);else for(a=n-r;t<=a;a-=r)o=Nc(a,e[a],e[a+1],o);return o&&kc(o,o.next)&&(Oc(o),o=o.next),o}function Mc(e,t){if(!e)return e;t=t||e;var n,r=e;do{if(n=!1,r.steiner||!kc(r,r.next)&&0!==Lc(r.prev,r,r.next))r=r.next;else{if(Oc(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Sc(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){for(var i=e;null===i.z&&(i.z=Ec(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,(i=i.next)!==e;);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,l,u=1;do{for(n=e,a=e=null,o=0;n;){for(o++,r=n,t=s=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;0<s||0<l&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(n=(i=n).nextZ,s--):(r=(i=r).nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}}while(a.nextZ=null,u*=2,1<o)}(i)}(e,r,i,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?function(e,t,n,r){var i=e.prev,a=e,o=e.next;if(0<=Lc(i,a,o))return!1;for(var s=(i.x<a.x?i.x<o.x?i:o:a.x<o.x?a:o).x,l=(i.y<a.y?i.y<o.y?i:o:a.y<o.y?a:o).y,u=(i.x>a.x?i.x>o.x?i:o:a.x>o.x?a:o).x,c=(i.y>a.y?i.y>o.y?i:o:a.y>o.y?a:o).y,h=Ec(s,l,t,n,r),d=Ec(u,c,t,n,r),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Ac(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Lc(p.prev,p,p.next))return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Ac(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Lc(f.prev,f,f.next))return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Ac(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Lc(p.prev,p,p.next))return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Ac(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Lc(f.prev,f,f.next))return!1;f=f.nextZ}return!0}(e,r,i,a):function(e){var t=e.prev,n=e,r=e.next;if(0<=Lc(t,n,r))return!1;for(var i=e.next.next;i!==e.prev;){if(Ac(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=Lc(i.prev,i,i.next))return!1;i=i.next}return!0}(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Oc(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Sc(e=function(e,t,n){var r=e;do{var i=r.prev,a=r.next.next}while(!kc(i,a)&&Rc(i,r,r.next,a)&&Ic(i,a)&&Ic(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Oc(r),Oc(r.next),r=e=a),(r=r.next)!==e);return Mc(r)}(Mc(e),t,n),t,n,r,i,a,2):2===o&&function(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Rc(n,n.next,e,t))return!0}while((n=n.next)!==e);return!1}(e,t)&&(Ic(e,t)&&Ic(t,e)&&function(e,t){for(var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),(n=n.next)!==e;);return r}(e,t)&&(Lc(e.prev,e,t.prev)||Lc(e,t.prev,t))||kc(e,t)&&0<Lc(e.prev,e,e.next)&&0<Lc(t.prev,t,t.next))}(o,s)){var l=Dc(o,s);return o=Mc(o,o.next),l=Mc(l,l.next),Sc(o,t,n,r,i,a),Sc(l,t,n,r,i,a)}s=s.next}}while((o=o.next)!==e)}(e,t,n,r,i,a):Sc(Mc(e),t,n,r,i,a,1);break}}}function Tc(e,t){return e.x-t.x}function Ec(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ac(e,t,n,r,i,a,o,s){return 0<=(i-o)*(t-s)-(e-o)*(a-s)&&0<=(e-o)*(r-s)-(n-o)*(t-s)&&0<=(n-o)*(a-s)-(i-o)*(r-s)}function Lc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function kc(e,t){return e.x===t.x&&e.y===t.y}function Rc(e,t,n,r){var i=Pc(Lc(e,t,n)),a=Pc(Lc(e,t,r)),o=Pc(Lc(n,r,e)),s=Pc(Lc(n,r,t));return i!==a&&o!==s||0===i&&Cc(e,n,t)||0===a&&Cc(e,r,t)||0===o&&Cc(n,e,r)||!(0!==s||!Cc(n,t,r))}function Cc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Pc(e){return 0<e?1:e<0?-1:0}function Ic(e,t){return Lc(e.prev,e,e.next)<0?0<=Lc(e,t,e.next)&&0<=Lc(e,e.prev,t):Lc(e,t,e.prev)<0||Lc(e,e.next,t)<0}function Dc(e,t){var n=new Fc(e.i,e.x,e.y),r=new Fc(t.i,t.x,t.y),i=e.next,a=t.prev;return(e.next=t).prev=e,(n.next=i).prev=n,(r.next=n).prev=r,(a.next=r).prev=a,r}function Nc(e,t,n,r){return n=new Fc(e,t,n),r?(n.next=r.next,(n.prev=r).next.prev=n,r.next=n):(n.prev=n).next=n,n}function Oc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Fc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Bc=function(){function e(){g(this,e)}return x(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],r=[],i=[];zc(e),Uc(n,e);var a=e.length;t.forEach(zc);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Uc(n,t[o]);for(var s=function(e,t){var n,r,i,a,o,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,l=t&&t.length,u=l?t[0]*s:e.length,c=wc(e,0,u,s,!0),h=[];if(!c||c.next===c.prev)return h;if(l&&(c=function(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=wc(e,t[i]*r,o=i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(function(e){for(var t=e,n=e;(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),(t=t.next)!==e;);return n}(o));for(s.sort(Tc),i=0;i<s.length;i++)!function(e,t){(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&o<s){if((o=s)===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}}while((r=r.next)!==t);if(!n)return null;if(i===o)return n;var l,u=n,c=n.x,h=n.y,d=1/0;for(r=n;i>=r.x&&r.x>=c&&i!==r.x&&Ac(a<h?i:o,a,c,h,a<h?o:i,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(i-r.x),Ic(r,e)&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&function(e,t){return Lc(e.prev,e,t.prev)<0&&Lc(t.next,e,e.next)<0}(n,r)))&&(n=r,d=l)),(r=r.next)!==u;);return n}(e,t))&&(e=Dc(t,e),Mc(t,t.next),Mc(e,e.next))}(s[i],n),n=Mc(n,n.next);return n}(e,t,c,s)),e.length>80*s){for(var d=n=e[0],p=r=e[1],f=s;f<u;f+=s)(i=e[f])<d&&(d=i),(a=e[f+1])<p&&(p=a),n<i&&(n=i),r<a&&(r=a);o=0!==(o=Math.max(n-d,r-p))?1/o:0}return Sc(c,h,s,d,p,o),h}(n,r),l=0;l<s.length;l+=3)i.push(s.slice(l,l+3));return i}}]),e}();function zc(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function Uc(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Hc=function(){h(t,ya);var e=p(t);function t(n,r){var i;g(this,t),(i=e.call(this)).type="ExtrudeGeometry",i.parameters={shapes:n,options:r},n=Array.isArray(n)?n:[n];for(var a=m(i),o=[],s=[],l=0,u=n.length;l<u;l++)!function(e){var t=[],n=void 0!==r.curveSegments?r.curveSegments:12,i=void 0!==r.steps?r.steps:1,l=void 0!==r.depth?r.depth:100,u=void 0===r.bevelEnabled||r.bevelEnabled,c=void 0!==r.bevelThickness?r.bevelThickness:6,h=void 0!==r.bevelSize?r.bevelSize:c-2,d=void 0!==r.bevelOffset?r.bevelOffset:0,p=void 0!==r.bevelSegments?r.bevelSegments:3,f=r.extrudePath,m=void 0!==r.UVGenerator?r.UVGenerator:Gc;void 0!==r.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=r.amount);var v,g,y,x,_,b=!1;f&&(v=f.getSpacedPoints(i),u=!(b=!0),g=f.computeFrenetFrames(i,!1),y=new Tr,x=new Tr,_=new Tr),u||(d=h=c=p=0);var w=(n=e.extractPoints(n)).shape,M=n.holes;if(!Bc.isClockWise(w)){w=w.reverse();for(var S=0,T=M.length;S<T;S++){var E=M[S];Bc.isClockWise(E)&&(M[S]=E.reverse())}}for(var A=Bc.triangulateShape(w,M),L=w,k=0,R=M.length;k<R;k++){var C=M[k];w=w.concat(C)}function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var I=w.length,D=A.length;function N(e,t,n){var r=e.x-t.x,i=e.y-t.y,a=n.x-e.x,o=n.y-e.y,s=r*r+i*i;if(Math.abs(r*o-i*a)>Number.EPSILON){var l=Math.sqrt(s),u=Math.sqrt(a*a+o*o),c=t.x-i/l,h=t.y+r/l;if((h=(u=c+r*(l=((n.x-o/u-c)*o-(n.y+a/u-h)*a)/(r*o-i*a))-e.x)*u+(c=h+i*l-e.y)*c)<=2)return new pr(u,c);l=Math.sqrt(h/2)}else h=!1,r>Number.EPSILON?a>Number.EPSILON&&(h=!0):r<-Number.EPSILON?a<-Number.EPSILON&&(h=!0):Math.sign(i)===Math.sign(o)&&(h=!0),l=h?(u=-i,c=r,Math.sqrt(s)):(u=r,c=i,Math.sqrt(s/2));return new pr(u/l,c/l)}for(var O=[],F=0,B=L.length,z=B-1,U=F+1;F<B;F++,z++,U++)z===B&&(z=0),U===B&&(U=0),O[F]=N(L[F],L[z],L[U]);for(var H,G=[],V=O.concat(),W=0,j=M.length;W<j;W++){var q=M[W];H=[];for(var X=0,Y=q.length,J=Y-1,Z=X+1;X<Y;X++,J++,Z++)J===Y&&(J=0),Z===Y&&(Z=0),H[X]=N(q[X],q[J],q[Z]);G.push(H),V=V.concat(H)}for(var K=0;K<p;K++){for(var Q=K/p,$=c*Math.cos(Q*Math.PI/2),ee=h*Math.sin(Q*Math.PI/2)+d,te=0,ne=L.length;te<ne;te++){var re=P(L[te],O[te],ee);Re(re.x,re.y,-$)}for(var ie=0,ae=M.length;ie<ae;ie++){var oe=M[ie];H=G[ie];for(var se=0,le=oe.length;se<le;se++){var ue=P(oe[se],H[se],ee);Re(ue.x,ue.y,-$)}}}for(var ce=h+d,he=0;he<I;he++){var de=u?P(w[he],V[he],ce):w[he];b?(x.copy(g.normals[0]).multiplyScalar(de.x),y.copy(g.binormals[0]).multiplyScalar(de.y),_.copy(v[0]).add(x).add(y),Re(_.x,_.y,_.z)):Re(de.x,de.y,0)}for(var pe=1;pe<=i;pe++)for(var fe=0;fe<I;fe++){var me=u?P(w[fe],V[fe],ce):w[fe];b?(x.copy(g.normals[pe]).multiplyScalar(me.x),y.copy(g.binormals[pe]).multiplyScalar(me.y),_.copy(v[pe]).add(x).add(y),Re(_.x,_.y,_.z)):Re(me.x,me.y,l/i*pe)}for(var ve=p-1;0<=ve;ve--){for(var ge=ve/p,ye=c*Math.cos(ge*Math.PI/2),xe=h*Math.sin(ge*Math.PI/2)+d,_e=0,be=L.length;_e<be;_e++){var we=P(L[_e],O[_e],xe);Re(we.x,we.y,l+ye)}for(var Me=0,Se=M.length;Me<Se;Me++){var Te=M[Me];H=G[Me];for(var Ee=0,Ae=Te.length;Ee<Ae;Ee++){var Le=P(Te[Ee],H[Ee],xe);b?Re(Le.x,Le.y+v[i-1].y,v[i-1].x+ye):Re(Le.x,Le.y,l+ye)}}}function ke(e,t){for(var n=e.length;0<=--n;){var r=n,s=n-1;s<0&&(s=e.length-1);for(var l=0,u=i+2*p;l<u;l++){var c=I*l,h=I*(l+1);!function(e,t,n,r){Pe(e),Pe(t),Pe(r),Pe(t),Pe(n),Pe(r),r=o.length/3,Ie((r=m.generateSideWallUV(a,o,r-6,r-3,r-2,r-1))[0]),Ie(r[1]),Ie(r[3]),Ie(r[1]),Ie(r[2]),Ie(r[3])}(t+r+c,t+s+c,t+s+h,t+r+h)}}}function Re(e,n,r){t.push(e),t.push(n),t.push(r)}function Ce(e,t,n){Pe(e),Pe(t),Pe(n),n=o.length/3,Ie((n=m.generateTopUV(a,o,n-3,n-2,n-1))[0]),Ie(n[1]),Ie(n[2])}function Pe(e){o.push(t[3*e+0]),o.push(t[3*e+1]),o.push(t[3*e+2])}function Ie(e){s.push(e.x),s.push(e.y)}(function(){var e=o.length/3;if(u){for(var t=0*I,n=0;n<D;n++){var r=A[n];Ce(r[2]+t,r[1]+t,r[0]+t)}t=I*(i+2*p);for(var s=0;s<D;s++){var l=A[s];Ce(l[0]+t,l[1]+t,l[2]+t)}}else{for(var c=0;c<D;c++){var h=A[c];Ce(h[2],h[1],h[0])}for(var d=0;d<D;d++){var f=A[d];Ce(f[0]+I*i,f[1]+I*i,f[2]+I*i)}}a.addGroup(e,o.length/3-e,0)})(),function(){var e=o.length/3,t=0;ke(L,t),t+=L.length;for(var n=0,r=M.length;n<r;n++){var i=M[n];ke(i,t),t+=i.length}a.addGroup(e,o.length/3-e,1)}()}(n[l]);return i.setAttribute("position",new oa(o,3)),i.setAttribute("uv",new oa(s,2)),i.computeVertexNormals(),i}return x(t,[{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,n){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=n[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new bc[s.type]).fromJSON(s)),new t(r,e.options)}}]),t}(),Gc={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r];return n=t[3*r+1],r=t[3*i],i=t[3*i+1],[new pr(a,o),new pr(s,n),new pr(r,i)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],u=t[3*r],c=t[3*r+1],h=t[3*r+2],d=t[3*i],p=t[3*i+1];return n=t[3*i+2],r=t[3*a],i=t[3*a+1],a=t[3*a+2],Math.abs(s-c)<Math.abs(o-u)?[new pr(o,1-l),new pr(u,1-h),new pr(d,1-n),new pr(r,1-a)]:[new pr(s,1-l),new pr(c,1-h),new pr(p,1-n),new pr(i,1-a)]}},Vc=function(){h(t,Ju);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;g(this,t);var i=(1+Math.sqrt(5))/2;return(i=e.call(this,[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[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],n,r)).type="IcosahedronGeometry",i.parameters={radius:n,detail:r},i}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}]),t}(),Wc=function(){h(t,ya);var e=p(t);function t(n){var r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;g(this,t),(r=e.call(this)).type="LatheGeometry",r.parameters={points:n,segments:i,phiStart:a,phiLength:o},i=Math.floor(i),o=or(o,0,2*Math.PI);for(var s=[],l=[],u=[],c=1/i,h=new Tr,d=new pr,p=0;p<=i;p++)for(var f=a+p*c*o,m=Math.sin(f),v=Math.cos(f),y=0;y<=n.length-1;y++)h.x=n[y].x*m,h.y=n[y].y,h.z=n[y].x*v,l.push(h.x,h.y,h.z),d.x=p/i,d.y=y/(n.length-1),u.push(d.x,d.y);for(var x=0;x<i;x++)for(var _=0;_<n.length-1;_++){var b=_+x*n.length,w=b+n.length,M=b+n.length+1,S=b+1;s.push(b,w,S),s.push(w,M,S)}if(r.setIndex(s),r.setAttribute("position",new oa(l,3)),r.setAttribute("uv",new oa(u,2)),r.computeVertexNormals(),o===2*Math.PI)for(var T=r.attributes.normal.array,E=new Tr,A=new Tr,L=new Tr,k=i*n.length*3,R=0,C=0;R<n.length;R++,C+=3)E.x=T[C+0],E.y=T[C+1],E.z=T[C+2],A.x=T[k+C+0],A.y=T[k+C+1],A.z=T[k+C+2],L.addVectors(E,A).normalize(),T[C+0]=T[k+C+0]=L.x,T[C+1]=T[k+C+1]=L.y,T[C+2]=T[k+C+2]=L.z;return r}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.points,e.segments,e.phiStart,e.phiLength)}}]),t}(),jc=function(){h(t,Ju);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return g(this,t),(n=e.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],r,i)).type="OctahedronGeometry",n.parameters={radius:r,detail:i},n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}]),t}(),qc=function(){h(t,ya);var e=p(t);function t(n,r,i){var a;g(this,t),(a=e.call(this)).type="ParametricGeometry",a.parameters={func:n,slices:r,stacks:i};var o=[],s=[],l=[],u=[],c=new Tr,h=new Tr,d=new Tr,p=new Tr,f=new Tr;n.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var m=r+1,v=0;v<=i;v++)for(var y=v/i,x=0;x<=r;x++){var _=x/r;n(_,y,h),s.push(h.x,h.y,h.z),0<=_-1e-5?(n(_-1e-5,y,d),p.subVectors(h,d)):(n(1e-5+_,y,d),p.subVectors(d,h)),0<=y-1e-5?(n(_,y-1e-5,d),f.subVectors(h,d)):(n(_,1e-5+y,d),f.subVectors(d,h)),c.crossVectors(p,f).normalize(),l.push(c.x,c.y,c.z),u.push(_,y)}for(var b=0;b<i;b++)for(var w=0;w<r;w++){var M=b*m+w+1,S=(b+1)*m+w+1,T=(b+1)*m+w;o.push(b*m+w,M,T),o.push(M,S,T)}return a.setIndex(o),a.setAttribute("position",new oa(s,3)),a.setAttribute("normal",new oa(l,3)),a.setAttribute("uv",new oa(u,2)),a}return t}(),Xc=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.5,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI;g(this,t),(n=e.call(this)).type="RingGeometry",n.parameters={innerRadius:r,outerRadius:i,thetaSegments:a,phiSegments:o,thetaStart:s,thetaLength:l},a=Math.max(3,a);for(var u=[],c=[],h=[],d=[],p=r,f=(i-r)/(o=Math.max(1,o)),m=new Tr,v=new pr,y=0;y<=o;y++){for(var x=0;x<=a;x++){var _=s+x/a*l;m.x=p*Math.cos(_),m.y=p*Math.sin(_),c.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/i+1)/2,v.y=(m.y/i+1)/2,d.push(v.x,v.y)}p+=f}for(var b=0;b<o;b++)for(var w=b*(a+1),M=0;M<a;M++){var S=M+w,T=S+a+1,E=S+a+2,A=S+1;u.push(S,T,A),u.push(T,E,A)}return n.setIndex(u),n.setAttribute("position",new oa(c,3)),n.setAttribute("normal",new oa(h,3)),n.setAttribute("uv",new oa(d,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),t}(),Yc=function(){h(t,ya);var e=p(t);function t(n){var r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12;g(this,t),(r=e.call(this)).type="ShapeGeometry",r.parameters={shapes:n,curveSegments:i};var a=[],o=[],s=[],l=[],u=0,c=0;if(!1===Array.isArray(n))d(n);else for(var h=0;h<n.length;h++)d(n[h]),r.addGroup(u,c,h),u+=c,c=0;function d(e){var t=o.length/3,n=(e=e.extractPoints(i)).shape,r=e.holes;!1===Bc.isClockWise(n)&&(n=n.reverse());for(var u=0,h=r.length;u<h;u++){var d=r[u];!0===Bc.isClockWise(d)&&(r[u]=d.reverse())}for(var p=Bc.triangulateShape(n,r),f=0,m=r.length;f<m;f++){var v=r[f];n=n.concat(v)}for(var g=0,y=n.length;g<y;g++){var x=n[g];o.push(x.x,x.y,0),s.push(0,0,1),l.push(x.x,x.y)}for(var _=0,b=p.length;_<b;_++){var w=(S=p[_])[0]+t,M=S[1]+t,S=S[2]+t;a.push(w,M,S),c+=3}}return r.setIndex(a),r.setAttribute("position",new oa(o,3)),r.setAttribute("normal",new oa(s,3)),r.setAttribute("uv",new oa(l,2)),r}return x(t,[{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,n){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=n[e.shapes[i]];r.push(o)}return new t(r,e.curveSegments)}}]),t}(),Jc=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:16,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,u=6<arguments.length&&void 0!==arguments[6]?arguments[6]:Math.PI;g(this,t),(n=e.call(this)).type="SphereGeometry",n.parameters={radius:r,widthSegments:i,heightSegments:a,phiStart:o,phiLength:s,thetaStart:l,thetaLength:u},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));for(var c=Math.min(l+u,Math.PI),h=0,d=[],p=new Tr,f=new Tr,m=[],v=[],y=[],x=[],_=0;_<=a;_++){var b=[],w=_/a,M=0;0==_&&0==l?M=.5/i:_==a&&c==Math.PI&&(M=-.5/i);for(var S=0;S<=i;S++){var T=S/i;p.x=-r*Math.cos(o+T*s)*Math.sin(l+w*u),p.y=r*Math.cos(l+w*u),p.z=r*Math.sin(o+T*s)*Math.sin(l+w*u),v.push(p.x,p.y,p.z),f.copy(p).normalize(),y.push(f.x,f.y,f.z),x.push(T+M,1-w),b.push(h++)}d.push(b)}for(var E=0;E<a;E++)for(var A=0;A<i;A++){var L=d[E][A+1],k=d[E][A],R=d[E+1][A],C=d[E+1][A+1];(0!==E||0<l)&&m.push(L,k,C),(E!==a-1||c<Math.PI)&&m.push(k,R,C)}return n.setIndex(m),n.setAttribute("position",new oa(v,3)),n.setAttribute("normal",new oa(y,3)),n.setAttribute("uv",new oa(x,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),t}(),Zc=function(){h(t,Ju);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return g(this,t),(n=e.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],r,i)).type="TetrahedronGeometry",n.parameters={radius:r,detail:i},n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.detail)}}]),t}(),Kc=function(){h(t,Hc);var e=p(t);function t(n){var r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};g(this,t);var a=i.font;return a&&a.isFont?(n=a.generateShapes(n,i.size),i.depth=void 0!==i.height?i.height:50,void 0===i.bevelThickness&&(i.bevelThickness=10),void 0===i.bevelSize&&(i.bevelSize=8),void 0===i.bevelEnabled&&(i.bevelEnabled=!1),(r=e.call(this,n,i)).type="TextGeometry",r):(console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),f(r,new ya))}return t}(),Qc=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:6,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI;g(this,t),(n=e.call(this)).type="TorusGeometry",n.parameters={radius:r,tube:i,radialSegments:a,tubularSegments:o,arc:s},a=Math.floor(a),o=Math.floor(o);for(var l=[],u=[],c=[],h=[],d=new Tr,p=new Tr,f=new Tr,m=0;m<=a;m++)for(var v=0;v<=o;v++){var y=v/o*s,x=m/a*Math.PI*2;p.x=(r+i*Math.cos(x))*Math.cos(y),p.y=(r+i*Math.cos(x))*Math.sin(y),p.z=i*Math.sin(x),u.push(p.x,p.y,p.z),d.x=r*Math.cos(y),d.y=r*Math.sin(y),f.subVectors(p,d).normalize(),c.push(f.x,f.y,f.z),h.push(v/o),h.push(m/a)}for(var _=1;_<=a;_++)for(var b=1;b<=o;b++){var w=(o+1)*(_-1)+b-1,M=(o+1)*(_-1)+b,S=(o+1)*_+b;l.push((o+1)*_+b-1,w,S),l.push(w,M,S)}return n.setIndex(l),n.setAttribute("position",new oa(u,3)),n.setAttribute("normal",new oa(c,3)),n.setAttribute("uv",new oa(h,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),t}(),$c=function(){h(t,ya);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:64,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:3;g(this,t),(n=e.call(this)).type="TorusKnotGeometry",n.parameters={radius:r,tube:i,tubularSegments:a,radialSegments:o,p:s,q:l},a=Math.floor(a),o=Math.floor(o);for(var u=[],c=[],h=[],d=[],p=new Tr,f=new Tr,m=new Tr,v=new Tr,y=new Tr,x=new Tr,_=new Tr,b=0;b<=a;++b){var w=b/a*s*Math.PI*2;C(w,s,l,r,m),C(.01+w,s,l,r,v),x.subVectors(v,m),_.addVectors(v,m),y.crossVectors(x,_),_.crossVectors(y,x),y.normalize(),_.normalize();for(var M=0;M<=o;++M){var S=M/o*Math.PI*2,T=-i*Math.cos(S);S=i*Math.sin(S),p.x=m.x+(T*_.x+S*y.x),p.y=m.y+(T*_.y+S*y.y),p.z=m.z+(T*_.z+S*y.z),c.push(p.x,p.y,p.z),f.subVectors(p,m).normalize(),h.push(f.x,f.y,f.z),d.push(b/a),d.push(M/o)}}for(var E=1;E<=a;E++)for(var A=1;A<=o;A++){var L=(o+1)*E+(A-1),k=(o+1)*E+A,R=(o+1)*(E-1)+A;u.push((o+1)*(E-1)+(A-1),L,R),u.push(L,k,R)}function C(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e);t=n/t*e,e=Math.cos(t),i.x=r*(2+e)*.5*a,i.y=r*(2+e)*o*.5,i.z=r*Math.sin(t)*.5}return n.setIndex(u),n.setAttribute("position",new oa(c,3)),n.setAttribute("normal",new oa(h,3)),n.setAttribute("uv",new oa(d,2)),n}return x(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),t}(),eh=function(){h(t,ya);var e=p(t);function t(n){var r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:64,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,s=4<arguments.length&&void 0!==arguments[4]&&arguments[4];g(this,t),(r=e.call(this)).type="TubeGeometry",r.parameters={path:n,tubularSegments:i,radius:a,radialSegments:o,closed:s};var l=n.computeFrenetFrames(i,s);r.tangents=l.tangents,r.normals=l.normals,r.binormals=l.binormals;var u=new Tr,c=new Tr,h=new pr,d=new Tr,p=[],f=[],m=[],v=[];function y(e){d=n.getPointAt(e/i,d);for(var t=l.normals[e],r=l.binormals[e],s=0;s<=o;s++){var h=s/o*Math.PI*2,m=Math.sin(h);h=-Math.cos(h),c.x=h*t.x+m*r.x,c.y=h*t.y+m*r.y,c.z=h*t.z+m*r.z,c.normalize(),f.push(c.x,c.y,c.z),u.x=d.x+a*c.x,u.y=d.y+a*c.y,u.z=d.z+a*c.z,p.push(u.x,u.y,u.z)}}return function(){for(var e=0;e<i;e++)y(e);y(!1===s?i:0),function(){for(var e=0;e<=i;e++)for(var t=0;t<=o;t++)h.x=e/i,h.y=t/o,m.push(h.x,h.y)}(),function(){for(var e=1;e<=i;e++)for(var t=1;t<=o;t++){var n=(o+1)*(e-1)+(t-1),r=(o+1)*e+(t-1),a=(o+1)*e+t,s=(o+1)*(e-1)+t;v.push(n,r,s),v.push(r,a,s)}}()}(),r.setIndex(v),r.setAttribute("position",new oa(p,3)),r.setAttribute("normal",new oa(f,3)),r.setAttribute("uv",new oa(m,2)),r}return x(t,[{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.path=this.parameters.path.toJSON(),e}}],[{key:"fromJSON",value:function(e){return new t((new bc[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}]),t}(),th=function(){h(t,ya);var e=p(t);function t(n){var r;if(g(this,t),(r=e.call(this)).type="WireframeGeometry",!0===n.isGeometry)return console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),f(r);var i=[],a=new Set,o=new Tr,s=new Tr;if(null!==n.index)for(var l=n.attributes.position,u=n.index,c=n.groups,h=0,d=(c=0===c.length?[{start:0,count:u.count,materialIndex:0}]:c).length;h<d;++h)for(var p=c[h],m=p.start,v=m,y=m+p.count;v<y;v+=3)for(var x=0;x<3;x++){var _=u.getX(v+x),b=u.getX(v+(x+1)%3);o.fromBufferAttribute(l,_),s.fromBufferAttribute(l,b),!0===nh(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}else for(var w=n.attributes.position,M=0,S=w.count/3;M<S;M++)for(var T=0;T<3;T++){var E=3*M+(T+1)%3;o.fromBufferAttribute(w,3*M+T),s.fromBufferAttribute(w,E),!0===nh(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}return r.setAttribute("position",new oa(i,3)),r}return t}();function nh(e,t,n){var r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z);return e="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z),!0!==n.has(r)&&!0!==n.has(e)&&(n.add(r,e),!0)}var rh=Object.freeze({__proto__:null,BoxGeometry:Ba,BoxBufferGeometry:Ba,CircleGeometry:qu,CircleBufferGeometry:qu,ConeGeometry:Yu,ConeBufferGeometry:Yu,CylinderGeometry:Xu,CylinderBufferGeometry:Xu,DodecahedronGeometry:Zu,DodecahedronBufferGeometry:Zu,EdgesGeometry:tc,ExtrudeGeometry:Hc,ExtrudeBufferGeometry:Hc,IcosahedronGeometry:Vc,IcosahedronBufferGeometry:Vc,LatheGeometry:Wc,LatheBufferGeometry:Wc,OctahedronGeometry:jc,OctahedronBufferGeometry:jc,ParametricGeometry:qc,ParametricBufferGeometry:qc,PlaneGeometry:ro,PlaneBufferGeometry:ro,PolyhedronGeometry:Ju,PolyhedronBufferGeometry:Ju,RingGeometry:Xc,RingBufferGeometry:Xc,ShapeGeometry:Yc,ShapeBufferGeometry:Yc,SphereGeometry:Jc,SphereBufferGeometry:Jc,TetrahedronGeometry:Zc,TetrahedronBufferGeometry:Zc,TextGeometry:Kc,TextBufferGeometry:Kc,TorusGeometry:Qc,TorusBufferGeometry:Qc,TorusKnotGeometry:$c,TorusKnotBufferGeometry:$c,TubeGeometry:eh,TubeBufferGeometry:eh,WireframeGeometry:th}),ih=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="ShadowMaterial",r.color=new Xi(0),r.transparent=!0,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.color.copy(e.color),this}}]),t}();ih.prototype.isShadowMaterial=!0;var ah=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new Xi(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Xi(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=Sn,r.normalScale=new pr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}]),t}();ah.prototype.isMeshStandardMaterial=!0;var oh=function(){h(t,ah);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.clearcoat=0,r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new pr(1,1),r.clearcoatNormalMap=null,r.reflectivity=.5,Object.defineProperty(m(r),"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=or(2.5*(e-1)/(e+1),0,1)}}),r.sheen=null,r.transmission=0,r.transmissionMap=null,r.thickness=.01,r.thicknessMap=null,r.attenuationDistance=0,r.attenuationTint=new Xi(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularTint=new Xi(1,1,1),r.specularTintMap=null,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},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.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Xi).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationTint.copy(e.attenuationTint),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularTint.copy(e.specularTint),this.specularTintMap=e.specularTintMap,this}}]),t}();oh.prototype.isMeshPhysicalMaterial=!0;var sh=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshPhongMaterial",r.color=new Xi(16777215),r.specular=new Xi(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Xi(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=Sn,r.normalScale=new pr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=de,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();sh.prototype.isMeshPhongMaterial=!0;var lh=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).defines={TOON:""},r.type="MeshToonMaterial",r.color=new Xi(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Xi(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=Sn,r.normalScale=new pr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();lh.prototype.isMeshToonMaterial=!0;var uh=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=Sn,r.normalScale=new pr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.flatShading=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();uh.prototype.isMeshNormalMaterial=!0;var ch=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="MeshLambertMaterial",r.color=new Xi(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Xi(0),r.emissiveIntensity=1,r.emissiveMap=null,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=de,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}]),t}();ch.prototype.isMeshLambertMaterial=!0;var hh=function(){h(t,Ui);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new Xi(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=Sn,r.normalScale=new pr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).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}}]),t}();hh.prototype.isMeshMatcapMaterial=!0;var dh=function(){h(t,Su);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(n),r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),t}();dh.prototype.isLineDashedMaterial=!0;var ph=Object.freeze({__proto__:null,ShadowMaterial:ih,SpriteMaterial:Wl,RawShaderMaterial:mo,ShaderMaterial:Ga,PointsMaterial:Nu,MeshPhysicalMaterial:oh,MeshStandardMaterial:ah,MeshPhongMaterial:sh,MeshToonMaterial:lh,MeshNormalMaterial:uh,MeshLambertMaterial:ch,MeshDepthMaterial:Ml,MeshDistanceMaterial:Sl,MeshBasicMaterial:Yi,MeshMatcapMaterial:hh,LineDashedMaterial:dh,LineBasicMaterial:Su,Material:Ui}),fh={arraySlice:function(e,t,n){return fh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,l=0;l!==t;++l)i[o++]=e[s+l];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))for(;void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),void 0!==(a=e[i++]););else if(void 0!==o.toArray)for(;void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),void 0!==(a=e[i++]););else for(;void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),void 0!==(a=e[i++]););}},subclip:function(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;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]*i;if(!(p<n||r<=p)){c.push(l.times[d]);for(var f=0;f<u;++f)h.push(l.values[d*u+f])}}0!==c.length&&(l.times=fh.convertArray(c,l.times.constructor),l.values=fh.convertArray(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(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:30,i=n.tracks.length,a=t/(r=r<=0?30:r),o=0;o<i;++o)!function(t){var r=n.tracks[t],i=r.ValueTypeName;if("bool"!==i&&"string"!==i){var o=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0!==o){var s=0,l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var u=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h,d,p=r.times.length-1;d=a<=r.times[0]?(t=s,fh.arraySlice(r.values,t,l-s)):a>=r.times[p]?fh.arraySlice(r.values,h=p*l+s,h+l-s):(l-=h=s,(s=r.createInterpolant()).evaluate(a),fh.arraySlice(s.resultBuffer,h,l)),"quaternion"===i&&(new Sr).fromArray(d).normalize().conjugate().toArray(d);for(var f=o.times.length,m=0;m<f;++m){var v=m*c+u;if("quaternion"===i)Sr.multiplyQuaternionsFlat(o.values,v,d,0,o.values,v);else for(var g=c-2*u,y=0;y<g;++y)o.values[v+y]-=d[y]}}}}(o);return e.blendMode=cn,e}},mh=function(){function e(t,n,r,i){g(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return x(e,[{key:"evaluate",value:function(e){var t,n=this.parameterPositions,r=this._cachedIndex,i=n[r],a=n[r-1];e:{t:{n:{r:if(!(e<i)){for(var o=r+2;;){if(void 0===i){if(e<a)break r;return r=n.length,this._cachedIndex=r,this.afterEnd_(r-1,e,a)}if(r===o)break;if(a=i,e<(i=n[++r]))break t}t=n.length;break n}if(a<=e)break e;var s=n[1];e<s&&(r=2,a=s);for(var l=r-2;;){if(void 0===a)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===l)break;if(i=a,(a=n[--r-1])<=e)break t}t=r,r=0}for(;r<t;){var u=r+t>>>1;e<n[u]?t=u:r=1+u}if(i=n[r],void 0===(a=n[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return r=n.length,this._cachedIndex=r,this.afterEnd_(r-1,a,e)}this._cachedIndex=r,this.intervalChanged_(r,a,i)}return this.interpolate_(r,a,e,i)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}();mh.prototype.beforeStart_=mh.prototype.copySampleValue_,mh.prototype.afterEnd_=mh.prototype.copySampleValue_;var vh=function(){h(t,mh);var e=p(t);function t(n,r,i,a){return g(this,t),(a=e.call(this,n,r,i,a))._weightPrev=-0,a._offsetPrev=-0,a._weightNext=-0,a._offsetNext=-0,a.DefaultSettings_={endingStart:on,endingEnd:on},a}return x(t,[{key:"intervalChanged_",value:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case sn:i=e,o=2*t-n;break;case ln:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case sn:a=e,s=2*n-t;break;case ln:s=n+r[a=1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*u,this._offsetNext=a*u}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=-h*(t=(r=(n=(n-t)/(r-t))*n)*n)+2*h*r-h*n,p=(1+h)*t+(-1.5-2*h)*r+(-.5+h)*n+1,f=(-1-(e=this._weightNext))*t+(1.5+e)*r+.5*n,m=e*t-e*r,v=0;v!==o;++v)i[v]=d*a[u+v]+p*a[l+v]+f*a[s+v]+m*a[c+v];return i}}]),t}(),gh=function(){h(t,mh);var e=p(t);function t(n,r,i,a){return g(this,t),e.call(this,n,r,i,a)}return x(t,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=(n-t)/(r-t),c=1-u,h=0;h!==o;++h)i[h]=a[l+h]*c+a[s+h]*u;return i}}]),t}(),yh=function(){h(t,mh);var e=p(t);function t(n,r,i,a){return g(this,t),e.call(this,n,r,i,a)}return x(t,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),t}(),xh=function(){function e(t,n,r,i){if(g(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=fh.convertArray(n,this.TimeBufferType),this.values=fh.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return x(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new yh(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new gh(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new vh(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case nn:t=this.InterpolantFactoryMethodDiscrete;break;case rn:t=this.InterpolantFactoryMethodLinear;break;case an:t=this.InterpolantFactoryMethodSmooth}if(void 0!==t)return this.createInterpolant=t,this;var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return nn;case this.InterpolantFactoryMethodLinear:return rn;case this.InterpolantFactoryMethodSmooth:return an}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n,r=this.times,i=r.length,a=0,o=i-1;a!==i&&r[a]<e;)++a;for(;-1!==o&&r[o]>t;)--o;return++o,0===a&&o===i||(o<=a&&(a=(o=Math.max(o,1))-1),n=this.getValueSize(),this.times=fh.arraySlice(r,a,o),this.values=fh.arraySlice(this.values,a*n,o*n)),this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&s<a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&fh.isTypedArray(r))for(var l=0,u=r.length;l!==u;++l){var c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=fh.arraySlice(this.times),t=fh.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===an,i=e.length-1,a=1,o=1;o<i;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==e[0]))if(r)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var p=t[u+d];if(p!==t[c+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var f=o*n,m=a*n,v=0;v!==n;++v)t[m+v]=t[f+v]}++a}}if(0<i){e[a]=e[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)t[y+x]=t[g+x];++a}return a!==e.length?(this.times=fh.arraySlice(e,0,a),this.values=fh.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=fh.arraySlice(this.times,0),t=fh.arraySlice(this.values,0);return(t=new this.constructor(this.name,e,t)).createInterpolant=this.createInterpolant,t}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;return n.toJSON!==this.toJSON?t=n.toJSON(e):(t={name:e.name,times:fh.convertArray(e.times,Array),values:fh.convertArray(e.values,Array)},(n=e.getInterpolation())!==e.DefaultInterpolation&&(t.interpolation=n)),t.type=e.ValueTypeName,t}}]),e}();xh.prototype.TimeBufferType=Float32Array,xh.prototype.ValueBufferType=Float32Array,xh.prototype.DefaultInterpolation=rn;var _h=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();_h.prototype.ValueTypeName="bool",_h.prototype.ValueBufferType=Array,_h.prototype.DefaultInterpolation=nn,_h.prototype.InterpolantFactoryMethodLinear=void 0,_h.prototype.InterpolantFactoryMethodSmooth=void 0;var bh=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();bh.prototype.ValueTypeName="color";var wh=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();wh.prototype.ValueTypeName="number";var Mh=function(){h(t,mh);var e=p(t);function t(n,r,i,a){return g(this,t),e.call(this,n,r,i,a)}return x(t,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),l=e*o,u=l+o;l!==u;l+=4)Sr.slerpFlat(i,0,a,l-o,a,l,s);return i}}]),t}(),Sh=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return x(t,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new Mh(this.times,this.values,this.getValueSize(),e)}}]),t}();Sh.prototype.ValueTypeName="quaternion",Sh.prototype.DefaultInterpolation=rn,Sh.prototype.InterpolantFactoryMethodSmooth=void 0;var Th=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();Th.prototype.ValueTypeName="string",Th.prototype.ValueBufferType=Array,Th.prototype.DefaultInterpolation=nn,Th.prototype.InterpolantFactoryMethodLinear=void 0,Th.prototype.InterpolantFactoryMethodSmooth=void 0;var Eh=function(){h(t,xh);var e=p(t);function t(){return g(this,t),e.apply(this,arguments)}return t}();Eh.prototype.ValueTypeName="vector";var Ah=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,r=2<arguments.length?arguments[2]:void 0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:un;g(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=ar(),this.duration<0&&this.resetDuration()}return x(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(function(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t,n,r=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wh;case"vector":case"vector2":case"vector3":case"vector4":return Eh;case"color":return bh;case"quaternion":return Sh;case"bool":case"boolean":return _h;case"string":return Th}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);return void 0===e.times&&(t=[],n=[],fh.flattenJSON(e.keys,t,n,"value"),e.times=t,e.values=n),void 0!==r.parse?r.parse(e):new r(e.name,e.times,e.values,e.interpolation)}(n[i]).scale(r));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,r=(e={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},0),i=n.length;r!==i;++r)t.push(xh.toJSON(n[r]));return e}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[];(u=[]).push((o+i-1)%i,o,(o+1)%i),s.push(0,1,0);var l=fh.getKeyframeOrder(u),u=fh.sortedArray(u,1,l);s=fh.sortedArray(s,1,l),r||0!==u[0]||(u.push(i),s.push(s[0])),a.push(new wh(".morphTargetInfluences["+t[o].name+"]",u,s).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;Array.isArray(e)||(n=e.geometry&&e.geometry.animations||e.animations);for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s,l=e[a],u=l.name.match(i);u&&1<u.length&&((u=r[s=u[1]])||(r[s]=u=[]),u.push(l))}var c,h=[];for(c in r)h.push(this.CreateFromMorphTargetSequence(c,r[c],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){var a;0!==n.length&&(fh.flattenJSON(n,a=[],n=[],r),0!==a.length&&i.push(new e(t,a,n)))},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h,d={},p=void 0;for(p=0;p<c.length;p++)if(c[p].morphTargets)for(var f=0;f<c[p].morphTargets.length;f++)d[c[p].morphTargets[f]]=-1;for(h in d){for(var m=[],v=[],g=0;g!==c[p].morphTargets.length;++g){var y=c[p];m.push(y.time),v.push(y.morphTarget===h?1:0)}r.push(new wh(".morphTargetInfluence["+h+"]",m,v))}s=d.length*(a||1)}else{var x=".bones["+t[u].name+"]";n(Eh,x+".position",c,"pos",r),n(Sh,x+".quaternion",c,"rot",r),n(Eh,x+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}(),Lh={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},kh=function e(t,n,r){g(this,e);var i=this,a=!1,o=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){return-1!==(e=u.indexOf(e))&&u.splice(e,2),this},this.getHandler=function(e){for(var t=0,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}},Rh=new kh,Ch=function(){function e(t){g(this,e),this.manager=void 0!==t?t:Rh,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return x(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}(),Ph={},Ih=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Lh.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Ph[e]){var o,s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var l=s[1],u=!!s[2],c=s[3];c=decodeURIComponent(c),u&&(c=atob(c));try{var h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(c.length),p=0;p<c.length;p++)d[p]=c.charCodeAt(p);f="blob"===h?new Blob([d.buffer],{type:l}):d.buffer;break;case"document":var f=(new DOMParser).parseFromString(c,l);break;case"json":f=JSON.parse(c);break;default:f=c}setTimeout((function(){t&&t(f),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{for(var m in Ph[e]=[],Ph[e].push({onLoad:t,onProgress:n,onError:r}),(o=new XMLHttpRequest).open("GET",e,!0),o.addEventListener("load",(function(t){var n=this.response,r=Ph[e];if(delete Ph[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Lh.add(e,n);for(var a=0,o=r.length;a<o;a++){var s=r[a];s.onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(var l=0,u=r.length;l<u;l++){var c=r[l];c.onError&&c.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),o.addEventListener("progress",(function(t){for(var n=Ph[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}}),!1),o.addEventListener("error",(function(t){var n=Ph[e];delete Ph[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),o.addEventListener("abort",(function(t){var n=Ph[e];delete Ph[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)o.setRequestHeader(m,this.requestHeader[m]);o.send(null)}return i.manager.itemStart(e),o}Ph[e].push({onLoad:t,onProgress:n,onError:r})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),t}(),Dh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ih(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ah.parse(e[n]);t.push(r)}return t}}]),t}(),Nh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=[],o=new Vu,s=new Ih(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var l=0;if(Array.isArray(e))for(var u=0,c=e.length;u<c;++u)!function(u){s.load(e[u],(function(e){e=i.parse(e,!0),a[u]={width:e.width,height:e.height,format:e.format,mipmaps:e.mipmaps},6===(l+=1)&&(1===e.mipmapCount&&(o.minFilter=Oe),o.image=a,o.format=e.format,o.needsUpdate=!0,t&&t(o))}),n,r)}(u);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;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=Oe),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}]),t}(),Oh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Lh.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Lh.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),t}(),Fh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=new qa,a=new Oh(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);for(var o=0,s=0;s<e.length;++s)!function(n){a.load(e[n],(function(e){i.images[n]=e,6==++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}(s);return i}}]),t}(),Bh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new mu,o=new Ih(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){(e=i.parse(e))&&(void 0!==e.image?a.image=e.image:void 0!==e.data&&(a.image.width=e.width,a.image.height=e.height,a.image.data=e.data),a.wrapS=void 0!==e.wrapS?e.wrapS:ke,a.wrapT=void 0!==e.wrapT?e.wrapT:ke,a.magFilter=void 0!==e.magFilter?e.magFilter:Oe,a.minFilter=void 0!==e.minFilter?e.minFilter:Oe,a.anisotropy=void 0!==e.anisotropy?e.anisotropy:1,void 0!==e.encoding&&(a.encoding=e.encoding),void 0!==e.flipY&&(a.flipY=e.flipY),void 0!==e.format&&(a.format=e.format),void 0!==e.type&&(a.type=e.type),void 0!==e.mipmaps&&(a.mipmaps=e.mipmaps,a.minFilter=ze),1===e.mipmapCount&&(a.minFilter=Oe),void 0!==e.generateMipmaps&&(a.generateMipmaps=e.generateMipmaps),a.needsUpdate=!0,t&&t(a,e))}),n,r),a}}]),t}(),zh=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=new yr,a=new Oh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){i.image=n,n=0<e.search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/),i.format=n?et:tt,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}]),t}(),Uh=function(){h(t,nc);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="CurvePath",n.curves=[],n.autoClose=!1,n}return x(t,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new vc(t,e))}},{key:"getPoint",value:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength();return a.getPointAt(0===o?0:1-i/o)}r++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e}},{key:"getSpacedPoints",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&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&&1<n.length&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){l(v(t.prototype),"copy",this).call(this,e),this.curves=[];for(var n=0,r=e.curves.length;n<r;n++){var i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var n=0,r=this.curves.length;n<r;n++){var i=this.curves[n];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){l(v(t.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var n=0,r=e.curves.length;n<r;n++){var i=e.curves[n];this.curves.push((new bc[i.type]).fromJSON(i))}return this}}]),t}(),Hh=function(){h(t,Uh);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="Path",r.currentPoint=new pr,n&&r.setFromPoints(n),r}return x(t,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new vc(this.currentPoint.clone(),new pr(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return t=new yc(this.currentPoint.clone(),new pr(e,t),new pr(n,r)),this.curves.push(t),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return r=new fc(this.currentPoint.clone(),new pr(e,t),new pr(n,r),new pr(i,a)),this.curves.push(r),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e);return t=new _c(t),this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}},{key:"absarc",value:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,r,i,a,o,s),this}},{key:"absellipse",value:function(e,t,n,r,i,a,o,s){return o=new rc(e,t,n,r,i,a,o,s),0<this.curves.length&&((s=o.getPoint(0)).equals(this.currentPoint)||this.lineTo(s.x,s.y)),this.curves.push(o),o=o.getPoint(1),this.currentPoint.copy(o),this}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return l(v(t.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),t}(),Gh=function(){h(t,Hh);var e=p(t);function t(n){return g(this,t),(n=e.call(this,n)).uuid=ar(),n.type="Shape",n.holes=[],n}return x(t,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){l(v(t.prototype),"copy",this).call(this,e),this.holes=[];for(var n=0,r=e.holes.length;n<r;n++){var i=e.holes[n];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var n=0,r=this.holes.length;n<r;n++){var i=this.holes[n];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){l(v(t.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var n=0,r=e.holes.length;n<r;n++){var i=e.holes[n];this.holes.push((new Hh).fromJSON(i))}return this}}]),t}(),Vh=function(){h(t,Ai);var e=p(t);function t(n){var r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return g(this,t),(r=e.call(this)).type="Light",r.color=new Xi(n),r.intensity=i,r}return x(t,[{key:"dispose",value:function(){}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}]),t}();Vh.prototype.isLight=!0;var Wh=function(){h(t,Vh);var e=p(t);function t(n,r,i){return g(this,t),(i=e.call(this,n,i)).type="HemisphereLight",i.position.copy(Ai.DefaultUp),i.updateMatrix(),i.groundColor=new Xi(r),i}return x(t,[{key:"copy",value:function(e){return Vh.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}]),t}();Wh.prototype.isHemisphereLight=!0;var jh=new ni,qh=new Tr,Xh=new Tr,Yh=function(){function e(t){g(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new pr(512,512),this.map=null,this.mapPass=null,this.matrix=new ni,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new eo,this._frameExtents=new pr(1,1),this._viewportCount=1,this._viewports=[new _r(0,0,1,1)]}return x(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;qh.setFromMatrixPosition(e.matrixWorld),t.position.copy(qh),Xh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Xh),t.updateMatrixWorld(),jh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}]),e}(),Jh=function(){h(t,Yh);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this,new Wa(50,1,.5,500))).focus=1,n}return x(t,[{key:"updateMatrices",value:function(e){var n=this.camera,r=2*ir*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||n.far;r===n.fov&&i===n.aspect&&a===n.far||(n.fov=r,n.aspect=i,n.far=a,n.updateProjectionMatrix()),l(v(t.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),t}();Jh.prototype.isSpotLightShadow=!0;var Zh=function(){h(t,Vh);var e=p(t);function t(n,r){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Math.PI/3,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;return g(this,t),(r=e.call(this,n,r)).type="SpotLight",r.position.copy(Ai.DefaultUp),r.updateMatrix(),r.target=new Ai,r.distance=i,r.angle=a,r.penumbra=o,r.decay=s,r.shadow=new Jh,r}return x(t,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),t}();Zh.prototype.isSpotLight=!0;var Kh=new ni,Qh=new Tr,$h=new Tr,ed=function(){h(t,Yh);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this,new Wa(90,1,.5,500)))._frameExtents=new pr(4,2),n._viewportCount=6,n._viewports=[new _r(2,1,1,1),new _r(0,1,1,1),new _r(3,1,1,1),new _r(1,1,1,1),new _r(3,0,1,1),new _r(1,0,1,1)],n._cubeDirections=[new Tr(1,0,0),new Tr(-1,0,0),new Tr(0,0,1),new Tr(0,0,-1),new Tr(0,1,0),new Tr(0,-1,0)],n._cubeUps=[new Tr(0,1,0),new Tr(0,1,0),new Tr(0,1,0),new Tr(0,1,0),new Tr(0,0,1),new Tr(0,0,-1)],n}return x(t,[{key:"updateMatrices",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Qh.setFromMatrixPosition(e.matrixWorld),n.position.copy(Qh),$h.copy(n.position),$h.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt($h),n.updateMatrixWorld(),r.makeTranslation(-Qh.x,-Qh.y,-Qh.z),Kh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Kh)}}]),t}();ed.prototype.isPointLightShadow=!0;var td=function(){h(t,Vh);var e=p(t);function t(n,r){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;return g(this,t),(r=e.call(this,n,r)).type="PointLight",r.distance=i,r.decay=a,r.shadow=new ed,r}return x(t,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),t}();td.prototype.isPointLight=!0;var nd=function(){h(t,Yh);var e=p(t);function t(){return g(this,t),e.call(this,new fo(-5,5,5,-5,.5,500))}return t}();nd.prototype.isDirectionalLightShadow=!0;var rd=function(){h(t,Vh);var e=p(t);function t(n,r){return g(this,t),(r=e.call(this,n,r)).type="DirectionalLight",r.position.copy(Ai.DefaultUp),r.updateMatrix(),r.target=new Ai,r.shadow=new nd,r}return x(t,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),t}();rd.prototype.isDirectionalLight=!0;var id=function(){h(t,Vh);var e=p(t);function t(n,r){return g(this,t),(r=e.call(this,n,r)).type="AmbientLight",r}return t}();id.prototype.isAmbientLight=!0;var ad=function(){h(t,Vh);var e=p(t);function t(n,r){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:10,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:10;return g(this,t),(r=e.call(this,n,r)).type="RectAreaLight",r.width=i,r.height=a,r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).object.width=this.width,e.object.height=this.height,e}}]),t}();ad.prototype.isRectAreaLight=!0;var od=function(){function e(){g(this,e),this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Tr)}return x(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;return e=this.coefficients,t.copy(e[0]).multiplyScalar(.282095),t.addScaledVector(e[1],.488603*r),t.addScaledVector(e[2],.488603*i),t.addScaledVector(e[3],.488603*n),t.addScaledVector(e[4],n*r*1.092548),t.addScaledVector(e[5],r*i*1.092548),t.addScaledVector(e[6],.315392*(3*i*i-1)),t.addScaledVector(e[7],n*i*1.092548),t.addScaledVector(e[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;return e=this.coefficients,t.copy(e[0]).multiplyScalar(.886227),t.addScaledVector(e[1],1.023328*r),t.addScaledVector(e[2],1.023328*i),t.addScaledVector(e[3],1.023328*n),t.addScaledVector(e[4],.858086*n*r),t.addScaledVector(e[5],.858086*r*i),t.addScaledVector(e[6],.743125*i*i-.247708),t.addScaledVector(e[7],.858086*n*i),t.addScaledVector(e[8],.429043*(n*n-r*r)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}},{key:"toArray",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,r=e.y;e=e.z,t[0]=.282095,t[1]=.488603*r,t[2]=.488603*e,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*e,t[6]=.315392*(3*e*e-1),t[7]=1.092548*n*e,t[8]=.546274*(n*n-r*r)}}]),e}();od.prototype.isSphericalHarmonics3=!0;var sd=function(){h(t,Vh);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new od,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return g(this,t),(r=e.call(this,void 0,r)).sh=n,r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).object.sh=this.sh.toArray(),e}}]),t}();sd.prototype.isLightProbe=!0;var ld=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),(n=e.call(this,n)).textures={},n}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ih(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var r,i=new ph[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new Xi).setHex(e.sheen)),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularTint&&void 0!==i.specularTint&&i.specularTint.setHex(e.specularTint),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationTint&&void 0!==i.attenuationTint&&i.attenuationTint.setHex(e.attenuationTint),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=0<e.vertexColors:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=n(o.value);break;case"c":i.uniforms[a].value=(new Xi).setHex(o.value);break;case"v2":i.uniforms[a].value=(new pr).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Tr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new _r).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new mr).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new ni).fromArray(o.value);break;default:i.uniforms[a].value=o.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var s in e.extensions)i.extensions[s]=e.extensions[s];return void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale&&(r=e.normalScale,!1===Array.isArray(r)&&(r=[r,r]),i.normalScale=(new pr).fromArray(r)),void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularTintMap&&(i.specularTintMap=n(e.specularTintMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new pr).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}]),t}(),ud=function(){function e(){g(this,e)}return x(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}}]),e}(),cd=function(){h(t,ya);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="InstancedBufferGeometry",n.instanceCount=1/0,n}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.instanceCount=e.instanceCount,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this,this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),t}();cd.prototype.isInstancedBufferGeometry=!0;var hd=function(){h(t,Ki);var e=p(t);function t(n,r,i){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;return g(this,t),"number"==typeof i&&(a=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),(i=e.call(this,n,r,i)).meshPerAttribute=a,i}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=l(v(t.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),t}();hd.prototype.isInstancedBufferAttribute=!0;var dd=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ih(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t={},n={};function r(e,r){if(void 0!==t[r])return t[r];var i=e.interleavedBuffers[r];return e=function(e,t){return void 0!==n[t]?n[t]:(e=e.arrayBuffers[t],e=new Uint32Array(e).buffer,n[t]=e)}(e,i.buffer),e=ca(i.type,e),(e=new Ul(e,i.stride)).uuid=i.uuid,t[r]=e}var i=new(e.isInstancedBufferGeometry?cd:ya);void 0!==(_=e.data.index)&&(x=ca(_.type,_.array),i.setIndex(new Ki(x,1)));var a,o=e.data.attributes;for(a in o){var s,l=o[a],u=void 0;u=l.isInterleavedBufferAttribute?(s=r(e.data,l.data),new Gl(s,l.itemSize,l.offset,l.normalized)):(s=ca(l.type,l.array),new(l.isInstancedBufferAttribute?hd:Ki)(s,l.itemSize,l.normalized)),void 0!==l.name&&(u.name=l.name),void 0!==l.usage&&u.setUsage(l.usage),void 0!==l.updateRange&&(u.updateRange.offset=l.updateRange.offset,u.updateRange.count=l.updateRange.count),i.setAttribute(a,u)}var c=e.data.morphAttributes;if(c)for(var h in c){for(var d=c[h],p=[],f=0,m=d.length;f<m;f++){var v,g=d[f],y=void 0;y=g.isInterleavedBufferAttribute?(v=r(e.data,g.data),new Gl(v,g.itemSize,g.offset,g.normalized)):(v=ca(g.type,g.array),new Ki(v,g.itemSize,g.normalized)),void 0!==g.name&&(y.name=g.name),p.push(y)}i.morphAttributes[h]=p}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var x,_,b=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==b)for(var w=0,M=b.length;w!==M;++w){var S=b[w];i.addGroup(S.start,S.count,S.materialIndex)}return void 0!==(_=e.data.boundingSphere)&&(x=new Tr,void 0!==_.center&&x.fromArray(_.center),i.boundingSphere=new Xr(x,_.radius)),e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}]),t}(),pd=function(){h(i,Ch);var e,t,n,r=p(i);function i(e){return g(this,i),r.call(this,e)}return x(i,[{key:"load",value:function(e,t,n,r){var i=this,a=""===this.path?ud.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a,(a=new Ih(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(n){return void 0!==r&&r(n),void console.error("THREE:ObjectLoader: Can't parse "+e+".",n.message)}void 0!==(n=a.metadata)&&void 0!==n.type&&"geometry"!==n.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)}},{key:"loadAsync",value:(n=a(regeneratorRuntime.mark((function e(t,n){var r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=""===(r=this).path?ud.extractUrlBase(t):this.path,this.resourcePath=this.resourcePath||a,(a=new Ih(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),e.next=9,a.loadAsync(t,n);case 9:if(a=e.sent,i=JSON.parse(a),void 0===(a=i.metadata)||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);e.next=14;break;case 14:return e.next=16,r.parseAsync(i);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"parse",value:function(e,t){var n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),o=this.parseTextures(e.textures,a),s=(r=this.parseMaterials(e.materials,o),this.parseObject(e.object,i,r,o,n));if(e=this.parseSkeletons(e.skeletons,s),this.bindSkeletons(s,e),void 0!==t){var l,u=!1;for(l in a)if(a[l]instanceof HTMLImageElement){u=!0;break}!1===u&&t(s)}return s}},{key:"parseAsync",value:(t=a(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.parseAnimations(t.animations),a=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,a),e.next=5,this.parseImagesAsync(t.images);case 5:return i=e.sent,a=this.parseTextures(t.textures,i),i=this.parseMaterials(t.materials,a),i=this.parseObject(t.object,r,i,a,n),a=this.parseSkeletons(t.skeletons,i),this.bindSkeletons(i,a),e.abrupt("return",i);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"parseShapes",value:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new Gh).fromJSON(e[n]);t[i.uuid]=i}return t}},{key:"parseSkeletons",value:function(e,t){var n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=(new yu).fromJSON(e[i],r);n[o.uuid]=o}return n}},{key:"parseGeometries",value:function(e,t){var n={};if(void 0!==e)for(var r=new dd,i=0,a=e.length;i<a;i++){var o=void 0,s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:s.type in rh?o=rh[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n}},{key:"parseMaterials",value:function(e,t){var n={},r={};if(void 0!==e){var i=new ld;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],u=0;u<s.materials.length;u++){var c=s.materials[u];void 0===n[c.uuid]&&(n[c.uuid]=i.parse(c)),l.push(n[c.uuid])}r[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}},{key:"parseAnimations",value:function(e){var t={};if(void 0!==e)for(var n=0;n<e.length;n++){var r=e[n];t[(r=Ah.parse(r)).uuid]=r}return t}},{key:"parseImages",value:function(e,t){var n=this,r={};function i(e){return"string"!=typeof e?e.data?{data:ca(e.type,e.data),width:e.width,height:e.height}:null:(e=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e=e)?e:n.resourcePath+e,t=e,n.manager.itemStart(t),a.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)})));var t}if(void 0!==e&&0<e.length){var a;t=new kh(t),(a=new Oh(t)).setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],u=l.url;if(Array.isArray(u)){r[l.uuid]=[];for(var c=0,h=u.length;c<h;c++){var d=i(u[c]);null!==d&&(d instanceof HTMLImageElement?r[l.uuid].push(d):r[l.uuid].push(new mu(d.data,d.width,d.height)))}}else{var p=i(l.url);null!==p&&(r[l.uuid]=p)}}}return r}},{key:"parseImagesAsync",value:(e=a(regeneratorRuntime.mark((function e(t){var n,r,i,o,s,l,u,c,h,d,p,f,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(){return(s=a(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof t)return r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r=t)?r:n.resourcePath+r,e.next=5,i.loadAsync(r);e.next=8;break;case 5:return e.abrupt("return",e.sent);case 8:if(t.data)return e.abrupt("return",{data:ca(t.type,t.data),width:t.width,height:t.height});e.next=12;break;case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)},o=function(e){return s.apply(this,arguments)},n=this,r={},!(void 0!==t&&0<t.length)){e.next=32;break}(i=new Oh(this.manager)).setCrossOrigin(this.crossOrigin),l=0,u=t.length;case 8:if(!(l<u)){e.next=32;break}if(c=t[l],h=c.url,!Array.isArray(h)){e.next=25;break}r[c.uuid]=[],d=0,p=h.length;case 14:if(d<p)return f=h[d],e.next=18,o(f);e.next=23;break;case 18:null!==(m=e.sent)&&(m instanceof HTMLImageElement?r[c.uuid].push(m):r[c.uuid].push(new mu(m.data,m.width,m.height)));case 20:d++,e.next=14;break;case 23:e.next=29;break;case 25:return e.next=27,o(c.url);case 27:null!==(m=e.sent)&&(r[c.uuid]=m);case 29:l++,e.next=8;break;case 32:return e.abrupt("return",r);case 33:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"parseTextures",value:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=e[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=void 0,l=t[o.image];Array.isArray(l)?(s=new qa(l),6===l.length&&(s.needsUpdate=!0)):(s=l&&l.data?new mu(l.data,l.width,l.height):new yr(l),l&&(s.needsUpdate=!0)),s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.mapping&&(s.mapping=n(o.mapping,fd)),void 0!==o.offset&&s.offset.fromArray(o.offset),void 0!==o.repeat&&s.repeat.fromArray(o.repeat),void 0!==o.center&&s.center.fromArray(o.center),void 0!==o.rotation&&(s.rotation=o.rotation),void 0!==o.wrap&&(s.wrapS=n(o.wrap[0],md),s.wrapT=n(o.wrap[1],md)),void 0!==o.format&&(s.format=o.format),void 0!==o.type&&(s.type=o.type),void 0!==o.encoding&&(s.encoding=o.encoding),void 0!==o.minFilter&&(s.minFilter=n(o.minFilter,vd)),void 0!==o.magFilter&&(s.magFilter=n(o.magFilter,vd)),void 0!==o.anisotropy&&(s.anisotropy=o.anisotropy),void 0!==o.flipY&&(s.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(s.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r}},{key:"parseObject",value:function(e,t,n,r,i){function a(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function o(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function s(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":l=new zl,void 0!==e.background&&(Number.isInteger(e.background)?l.background=new Xi(e.background):l.background=s(e.background)),void 0!==e.environment&&(l.environment=s(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?l.fog=new Bl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(l.fog=new Fl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":l=new Wa(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(l.focus=e.focus),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.filmGauge&&(l.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(l.filmOffset=e.filmOffset),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new fo(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new id(e.color,e.intensity);break;case"DirectionalLight":l=new rd(e.color,e.intensity);break;case"PointLight":l=new td(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new ad(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new Zh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":l=new Wh(e.color,e.groundColor,e.intensity);break;case"LightProbe":l=(new sd).fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),c=o(e.material),l=new pu(u,c),void 0!==e.bindMode&&(l.bindMode=e.bindMode),void 0!==e.bindMatrix&&l.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(l.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),c=o(e.material),l=new Oa(u,c);break;case"InstancedMesh":var l,u=a(e.geometry),c=o(e.material),h=e.count,d=e.instanceMatrix,p=e.instanceColor;(l=new Mu(u,c,h)).instanceMatrix=new Ki(new Float32Array(d.array),16),void 0!==p&&(l.instanceColor=new Ki(new Float32Array(p.array),p.itemSize));break;case"LOD":l=new su;break;case"Line":l=new Ru(a(e.geometry),o(e.material));break;case"LineLoop":l=new Du(a(e.geometry),o(e.material));break;case"LineSegments":l=new Iu(a(e.geometry),o(e.material));break;case"PointCloud":case"Points":l=new Uu(a(e.geometry),o(e.material));break;case"Sprite":l=new ru(o(e.material));break;case"Group":l=new Rl;break;case"Bone":l=new fu;break;default:l=new Ai}if(l.uuid=e.uuid,void 0!==e.name&&(l.name=e.name),void 0!==e.matrix?(l.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)):(void 0!==e.position&&l.position.fromArray(e.position),void 0!==e.rotation&&l.rotation.fromArray(e.rotation),void 0!==e.quaternion&&l.quaternion.fromArray(e.quaternion),void 0!==e.scale&&l.scale.fromArray(e.scale)),void 0!==e.castShadow&&(l.castShadow=e.castShadow),void 0!==e.receiveShadow&&(l.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(l.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(l.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(l.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&l.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(l.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(l.visible=e.visible),void 0!==e.frustumCulled&&(l.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(l.renderOrder=e.renderOrder),void 0!==e.userData&&(l.userData=e.userData),void 0!==e.layers&&(l.layers.mask=e.layers),void 0!==e.children)for(var f=e.children,m=0;m<f.length;m++)l.add(this.parseObject(f[m],t,n,r,i));if(void 0!==e.animations)for(var v=e.animations,g=0;g<v.length;g++){var y=v[g];l.animations.push(i[y])}if("LOD"===e.type){void 0!==e.autoUpdate&&(l.autoUpdate=e.autoUpdate);for(var x=e.levels,_=0;_<x.length;_++){var b=x[_],w=l.getObjectByProperty("uuid",b.object);void 0!==w&&l.addLevel(w,b.distance)}}return l}},{key:"bindSkeletons",value:function(e,t){0!==Object.keys(t).length&&e.traverse((function(e){var n;!0===e.isSkinnedMesh&&void 0!==e.skeleton&&(void 0===(n=t[e.skeleton])?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix))}))}},{key:"setTexturePath",value:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}]),i}(),fd={UVMapping:be,CubeReflectionMapping:we,CubeRefractionMapping:Me,EquirectangularReflectionMapping:Se,EquirectangularRefractionMapping:Te,CubeUVReflectionMapping:Ee,CubeUVRefractionMapping:Ae},md={RepeatWrapping:Le,ClampToEdgeWrapping:ke,MirroredRepeatWrapping:Re},vd={NearestFilter:Ce,NearestMipmapNearestFilter:Pe,NearestMipmapLinearFilter:De,LinearFilter:Oe,LinearMipmapNearestFilter:Fe,LinearMipmapLinearFilter:ze},gd=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),n=e.call(this,n),"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}return x(t,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Lh.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){Lh.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}]),t}();gd.prototype.isImageBitmapLoader=!0;var yd=function(){function e(){g(this,e),this.type="ShapePath",this.color=new Xi,this.subPaths=[],this.currentPath=null}return x(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Hh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new Gh;a.curves=i.curves,t.push(a)}return t}var r,i,a,o=Bc.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);var l=[];if(1===s.length)return i=s[0],(a=new Gh).curves=i.curves,l.push(a),l;var u,c=!o(s[0].getPoints()),h=(c=e?!c:c,[]),d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,v=s.length;m<v;m++)r=o(u=(i=s[m]).getPoints()),(r=e?!r:r)?(!c&&d[f]&&f++,d[f]={s:new Gh,p:u},d[f].s.curves=i.curves,c&&f++,p[f]=[]):p[f].push({h:i,p:u[0]});if(!d[0])return n(s);if(1<d.length){for(var g=!1,y=[],x=0,_=d.length;x<_;x++)h[x]=[];for(var b=0,w=d.length;b<w;b++)for(var M=p[b],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<d.length;A++)!function(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],l=s.x-o.x,u=s.y-o.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[i],u=-u),!(e.y<o.y||e.y>s.y))if(e.y===o.y){if(e.x===o.x)return 1}else{if(0==(l=u*(e.x-o.x)-l*(e.y-o.y)))return 1;l<0||(r=!r)}}else if(e.y===o.y&&(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x))return 1}return r}(T.p,d[A].p)||(b!==A&&y.push({froms:b,tos:A,hole:S}),E?(E=!1,h[A].push(T)):g=!0);E&&h[b].push(T)}0<y.length&&(g||(p=h))}for(var L=0,k=d.length;L<k;L++){a=d[L].s,l.push(a);for(var R,C=0,P=(R=p[L]).length;C<P;C++)a.holes.push(R[C].h)}return l}}]),e}(),xd=function(){function e(t){g(this,e),this.type="Font",this.data=t}return x(e,[{key:"generateShapes",value:function(e){for(var t=[],n=function(e,t,n){for(var r=Array.from(e),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,l=0,u=0;u<r.length;u++){var c=r[u];"\n"===c?(s=0,l-=a):(c=function(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,l,u,c,h,d,p,f=new yd;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;)switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(o,s);break;case"q":l=m[v++]*t+n,u=m[v++]*t+r,c=m[v++]*t+n,h=m[v++]*t+r,f.quadraticCurveTo(c,h,l,u);break;case"b":l=m[v++]*t+n,u=m[v++]*t+r,c=m[v++]*t+n,h=m[v++]*t+r,d=m[v++]*t+n,p=m[v++]*t+r,f.bezierCurveTo(c,h,d,p,l,u)}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".")}(c,i,s,l,n),s+=c.offsetX,o.push(c.path))}return o}(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,this.data),r=0,i=n.length;r<i;r++)Array.prototype.push.apply(t,n[r].toShapes());return t}}]),e}();xd.prototype.isFont=!0;var _d,bd=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ih(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(e){try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var n=i.parse(n);t&&t(n)}),n,r)}},{key:"parse",value:function(e){return new xd(e)}}]),t}(),wd={getContext:function(){return _d=void 0===_d?new(window.AudioContext||window.webkitAudioContext):_d},setContext:function(e){_d=e}},Md=function(){h(t,Ch);var e=p(t);function t(n){return g(this,t),e.call(this,n)}return x(t,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ih(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{var a=n.slice(0);wd.getContext().decodeAudioData(a,(function(e){t(e)}))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}}]),t}(),Sd=function(){h(t,sd);var e=p(t);function t(n,r){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;g(this,t);var a=e.call(this,void 0,i),o=(new Xi).set(n);return i=(new Xi).set(r),n=new Tr(o.r,o.g,o.b),r=new Tr(i.r,i.g,i.b),i=(o=Math.sqrt(Math.PI))*Math.sqrt(.75),a.sh.coefficients[0].copy(n).add(r).multiplyScalar(o),a.sh.coefficients[1].copy(n).sub(r).multiplyScalar(i),a}return t}();Sd.prototype.isHemisphereLightProbe=!0;var Td=function(){h(t,sd);var e=p(t);function t(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return g(this,t),r=e.call(this,void 0,r),n=(new Xi).set(n),r.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return t}();Td.prototype.isAmbientLightProbe=!0;var Ed=new ni,Ad=new ni,Ld=function(){function e(){g(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Wa,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Wa,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 x(e,[{key:"update",value:function(e){var t,n,r,i,a,o=this._cache;o.focus===e.focus&&o.fov===e.fov&&o.aspect===e.aspect*this.aspect&&o.near===e.near&&o.far===e.far&&o.zoom===e.zoom&&o.eyeSep===this.eyeSep||(o.focus=e.focus,o.fov=e.fov,o.aspect=e.aspect*this.aspect,o.near=e.near,o.far=e.far,o.zoom=e.zoom,o.eyeSep=this.eyeSep,t=e.projectionMatrix.clone(),n=(a=o.eyeSep/2)*o.near/o.focus,r=o.near*Math.tan(rr*o.fov*.5)/o.zoom,Ad.elements[12]=-a,Ed.elements[12]=a,i=-r*o.aspect+n,a=r*o.aspect+n,t.elements[0]=2*o.near/(a-i),t.elements[8]=(a+i)/(a-i),this.cameraL.projectionMatrix.copy(t),i=-r*o.aspect-n,a=r*o.aspect-n,t.elements[0]=2*o.near/(a-i),t.elements[8]=(a+i)/(a-i),this.cameraR.projectionMatrix.copy(t)),this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ad),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ed)}}]),e}(),kd=function(){function e(){var t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];g(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return x(e,[{key:"start",value:function(){this.startTime=Rd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e,t=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(t=((e=Rd())-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t),t)}}]),e}();function Rd(){return("undefined"==typeof performance?Date:performance).now()}var Cd=new Tr,Pd=new Sr,Id=new Tr,Dd=new Tr,Nd=function(){h(t,Ai);var e=p(t);function t(){var n;return g(this,t),(n=e.call(this)).type="AudioListener",n.context=wd.getContext(),n.gain=n.context.createGain(),n.gain.connect(n.context.destination),n.filter=null,n.timeDelta=0,n._clock=new kd,n}return x(t,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value: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}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){l(v(t.prototype),"updateMatrixWorld",this).call(this,e);var n=this.context.listener,r=this.up;this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Cd,Pd,Id),Dd.set(0,0,-1).applyQuaternion(Pd),n.positionX?(e=this.context.currentTime+this.timeDelta,n.positionX.linearRampToValueAtTime(Cd.x,e),n.positionY.linearRampToValueAtTime(Cd.y,e),n.positionZ.linearRampToValueAtTime(Cd.z,e),n.forwardX.linearRampToValueAtTime(Dd.x,e),n.forwardY.linearRampToValueAtTime(Dd.y,e),n.forwardZ.linearRampToValueAtTime(Dd.z,e),n.upX.linearRampToValueAtTime(r.x,e),n.upY.linearRampToValueAtTime(r.y,e),n.upZ.linearRampToValueAtTime(r.z,e)):(n.setPosition(Cd.x,Cd.y,Cd.z),n.setOrientation(Dd.x,Dd.y,Dd.z,r.x,r.y,r.z))}}]),t}(),Od=function(){h(t,Ai);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).type="Audio",r.listener=n,r.context=n.context,r.gain=r.context.createGain(),r.gain.connect(n.getInput()),r.autoplay=!1,r.buffer=null,r.detune=0,r.loop=!1,r.loopStart=0,r.loopEnd=0,r.offset=0,r.duration=void 0,r.playbackRate=1,r.isPlaying=!1,r.hasPlaybackControl=!0,r.source=null,r.sourceType="empty",r._startedAt=0,r._progress=0,r._connected=!1,r.filters=[],r}return x(t,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl)return this._startedAt=this.context.currentTime+e,(e=this.context.createBufferSource()).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.")}},{key:"pause",value: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.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}},{key:"disconnect",value:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}},{key:"getFilters",value:function(){return this.filters}},{key:"setFilters",value:function(e){return e=e||[],!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}},{key:"setDetune",value:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}},{key:"getDetune",value:function(){return this.detune}},{key:"getFilter",value:function(){return this.getFilters()[0]}},{key:"setFilter",value:function(e){return this.setFilters(e?[e]:[])}},{key:"setPlaybackRate",value:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"onEnded",value:function(){this.isPlaying=!1}},{key:"getLoop",value:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}},{key:"setLoop",value:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"setLoopStart",value:function(e){return this.loopStart=e,this}},{key:"setLoopEnd",value:function(e){return this.loopEnd=e,this}},{key:"getVolume",value:function(){return this.gain.gain.value}},{key:"setVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}]),t}(),Fd=new Tr,Bd=new Sr,zd=new Tr,Ud=new Tr,Hd=function(){h(t,Od);var e=p(t);function t(n){return g(this,t),(n=e.call(this,n)).panner=n.context.createPanner(),n.panner.panningModel="HRTF",n.panner.connect(n.gain),n}return x(t,[{key:"getOutput",value:function(){return this.panner}},{key:"getRefDistance",value:function(){return this.panner.refDistance}},{key:"setRefDistance",value:function(e){return this.panner.refDistance=e,this}},{key:"getRolloffFactor",value:function(){return this.panner.rolloffFactor}},{key:"setRolloffFactor",value:function(e){return this.panner.rolloffFactor=e,this}},{key:"getDistanceModel",value:function(){return this.panner.distanceModel}},{key:"setDistanceModel",value:function(e){return this.panner.distanceModel=e,this}},{key:"getMaxDistance",value:function(){return this.panner.maxDistance}},{key:"setMaxDistance",value:function(e){return this.panner.maxDistance=e,this}},{key:"setDirectionalCone",value:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}},{key:"updateMatrixWorld",value:function(e){var n;l(v(t.prototype),"updateMatrixWorld",this).call(this,e),!0===this.hasPlaybackControl&&!1===this.isPlaying||(this.matrixWorld.decompose(Fd,Bd,zd),Ud.set(0,0,1).applyQuaternion(Bd),(n=this.panner).positionX?(e=this.context.currentTime+this.listener.timeDelta,n.positionX.linearRampToValueAtTime(Fd.x,e),n.positionY.linearRampToValueAtTime(Fd.y,e),n.positionZ.linearRampToValueAtTime(Fd.z,e),n.orientationX.linearRampToValueAtTime(Ud.x,e),n.orientationY.linearRampToValueAtTime(Ud.y,e),n.orientationZ.linearRampToValueAtTime(Ud.z,e)):(n.setPosition(Fd.x,Fd.y,Fd.z),n.setOrientation(Ud.x,Ud.y,Ud.z)))}}]),t}(),Gd=function(){function e(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2048;g(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return x(e,[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}]),e}(),Vd=function(){function e(t,n,r){var i,a,o;switch(g(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return x(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r;if(0===(e=this.cumulativeWeight)){for(var a=0;a!==r;++a)n[i+a]=n[a];e=t}else this._mixBufferRegion(n,i,0,t/(e+=t),r);this.cumulativeWeight=e}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1&&(e=t*this._origIndex,this._mixBufferRegion(n,r,e,1-i,t)),0<a&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}},{key:"_select",value:function(e,t,n,r,i){if(.5<=r)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){Sr.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){i=this._workIndex*i,Sr.multiplyQuaternionsFlat(e,i,e,t,e,n),Sr.slerpFlat(e,t,e,t,e,i,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Wd="\\[\\]\\.:\\/",jd=new RegExp("["+Wd+"]","g"),qd="[^"+Wd+"]",Xd=(n="[^"+Wd.replace("\\.","")+"]",t=/((?:WC+[\/:])*)/.source.replace("WC",qd),Wd=/(WCOD+)?/.source.replace("WCOD",n),n=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",qd),qd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",qd),new RegExp("^"+t+Wd+n+qd+"$")),Yd=["material","materials","bones"],Jd=(qd=function(){function e(t,n,r){g(this,e),r=r||Jd.parseTrackName(n),this._targetGroup=t,this._bindings=t.subscribe_(n,r)}return x(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_;void 0!==(n=this._bindings[n])&&n.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),function(){function e(t,n,r){g(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return x(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.node[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var l=t[i];if(void 0!==l){var u=this.Versioning.None;void 0!==(this.targetObject=t).needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.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=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else n=n.nodeName,console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,r){return new(t&&t.isAnimationObjectGroup?e.Composite:e)(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(jd,"")}},{key:"parseTrackName",value:function(e){var t=Xd.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r&&(t=n.nodeName.substring(r+1),-1!==Yd.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)),null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}return e.children&&(e=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;if(i=e(i.children))return i}return null}(e.children))?e:null}}]),e}());Jd.Composite=qd,Jd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Jd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Jd.prototype.GetterByBindingType=[Jd.prototype._getValue_direct,Jd.prototype._getValue_array,Jd.prototype._getValue_arrayElement,Jd.prototype._getValue_toArray],Jd.prototype.SetterByBindingTypeAndVersioning=[[Jd.prototype._setValue_direct,Jd.prototype._setValue_direct_setNeedsUpdate,Jd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_array,Jd.prototype._setValue_array_setNeedsUpdate,Jd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_arrayElement,Jd.prototype._setValue_arrayElement_setNeedsUpdate,Jd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_fromArray,Jd.prototype._setValue_fromArray_setNeedsUpdate,Jd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Zd=function(){function e(){g(this,e),this.uuid=ar(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;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}}}return x(e,[{key:"add",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=e.length,l=this.nCachedObjects_,u=0,c=arguments.length;u!==c;++u){var h=arguments[u],d=h.uuid,p=t[d];if(void 0===p){p=s++,t[d]=p,e.push(h);for(var f=0,m=a;f!==m;++f)i[f].push(new Jd(h,n[f],r[f]))}else if(p<l){o=e[p];var v=--l,g=e[v];e[t[g.uuid]=p]=g,e[t[d]=v]=h;for(var y=0,x=a;y!==x;++y){var _=i[y],b=_[v],w=_[p];_[p]=b,void 0===w&&(w=new Jd(h,n[y],r[y])),_[v]=w}}else e[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}},{key:"remove",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,u=t[l];if(void 0!==u&&i<=u){var c=i++,h=e[c];e[t[h.uuid]=u]=h,e[t[l]=c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[c],v=f[u];f[u]=m,f[c]=v}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var l=t[c=arguments[o].uuid];if(void 0!==l)if(delete t[c],l<i){var u=--i,c=e[u],h=--a,d=e[h];e[t[c.uuid]=l]=c,e[t[d.uuid]=u]=d,e.pop();for(var p=0,f=r;p!==f;++p){var m=n[p],v=m[u],g=m[h];m[l]=v,m[u]=g,m.pop()}}else{var y=--a;d=e[y],0<y&&(t[d.uuid]=l),e[l]=d,e.pop();for(var x=0,_=r;x!==_;++x){var b=n[x];b[l]=b[y],b.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=u,d=s.length;h!==d;++h){var p=s[h];c[h]=new Jd(p,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t,n,r,i,a,o=this._bindingsIndicesByPath,s=o[e];void 0!==s&&(t=this._paths,n=this._parsedPaths,a=(r=this._bindings)[i=r.length-1],r[o[e[i]]=s]=a,r.pop(),n[s]=n[i],n.pop(),t[s]=t[i],t.pop())}}]),e}();Zd.prototype.isAnimationObjectGroup=!0;var Kd=function(){function e(t,n){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:n.blendMode;g(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:on,endingEnd:on},u=0;u!==o;++u){var c=a[u].createInterpolant(null);(s[u]=c).settings=l}this._interpolantSettings=l,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=en,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}return x(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){var r,i;return e.fadeOut(t),this.fadeIn(t),n&&(n=(r=this._clip.duration)/(i=e._clip.duration),e.warp(1,i/r,t),this.warp(n,1,t)),this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;return null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o),r=o.parameterPositions,o=o.sampleValues,r[0]=i,r[1]=i+n,o[0]=e/a,o[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){if((i=(e-i)*n)<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);var a=this._updateTime(t),o=this._updateWeight(e);if(0<o){var s=this._interpolants,l=this._propertyBindings;if(this.blendMode===cn)for(var u=0,c=s.length;u!==c;++u)s[u].evaluate(a),l[u].accumulateAdditive(o);else for(var h=0,d=s.length;h!==d;++h)s[h].evaluate(a),l[h].accumulate(r,o)}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t,n,r=0;return this.enabled&&(r=this.weight,null!==(t=this._weightInterpolant)&&(r*=n=t.evaluate(e)[0],e>t.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1)))),this._effectiveWeight=r}},{key:"_updateTimeScale",value:function(e){var t,n=0;return this.paused||(n=this.timeScale,null!==(t=this._timeScaleInterpolant)&&(n*=t.evaluate(e)[0],e>t.parameterPositions[1]&&(this.stopWarping(),0===n?this.paused=!0:this.timeScale=n))),this._effectiveTimeScale=n}},{key:"_updateTime",value:function(e){var t,n=this._clip.duration,r=this.loop,i=this.time+e,a=this._loopCount,o=r===tn;if(0===e)return-1!==a&&o&&1==(1&a)?n-i:i;if(r===$t){-1===a&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=i)i=n;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else if(-1===a&&(0<=e?this._setEndings(!(a=0),0===this.repetitions,o):this._setEndings(0===this.repetitions,!0,o)),n<=i||i<0?(i-=n*(t=Math.floor(i/n)),a+=Math.abs(t),(r=this.repetitions-a)<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i=0<e?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1})):(1==r?this._setEndings(r=e<0,!r,o):this._setEndings(!1,!1,o),this._loopCount=a,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:t}))):this.time=i,o&&1==(1&a))return n-i;return i}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=sn,r.endingEnd=sn):(r.endingStart=e?this.zeroSlopeAtStart?sn:on:ln,r.endingEnd=t?this.zeroSlopeAtEnd?sn:on:ln)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;return null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a),r=a.parameterPositions,a=a.sampleValues,r[0]=i,a[0]=t,r[1]=i+e,a[1]=n,this}}]),e}(),Qd=function(){h(t,$n);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this))._root=n,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return x(t,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=(e=this._bindingsByRootAndName)[s];void 0===l&&(e[s]=l={});for(var u=0;u!==i;++u){var c=r[u],h=c.name;if(void 0!==(d=l[h]))a[u]=d;else{if(void 0!==(d=a[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,h));continue}var d,p=t&&t._propertyBindings[u].binding.parsedPath;++(d=new Vd(Jd.create(n,h,p),c.ValueTypeName,c.getValueSize())).referenceCount,this._addInactiveBinding(d,s,h),a[u]=d}o[u].resultBuffer=d.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){var t,n,r;null===e._cacheIndex&&(t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n],this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t));for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){return null!==(e=e._cacheIndex)&&e<this._nActiveActions}},{key:"_addInactiveAction",value:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];void 0===a?(a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a):(t=a.knownActions,e._byClipCacheIndex=t.length,t.push(e)),e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}},{key:"_removeInactiveAction",value:function(e){var t=(o=this._actions)[o.length-1],n=e._cacheIndex;o[t._cacheIndex=n]=t,o.pop(),e._cacheIndex=null;var r=e._clip.uuid,i=this._actionsByClip,a=i[r],o=(t=(n=a.knownActions)[n.length-1],e._byClipCacheIndex);n[t._byClipCacheIndex=o]=t,n.pop(),e._byClipCacheIndex=null,delete a.actionByRoot[(e._localRoot||this._root).uuid],0===n.length&&delete i[r],this._removeInactiveBindingsForAction(e)}},{key:"_removeInactiveBindingsForAction",value:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}}},{key:"_lendAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i}},{key:"_takeBackAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(r[t]=a={}),(a[n]=e)._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value:function(e){var t=this._bindings,n=(o=e.binding).rootNode.uuid,r=o.path,i=this._bindingsByRootAndName,a=i[n],o=t[t.length-1];e=e._cacheIndex,t[o._cacheIndex=e]=o,t.pop(),delete a[r],0===Object.keys(a).length&&delete i[n]}},{key:"_lendBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i}},{key:"_takeBackBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];t[e._cacheIndex=r]=e,t[i._cacheIndex=n]=i}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&(e[(n=new gh(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t]=n),n}},{key:"_takeBackControlInterpolant",value:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];t[e.__cacheIndex=r]=e,t[i.__cacheIndex=n]=i}},{key:"clipAction",value:function(e,t,n){var r=(s=t||this._root).uuid,i="string"==typeof e?Ah.findByName(s,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0===n&&(n=null!==i?i.blendMode:un),void 0!==o){if(void 0!==(e=o.actionByRoot[r])&&e.blendMode===n)return e;s=o.knownActions[0],null===i&&(i=s._clip)}return null===i?null:(n=new Kd(this,i,t,n),this._bindAction(n,s),this._addInactiveAction(n,a,r),n)}},{key:"existingAction",value:function(e,t){var n;return t=(n=t||this._root).uuid,e=(n="string"==typeof e?Ah.findByName(n,e):e)?n.uuid:e,void 0!==(e=this._actionsByClip[e])&&e.actionByRoot[t]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;0<=t;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(r,e,i,a);for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this}},{key:"setTime",value:function(e){for(var t=this.time=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip;if(void 0!==(e=r[n])){for(var i=e.knownActions,a=0,o=i.length;a!==o;++a){var s=i[a];this._deactivateAction(s);var l=s._cacheIndex,u=t[t.length-1];s._cacheIndex=null,s._byClipCacheIndex=null,t[u._cacheIndex=l]=u,t.pop(),this._removeInactiveBindingsForAction(s)}delete r[n]}}},{key:"uncacheRoot",value:function(e){var t,n=e.uuid,r=this._actionsByClip;for(t in r){var i=r[t].actionByRoot[n];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[n];if(void 0!==a)for(var o in a)(o=a[o]).restoreOriginalState(),this._removeInactiveBinding(o)}},{key:"uncacheAction",value:function(e,t){null!==(t=this.existingAction(e,t))&&(this._deactivateAction(t),this._removeInactiveAction(t))}}]),t}();Qd.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var $d=function(){function e(t){g(this,e),"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}return x(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}(),ep=function(){h(t,Ul);var e=p(t);function t(n,r){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return g(this,t),(r=e.call(this,n,r)).meshPerAttribute=i,r}return x(t,[{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){return(e=l(v(t.prototype),"clone",this).call(this,e)).meshPerAttribute=this.meshPerAttribute,e}},{key:"toJSON",value:function(e){return(e=l(v(t.prototype),"toJSON",this).call(this,e)).isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}]),t}();ep.prototype.isInstancedInterleavedBuffer=!0;var tp=function(){function e(t,n,r,i,a){g(this,e),this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=a,this.version=0}return x(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}]),e}();tp.prototype.isGLBufferAttribute=!0;var np=function(){function e(t,n){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1/0;g(this,e),this.ray=new ti(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new pi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return x(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return ip(e,this,n,t),n.sort(rp),n}},{key:"intersectObjects",value:function(e){for(var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r<i;r++)ip(e[r],this,n,t);return n.sort(rp),n}}]),e}();function rp(e,t){return e.distance-t.distance}function ip(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)ip(i[a],t,n,!0)}var ap=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return g(this,e),this.radius=t,this.phi=n,this.theta=r,this}return x(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(or(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),op=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return g(this,e),this.radius=t,this.theta=n,this.y=r,this}return x(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),sp=new pr,lp=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new pr(1/0,1/0),n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new pr(-1/0,-1/0);g(this,e),this.min=t,this.max=n}return x(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){return t=sp.copy(t).multiplyScalar(.5),this.min.copy(e).sub(t),this.max.copy(e).add(t),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return sp.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}();lp.prototype.isBox2=!0;var up=new Tr,cp=new Tr,hp=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr;g(this,e),this.start=t,this.end=n}return x(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){return up.subVectors(e,this.start),cp.subVectors(this.end,this.start),e=cp.dot(cp),e=cp.dot(up)/e,t?or(e,0,1):e}},{key:"closestPointToPoint",value:function(e,t,n){return t=this.closestPointToPointParameter(e,t),this.delta(n).multiplyScalar(t).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),dp=function(){h(t,Ai);var e=p(t);function t(n){var r;return g(this,t),(r=e.call(this)).material=n,r.render=function(){},r.hasPositions=!1,r.hasNormals=!1,r.hasColors=!1,r.hasUvs=!1,r.positionArray=null,r.normalArray=null,r.colorArray=null,r.uvArray=null,r.count=0,r}return t}();dp.prototype.isImmediateRenderObject=!0;var pp=new Tr,fp=function(){h(t,Ai);var e=p(t);function t(n,r){var i;g(this,t),(i=e.call(this)).light=n,i.light.updateMatrixWorld(),i.matrix=n.matrixWorld,i.matrixAutoUpdate=!1,i.color=r,n=new ya;for(var 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)}return n.setAttribute("position",new oa(a,3)),r=new Su({fog:!1,toneMapped:!1}),i.cone=new Iu(n,r),i.add(i.cone),i.update(),i}return x(t,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateMatrixWorld();var e=this.light.distance||1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),pp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(pp),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),t}(),mp=new Tr,vp=new ni,gp=new ni,yp=function(){h(t,Iu);var e=p(t);function t(n){g(this,t);for(var r=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,e(t.children[r]));return n}(n),i=new ya,a=[],o=[],s=new Xi(0,0,1),l=new Xi(0,1,0),u=0;u<r.length;u++){var c=r[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))}i.setAttribute("position",new oa(a,3)),i.setAttribute("color",new oa(o,3));var h=new Su({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(h=e.call(this,i,h)).type="SkeletonHelper",h.isSkeletonHelper=!0,h.root=n,h.bones=r,h.matrix=n.matrixWorld,h.matrixAutoUpdate=!1,h}return x(t,[{key:"updateMatrixWorld",value:function(e){var n=this.bones,r=this.geometry,i=r.getAttribute("position");gp.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<n.length;a++){var s=n[a];s.parent&&s.parent.isBone&&(vp.multiplyMatrices(gp,s.matrixWorld),mp.setFromMatrixPosition(vp),i.setXYZ(o,mp.x,mp.y,mp.z),vp.multiplyMatrices(gp,s.parent.matrixWorld),mp.setFromMatrixPosition(vp),i.setXYZ(o+1,mp.x,mp.y,mp.z),o+=2)}r.getAttribute("position").needsUpdate=!0,l(v(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),xp=function(){h(t,Oa);var e=p(t);function t(n,r,i){g(this,t);var a=new Jc(r,4,2);return r=new Yi({wireframe:!0,fog:!1,toneMapped:!1}),(r=e.call(this,a,r)).light=n,r.light.updateMatrixWorld(),r.color=i,r.type="PointLightHelper",r.matrix=r.light.matrixWorld,r.matrixAutoUpdate=!1,r.update(),r}return x(t,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}},{key:"update",value:function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}]),t}(),_p=new Tr,bp=new Xi,wp=new Xi,Mp=function(){h(t,Ai);var e=p(t);function t(n,r,i){var a;return g(this,t),(a=e.call(this)).light=n,a.light.updateMatrixWorld(),a.matrix=n.matrixWorld,a.matrixAutoUpdate=!1,a.color=i,(i=new jc(r)).rotateY(.5*Math.PI),a.material=new Yi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===a.color&&(a.material.vertexColors=!0),r=i.getAttribute("position"),r=new Float32Array(3*r.count),i.setAttribute("color",new Ki(r,3)),a.add(new Oa(i,a.material)),a.update(),a}return x(t,[{key:"dispose",value:function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}},{key:"update",value:function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");bp.copy(this.light.color),wp.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?bp:wp;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(_p.setFromMatrixPosition(this.light.matrixWorld).negate())}}]),t}(),Sp=function(){h(t,Iu);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:4473924,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8947848;g(this,t),i=new Xi(i),a=new Xi(a);for(var o=r/2,s=n/r,l=n/2,u=[],c=[],h=0,d=0,p=-l;h<=r;h++,p+=s){u.push(-l,0,p,l,0,p),u.push(p,0,-l,p,0,l);var f=h===o?i:a;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 ya;return m.setAttribute("position",new oa(u,3)),m.setAttribute("color",new oa(c,3)),n=new Su({vertexColors:!0,toneMapped:!1}),(n=e.call(this,m,n)).type="GridHelper",n}return t}(),Tp=function(){h(t,Iu);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:64,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:4473924,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:8947848;g(this,t),o=new Xi(o),s=new Xi(s);for(var l=[],u=[],c=0;c<=r;c++){var h=c/r*(2*Math.PI),d=Math.sin(h)*n;h=Math.cos(h)*n,l.push(0,0,0),l.push(d,0,h),h=1&c?o:s,u.push(h.r,h.g,h.b),u.push(h.r,h.g,h.b)}for(var p=0;p<=i;p++)for(var f=1&p?o:s,m=n-n/i*p,v=0;v<a;v++){var y=v/a*(2*Math.PI),x=Math.sin(y)*m,_=Math.cos(y)*m;l.push(x,0,_),u.push(f.r,f.g,f.b),y=(v+1)/a*(2*Math.PI),x=Math.sin(y)*m,_=Math.cos(y)*m,l.push(x,0,_),u.push(f.r,f.g,f.b)}var b=new ya;b.setAttribute("position",new oa(l,3)),b.setAttribute("color",new oa(u,3));var w=new Su({vertexColors:!0,toneMapped:!1});return(w=e.call(this,b,w)).type="PolarGridHelper",w}return t}(),Ep=new Tr,Ap=new Tr,Lp=new Tr,kp=function(){h(t,Ai);var e=p(t);function t(n,r,i){var a;return g(this,t),(a=e.call(this)).light=n,a.light.updateMatrixWorld(),a.matrix=n.matrixWorld,a.matrixAutoUpdate=!1,a.color=i,void 0===r&&(r=1),(i=new ya).setAttribute("position",new oa([-r,r,0,r,r,0,r,-r,0,-r,-r,0,-r,r,0],3)),r=new Su({fog:!1,toneMapped:!1}),a.lightPlane=new Ru(i,r),a.add(a.lightPlane),(i=new ya).setAttribute("position",new oa([0,0,0,0,0,1],3)),a.targetLine=new Ru(i,r),a.add(a.targetLine),a.update(),a}return x(t,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){Ep.setFromMatrixPosition(this.light.matrixWorld),Ap.setFromMatrixPosition(this.light.target.matrixWorld),Lp.subVectors(Ap,Ep),this.lightPlane.lookAt(Ap),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(Ap),this.targetLine.scale.z=Lp.length()}}]),t}(),Rp=new Tr,Cp=new Va,Pp=function(){h(t,Iu);var e=p(t);function t(n){g(this,t);var r=new ya,i=new Su({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],o=[],s={},l=new Xi(16755200),u=new Xi(16711680),c=new Xi(43775),h=new Xi(16777215),d=new Xi(3355443);function p(e,t,n){f(e,n),f(t,n)}function f(e,t){a.push(0,0,0),o.push(t.r,t.g,t.b),void 0===s[e]&&(s[e]=[]),s[e].push(a.length/3-1)}return p("n1","n2",l),p("n2","n4",l),p("n4","n3",l),p("n3","n1",l),p("f1","f2",l),p("f2","f4",l),p("f4","f3",l),p("f3","f1",l),p("n1","f1",l),p("n2","f2",l),p("n3","f3",l),p("n4","f4",l),p("p","n1",u),p("p","n2",u),p("p","n3",u),p("p","n4",u),p("u1","u2",c),p("u2","u3",c),p("u3","u1",c),p("c","t",h),p("p","c",d),p("cn1","cn2",d),p("cn3","cn4",d),p("cf1","cf2",d),p("cf3","cf4",d),r.setAttribute("position",new oa(a,3)),r.setAttribute("color",new oa(o,3)),(i=e.call(this,r,i)).type="CameraHelper",i.camera=n,i.camera.updateProjectionMatrix&&i.camera.updateProjectionMatrix(),i.matrix=n.matrixWorld,i.matrixAutoUpdate=!1,i.pointMap=s,i.update(),i}return x(t,[{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Cp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Ip("c",t,e,Cp,0,0,-1),Ip("t",t,e,Cp,0,0,1),Ip("n1",t,e,Cp,-1,-1,-1),Ip("n2",t,e,Cp,1,-1,-1),Ip("n3",t,e,Cp,-1,1,-1),Ip("n4",t,e,Cp,1,1,-1),Ip("f1",t,e,Cp,-1,-1,1),Ip("f2",t,e,Cp,1,-1,1),Ip("f3",t,e,Cp,-1,1,1),Ip("f4",t,e,Cp,1,1,1),Ip("u1",t,e,Cp,.7,1.1,-1),Ip("u2",t,e,Cp,-.7,1.1,-1),Ip("u3",t,e,Cp,0,2,-1),Ip("cf1",t,e,Cp,-1,0,1),Ip("cf2",t,e,Cp,1,0,1),Ip("cf3",t,e,Cp,0,-1,1),Ip("cf4",t,e,Cp,0,1,1),Ip("cn1",t,e,Cp,-1,0,-1),Ip("cn2",t,e,Cp,1,0,-1),Ip("cn3",t,e,Cp,0,-1,-1),Ip("cn4",t,e,Cp,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),t}();function Ip(e,t,n,r,i,a,o){Rp.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u<c;u++)l.setXYZ(s[u],Rp.x,Rp.y,Rp.z)}var Dp,Np,Op=new Lr,Fp=function(){h(t,Iu);var e=p(t);function t(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960;g(this,t);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new Float32Array(24),o=new ya;return o.setIndex(new Ki(i,1)),o.setAttribute("position",new Ki(a,3)),(r=e.call(this,o,new Su({color:r,toneMapped:!1}))).object=n,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return x(t,[{key:"update",value:function(e){var t,n,r;void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Op.setFromObject(this.object),Op.isEmpty()||(t=Op.min,n=Op.max,(e=(r=this.geometry.attributes.position).array)[0]=n.x,e[1]=n.y,e[2]=n.z,e[3]=t.x,e[4]=n.y,e[5]=n.z,e[6]=t.x,e[7]=t.y,e[8]=n.z,e[9]=n.x,e[10]=t.y,e[11]=n.z,e[12]=n.x,e[13]=n.y,e[14]=t.z,e[15]=t.x,e[16]=n.y,e[17]=t.z,e[18]=t.x,e[19]=t.y,e[20]=t.z,e[21]=n.x,e[22]=t.y,e[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere())}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e){return Iu.prototype.copy.call(this,e),this.object=e.object,this}}]),t}(),Bp=function(){h(t,Iu);var e=p(t);function t(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960;g(this,t);var i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),a=new ya;return a.setIndex(new Ki(i,1)),a.setAttribute("position",new oa([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)),(r=e.call(this,a,new Su({color:r,toneMapped:!1}))).box=n,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return x(t,[{key:"updateMatrixWorld",value:function(e){var n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),l(v(t.prototype),"updateMatrixWorld",this).call(this,e))}}]),t}(),zp=function(){h(t,Ru);var e=p(t);function t(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:16776960;g(this,t);var a=i;return(i=new ya).setAttribute("position",new oa([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),(i=e.call(this,i,new Su({color:a,toneMapped:!1}))).type="PlaneHelper",i.plane=n,i.size=r,(r=new ya).setAttribute("position",new oa([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),r.computeBoundingSphere(),i.add(new Oa(r,new Yi({color:a,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),i}return x(t,[{key:"updateMatrixWorld",value:function(e){var n=-this.plane.constant;Math.abs(n)<1e-8&&(n=1e-8),this.scale.set(.5*this.size,.5*this.size,n),this.children[0].material.side=n<0?P:C,this.lookAt(this.plane.normal),l(v(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),Up=new Tr,Hp=function(){h(t,Ai);var e=p(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Tr(0,0,1),i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Tr(0,0,0),a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:16776960,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.2*a,l=5<arguments.length&&void 0!==arguments[5]?arguments[5]:.2*s;return g(this,t),(n=e.call(this)).type="ArrowHelper",void 0===Dp&&((Dp=new ya).setAttribute("position",new oa([0,0,0,0,1,0],3)),(Np=new Xu(0,.5,1,5,1)).translate(0,-.5,0)),n.position.copy(i),n.line=new Ru(Dp,new Su({color:o,toneMapped:!1})),n.line.matrixAutoUpdate=!1,n.add(n.line),n.cone=new Oa(Np,new Yi({color:o,toneMapped:!1})),n.cone.matrixAutoUpdate=!1,n.add(n.cone),n.setDirection(r),n.setLength(a,s,l),n}return x(t,[{key:"setDirection",value:function(e){.99999<e.y?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(Up.set(e.z,0,-e.x).normalize(),e=Math.acos(e.y),this.quaternion.setFromAxisAngle(Up,e))}},{key:"setLength",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.2*e,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return l(v(t.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}]),t}(),Gp=function(){h(t,Iu);var e=p(t);function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1;g(this,t);var r=[0,0,0,n,0,0,0,0,0,0,n,0,0,0,0,0,0,n];return(n=new ya).setAttribute("position",new oa(r,3)),n.setAttribute("color",new oa([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),r=new Su({vertexColors:!0,toneMapped:!1}),(r=e.call(this,n,r)).type="AxesHelper",r}return x(t,[{key:"setColors",value:function(e,t,n){var r=new Xi,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),t}(),Vp=new Float32Array(1),Wp=new Int32Array(Vp.buffer),jp=function(){function e(){g(this,e)}return x(e,null,[{key:"toHalfFloat",value:function(e){Vp[0]=e;var t=Wp[0],n=t>>16&32768,r=t>>12&2047;return(e=t>>23&255)<103?n:142<e?(n|=31744,n|=(255==e?0:1)&&8388607&t):e<113?n|=((r|=2048)>>114-e)+(r>>113-e&1):(n|=e-112<<10|r>>1,n+=1&r)}}]),e}(),qp=0,Xp=1,Yp=0,Jp=1,Zp=2;nc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(nc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Hh.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},Sp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},yp.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Ch.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ud.extractUrlBase(e)},Ch.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},lp.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},lp.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},lp.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},lp.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},Lr.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Lr.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Lr.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Lr.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},Lr.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Xr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},eo.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},hp.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},mr.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},mr.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},mr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},mr.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},mr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},mr.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},ni.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},ni.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},ni.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Tr).setFromMatrixColumn(this,3)},ni.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},ni.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},ni.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},ni.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},ni.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},ni.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},ni.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},ni.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},ni.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},ni.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},ni.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},ni.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},ni.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},ni.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},ni.prototype.makeFrustum=function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)},ni.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Ka.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Sr.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Sr.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ti.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},ti.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},ti.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},Bi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Bi.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},Bi.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},Bi.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},Bi.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},Bi.barycoordFromPoint=function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Bi.getBarycoord(e,t,n,r,i)},Bi.normal=function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Bi.getNormal(e,t,n,r)},Gh.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Gh.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Hc(this,e)},Gh.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Yc(this,e)},pr.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},pr.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},pr.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tr.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Tr.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Tr.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},Tr.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},Tr.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},Tr.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},Tr.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Tr.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Tr.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},_r.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},_r.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ai.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},Ai.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Ai.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},Ai.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Ai.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Ai.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Oa.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Oa.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),hn},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),pu.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Wa.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Vh.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Ki.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Vn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Vn)}}}),Ki.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Vn:Gn),this},Ki.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ki.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ya.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},ya.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Ki(t,arguments[2])))},ya.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},ya.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ya.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ya.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},ya.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(ya.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Ul.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Vn:Gn),this},Ul.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Hc.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Hc.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Hc.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},zl.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},$d.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Ui.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===D}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Ga.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Nl.prototype.clearTarget=function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},Nl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},Nl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Nl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Nl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Nl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Nl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Nl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Nl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Nl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Nl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Nl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Nl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Nl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Nl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},Nl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Nl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Nl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Nl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Nl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Nl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Nl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Nl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Nl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Nl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Nl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?mn:fn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Tl.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(br.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Od.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Md).load(e,(function(e){t.setBuffer(e)})),this},Gd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ja.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ja.prototype.clear=function(e,t,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)},vr.crossOrigin=void 0,vr.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new zh;return i.setCrossOrigin(this.crossOrigin),r=i.load(e,n,void 0,r),t&&(r.mapping=t),r},vr.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Fh;return i.setCrossOrigin(this.crossOrigin),r=i.load(e,n,void 0,r),t&&(r.mapping=t),r},vr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},vr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Kp={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:_}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=_)},705:()=>{function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(t){var n=i();return function(){var r,i=o(t);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t)}(this,n?(r=o(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments))}}function n(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)}(e)}function r(e,t,n){return(r=i()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&a(r,n.prototype),r}).apply(null,arguments)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,n(HTMLElement));var e,r=t(i);function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).shadowDOM=e.attachShadow({mode:"open"}),e}return(e=[{key:"connectedCallback",value:function(){this.render()}},{key:"render",value:function(){this.shadowDOM.innerHTML="\n        <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        :host {\n            display: block;\n            width: 100%;\n            background-color: #F5F5F5;\n            color: #313131;\n            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);\n            font-size: 18px;\n            letter-spacing: 8px;\n        }\n        h2 {\n            padding: 4px 48px;\n            font-family: 'Pokemon Solid', sans-serif;\n        }\n        </style>\n        <h2>Pokédex</h2>"}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,e),i}();customElements.define("app-bar",s)},84:()=>{function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(t){var n=i();return function(){var r,i=o(t);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t)}(this,n?(r=o(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments))}}function n(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)}(e)}function r(e,t,n){return(r=i()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&a(r,n.prototype),r}).apply(null,arguments)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,n(HTMLElement));var e,r=t(i);function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).shadowDOM=e.attachShadow({mode:"open"}),e}return(e=[{key:"pokemon",set:function(e){this._pokemon=e,this.render()}},{key:"allPokemon",set:function(e){this._allPokemon=e,this.renderAll()}},{key:"render",value:function(){this.shadowDOM.innerHTML="\n        <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        :host {\n            height: 280px;\n            width: 220px;\n            background-image: url('./images/pokemon-card.png');\n            background-repeat: no-repeat;\n            background-size: cover;\n            background-position: center;\n            border-radius: 5px;\n            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .5);\n            overflow: hidden;\n        }\n        img{\n            display: flex;\n            margin: auto;\n            width: 200px;\n        }\n        h2{\n            color: #313131;\n            text-align: center;\n            text-transform: uppercase;\n            font-weight: normal;\n            font-family: 'Pokemon Solid', sans-serif;\n        }\n        </style>\n        <img src=\"".concat(this._pokemon.sprites.other["official-artwork"].front_default,'" alt="').concat(this._pokemon.species.name,'"> \n        <h2>').concat(this._pokemon.species.name,"</h2>")}},{key:"renderAll",value:function(){this.shadowDOM.innerHTML="\n        <style>\n        * {\n            margin: 0;\n            padding: 0;\n            box-sizing: border-box;\n        }\n        :host {\n            height: 280px;\n            width: 220px;\n            background-image: url('./images/pokemon-card.png');\n            background-repeat: no-repeat;\n            background-size: cover;\n            background-position: center;\n            border-radius: 5px;\n            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, .5);\n            overflow: hidden;\n        }\n        img{\n            display: flex;\n            margin: auto;\n            width: 200px;\n        }\n        h2{\n            color: #313131;\n            text-align: center;\n            text-transform: uppercase;\n            font-weight: normal;\n            font-family: 'Pokemon Solid', sans-serif;\n        }\n        </style>\n        <img src=\"".concat(this._allPokemon.sprites.other["official-artwork"].front_default,'" alt="').concat(this._allPokemon.species.name,'"> \n        <h2>').concat(this._allPokemon.species.name,"</h2>")}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,e),i}();customElements.define("pokemon-item",s)},998:()=>{function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(t){var n=i();return function(){var r,i=o(t);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t)}(this,n?(r=o(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments))}}function n(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)}(e)}function r(e,t,n){return(r=i()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&a(r,n.prototype),r}).apply(null,arguments)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,n(HTMLElement));var e,r=t(i);function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).shadowDOM=e.attachShadow({mode:"open"}),e}return(e=[{key:"connectedCallback",value:function(){this.render()}},{key:"clickEvent",set:function(e){this._clickEvent=e,this.render()}},{key:"value",get:function(){return this.shadowDOM.querySelector("#searchElement").value}},{key:"render",value:function(){this.shadowDOM.innerHTML='\n        <style>\n        .search-container {\n            display: flex;\n            max-width: 800px;\n            margin: auto;\n            padding: 16px;\n            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);\n            border: 3px solid #616161;\n            border-radius: 5px;\n            background-color: white;\n        }\n        .search-container > input {\n            width: 75%;\n            padding: 16px;\n            border: 0;\n            border-bottom: 1px solid #616161;\n        }\n        .search-container > input:focus {\n            outline: 0;\n            border-bottom: 2px solid #616161;\n        }\n        .search-container > input:focus::placeholder {\n            font-weight: bold;\n        }\n        .search-container >  input::placeholder {\n            color: #616161;\n            font-weight: normal;\n        }\n        .search-container > button {\n            width: 23%;\n            margin-left: auto;\n            padding: 16px;\n            border: 0;\n            cursor: pointer;\n            background-color: #35B2FA;\n            color: white;\n            text-transform: uppercase;\n        }\n        @media screen and (max-width: 1000px){\n            .search-container {\n                flex-direction: column;\n            }\n            .search-container > input {\n                width: 100%;\n                margin-bottom: 12px;\n            }\n            .search-container > button {\n                width: 100%;\n            }\n        }\n        </style>\n        <div id="search-container" class="search-container">\n            <input placeholder="Search by Pokemon\'s Name" id="searchElement" type="search">\n            <button id="searchButtonElement" type="button">View All</button>\n        </div>';var e=this.shadowDOM.querySelector("#searchElement"),t=this.shadowDOM.querySelector("#searchButtonElement");e.addEventListener("keyup",(function(){""!==e.value?t.innerHTML="Search":t.innerHTML="View All"})),t.addEventListener("click",this._clickEvent)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,e),i}();customElements.define("search-bar",s)},890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(286);t=n.n(r),r=n(672),r=n.n(r),n=new URL(n(718),n.b),t=t()((function(e){return e[1]})),n=r()(n),t.push([e.id,"::-webkit-scrollbar {\r\n    width: .75em;\r\n}\r\n\r\n::-webkit-scrollbar-track {\r\n    background: #f1f1f1;\r\n}\r\n\r\n::-webkit-scrollbar-thumb {\r\n    background: #A8A8A8;\r\n    border-radius: 5px;\r\n}\r\n\r\n::-webkit-scrollbar-thumb:hover {\r\n    background: #797979;\r\n}\r\n\r\n* {\r\n    padding: 0;\r\n    margin: 0;\r\n    box-sizing: border-box;\r\n\r\n    user-select: none;\r\n    -moz-user-select: none;\r\n    -khtml-user-select: none;\r\n    -webkit-user-select: none;\r\n    -o-user-select: none;\r\n}\r\n\r\nbody {\r\n    background-image: url("+n+");\r\n}\r\n\r\n.pokedex-section {\r\n    background-color: #313131;\r\n    padding: 70px 100px;\r\n}\r\n\r\n@media screen and (max-width: 1000px) {\r\n    .pokedex-section {\r\n        padding: 70px 20px;\r\n    }\r\n}",""]);const i=t},379:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},a=[],o=0;o<e.length;o++){var s=e[o],l=r.base?s[0]+r.base:s[0],u=i[l]||0,c="".concat(l," ").concat(u);i[l]=u+1,u=n(c),s={css:s[1],media:s[2],sourceMap:s[3]},-1!==u?(t[u].references++,t[u].updater(s)):t.push({identifier:c,updater:function(e,t){var n=t.domAPI(t);return n.update(e),function(t){t?t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap||n.update(e=t):n.remove()}}(s,r),references:1}),a.push(c)}return a}e.exports=function(e,i){var a=r(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<a.length;o++){var s=n(a[o]);t[s].references--}e=r(e,i);for(var l=0;l<a.length;l++){var u=n(a[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}a=e}}},569:e=>{"use strict";var t={};e.exports=function(e,n){if(!(e=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e)))throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");e.appendChild(n)}},216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t),t}},565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){var r,i,a,o;r=t,i=e,o=(a=n).css,n=a.media,a=a.sourceMap,n?r.setAttribute("media",n):r.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),i.styleTagTransform(o,r)},remove:function(){var e;null!==(e=t).parentNode&&e.parentNode.removeChild(e)}}}},589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},718:(e,t,n)=>{"use strict";e.exports=n.p+"b1af5f89a1fb99a0ca66.png"}},t={};function n(r){var i=t[r];return void 0!==i||(i=t[r]={id:r,loaded:!1,exports:{}},e[r](i,i.exports,n),i.loaded=!0),i.exports}n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&((e=t.currentScript?t.currentScript.src:e)||(t=t.getElementsByTagName("script")).length&&(e=t[t.length-1].src)),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,(()=>{"use strict";n(39);var e=n(379),t=n.n(e),r=n(795),i=n.n(r),a=n(569),o=n.n(a),s=n(565),l=n.n(s);e=n(216),r=n.n(e),a=n(589),s=n.n(a),e=n(890),(a={}).styleTagTransform=s(),a.setAttributes=l(),a.insert=o().bind(null,"head"),a.domAPI=i(),a.insertStyleElement=r(),t()(e.Z,a),e.Z&&e.Z.locals&&e.Z.locals,n(705);var u=n(733);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){if(e=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=x(e)););return e}(e,t))return(t=Object.getOwnPropertyDescriptor(e,t)).get?t.get.call(n):t.value})(e,t,n||e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=x(e);return function(e,t){if(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}(this,t?(n=x(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments))}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _=function(){m(t,u.Loader);var e=g(t);function t(n){return d(this,t),(n=e.call(this,n)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(e){return new T(e)})),n.register((function(e){return new R(e)})),n.register((function(e){return new C(e)})),n.register((function(e){return new E(e)})),n.register((function(e){return new A(e)})),n.register((function(e){return new L(e)})),n.register((function(e){return new k(e)})),n.register((function(e){return new M(e)})),n.register((function(e){return new P(e)})),n}return f(t,[{key:"load",value:function(e,t,n,r){var i=this,a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:u.LoaderUtils.extractUrlBase(e);function o(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)}this.manager.itemStart(e);var s=new u.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{i.parse(n,a,(function(n){t(n),i.manager.itemEnd(e)}),o)}catch(n){o(n)}}),n,o)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){var i,a={},o={};if("string"==typeof e)i=e;else if(u.LoaderUtils.decodeText(new Uint8Array(e,0,4))===I){try{a[w.KHR_BINARY_GLTF]=new D(e)}catch(e){return void(r&&r(e))}i=a[w.KHR_BINARY_GLTF].content}else i=u.LoaderUtils.decodeText(new Uint8Array(e));var s=JSON.parse(i);if(void 0===s.asset||s.asset.version[0]<2)r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var l=new $(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(var c=0;c<this.pluginCallbacks.length;c++){var h=this.pluginCallbacks[c](l);a[(o[h.name]=h).name]=!0}if(s.extensionsUsed)for(var d=0;d<s.extensionsUsed.length;++d){var p=s.extensionsUsed[d],f=s.extensionsRequired||[];switch(p){case w.KHR_MATERIALS_UNLIT:a[p]=new S;break;case w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[p]=new B;break;case w.KHR_DRACO_MESH_COMPRESSION:a[p]=new N(s,this.dracoLoader);break;case w.KHR_TEXTURE_TRANSFORM:a[p]=new O;break;case w.KHR_MESH_QUANTIZATION:a[p]=new z;break;default:0<=f.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,r)}}}]),t}();function b(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var w={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},M=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return f(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var i,a=t.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new u.Color(16777215);void 0!==o.color&&s.fromArray(o.color);var l=void 0!==o.range?o.range:0;switch(o.type){case"directional":(i=new u.DirectionalLight(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new u.PointLight(s)).distance=l;break;case"spot":(i=new u.SpotLight(s)).distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(i),t.cache.add(n,r),r}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=((e=n.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}]),e}(),S=function(){function e(){d(this,e),this.name=w.KHR_MATERIALS_UNLIT}return f(e,[{key:"getMaterialType",value:function(){return u.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var r=[];e.color=new u.Color(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;return i&&(Array.isArray(i.baseColorFactor)&&(t=i.baseColorFactor,e.color.fromArray(t),e.opacity=t[3]),void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture))),Promise.all(r)}}]),e}(),T=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_MATERIALS_CLEARCOAT}return f(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?u.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];return r.extensions&&r.extensions[this.name]?(e=[],void 0!==(r=r.extensions[this.name]).clearcoatFactor&&(t.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&e.push(n.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&e.push(n.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(e.push(n.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale&&(r=r.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new u.Vector2(r,-r))),Promise.all(e)):Promise.resolve()}}]),e}(),E=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_MATERIALS_TRANSMISSION}return f(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?u.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];return r.extensions&&r.extensions[this.name]?(e=[],void 0!==(r=r.extensions[this.name]).transmissionFactor&&(t.transmission=r.transmissionFactor),void 0!==r.transmissionTexture&&e.push(n.assignTexture(t,"transmissionMap",r.transmissionTexture)),Promise.all(e)):Promise.resolve()}}]),e}(),A=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_MATERIALS_VOLUME}return f(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?u.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];return r.extensions&&r.extensions[this.name]?(e=[],r=r.extensions[this.name],t.thickness=void 0!==r.thicknessFactor?r.thicknessFactor:0,void 0!==r.thicknessTexture&&e.push(n.assignTexture(t,"thicknessMap",r.thicknessTexture)),t.attenuationDistance=r.attenuationDistance||0,r=r.attenuationColor||[1,1,1],t.attenuationTint=new u.Color(r[0],r[1],r[2]),Promise.all(e)):Promise.resolve()}}]),e}(),L=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_MATERIALS_IOR}return f(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?u.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),k=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_MATERIALS_SPECULAR}return f(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?u.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[];return e=r.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",e.specularTexture)),r=e.specularColorFactor||[1,1,1],t.specularTint=new u.Color(r[0],r[1],r[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularTintMap",e.specularColorTexture).then((function(e){e.encoding=u.sRGBEncoding}))),Promise.all(i)}}]),e}(),R=function(){function e(t){d(this,e),this.parser=t,this.name=w.KHR_TEXTURE_BASISU}return f(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json;if(!(i=n.textures[e]).extensions||!i.extensions[this.name])return null;var r=i.extensions[this.name],i=n.images[r.source];if(r=t.options.ktx2Loader)return t.loadTextureImage(e,i,r);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),C=function(){function e(t){d(this,e),this.parser=t,this.name=w.EXT_TEXTURE_WEBP,this.isSupported=null}return f(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json;if(!(i=r.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],a=r.images[i.source],o=n.textureLoader;return!a.uri||null!==(i=n.options.manager.getHandler(a.uri))&&(o=i),this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a,o);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),P=function(){function e(t){d(this,e),this.name=w.EXT_MESHOPT_COMPRESSION,this.parser=t}return f(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var n=e.extensions[this.name],r=(e=this.parser.getDependency("buffer",n.buffer),this.parser.options.meshoptDecoder);if(r&&r.supported)return Promise.all([e,r.ready]).then((function(e){var t=n.byteOffset||0,i=n.byteLength||0,a=n.count,o=n.byteStride,s=new ArrayBuffer(a*o);return i=new Uint8Array(e[0],t,i),r.decodeGltfBuffer(new Uint8Array(s),a,o,i,n.mode,n.filter),s}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),I="glTF",D=function e(t){d(this,e),this.name=w.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12);if(this.header={magic:u.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==I)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=this.header.length-12,i=new DataView(t,12),a=0;a<r;){var o=i.getUint32(a,!0);a+=4;var s,l=i.getUint32(a,!0);a+=4,1313821514===l?(s=new Uint8Array(t,12+a,o),this.content=u.LoaderUtils.decodeText(s)):5130562===l&&(this.body=t.slice(l=12+a,l+o)),a+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")},N=function(){function e(t,n){if(d(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=w.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return f(e,[{key:"decodePrimitive",value:function(e,t){var n,r,i=this.json,a=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(n in s){var h=j[n]||n.toLowerCase();l[h]=s[n]}for(r in e.attributes){var d,p,f=j[r]||r.toLowerCase();void 0!==s[r]&&(d=i.accessors[e.attributes[r]],p=H[d.componentType],c[f]=p,u[f]=!0===d.normalized)}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n];void 0!==(n=u[n])&&(r.normalized=n)}t(e)}),l,c)}))}))}}]),e}(),O=function(){function e(){d(this,e),this.name=w.KHR_TEXTURE_TRANSFORM}return f(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),F=function(){m(t,u.MeshStandardMaterial);var e=g(t);function t(n){var r;d(this,t),(r=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var i=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),o=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),s=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),l=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),c={specular:{value:(new u.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return r._extraUniforms=c,r.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",i).replace("#include <metalnessmap_pars_fragment>",a).replace("#include <roughnessmap_fragment>",o).replace("#include <metalnessmap_fragment>",s).replace("#include <lights_physical_fragment>",l)},Object.defineProperties(y(r),{specular:{get:function(){return c.specular.value},set:function(e){c.specular.value=e}},specularMap:{get:function(){return c.specularMap.value},set:function(e){(c.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return c.glossiness.value},set:function(e){c.glossiness.value=e}},glossinessMap:{get:function(){return c.glossinessMap.value},set:function(e){(c.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete r.metalness,delete r.roughness,delete r.metalnessMap,delete r.roughnessMap,r.setValues(n),r}return f(t,[{key:"copy",value:function(e){return h(x(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),B=function(){function e(){d(this,e),this.name=w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return f(e,[{key:"getMaterialType",value:function(){return F}},{key:"extendParams",value:function(e,t,n){var r=t.extensions[this.name];e.color=new u.Color(1,1,1),e.opacity=1;var i=[];return Array.isArray(r.diffuseFactor)&&(t=r.diffuseFactor,e.color.fromArray(t),e.opacity=t[3]),void 0!==r.diffuseTexture&&i.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new u.Color(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new u.Color(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture&&(r=r.specularGlossinessTexture,i.push(n.assignTexture(e,"glossinessMap",r)),i.push(n.assignTexture(e,"specularMap",r))),Promise.all(i)}},{key:"createMaterial",value:function(e){var t=new F(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=u.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),z=function e(){d(this,e),this.name=w.KHR_MESH_QUANTIZATION},U=function(){m(t,u.Interpolant);var e=g(t);function t(n,r,i,a){return d(this,t),e.call(this,n,r,i,a)}return f(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}}]),t}();U.prototype.beforeStart_=U.prototype.copySampleValue_,U.prototype.afterEnd_=U.prototype.copySampleValue_,U.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=r-t,c=e*l,h=c-l,d=-2*(t=(n=(r=(n-t)/u)*r)*r)+3*n,p=t-n,f=1-d,m=p-n+r,v=0;v!==o;v++){var g=a[h+v+o],y=a[h+v+s]*u,x=a[c+v+o],_=a[c+v]*u;i[v]=f*g+m*y+d*x+p*_}return i};var H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},G={9728:u.NearestFilter,9729:u.LinearFilter,9984:u.NearestMipmapNearestFilter,9985:u.LinearMipmapNearestFilter,9986:u.NearestMipmapLinearFilter,9987:u.LinearMipmapLinearFilter},V={33071:u.ClampToEdgeWrapping,33648:u.MirroredRepeatWrapping,10497:u.RepeatWrapping},W={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},j={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},q={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},X={CUBICSPLINE:void 0,LINEAR:u.InterpolateLinear,STEP:u.InterpolateDiscrete};function Y(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function J(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Z(e,t){void 0!==t.extras&&("object"===c(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function K(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Q(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var $=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};d(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new b,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new u.ImageBitmapLoader(this.options.manager):this.textureLoader=new u.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return f(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};J(i,a,r),Z(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){return e.refs[t]<=1||((n=n.clone()).name+="_instance_"+e.uses[t]++),n}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t,n,r=this.cache.get(e);return r||(n=(t=this).json[e+("mesh"===e?"es":"s")]||[],r=Promise.all(n.map((function(n,r){return t.getDependency(e,r)}))),this.cache.add(e,r)),r}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,i){n.load(Y(t.uri,r.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,r=this.json.accessors[e];return void 0===r.bufferView&&void 0===r.sparse?Promise.resolve(null):(e=[],void 0!==r.bufferView?e.push(this.getDependency("bufferView",r.bufferView)):e.push(null),void 0!==r.sparse&&(e.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(e).then((function(e){var i,a,o,s=e[0],l=W[r.type],c=H[r.componentType],h=c.BYTES_PER_ELEMENT,d=r.byteOffset||0,p=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized,m=p&&p!==h*l?(i=Math.floor(d/p),a="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+i+":"+r.count,(o=t.cache.get(a))||(v=new c(s,i*p,r.count*p/h),o=new u.InterleavedBuffer(v,p/h),t.cache.add(a,o)),new u.InterleavedBufferAttribute(o,l,d%p/h,f)):(v=null===s?new c(r.count*l):new c(s,d,r.count*l),new u.BufferAttribute(v,l,f));if(void 0!==r.sparse){d=H[r.sparse.indices.componentType];var v=r.sparse.indices.byteOffset||0,g=(f=r.sparse.values.byteOffset||0,new d(e[1],v,r.sparse.count*W.SCALAR)),y=new c(e[2],f,r.sparse.count*l);null!==s&&(m=new u.BufferAttribute(m.array.slice(),m.itemSize,m.normalized));for(var x=0,_=g.length;x<_;x++){var b=g[x];if(m.setX(b,y[x*l]),2<=l&&m.setY(b,y[x*l+1]),3<=l&&m.setZ(b,y[x*l+2]),4<=l&&m.setW(b,y[x*l+3]),5<=l)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})))}},{key:"loadTexture",value:function(e){var t=this.json,n=this.options,r=t.textures[e];return t=t.images[r.source],r=this.textureLoader,!t.uri||null!==(n=n.manager.getHandler(t.uri))&&(r=n),this.loadTextureImage(e,t,r)}},{key:"loadTextureImage",value:function(e,t,n){var r=this,i=this.json,a=this.options,o=i.textures[e],s=(t.uri||t.bufferView)+":"+o.sampler;if(this.textureCache[s])return this.textureCache[s];var l=self.URL||self.webkitURL,c=t.uri||"",h=!1,d=!0,p=0<c.search(/\.jpe?g($|\?)/i)||0===c.search(/^data\:image\/jpeg/);if("image/jpeg"!==t.mimeType&&!p||(d=!1),void 0!==t.bufferView)c=r.getDependency("bufferView",t.bufferView).then((function(e){var n;return"image/png"===t.mimeType&&(n=new DataView(e,25,1).getUint8(0,!1),d=6===n||4===n||3===n),h=!0,e=new Blob([e],{type:t.mimeType}),c=l.createObjectURL(e)}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return p=Promise.resolve(c).then((function(e){return new Promise((function(t,r){var i=t;!0===n.isImageBitmapLoader&&(i=function(e){(e=new u.Texture(e)).needsUpdate=!0,t(e)}),n.load(Y(e,a.path),i,void 0,r)}))})).then((function(t){!0===h&&l.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name),d||(t.format=u.RGBFormat);var n=(i.samplers||{})[o.sampler]||{};return t.magFilter=G[n.magFilter]||u.LinearFilter,t.minFilter=G[n.minFilter]||u.LinearMipmapLinearFilter,t.wrapS=V[n.wrapS]||u.RepeatWrapping,t.wrapT=V[n.wrapT]||u.RepeatWrapping,r.associations.set(t,{type:"textures",index:e}),t})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",c),null})),this.textureCache[s]=p}},{key:"assignTexture",value:function(e,t,n){var r=this;return this.getDependency("texture",n.index).then((function(i){var a,o;return void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),!r.extensions[w.KHR_TEXTURE_TRANSFORM]||(a=void 0!==n.extensions?n.extensions[w.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=r.associations.get(i),i=r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,o)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,n,r,i,a=e.geometry,o=e.material,s=void 0!==a.attributes.tangent,l=void 0!==a.attributes.color,c=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+o.uuid,(n=this.cache.get(t))||(n=new u.PointsMaterial,u.Material.prototype.copy.call(n,o),n.color.copy(o.color),n.map=o.map,n.sizeAttenuation=!1,this.cache.add(t,n)),o=n):e.isLine&&(r="LineBasicMaterial:"+o.uuid,(i=this.cache.get(r))||(i=new u.LineBasicMaterial,u.Material.prototype.copy.call(i,o),i.color.copy(o.color),this.cache.add(r,i)),o=i),(s||l||c)&&(r="ClonedMaterial:"+o.uuid+":",o.isGLTFSpecularGlossinessMaterial&&(r+="specular-glossiness:"),s&&(r+="vertex-tangents:"),l&&(r+="vertex-colors:"),c&&(r+="flat-shading:"),(i=this.cache.get(r))||(i=o.clone(),l&&(i.vertexColors=!0),c&&(i.flatShading=!0),s&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(r,i),this.associations.set(i,this.associations.get(o))),o=i),o.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),e.material=o}},{key:"getMaterialType",value:function(){return u.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n,r=this,i=this.json,a=this.extensions,o=i.materials[e],s={},l=o.extensions||{},c=[];l[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(i=a[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=i.getMaterialType(),c.push(i.extendParams(s,o,r))):l[w.KHR_MATERIALS_UNLIT]?(n=a[w.KHR_MATERIALS_UNLIT],t=n.getMaterialType(),c.push(n.extendParams(s,o,r))):(h=o.pbrMetallicRoughness||{},s.color=new u.Color(1,1,1),s.opacity=1,Array.isArray(h.baseColorFactor)&&(n=h.baseColorFactor,s.color.fromArray(n),s.opacity=n[3]),void 0!==h.baseColorTexture&&c.push(r.assignTexture(s,"map",h.baseColorTexture)),s.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,s.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(c.push(r.assignTexture(s,"metalnessMap",h.metallicRoughnessTexture)),c.push(r.assignTexture(s,"roughnessMap",h.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))),!0===o.doubleSided&&(s.side=u.DoubleSide);var h=o.alphaMode||"OPAQUE";return"BLEND"===h?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===h&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==u.MeshBasicMaterial&&(c.push(r.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new u.Vector2(1,-1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==u.MeshBasicMaterial&&(c.push(r.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==u.MeshBasicMaterial&&(s.emissive=(new u.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==u.MeshBasicMaterial&&c.push(r.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(c).then((function(){var n=t===F?a[w.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s);return o.name&&(n.name=o.name),n.map&&(n.map.encoding=u.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=u.sRGBEncoding),Z(n,o),r.associations.set(n,{type:"materials",index:e}),o.extensions&&J(a,n,o),n}))}},{key:"createUniqueName",value:function(e){for(var t=u.PropertyBinding.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,r=this.primitiveCache,i=[],a=0,o=e.length;a<o;a++){var s=e[a],l=(l=void 0,c=(l=(c=s).extensions&&c.extensions[w.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+K(l.attributes):c.indices+":"+K(c.attributes)+":"+c.mode),c=r[l];c?i.push(c.promise):(c=void 0,c=s.extensions&&s.extensions[w.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return ee(n,e,t)}))}(s):ee(new u.BufferGeometry,s,t),r[l]={primitive:s,promise:c},i.push(c))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[],s=0,l=a.length;s<l;s++){var c=void 0===a[s].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new u.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:u.FrontSide})),c.DefaultMaterial):this.getDependency("material",a[s].material);o.push(c)}return o.push(t.loadGeometries(a)),Promise.all(o).then((function(n){for(var o=n.slice(0,n.length-1),s=n[n.length-1],l=[],c=0,h=s.length;c<h;c++){var d=s[c],p=a[c],f=void 0,m=o[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(f=new(!0===i.isSkinnedMesh?u.SkinnedMesh:u.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=te(f.geometry,u.TriangleStripDrawMode):6===p.mode&&(f.geometry=te(f.geometry,u.TriangleFanDrawMode));else if(1===p.mode)f=new u.LineSegments(d,m);else if(3===p.mode)f=new u.Line(d,m);else if(2===p.mode)f=new u.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new u.Points(d,m)}0<Object.keys(f.geometry.morphAttributes).length&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(var a=0,o=i.length;a<o;a++)e.morphTargetDictionary[i[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(f,i),f.name=t.createUniqueName(i.name||"mesh_"+e),Z(f,i),p.extensions&&J(r,f,p),t.assignFinalMaterial(f),l.push(f)}if(1===l.length)return l[0];for(var v=new u.Group,g=0,y=l.length;g<y;g++)v.add(l[g]);return v}))}},{key:"loadCamera",value:function(e){var t,n=this.json.cameras[e];if(e=n[n.type])return"perspective"===n.type?t=new u.PerspectiveCamera(u.MathUtils.radToDeg(e.yfov),e.aspectRatio||1,e.znear||1,e.zfar||2e6):"orthographic"===n.type&&(t=new u.OrthographicCamera(-e.xmag,e.xmag,e.ymag,-e.ymag,e.znear,e.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Z(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],r=[],i=[],a=[],o=[],s=0,l=t.channels.length;s<l;s++){var c=t.channels[s],h=t.samplers[c.sampler],d=c.target,p=void 0!==d.node?d.node:d.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input;c=void 0!==t.parameters?t.parameters[h.output]:h.output,n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",c)),a.push(h),o.push(d)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(o)]).then((function(n){for(var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=[],c=0,h=r.length;c<h;c++)!function(e){var t=r[e],n=i[e],c=a[e],h=o[e],d=s[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var p=void 0;switch(q[d.path]){case q.weights:p=u.NumberKeyframeTrack;break;case q.rotation:p=u.QuaternionKeyframeTrack;break;default:p=u.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?X[h.interpolation]:u.InterpolateLinear,m=[];q[d.path]===q.weights?t.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e);var v=c.array;if(c.normalized){for(var g=Q(v.constructor),y=new Float32Array(v.length),x=0,_=v.length;x<_;x++)y[x]=v[x]*g;v=y}for(var b=0,w=m.length;b<w;b++){var M=new p(m[b]+"."+q[d.path],n.array,v,f);"CUBICSPLINE"===h.interpolation&&(M.createInterpolant=function(e){return new U(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(M)}}}(c);return n=t.name||"animation_"+e,new u.AnimationClip(n,void 0,l)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){return e=n._getNodeRef(n.meshCache,r.mesh,e),void 0!==r.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,n=this.json,r=this.extensions,i=this,a=n.nodes[e],o=a.name?i.createUniqueName(a.name):"";return t=[],(n=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(n),void 0!==a.camera&&t.push(i.getDependency("camera",a.camera).then((function(e){return i._getNodeRef(i.cameraCache,a.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var n,s=!0===a.isBone?new u.Bone:1<t.length?new u.Group:1===t.length?t[0]:new u.Object3D;if(s!==t[0])for(var l=0,c=t.length;l<c;l++)s.add(t[l]);return a.name&&(s.userData.name=a.name,s.name=o),Z(s,a),a.extensions&&J(r,s,a),void 0!==a.matrix?((n=new u.Matrix4).fromArray(a.matrix),s.applyMatrix4(n)):(void 0!==a.translation&&s.position.fromArray(a.translation),void 0!==a.rotation&&s.quaternion.fromArray(a.rotation),void 0!==a.scale&&s.scale.fromArray(a.scale)),i.associations.set(s,{type:"nodes",index:e}),s}))}},{key:"loadScene",value:function(e){var t=this.json,n=this.extensions,r=(e=this.json.scenes[e],new u.Group);e.name&&(r.name=this.createUniqueName(e.name)),Z(r,e),e.extensions&&J(n,r,e);for(var i=e.nodes||[],a=[],o=0,s=i.length;o<s;o++)a.push(function e(t,n,r,i){var a=r.nodes[t];return i.getDependency("node",t).then((function(e){return void 0===a.skin?e:i.getDependency("skin",a.skin).then((function(e){for(var n=[],r=0,a=(t=e).joints.length;r<a;r++)n.push(i.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var r=[],i=[],a=0,o=n.length;a<o;a++){var s=n[a];s?(r.push(s),s=new u.Matrix4,void 0!==t.inverseBindMatrices&&s.fromArray(t.inverseBindMatrices.array,16*a),i.push(s)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new u.Skeleton(r,i),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var o=[];if(a.children)for(var s=a.children,l=0,u=s.length;l<u;l++){var c=s[l];o.push(e(c,t,r,i))}return Promise.all(o)}))}(i[o],r,t,this));return Promise.all(a).then((function(){return r}))}}]),e}();function ee(e,t,n){var r,i,a=t.attributes,o=[];for(r in a){var s=j[r]||r.toLowerCase();s in e.attributes||o.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(a[r],s))}return void 0===t.indices||e.index||(i=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),o.push(i)),Z(e,t),function(e,t,n){var r=t.attributes,i=new u.Box3;if(void 0!==r.POSITION){var a=n.json.accessors[r.POSITION],o=a.min;if(r=a.max,void 0!==o&&void 0!==r){i.set(new u.Vector3(o[0],o[1],o[2]),new u.Vector3(r[0],r[1],r[2])),a.normalized&&(a=Q(H[a.componentType]),i.min.multiplyScalar(a),i.max.multiplyScalar(a));var s=t.targets;if(void 0!==s){for(var l=new u.Vector3,c=new u.Vector3,h=0,d=s.length;h<d;h++){var p,f,m=s[h];void 0!==m.POSITION&&(p=(f=n.json.accessors[m.POSITION]).min,m=f.max,void 0!==p&&void 0!==m?(c.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),f.normalized&&(f=Q(H[f.componentType]),c.multiplyScalar(f)),l.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}i.expandByVector(l)}e.boundingBox=i,t=new u.Sphere,i.getCenter(t.center),t.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=t}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(o).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,a=0,o=t.length;a<o;a++){var s=t[a];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(e);for(var l=[],u=[],c=0,h=t.length;c<h;c++){var d,p=t[c];r&&(d=void 0!==p.POSITION?n.getDependency("accessor",p.POSITION):e.attributes.position,l.push(d)),i&&(p=void 0!==p.NORMAL?n.getDependency("accessor",p.NORMAL):e.attributes.normal,u.push(p))}return Promise.all([Promise.all(l),Promise.all(u)]).then((function(t){var n=t[0];return t=t[1],r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=t),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function te(e,t){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<i.count;a++)r.push(a);e.setIndex(r),n=e.getIndex()}var o=n.count-2,s=[];if(t===u.TriangleFanDrawMode)for(var l=1;l<=o;l++)s.push(n.getX(0)),s.push(n.getX(l)),s.push(n.getX(l+1));else for(var c=0;c<o;c++)c%2==0?(s.push(n.getX(c)),s.push(n.getX(c+1)),s.push(n.getX(c+2))):(s.push(n.getX(c+2)),s.push(n.getX(c+1)),s.push(n.getX(c)));return s.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(e=e.clone()).setIndex(s),e}function ne(e){return(ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(e,t){return(re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oe={type:"change"},se={type:"start"},le={type:"end"},ue=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&re(e,t)}(t,u.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ae(e);return function(e,t){if(t&&("object"===ne(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ie(e)}(this,t?(n=ae(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments))}}(t);function t(n,r){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=e.call(this),void 0===r&&console.warn('THREE.TrackballControls: The second parameter "domElement" is now mandatory.'),r===document&&console.error('THREE.TrackballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');var a=ie(i),o=-1;i.object=n,i.domElement=r,i.domElement.style.touchAction="none",i.enabled=!0,i.screen={left:0,top:0,width:0,height:0},i.rotateSpeed=1,i.zoomSpeed=1.2,i.panSpeed=.3,i.noRotate=!1,i.noZoom=!1,i.noPan=!1,i.staticMoving=!1,i.dynamicDampingFactor=.2,i.minDistance=0,i.maxDistance=1/0,i.keys=["KeyA","KeyS","KeyD"],i.mouseButtons={LEFT:u.MOUSE.ROTATE,MIDDLE:u.MOUSE.DOLLY,RIGHT:u.MOUSE.PAN},i.target=new u.Vector3;var s=new u.Vector3,l=1,c=o,h=o,d=0,p=0,f=0,m=new u.Vector3,v=new u.Vector2,g=new u.Vector2,y=new u.Vector3,x=new u.Vector2,_=new u.Vector2,b=new u.Vector2,w=new u.Vector2,M=[],S={};i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.up0=i.object.up.clone(),i.zoom0=i.object.zoom,i.handleResize=function(){var e=a.domElement.getBoundingClientRect(),t=a.domElement.ownerDocument.documentElement;a.screen.left=e.left+window.pageXOffset-t.clientLeft,a.screen.top=e.top+window.pageYOffset-t.clientTop,a.screen.width=e.width,a.screen.height=e.height};var T,E,A,L,k,R,C,P,I,D,N,O=(T=new u.Vector2,function(e,t){return T.set((e-a.screen.left)/a.screen.width,(t-a.screen.top)/a.screen.height),T}),F=(E=new u.Vector2,function(e,t){return E.set((e-.5*a.screen.width-a.screen.left)/(.5*a.screen.width),(a.screen.height+2*(a.screen.top-t))/a.screen.width),E});function B(e){!1!==a.enabled&&(0===M.length&&(a.domElement.setPointerCapture(e.pointerId),a.domElement.addEventListener("pointermove",z),a.domElement.addEventListener("pointerup",U)),M.push(e),("touch"===e.pointerType?function(e){var t;1===(X(e),M.length)?(c=3,g.copy(F(M[0].pageX,M[0].pageY)),v.copy(g)):(c=4,t=M[0].pageX-M[1].pageX,e=M[0].pageY-M[1].pageY,p=d=Math.sqrt(t*t+e*e),t=(M[0].pageX+M[1].pageX)/2,e=(M[0].pageY+M[1].pageY)/2,b.copy(O(t,e)),w.copy(b)),a.dispatchEvent(se)}:function(e){if(c===o)switch(e.button){case a.mouseButtons.LEFT:c=0;break;case a.mouseButtons.MIDDLE:c=1;break;case a.mouseButtons.RIGHT:c=2;break;default:c=o}var t=h!==o?h:c;0!==t||a.noRotate?1!==t||a.noZoom?2!==t||a.noPan||(b.copy(O(e.pageX,e.pageY)),w.copy(b)):(x.copy(O(e.pageX,e.pageY)),_.copy(x)):(g.copy(F(e.pageX,e.pageY)),v.copy(g)),a.dispatchEvent(se)})(e))}function z(e){var t;!1!==a.enabled&&("touch"===e.pointerType?function(e){var t,n,r;1===(X(e),M.length)?(v.copy(g),g.copy(F(e.pageX,e.pageY))):(r=function(e){return e=e.pointerId===M[0].pointerId?M[1]:M[0],S[e.pointerId]}(e),t=e.pageX-r.x,n=e.pageY-r.y,p=Math.sqrt(t*t+n*n),n=(e.pageX+r.x)/2,r=(e.pageY+r.y)/2,w.copy(O(n,r)))}(e):(t=e,0!==(e=h!==o?h:c)||a.noRotate?1!==e||a.noZoom?2!==e||a.noPan||w.copy(O(t.pageX,t.pageY)):_.copy(O(t.pageX,t.pageY)):(v.copy(g),g.copy(F(t.pageX,t.pageY)))))}function U(e){!1!==a.enabled&&("touch"===e.pointerType?function(e){switch(M.length){case 0:c=o;break;case 1:c=3,g.copy(F(e.pageX,e.pageY)),v.copy(g);break;case 2:c=4,g.copy(F(e.pageX-v.pageX,e.pageY-v.pageY)),v.copy(g)}a.dispatchEvent(le)}(e):(c=o,a.dispatchEvent(le)),q(e),0===M.length&&(a.domElement.releasePointerCapture(e.pointerId),a.domElement.removeEventListener("pointermove",z),a.domElement.removeEventListener("pointerup",U)))}function H(e){q(e)}function G(e){!1!==a.enabled&&(window.removeEventListener("keydown",G),h!==o||(e.code!==a.keys[0]||a.noRotate?e.code!==a.keys[1]||a.noZoom?e.code!==a.keys[2]||a.noPan||(h=2):h=1:h=0))}function V(){!1!==a.enabled&&(h=o,window.addEventListener("keydown",G))}function W(e){if(!1!==a.enabled&&!0!==a.noZoom){switch(e.preventDefault(),e.deltaMode){case 2:x.y-=.025*e.deltaY;break;case 1:x.y-=.01*e.deltaY;break;default:x.y-=25e-5*e.deltaY}a.dispatchEvent(se),a.dispatchEvent(le)}}function j(e){!1!==a.enabled&&e.preventDefault()}function q(e){delete S[e.pointerId];for(var t=0;t<M.length;t++)if(M[t].pointerId==e.pointerId)return void M.splice(t,1)}function X(e){var t=S[e.pointerId];void 0===t&&(t=new u.Vector2,S[e.pointerId]=t),t.set(e.pageX,e.pageY)}return i.rotateCamera=(A=new u.Vector3,L=new u.Quaternion,k=new u.Vector3,R=new u.Vector3,C=new u.Vector3,P=new u.Vector3,function(){P.set(g.x-v.x,g.y-v.y,0);var e=P.length();e?(m.copy(a.object.position).sub(a.target),k.copy(m).normalize(),R.copy(a.object.up).normalize(),C.crossVectors(R,k).normalize(),R.setLength(g.y-v.y),C.setLength(g.x-v.x),P.copy(R.add(C)),A.crossVectors(P,m).normalize(),e*=a.rotateSpeed,L.setFromAxisAngle(A,e),m.applyQuaternion(L),a.object.up.applyQuaternion(L),y.copy(A),f=e):!a.staticMoving&&f&&(f*=Math.sqrt(1-a.dynamicDampingFactor),m.copy(a.object.position).sub(a.target),L.setFromAxisAngle(y,f),m.applyQuaternion(L),a.object.up.applyQuaternion(L)),v.copy(g)}),i.zoomCamera=function(){var e;4===c?(e=d/p,d=p,a.object.isPerspectiveCamera?m.multiplyScalar(e):a.object.isOrthographicCamera?(a.object.zoom*=e,a.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(1!=(e=1+(_.y-x.y)*a.zoomSpeed)&&0<e&&(a.object.isPerspectiveCamera?m.multiplyScalar(e):a.object.isOrthographicCamera?(a.object.zoom/=e,a.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),a.staticMoving?x.copy(_):x.y+=(_.y-x.y)*this.dynamicDampingFactor)},i.panCamera=(I=new u.Vector2,D=new u.Vector3,N=new u.Vector3,function(){var e,t;I.copy(w).sub(b),I.lengthSq()&&(a.object.isOrthographicCamera&&(e=(a.object.right-a.object.left)/a.object.zoom/a.domElement.clientWidth,t=(a.object.top-a.object.bottom)/a.object.zoom/a.domElement.clientWidth,I.x*=e,I.y*=t),I.multiplyScalar(m.length()*a.panSpeed),N.copy(m).cross(a.object.up).setLength(I.x),N.add(D.copy(a.object.up).setLength(I.y)),a.object.position.add(N),a.target.add(N),a.staticMoving?b.copy(w):b.add(I.subVectors(w,b).multiplyScalar(a.dynamicDampingFactor)))}),i.checkDistances=function(){a.noZoom&&a.noPan||(m.lengthSq()>a.maxDistance*a.maxDistance&&(a.object.position.addVectors(a.target,m.setLength(a.maxDistance)),x.copy(_)),m.lengthSq()<a.minDistance*a.minDistance&&(a.object.position.addVectors(a.target,m.setLength(a.minDistance)),x.copy(_)))},i.update=function(){m.subVectors(a.object.position,a.target),a.noRotate||a.rotateCamera(),a.noZoom||a.zoomCamera(),a.noPan||a.panCamera(),a.object.position.addVectors(a.target,m),a.object.isPerspectiveCamera?(a.checkDistances(),a.object.lookAt(a.target),1e-6<s.distanceToSquared(a.object.position)&&(a.dispatchEvent(oe),s.copy(a.object.position))):a.object.isOrthographicCamera?(a.object.lookAt(a.target),(1e-6<s.distanceToSquared(a.object.position)||l!==a.object.zoom)&&(a.dispatchEvent(oe),s.copy(a.object.position),l=a.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},i.reset=function(){c=o,h=o,a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.up.copy(a.up0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),m.subVectors(a.object.position,a.target),a.object.lookAt(a.target),a.dispatchEvent(oe),s.copy(a.object.position),l=a.object.zoom},i.dispose=function(){a.domElement.removeEventListener("contextmenu",j),a.domElement.removeEventListener("pointerdown",B),a.domElement.removeEventListener("pointercancel",H),a.domElement.removeEventListener("wheel",W),a.domElement.removeEventListener("pointermove",z),a.domElement.removeEventListener("pointerup",U),window.removeEventListener("keydown",G),window.removeEventListener("keyup",V)},i.domElement.addEventListener("contextmenu",j),i.domElement.addEventListener("pointerdown",B),i.domElement.addEventListener("pointercancel",H),i.domElement.addEventListener("wheel",W,{passive:!1}),window.addEventListener("keydown",G),window.addEventListener("keyup",V),i.handleResize(),i.update(),i}return t}();function ce(e){return(ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function he(e,t,n){return(he=de()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&pe(r,n.prototype),r}).apply(null,arguments)}function de(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function pe(e,t){return(pe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fe(e){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var me=n(733);function ve(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ve(a,r,i,o,s,"next",e)}function s(e){ve(a,r,i,o,s,"throw",e)}o(void 0)}))}}e=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pe(e,t)}(n,function(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return he(e,arguments,fe(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),pe(n,e)}(e)}(HTMLElement));var e,t=function(e){var t=de();return function(){var n,r=fe(e);return function(e,t){if(t&&("object"===ce(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,t?(n=fe(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments))}}(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.call(this)).shadowDOM=e.attachShadow({mode:"open"}),e}return(e=[{key:"connectedCallback",value:function(){this.init()}},{key:"init",value:function(){var e=this;this.shadowDOM.innerHTML="\n        <style>\n        #pokeball-canvas {\n            display: flex;\n            margin: 100px auto;\n            width: 50%;\n            border: 15px solid #1f1f1f;\n            border-radius: 20%;\n            background-image: url('./images/pokemon-background.jpg');\n            background-repeat: no-repeat;\n            background-size: cover;\n            background-position: center;\n        }\n        #pokeball-canvas:hover {\n            cursor: grab;\n        }\n        @media screen and (max-width: 1000px) {\n            #pokeball-canvas{\n                width: 70%;\n            }\n        }\n        </style>\n        <canvas id=\"pokeball-canvas\"></canvas>",this.canvas=this.shadowDOM.querySelector("#pokeball-canvas"),this.scene=new me.Scene;var t=this.canvas.offsetHeight,n=this.canvas.offsetWidth;this.camera=new me.PerspectiveCamera(50,t/n,1,100),this.camera.position.z=3.5,this.renderer=new me.WebGLRenderer({canvas:this.canvas,alpha:!0,antialias:!0}),this.renderer.gammaInput=!0,this.renderer.gammaOutput=!0,this.renderer.setClearColor(16777215,0),this.ambientLight=new me.AmbientLight(16777215,.2),this.scene.add(this.ambientLight),this.directionalLight=new me.DirectionalLight(16777215,.5),this.scene.add(this.directionalLight),this.loader=new _,this.loader.load("./model/pokeball-model.gltf",(function(t){e.model=t.scene,e.scene.add(e.model),e.render()})),this.renderer.setSize(this.canvas.clientWidth,this.canvas.clientHeight,!1),this.controls=new ue(this.camera,this.renderer.domElement),this.controls.noZoom=!0}},{key:"render",value:function(){var e=this;requestAnimationFrame((function(){return e.render()})),this.model.rotation.x+=.01,this.model.rotation.y+=.01,this.camera.aspect=this.canvas.clientWidth/this.canvas.clientHeight,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),this.controls.update()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,e),n}(),customElements.define("pokeball-model",e);const ye=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,i;return t=e,(n=[{key:"searchPokemon",value:(i=ge(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("https://pokeapi.co/api/v2/pokemon/".concat(t));case 2:return n=e.sent,e.next=5,n.json();case 5:return n=e.sent,e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"searchAllPokemon",value:(r=ge(regeneratorRuntime.mark((function e(){var t,n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=1;case 2:if(n<=151)return e.next=5,fetch("https://pokeapi.co/api/v2/pokemon/".concat(n));e.next=13;break;case 5:return r=e.sent,e.next=8,r.json();case 8:r=e.sent,t.push(r);case 10:n+=1,e.next=2;break;case 13:return e.abrupt("return",t);case 14:case"end":return e.stop()}}),e)}))),function(){return r.apply(this,arguments)})}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t,n),e}();function xe(e){return(xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e,t,n){return(_e=be()?Reflect.construct:function(e,t,n){var r=[null];return r.push.apply(r,t),r=new(Function.bind.apply(e,r)),n&&we(r,n.prototype),r}).apply(null,arguments)}function be(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function we(e,t){return(we=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e){return(Me=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}n(998),n(84),e=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&we(e,t)}(n,function(e){var t="function"==typeof Map?new Map:void 0;return function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _e(e,arguments,Me(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),we(n,e)}(e)}(HTMLElement));var e,t=function(e){var t=be();return function(){var n,r=Me(e);return function(e,t){if(t&&("object"===xe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,t?(n=Me(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments))}}(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.call(this)).shadowDOM=e.attachShadow({mode:"open"}),e}return(e=[{key:"pokemons",set:function(e){this._pokemons=e,this.render()}},{key:"allPokemons",set:function(e){this._allPokemons=e,this.renderAll()}},{key:"render",value:function(){this.shadowDOM.innerHTML='\n        <style>\n        .list-container{\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            margin-top: 50px;\n            background-image: url(\'./pattern/cubes.png\');\n            border: 3px solid #616161;\n            border-radius: 5px; \n        }\n        .flex-gap{\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            flex-wrap: wrap;\n            gap: 50px;\n            padding: 50px;\n        }\n        </style>\n        <div class="list-container">\n            <div class="flex-gap"></div>\n        </div>';var e=document.createElement("pokemon-item");e.pokemon=this._pokemons,this.shadowDOM.querySelector(".flex-gap").appendChild(e)}},{key:"renderAll",value:function(){var e=this;this.shadowDOM.innerHTML='\n        <style>\n        .list-container{\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            margin-top: 50px;\n            background-image: url(\'./pattern/cubes.png\');\n            border: 3px solid #616161;\n            border-radius: 5px; \n        }\n        .flex-gap{\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            flex-wrap: wrap;\n            gap: 50px;\n            padding: 50px;\n        }\n        </style>\n        <div class="list-container">\n            <div class="flex-gap"></div>\n        </div>',this._allPokemons.forEach((function(t){var n=document.createElement("pokemon-item");n.allPokemon=t,e.shadowDOM.querySelector(".flex-gap").appendChild(n)}))}},{key:"renderError",value:function(){this.shadowDOM.innerHTML="\n        <style>\n        .list-container{\n            background-color: white;\n            border: 3px solid #616161;\n            border-radius: 5px;\n            \n            margin-top: 50px;\n        }\n\n        h2{\n            text-align: center;\n            font-weight: normal;\n        }\n        </style>",this.shadowDOM.innerHTML+='\n        <div class="list-container">\n            <h2>Pokemon\'s name is not found.</h2>\n        </div>'}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,e),n}(),customElements.define("pokemon-list",e),document.addEventListener("DOMContentLoaded",(function(){var e=document.querySelector("search-bar"),t=document.querySelector("pokemon-list"),n=function(){var t,n=(t=regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,""!==e.value.replace(/\s/g,""))return t.next=4,ye.searchPokemon(e.value.toLowerCase());t.next=8;break;case 4:n=t.sent,r(n),t.next=12;break;case 8:return t.next=10,ye.searchAllPokemon(e.value.toLowerCase());case 10:n=t.sent,i(n);case 12:t.next=17;break;case 14:t.prev=14,t.t0=t.catch(0),a(t.t0);case 17:case"end":return t.stop()}}),t,null,[[0,14]])})),function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){Se(a,r,i,o,s,"next",e)}function s(e){Se(a,r,i,o,s,"throw",e)}o(void 0)}))});return function(){return n.apply(this,arguments)}}(),r=function(e){t.pokemons=e},i=function(e){t.allPokemons=e},a=function(e){t.renderError(e)};e.clickEvent=n}))})()})();