15 lines
674 KiB
JavaScript
15 lines
674 KiB
JavaScript
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"D9Nj":[function(require,module,exports) {
|
|
|
|
},{}],"gBK8":[function(require,module,exports) {
|
|
var define;
|
|
var e;function t(e){return i(e)||r(e)||c(e)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function i(e){if(Array.isArray(e))return h(e)}function a(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(u){return void n(u)}s.done?t(l):Promise.resolve(l).then(r,i)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(e){a(o,r,i,s,l,"next",e)}function l(e){a(o,r,i,s,l,"throw",e)}s(void 0)})}}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function l(e,t){return p(e)||d(e,t)||c(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(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 d(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function p(e){if(Array.isArray(e))return e}function f(){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=v(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}}).apply(this,arguments)}function v(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return 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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return(g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t=M();return function(){var n,r=b(e);if(t){var i=b(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return x(this,n)}}function x(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(){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 b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(){"use strict";w=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},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(e){u=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var a=t&&t.prototype instanceof g?t:g,o=Object.create(a.prototype),s=new P(r||[]);return i(o,"_invoke",{value:E(e,n,s)}),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",v="completed",m={};function g(){}function y(){}function x(){}var _={};u(_,o,function(){return this});var M=Object.getPrototypeOf,b=M&&M(M(I([])));b&&b!==n&&r.call(b,o)&&(_=b);var S=x.prototype=g.prototype=Object.create(_);function A(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function k(e,t){function n(i,a,o,s){var l=h(e[i],e,a);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==T(c)&&r.call(c,"__await")?t.resolve(c.__await).then(function(e){n("next",e,o,s)},function(e){n("throw",e,o,s)}):t.resolve(c).then(function(e){u.value=e,o(u)},function(e){return n("throw",e,o,s)})}s(l.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t(function(t,i){n(e,r,t,i)})}return a=a?a.then(i,i):i()}})}function E(t,n,r){var i=d;return function(a,o){if(i===f)throw new Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var l=C(s,r);if(l){if(l===m)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var u=h(t,n,r);if("normal"===u.type){if(i=r.done?v:p,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i=v,r.method="throw",r.arg=u.arg)}}}function C(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var a=h(i,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,m;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function L(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 R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(T(t)+" is not iterable")}return y.prototype=x,i(S,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:y,configurable:!0}),y.displayName=u(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,u(e,l,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,function(){return this}),t.AsyncIterator=k,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new k(c(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},A(S),u(S,l,"Generator"),u(S,o,function(){return this}),u(S,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,m):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),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function T(e){return(T="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 A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(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,C(r.key),r)}}function E(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C(e){var t=L(e,"string");return"symbol"==T(t)?t:String(t)}function L(e,t){if("object"!=T(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DiscreteInterpolant=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTextureLoader=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.DataArrayTexture=exports.Data3DTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.Curve=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicInterpolant=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTextureLoader=exports.CompressedTexture=exports.ColorManagement=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CapsuleGeometry=exports.CapsuleBufferGeometry=exports.CanvasTexture=exports.CameraHelper=exports.Camera=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BufferGeometry=exports.BufferAttribute=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.Bone=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArrayCamera=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.FogExp2=exports.Fog=exports.FloatType=exports.Float64BufferAttribute=exports.Float32BufferAttribute=exports.Float16BufferAttribute=exports.FlatShading=exports.FileLoader=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.EventDispatcher=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=void 0,exports.Font=Jg,exports.FontLoader=Zg,exports.ImageUtils=exports.ImageLoader=exports.ImageBitmapLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GLSL3=exports.GLSL1=exports.GLBufferAttribute=exports.Frustum=exports.FrontSide=exports.FramebufferTexture=void 0,exports.ImmediateRenderObject=Kg,exports.Material=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LoadingManager=exports.LoaderUtils=exports.Loader=exports.LinearToneMapping=exports.LinearSRGBColorSpace=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearInterpolant=exports.LinearFilter=exports.LinearEncoding=exports.LineSegments=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.Line=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.Interpolant=exports.InterleavedBufferAttribute=exports.InterleavedBuffer=exports.IntType=exports.Int8BufferAttribute=exports.Int32BufferAttribute=exports.Int16BufferAttribute=exports.InstancedMesh=exports.InstancedInterleavedBuffer=exports.InstancedBufferGeometry=exports.InstancedBufferAttribute=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=void 0,exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBFormat=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionLinearInterpolant=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PropertyBinding=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.Points=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.PerspectiveCamera=exports.Path=exports.ParametricGeometry=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=exports.ObjectLoader=exports.Object3D=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColorSpace=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshStandardMaterial=exports.MeshPhysicalMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.Mesh=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.MaterialLoader=void 0,exports.WebGLMultisampleRenderTarget=exports.WebGLMultipleRenderTargets=exports.WebGLCubeRenderTarget=exports.WebGLArrayRenderTarget=exports.WebGL3DRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.Uint8ClampedBufferAttribute=exports.Uint8BufferAttribute=exports.Uint32BufferAttribute=exports.Uint16BufferAttribute=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.TextureLoader=exports.Texture=exports.TextGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.Source=exports.SmoothShading=exports.SkinnedMesh=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderMaterial=exports.ShaderLib=exports.ShaderChunk=exports.Scene=exports.SRGBColorSpace=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Raycaster=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=void 0,exports.WebGLRenderTarget=void 0,exports.WebGLRenderer=Yh,exports.WebGLUtils=Bh,exports.sRGBEncoding=exports._SRGBAFormat=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=void 0;var R=exports.REVISION="142",P=exports.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},I=exports.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},D=exports.CullFaceNone=0,N=exports.CullFaceBack=1,O=exports.CullFaceFront=2,F=exports.CullFaceFrontBack=3,z=exports.BasicShadowMap=0,B=exports.PCFShadowMap=1,U=exports.PCFSoftShadowMap=2,G=exports.VSMShadowMap=3,V=exports.FrontSide=0,H=exports.BackSide=1,W=exports.DoubleSide=2,j=exports.FlatShading=1,q=exports.SmoothShading=2,X=exports.NoBlending=0,Y=exports.NormalBlending=1,Z=exports.AdditiveBlending=2,J=exports.SubtractiveBlending=3,K=exports.MultiplyBlending=4,Q=exports.CustomBlending=5,$=exports.AddEquation=100,ee=exports.SubtractEquation=101,te=exports.ReverseSubtractEquation=102,ne=exports.MinEquation=103,re=exports.MaxEquation=104,ie=exports.ZeroFactor=200,ae=exports.OneFactor=201,oe=exports.SrcColorFactor=202,se=exports.OneMinusSrcColorFactor=203,le=exports.SrcAlphaFactor=204,ue=exports.OneMinusSrcAlphaFactor=205,ce=exports.DstAlphaFactor=206,he=exports.OneMinusDstAlphaFactor=207,de=exports.DstColorFactor=208,pe=exports.OneMinusDstColorFactor=209,fe=exports.SrcAlphaSaturateFactor=210,ve=exports.NeverDepth=0,me=exports.AlwaysDepth=1,ge=exports.LessDepth=2,ye=exports.LessEqualDepth=3,xe=exports.EqualDepth=4,_e=exports.GreaterEqualDepth=5,Me=exports.GreaterDepth=6,be=exports.NotEqualDepth=7,Se=exports.MultiplyOperation=0,we=exports.MixOperation=1,Te=exports.AddOperation=2,Ae=exports.NoToneMapping=0,ke=exports.LinearToneMapping=1,Ee=exports.ReinhardToneMapping=2,Ce=exports.CineonToneMapping=3,Le=exports.ACESFilmicToneMapping=4,Re=exports.CustomToneMapping=5,Pe=exports.UVMapping=300,Ie=exports.CubeReflectionMapping=301,De=exports.CubeRefractionMapping=302,Ne=exports.EquirectangularReflectionMapping=303,Oe=exports.EquirectangularRefractionMapping=304,Fe=exports.CubeUVReflectionMapping=306,ze=exports.RepeatWrapping=1e3,Be=exports.ClampToEdgeWrapping=1001,Ue=exports.MirroredRepeatWrapping=1002,Ge=exports.NearestFilter=1003,Ve=exports.NearestMipmapNearestFilter=1004,He=exports.NearestMipMapNearestFilter=1004,We=exports.NearestMipmapLinearFilter=1005,je=exports.NearestMipMapLinearFilter=1005,qe=exports.LinearFilter=1006,Xe=exports.LinearMipmapNearestFilter=1007,Ye=exports.LinearMipMapNearestFilter=1007,Ze=exports.LinearMipmapLinearFilter=1008,Je=exports.LinearMipMapLinearFilter=1008,Ke=exports.UnsignedByteType=1009,Qe=exports.ByteType=1010,$e=exports.ShortType=1011,et=exports.UnsignedShortType=1012,tt=exports.IntType=1013,nt=exports.UnsignedIntType=1014,rt=exports.FloatType=1015,it=exports.HalfFloatType=1016,at=exports.UnsignedShort4444Type=1017,ot=exports.UnsignedShort5551Type=1018,st=exports.UnsignedInt248Type=1020,lt=exports.AlphaFormat=1021,ut=exports.RGBFormat=1022,ct=exports.RGBAFormat=1023,ht=exports.LuminanceFormat=1024,dt=exports.LuminanceAlphaFormat=1025,pt=exports.DepthFormat=1026,ft=exports.DepthStencilFormat=1027,vt=exports.RedFormat=1028,mt=exports.RedIntegerFormat=1029,gt=exports.RGFormat=1030,yt=exports.RGIntegerFormat=1031,xt=exports.RGBAIntegerFormat=1033,_t=exports.RGB_S3TC_DXT1_Format=33776,Mt=exports.RGBA_S3TC_DXT1_Format=33777,bt=exports.RGBA_S3TC_DXT3_Format=33778,St=exports.RGBA_S3TC_DXT5_Format=33779,wt=exports.RGB_PVRTC_4BPPV1_Format=35840,Tt=exports.RGB_PVRTC_2BPPV1_Format=35841,At=exports.RGBA_PVRTC_4BPPV1_Format=35842,kt=exports.RGBA_PVRTC_2BPPV1_Format=35843,Et=exports.RGB_ETC1_Format=36196,Ct=exports.RGB_ETC2_Format=37492,Lt=exports.RGBA_ETC2_EAC_Format=37496,Rt=exports.RGBA_ASTC_4x4_Format=37808,Pt=exports.RGBA_ASTC_5x4_Format=37809,It=exports.RGBA_ASTC_5x5_Format=37810,Dt=exports.RGBA_ASTC_6x5_Format=37811,Nt=exports.RGBA_ASTC_6x6_Format=37812,Ot=exports.RGBA_ASTC_8x5_Format=37813,Ft=exports.RGBA_ASTC_8x6_Format=37814,zt=exports.RGBA_ASTC_8x8_Format=37815,Bt=exports.RGBA_ASTC_10x5_Format=37816,Ut=exports.RGBA_ASTC_10x6_Format=37817,Gt=exports.RGBA_ASTC_10x8_Format=37818,Vt=exports.RGBA_ASTC_10x10_Format=37819,Ht=exports.RGBA_ASTC_12x10_Format=37820,Wt=exports.RGBA_ASTC_12x12_Format=37821,jt=exports.RGBA_BPTC_Format=36492,qt=exports.LoopOnce=2200,Xt=exports.LoopRepeat=2201,Yt=exports.LoopPingPong=2202,Zt=exports.InterpolateDiscrete=2300,Jt=exports.InterpolateLinear=2301,Kt=exports.InterpolateSmooth=2302,Qt=exports.ZeroCurvatureEnding=2400,$t=exports.ZeroSlopeEnding=2401,en=exports.WrapAroundEnding=2402,tn=exports.NormalAnimationBlendMode=2500,nn=exports.AdditiveAnimationBlendMode=2501,rn=exports.TrianglesDrawMode=0,an=exports.TriangleStripDrawMode=1,on=exports.TriangleFanDrawMode=2,sn=exports.LinearEncoding=3e3,ln=exports.sRGBEncoding=3001,un=exports.BasicDepthPacking=3200,cn=exports.RGBADepthPacking=3201,hn=exports.TangentSpaceNormalMap=0,dn=exports.ObjectSpaceNormalMap=1,pn=exports.NoColorSpace="",fn=exports.SRGBColorSpace="srgb",vn=exports.LinearSRGBColorSpace="srgb-linear",mn=exports.ZeroStencilOp=0,gn=exports.KeepStencilOp=7680,yn=exports.ReplaceStencilOp=7681,xn=exports.IncrementStencilOp=7682,_n=exports.DecrementStencilOp=7683,Mn=exports.IncrementWrapStencilOp=34055,bn=exports.DecrementWrapStencilOp=34056,Sn=exports.InvertStencilOp=5386,wn=exports.NeverStencilFunc=512,Tn=exports.LessStencilFunc=513,An=exports.EqualStencilFunc=514,kn=exports.LessEqualStencilFunc=515,En=exports.GreaterStencilFunc=516,Cn=exports.NotEqualStencilFunc=517,Ln=exports.GreaterEqualStencilFunc=518,Rn=exports.AlwaysStencilFunc=519,Pn=exports.StaticDrawUsage=35044,In=exports.DynamicDrawUsage=35048,Dn=exports.StreamDrawUsage=35040,Nn=exports.StaticReadUsage=35045,On=exports.DynamicReadUsage=35049,Fn=exports.StreamReadUsage=35041,zn=exports.StaticCopyUsage=35046,Bn=exports.DynamicCopyUsage=35050,Un=exports.StreamCopyUsage=35042,Gn=exports.GLSL1="100",Vn=exports.GLSL3="300 es",Hn=exports._SRGBAFormat=1035,Wn=exports.EventDispatcher=function(){function e(){A(this,e)}return E(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){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,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}(),jn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],qn=1234567,Xn=Math.PI/180,Yn=180/Math.PI;function Zn(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(jn[255&e]+jn[e>>8&255]+jn[e>>16&255]+jn[e>>24&255]+"-"+jn[255&t]+jn[t>>8&255]+"-"+jn[t>>16&15|64]+jn[t>>24&255]+"-"+jn[63&n|128]+jn[n>>8&255]+"-"+jn[n>>16&255]+jn[n>>24&255]+jn[255&r]+jn[r>>8&255]+jn[r>>16&255]+jn[r>>24&255]).toLowerCase()}function Jn(e,t,n){return Math.max(t,Math.min(n,e))}function Kn(e,t){return(e%t+t)%t}function Qn(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function $n(e,t,n){return e!==t?(n-e)/(t-e):0}function er(e,t,n){return(1-n)*e+n*t}function tr(e,t,n,r){return er(e,t,1-Math.exp(-n*r))}function nr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Kn(e,2*t)-t)}function rr(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}function ir(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)}function ar(e,t){return e+Math.floor(Math.random()*(t-e+1))}function or(e,t){return e+Math.random()*(t-e)}function sr(e){return e*(.5-Math.random())}function lr(e){void 0!==e&&(qn=e);var t=qn+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296}function ur(e){return e*Xn}function cr(e){return e*Yn}function hr(e){return 0==(e&e-1)&&0!==e}function dr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function pr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fr(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)}}function vr(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function mr(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var gr=exports.MathUtils=Object.freeze({__proto__:null,DEG2RAD:Xn,RAD2DEG:Yn,generateUUID:Zn,clamp:Jn,euclideanModulo:Kn,mapLinear:Qn,inverseLerp:$n,lerp:er,damp:tr,pingpong:nr,smoothstep:rr,smootherstep:ir,randInt:ar,randFloat:or,randFloatSpread:sr,seededRandom:lr,degToRad:ur,radToDeg:cr,isPowerOfTwo:hr,ceilPowerOfTwo:dr,floorPowerOfTwo:pr,setQuaternionFromProperEuler:fr,normalize:mr,denormalize:vr}),yr=exports.Vector2=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return E(t,[{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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{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}},{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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}},e,this)})}]),t}(),xr=exports.Matrix3=function(){function e(){A(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}return E(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,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{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){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{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],v=r[3],m=r[6],g=r[1],y=r[4],x=r[7],_=r[2],M=r[5],b=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*v+o*y+s*M,i[6]=a*m+o*x+s*b,i[1]=l*f+u*g+c*_,i[4]=l*v+u*y+c*M,i[7]=l*m+u*x+c*b,i[2]=h*f+d*g+p*_,i[5]=h*v+d*y+p*M,i[8]=h*m+d*x+p*b,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=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];return t*a*u-t*o*l-n*i*u+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;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(o*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*s)*f,e[5]=(r*i-o*t)*f,e[6]=d*f,e[7]=(n*s-l*t)*f,e[8]=(a*t-n*i)*f,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{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),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*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],u=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*u,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*u,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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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}();function _r(e){for(var t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}var Mr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function br(e,t){return new Mr[e](t)}function Sr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function wr(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Tr(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Ar=S(S({},fn,S({},vn,wr)),vn,S({},fn,Tr)),kr=exports.ColorManagement={legacyMode:!0,get workingColorSpace(){return vn},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Ar[t]&&void 0!==Ar[t][n]){var r=Ar[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Er={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},Cr={r:0,g:0,b:0},Lr={h:0,s:0,l:0},Rr={h:0,s:0,l:0};function Pr(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Ir(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var Dr,Nr=exports.Color=function(e){function t(e,n,r){return A(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===n&&void 0===r?this.set(e):this.setRGB(e,n,r)}return E(t,[{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){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,kr.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vn;return this.r=e,this.g=t,this.b=n,kr.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vn;if(e=Kn(e,1),t=Jn(t,0,1),n=Jn(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=Pr(a,i,e+1/3),this.g=Pr(a,i,e),this.b=Pr(a,i,e-1/3)}return kr.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,kr.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,kr.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,l,u,n)}}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,kr.toWorkingColorSpace(this,n),this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,kr.toWorkingColorSpace(this,n),this}return e&&e.length>0?this.setColorName(e,n):this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn,n=Er[e.toLowerCase()];return void 0!==n?this.setHex(n,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:"copySRGBToLinear",value:function(e){return this.r=wr(e.r),this.g=wr(e.g),this.b=wr(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Tr(e.r),this.g=Tr(e.g),this.b=Tr(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(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return kr.fromWorkingColorSpace(Ir(this,Cr),e),Jn(255*Cr.r,0,255)<<16^Jn(255*Cr.g,0,255)<<8^Jn(255*Cr.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn;kr.fromWorkingColorSpace(Ir(this,Cr),t);var n,r,i=Cr.r,a=Cr.g,o=Cr.b,s=Math.max(i,a,o),l=Math.min(i,a,o),u=(l+s)/2;if(l===s)n=0,r=0;else{var c=s-l;switch(r=u<=.5?c/(s+l):c/(2-s-l),s){case i:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-i)/c+2;break;case o:n=(i-a)/c+4}n/=6}return e.h=n,e.s=r,e.l=u,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vn;return kr.fromWorkingColorSpace(Ir(this,Cr),t),e.r=Cr.r,e.g=Cr.g,e.b=Cr.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fn;return kr.fromWorkingColorSpace(Ir(this,Cr),e),e!==fn?"color(".concat(e," ").concat(Cr.r," ").concat(Cr.g," ").concat(Cr.b,")"):"rgb(".concat(255*Cr.r|0,",").concat(255*Cr.g|0,",").concat(255*Cr.b|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Lr),Lr.h+=e,Lr.s+=t,Lr.l+=n,this.setHSL(Lr.h,Lr.s,Lr.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(Lr),e.getHSL(Rr);var n=er(Lr.h,Rr.h,t),r=er(Lr.s,Rr.s,t),i=er(Lr.l,Rr.l,t);return this.setHSL(n,r,i),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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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()}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}},e,this)})}]),t}();Nr.NAMES=Er;var Or=exports.ImageUtils=function(){function e(){A(this,e)}return E(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;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Dr&&(Dr=Sr("canvas")),Dr.width=e.width,Dr.height=e.height;var n=Dr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Dr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Sr("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a<i.length;a++)i[a]=255*wr(i[a]/255);return n.putImageData(r,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*wr(o[s]/255)):o[s]=wr(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Fr=exports.Source=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;A(this,e),this.isSource=!0,this.uuid=Zn(),this.data=t,this.version=0}return E(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(zr(r[a].image)):i.push(zr(r[a]))}else i=zr(r);n.url=i}return t||(e.images[this.uuid]=n),n}}]),e}();function zr(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Or.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Br=0,Ur=exports.Texture=function(e){m(n,Wn);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Be,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:qe,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ze,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ct,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Ke,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:sn;return A(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(_(e),"id",{value:Br++}),e.uuid=Zn(),e.name="",e.source=new Fr(r),e.mipmaps=[],e.mapping=i,e.wrapS=a,e.wrapT=o,e.magFilter=s,e.minFilter=l,e.anisotropy=h,e.format=u,e.internalFormat=null,e.type=c,e.offset=new yr(0,0),e.repeat=new yr(1,1),e.center=new yr(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new xr,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=d,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return E(n,[{key:"image",get:function(){return this.source.data},set:function(e){this.source.data=e}},{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.source=e.source,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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,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,image:this.source.toJSON(e).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==Pe)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ze:e.x=e.x-Math.floor(e.x);break;case Be:e.x=e.x<0?0:1;break;case Ue:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ze:e.y=e.y-Math.floor(e.y);break;case Be:e.y=e.y<0?0:1;break;case Ue: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++,this.source.needsUpdate=!0)}}]),n}();Ur.DEFAULT_IMAGE=null,Ur.DEFAULT_MAPPING=Pe;var Gr=exports.Vector4=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}return E(t,[{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,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[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,a=e.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var v=(o+1)/2,m=(c+1)/2,g=(f+1)/2,y=(s+u)/4,x=(l+d)/4,_=(h+p)/4;return v>m&&v>g?v<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(v)),i=x/n):m>g?m<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(m)),i=_/r):g<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=_/i),this.set(n,r,i,t),this}var M=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-s)*(u-s));return Math.abs(M)<.001&&(M=1),this.x=(p-h)/M,this.y=(l-d)/M,this.z=(u-s)/M,this.w=Math.acos((o+c+f-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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}},e,this)})}]),t}(),Vr=exports.WebGLRenderTarget=function(e){m(n,Wn);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};A(this,n),(i=t.call(this)).isWebGLRenderTarget=!0,i.width=e,i.height=r,i.depth=1,i.scissor=new Gr(0,0,e,r),i.scissorTest=!1,i.viewport=new Gr(0,0,e,r);var o={width:e,height:r,depth:1};return i.texture=new Ur(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.flipY=!1,i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:qe,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.samples=void 0!==a.samples?a.samples:0,i}return E(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&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){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Fr(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(),Hr=exports.DataArrayTexture=function(e){m(n,Ur);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=Ge,e.minFilter=Ge,e.wrapR=Be,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),Wr=exports.WebGLArrayRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isWebGLArrayRenderTarget=!0,a.depth=i,a.texture=new Hr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return E(n)}(),jr=exports.Data3DTexture=function(e){m(n,Ur);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:r,width:i,height:a,depth:o},e.magFilter=Ge,e.minFilter=Ge,e.wrapR=Be,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),qr=exports.WebGL3DRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isWebGL3DRenderTarget=!0,a.depth=i,a.texture=new jr(null,e,r,i),a.texture.isRenderTargetTexture=!0,a}return E(n)}(),Xr=exports.WebGLMultipleRenderTargets=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};A(this,n),(a=t.call(this,e,r,o)).isWebGLMultipleRenderTargets=!0;var s=a.texture;a.texture=[];for(var l=0;l<i;l++)a.texture[l]=s.clone(),a.texture[l].isRenderTargetTexture=!0;return a}return E(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&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,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(var t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}]),n}(),Yr=exports.Quaternion=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}return E(t,[{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=Math.sin,l=o(n/2),u=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+u)/f}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+l)/v,this._y=(s+u)/v,this._z=.25*v}return 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._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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(Jn(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),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):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{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,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-i*s,this._y=r*u+a*s+i*o-n*l,this._z=i*u+a*l+n*s-r*o,this._w=a*u-n*o-r*s-i*l,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),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}},e,this)})}],[{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];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f);if(c!==f||s!==h||l!==d||u!==p){var v=1-o,m=s*h+l*d+u*p+c*f,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,m*g);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var M=o*g;if(s=s*v+h*M,l=l*v+d*M,u=u*v+p*M,c=c*v+f*M,v===1-o){var b=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=b,l*=b,u*=b,c*=b}}e[t]=s,e[t+1]=l,e[t+2]=u,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],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=o*p+u*c+s*d-l*h,e[t+1]=s*p+u*h+l*c-o*d,e[t+2]=l*p+u*d+o*h-s*c,e[t+3]=u*p-o*c-s*h-l*d,e}}]),t}(),Zr=exports.Vector3=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;A(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}return E(t,[{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(Kr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Kr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[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,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,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,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+u*-o-c*-a,this.y=u*s+h*-a+c*-i-l*-o,this.z=c*s+h*-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,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[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,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return Jr.copy(this).projectOnVector(e),this.sub(Jr)}},{key:"reflect",value:function(e){return this.sub(Jr.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Jn(n,-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,r=this.z-e.z;return t*t+n*n+r*r}},{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){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,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:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}},e,this)})}]),t}(),Jr=new Zr,Kr=new Yr,Qr=exports.Box3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(-1/0,-1/0,-1/0);A(this,e),this.isBox3=!0,this.min=t,this.max=n}return E(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),u>i&&(i=u),c>a&&(a=c),h>o&&(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),u>i&&(i=u),c>a&&(a=c),h>o&&(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){var n=ei.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{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){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)ei.fromBufferAttribute(r,i).applyMatrix4(e.matrixWorld),this.expandByPoint(ei);else null===n.boundingBox&&n.computeBoundingBox(),ti.copy(n.boundingBox),ti.applyMatrix4(e.matrixWorld),this.union(ti);for(var o=e.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],t);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,ei),ei.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(li),ui.subVectors(this.max,li),ni.subVectors(e.a,li),ri.subVectors(e.b,li),ii.subVectors(e.c,li),ai.subVectors(ri,ni),oi.subVectors(ii,ri),si.subVectors(ni,ii);var t=[0,-ai.z,ai.y,0,-oi.z,oi.y,0,-si.z,si.y,ai.z,0,-ai.x,oi.z,0,-oi.x,si.z,0,-si.x,-ai.y,ai.x,0,-oi.y,oi.x,0,-si.y,si.x,0];return!!di(t,ni,ri,ii,ui)&&(!!di(t=[1,0,0,0,1,0,0,0,1],ni,ri,ii,ui)&&(ci.crossVectors(ai,oi),di(t=[ci.x,ci.y,ci.z],ni,ri,ii,ui)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return ei.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(ei).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()?this:($r[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),$r[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),$r[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),$r[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),$r[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),$r[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),$r[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),$r[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints($r),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}(),$r=[new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr,new Zr],ei=new Zr,ti=new Qr,ni=new Zr,ri=new Zr,ii=new Zr,ai=new Zr,oi=new Zr,si=new Zr,li=new Zr,ui=new Zr,ci=new Zr,hi=new Zr;function di(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){hi.fromArray(e,a);var s=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),l=t.dot(hi),u=n.dot(hi),c=r.dot(hi);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var pi=new Qr,fi=new Zr,vi=new Zr,mi=new Zr,gi=exports.Sphere=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;A(this,e),this.center=t,this.radius=n}return E(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):pi.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):(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){mi.subVectors(e,this.center);var t=mi.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.add(mi.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(e){return!0===this.center.equals(e.center)?vi.set(0,0,1).multiplyScalar(e.radius):vi.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(fi.copy(e.center).add(vi)),this.expandByPoint(fi.copy(e.center).sub(vi)),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}(),yi=new Zr,xi=new Zr,_i=new Zr,Mi=new Zr,bi=new Zr,Si=new Zr,wi=new Zr,Ti=exports.Ray=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(0,0,-1);A(this,e),this.origin=t,this.direction=n}return E(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,yi)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=yi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yi.copy(this.direction).multiplyScalar(t).add(this.origin),yi.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){xi.copy(e).add(t).multiplyScalar(.5),_i.copy(t).sub(e).normalize(),Mi.copy(this.origin).sub(xi);var i,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(_i),c=Mi.dot(this.direction),h=-Mi.dot(_i),d=Mi.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(a=u*c-h,s=l*p,(i=u*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+u*(a*=f)+2*c)+a*(u*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-u*l+c)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(u*l+c)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(_i).multiplyScalar(a).add(xi),o}},{key:"intersectSphere",value:function(e,t){yi.subVectors(e.center,this.origin);var n=yi.dot(this.direction),r=yi.dot(yi)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,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);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,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,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,yi)}},{key:"intersectTriangle",value:function(e,t,n,r,i){bi.subVectors(t,e),Si.subVectors(n,e),wi.crossVectors(bi,Si);var a,o=this.direction.dot(wi);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Mi.subVectors(this.origin,e);var s=a*this.direction.dot(Si.crossVectors(Mi,Si));if(s<0)return null;var l=a*this.direction.dot(bi.cross(Mi));if(l<0)return null;if(s+l>o)return null;var u=-a*Mi.dot(wi);return u<0?null:this.at(u/o,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}(),Ai=exports.Matrix4=function(){function e(){A(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}return E(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,p,f,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=v,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,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[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/ki.setFromMatrixColumn(e,0).length(),i=1/ki.setFromMatrixColumn(e,1).length(),a=1/ki.setFromMatrixColumn(e,2).length();return 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]*a,t[9]=n[9]*a,t[10]=n[10]*a,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=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*u,d=a*c,p=o*u,f=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var x=s*u,_=s*c,M=l*u,b=l*c;t[0]=x-b*o,t[4]=-a*c,t[8]=M+_*o,t[1]=_+M*o,t[5]=a*u,t[9]=b-x*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var S=a*u,w=a*c,T=o*u,A=o*c;t[0]=s*u,t[4]=T*l-w,t[8]=S*l+A,t[1]=s*c,t[5]=A*l+S,t[9]=w*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var k=a*s,E=a*l,C=o*s,L=o*l;t[0]=s*u,t[4]=L-k*c,t[8]=C*c+E,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=E*c+C,t[10]=k-L*c}else if("XZY"===e.order){var R=a*s,P=a*l,I=o*s,D=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=R*c+D,t[5]=a*u,t[9]=P*c-I,t[2]=I*c-P,t[6]=o*u,t[10]=D*c+R}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Ci,e,Li)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Ii.subVectors(e,t),0===Ii.lengthSq()&&(Ii.z=1),Ii.normalize(),Ri.crossVectors(n,Ii),0===Ri.lengthSq()&&(1===Math.abs(n.z)?Ii.x+=1e-4:Ii.z+=1e-4,Ii.normalize(),Ri.crossVectors(n,Ii)),Ri.normalize(),Pi.crossVectors(Ii,Ri),r[0]=Ri.x,r[4]=Pi.x,r[8]=Ii.x,r[1]=Ri.y,r[5]=Pi.y,r[9]=Ii.y,r[2]=Ri.z,r[6]=Pi.z,r[10]=Ii.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],v=n[10],m=n[14],g=n[3],y=n[7],x=n[11],_=n[15],M=r[0],b=r[4],S=r[8],w=r[12],T=r[1],A=r[5],k=r[9],E=r[13],C=r[2],L=r[6],R=r[10],P=r[14],I=r[3],D=r[7],N=r[11],O=r[15];return i[0]=a*M+o*T+s*C+l*I,i[4]=a*b+o*A+s*L+l*D,i[8]=a*S+o*k+s*R+l*N,i[12]=a*w+o*E+s*P+l*O,i[1]=u*M+c*T+h*C+d*I,i[5]=u*b+c*A+h*L+d*D,i[9]=u*S+c*k+h*R+d*N,i[13]=u*w+c*E+h*P+d*O,i[2]=p*M+f*T+v*C+m*I,i[6]=p*b+f*A+v*L+m*D,i[10]=p*S+f*k+v*R+m*N,i[14]=p*w+f*E+v*P+m*O,i[3]=g*M+y*T+x*C+_*I,i[7]=g*b+y*A+x*L+_*D,i[11]=g*S+y*k+x*R+_*N,i[15]=g*w+y*E+x*P+_*O,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,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{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],v=e[14],m=e[15],g=c*v*l-f*h*l+f*s*d-o*v*d-c*s*m+o*h*m,y=p*h*l-u*v*l-p*s*d+a*v*d+u*s*m-a*h*m,x=u*f*l-p*c*l+p*o*d-a*f*d-u*o*m+a*c*m,_=p*c*s-u*f*s-p*o*h+a*f*h+u*o*v-a*c*v,M=t*g+n*y+r*x+i*_;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/M;return e[0]=g*b,e[1]=(f*h*i-c*v*i-f*r*d+n*v*d+c*r*m-n*h*m)*b,e[2]=(o*v*i-f*s*i+f*r*l-n*v*l-o*r*m+n*s*m)*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*v*i-p*h*i+p*r*d-t*v*d-u*r*m+t*h*m)*b,e[6]=(p*s*i-a*v*i-p*r*l+t*v*l+a*r*m-t*s*m)*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*m-t*c*m)*b,e[10]=(a*f*i-p*o*i+p*n*l-t*f*l-a*n*m+t*o*m)*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*v+t*c*v)*b,e[14]=(p*o*r-a*f*r-p*n*s+t*f*s+a*n*v-t*o*v)*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,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{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),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{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,l=i*a,u=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,u*o+n,u*s-r*a,0,l*s-r*o,u*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+i,u=a+a,c=o+o,h=i*l,d=i*u,p=i*c,f=a*u,v=a*c,m=o*c,g=s*l,y=s*u,x=s*c,_=n.x,M=n.y,b=n.z;return r[0]=(1-(f+m))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*M,r[5]=(1-(h+m))*M,r[6]=(v+g)*M,r[7]=0,r[8]=(p+y)*b,r[9]=(v-g)*b,r[10]=(1-(h+f))*b,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=ki.set(r[0],r[1],r[2]).length(),a=ki.set(r[4],r[5],r[6]).length(),o=ki.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],Ei.copy(this);var s=1/i,l=1/a,u=1/o;return Ei.elements[0]*=s,Ei.elements[1]*=s,Ei.elements[2]*=s,Ei.elements[4]*=l,Ei.elements[5]*=l,Ei.elements[6]*=l,Ei.elements[8]*=u,Ei.elements[9]*=u,Ei.elements[10]*=u,t.setFromRotationMatrix(Ei),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/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),c=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,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),c=(t+e)*s,h=(n+r)*l,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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}(),ki=new Zr,Ei=new Ai,Ci=new Zr(0,0,0),Li=new Zr(1,1,1),Ri=new Zr,Pi=new Zr,Ii=new Zr,Di=new Ai,Ni=new Yr,Oi=exports.Euler=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DefaultOrder;A(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}return E(t,[{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=arguments.length>3&&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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Jn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Jn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Jn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Jn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Jn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Jn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-u,d),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 Di.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Di,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Ni.setFromEuler(this),this.setFromQuaternion(Ni,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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:w().mark(function e(){return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}},e,this)})},{key:"toVector3",value:function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}]),t}();Oi.DefaultOrder="XYZ",Oi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Fi=exports.Layers=function(){function e(){A(this,e),this.mask=1}return E(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>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)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}(),zi=0,Bi=new Zr,Ui=new Yr,Gi=new Ai,Vi=new Zr,Hi=new Zr,Wi=new Zr,ji=new Yr,qi=new Zr(1,0,0),Xi=new Zr(0,1,0),Yi=new Zr(0,0,1),Zi={type:"added"},Ji={type:"removed"},Ki=exports.Object3D=function(e){m(n,Wn);var t=y(n);function n(){var e;A(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(_(e),"id",{value:zi++}),e.uuid=Zn(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DefaultUp.clone();var r=new Zr,i=new Oi,a=new Yr,o=new Zr(1,1,1);return i._onChange(function(){a.setFromEuler(i,!1)}),a._onChange(function(){i.setFromQuaternion(a,void 0,!1)}),Object.defineProperties(_(e),{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 Ai},normalMatrix:{value:new xr}}),e.matrix=new Ai,e.matrixWorld=new Ai,e.matrixAutoUpdate=n.DefaultMatrixAutoUpdate,e.matrixWorldNeedsUpdate=!1,e.layers=new Fi,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return E(n,[{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 Ui.setFromAxisAngle(e,t),this.quaternion.multiply(Ui),this}},{key:"rotateOnWorldAxis",value:function(e,t){return Ui.setFromAxisAngle(e,t),this.quaternion.premultiply(Ui),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(qi,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(Xi,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(Yi,e)}},{key:"translateOnAxis",value:function(e,t){return Bi.copy(e).applyQuaternion(this.quaternion),this.position.add(Bi.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(qi,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(Xi,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(Yi,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?Vi.copy(e):Vi.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Hi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gi.lookAt(Hi,Vi,this.up):Gi.lookAt(Vi,Hi,this.up),this.quaternion.setFromRotationMatrix(Gi),r&&(Gi.extractRotation(r.matrixWorld),Ui.setFromRotationMatrix(Gi),this.quaternion.premultiply(Ui.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Zi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Ji)),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(Ji)}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(Hi,e,Wi),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,ji,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),this.matrixWorldNeedsUpdate=!1,e=!0);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:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var u=o[s];i(e.shapes,u)}else i(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(i(e.materials,this.material[h]));r.material=c}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var p=0;p<this.children.length;p++)r.children.push(this.children[p].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(var f=0;f<this.animations.length;f++){var v=this.animations[f];r.animations.push(i(e.animations,v))}}if(t){var m=w(e.geometries),g=w(e.materials),y=w(e.textures),x=w(e.images),_=w(e.shapes),M=w(e.skeletons),b=w(e.animations),S=w(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),M.length>0&&(n.skeletons=M),b.length>0&&(n.animations=b),S.length>0&&(n.nodes=S)}return n.object=r,n;function w(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&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}}]),n}();Ki.DefaultUp=new Zr(0,1,0),Ki.DefaultMatrixAutoUpdate=!0;var Qi=new Zr,$i=new Zr,ea=new Zr,ta=new Zr,na=new Zr,ra=new Zr,ia=new Zr,aa=new Zr,oa=new Zr,sa=new Zr,la=exports.Triangle=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr;A(this,e),this.a=t,this.b=n,this.c=r}return E(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:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(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 Qi.subVectors(this.c,this.b),$i.subVectors(this.a,this.b),.5*Qi.cross($i).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,r,i=this.a,a=this.b,o=this.c;na.subVectors(a,i),ra.subVectors(o,i),aa.subVectors(e,i);var s=na.dot(aa),l=ra.dot(aa);if(s<=0&&l<=0)return t.copy(i);oa.subVectors(e,a);var u=na.dot(oa),c=ra.dot(oa);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(na,n);sa.subVectors(e,o);var d=na.dot(sa),p=ra.dot(sa);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ra,r);var v=u*p-d*c;if(v<=0&&c-u>=0&&d-p>=0)return ia.subVectors(o,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(ia,r);var m=1/(v+f+h);return n=f*m,r=h*m,t.copy(i).addScaledVector(na,n).addScaledVector(ra,r)}},{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){r.subVectors(n,t),Qi.subVectors(e,t),r.cross(Qi);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Qi.subVectors(r,t),$i.subVectors(n,t),ea.subVectors(e,t);var a=Qi.dot(Qi),o=Qi.dot($i),s=Qi.dot(ea),l=$i.dot($i),u=$i.dot(ea),c=a*l-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,p=(a*u-o*s)*h;return i.set(1-d-p,p,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,ta),ta.x>=0&&ta.y>=0&&ta.x+ta.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ta),s.set(0,0),s.addScaledVector(i,ta.x),s.addScaledVector(a,ta.y),s.addScaledVector(o,ta.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Qi.subVectors(n,t),$i.subVectors(e,t),Qi.cross($i).dot(r)<0}}]),e}(),ua=0,ca=exports.Material=function(e){m(n,Wn);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(_(e),"id",{value:ua++}),e.uuid=Zn(),e.name="",e.type="Material",e.blending=Y,e.side=V,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=le,e.blendDst=ue,e.blendEquation=$,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=ye,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Rn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=gn,e.stencilZFail=gn,e.stencilZPass=gn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return E(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",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=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===j;else 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=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(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()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),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.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.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.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Y&&(n.blending=this.blending),this.side!==V&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,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){var r=t.length;n=new Array(r);for(var i=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++}}]),n}(),ha=exports.MeshBasicMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshBasicMaterial=!0,r.type="MeshBasicMaterial",r.color=new Nr(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=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),da=new Zr,pa=new yr,fa=exports.BufferAttribute=function(){function e(t,n,r){if(A(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===r,this.usage=Pn,this.updateRange={offset:0,count:-1},this.version=0}return E(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 Nr),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 yr),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 Zr),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 Gr),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++)pa.fromBufferAttribute(this,t),pa.applyMatrix3(e),this.setXY(t,pa.x,pa.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)da.fromBufferAttribute(this,r),da.applyMatrix3(e),this.setXYZ(r,da.x,da.y,da.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)da.fromBufferAttribute(this,t),da.applyMatrix4(e),this.setXYZ(t,da.x,da.y,da.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)da.fromBufferAttribute(this,t),da.applyNormalMatrix(e),this.setXYZ(t,da.x,da.y,da.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)da.fromBufferAttribute(this,t),da.transformDirection(e),this.setXYZ(t,da.x,da.y,da.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),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.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Pn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}(),va=exports.Int8BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int8Array(e),r,i)}return E(n)}(),ma=exports.Uint8BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint8Array(e),r,i)}return E(n)}(),ga=exports.Uint8ClampedBufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint8ClampedArray(e),r,i)}return E(n)}(),ya=exports.Int16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int16Array(e),r,i)}return E(n)}(),xa=exports.Uint16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint16Array(e),r,i)}return E(n)}(),_a=exports.Int32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Int32Array(e),r,i)}return E(n)}(),Ma=exports.Uint32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Uint32Array(e),r,i)}return E(n)}(),ba=exports.Float16BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,new Uint16Array(e),r,i)).isFloat16BufferAttribute=!0,a}return E(n)}(),Sa=exports.Float32BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Float32Array(e),r,i)}return E(n)}(),wa=exports.Float64BufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){return A(this,n),t.call(this,new Float64Array(e),r,i)}return E(n)}(),Ta=0,Aa=new Ai,ka=new Ki,Ea=new Zr,Ca=new Qr,La=new Qr,Ra=new Zr,Pa=exports.BufferGeometry=function(e){m(n,Wn);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(_(e),"id",{value:Ta++}),e.uuid=Zn(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return E(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(_r(e)?Ma:xa)(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){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{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;if(void 0!==n){var r=(new xr).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Aa.makeRotationFromQuaternion(e),this.applyMatrix4(Aa),this}},{key:"rotateX",value:function(e){return Aa.makeRotationX(e),this.applyMatrix4(Aa),this}},{key:"rotateY",value:function(e){return Aa.makeRotationY(e),this.applyMatrix4(Aa),this}},{key:"rotateZ",value:function(e){return Aa.makeRotationZ(e),this.applyMatrix4(Aa),this}},{key:"translate",value:function(e,t,n){return Aa.makeTranslation(e,t,n),this.applyMatrix4(Aa),this}},{key:"scale",value:function(e,t,n){return Aa.makeScale(e,t,n),this.applyMatrix4(Aa),this}},{key:"lookAt",value:function(e){return ka.lookAt(e),ka.updateMatrix(),this.applyMatrix4(ka.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ea).negate(),this.translate(Ea.x,Ea.y,Ea.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 Sa(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Qr);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 Zr(-1/0,-1/0,-1/0),new Zr(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];Ca.setFromBufferAttribute(i),this.morphTargetsRelative?(Ra.addVectors(this.boundingBox.min,Ca.min),this.boundingBox.expandByPoint(Ra),Ra.addVectors(this.boundingBox.max,Ca.max),this.boundingBox.expandByPoint(Ra)):(this.boundingBox.expandByPoint(Ca.min),this.boundingBox.expandByPoint(Ca.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 gi);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 Zr,1/0);if(e){var n=this.boundingSphere.center;if(Ca.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];La.setFromBufferAttribute(a),this.morphTargetsRelative?(Ra.addVectors(Ca.min,La.min),Ca.expandByPoint(Ra),Ra.addVectors(Ca.max,La.max),Ca.expandByPoint(Ra)):(Ca.expandByPoint(La.min),Ca.expandByPoint(La.max))}Ca.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)Ra.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Ra));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++)Ra.fromBufferAttribute(h,p),d&&(Ea.fromBufferAttribute(e,p),Ra.add(Ea)),o=Math.max(o,n.distanceToSquared(Ra));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:"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;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new fa(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new Zr,u[c]=new Zr;var h=new Zr,d=new Zr,p=new Zr,f=new yr,v=new yr,m=new yr,g=new Zr,y=new Zr,x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(var _=0,M=x.length;_<M;++_)for(var b=x[_],S=b.start,w=S,T=S+b.count;w<T;w+=3)O(n[w+0],n[w+1],n[w+2]);for(var A=new Zr,k=new Zr,E=new Zr,C=new Zr,L=0,R=x.length;L<R;++L)for(var P=x[L],I=P.start,D=I,N=I+P.count;D<N;D+=3)F(n[D+0]),F(n[D+1]),F(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),p.fromArray(r,3*n),f.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),p.sub(h),v.sub(f),m.sub(f);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(p,-v.y).multiplyScalar(i),y.copy(p).multiplyScalar(v.x).addScaledVector(d,-m.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))}function F(e){E.fromArray(i,3*e),C.copy(E);var t=l[e];A.copy(t),A.sub(E.multiplyScalar(E.dot(t))).normalize(),k.crossVectors(C,t);var n=k.dot(u[e])<0?-1:1;s[4*e]=A.x,s[4*e+1]=A.y,s[4*e+2]=A.z,s[4*e+3]=n}}},{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 fa(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 Zr,o=new Zr,s=new Zr,l=new Zr,u=new Zr,c=new Zr,h=new Zr,d=new Zr;if(e)for(var p=0,f=e.count;p<f;p+=3){var v=e.getX(p+0),m=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,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=this.attributes;for(var r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,l=Math.min(o.length,i.length-s),u=0,c=s;u<l;u++,c++)i[c]=o[u];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++)Ra.fromBufferAttribute(e,t),Ra.normalize(),e.setXYZ(t,Ra.x,Ra.y,Ra.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 fa(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=e(i[a],r);t.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var p=e(c[h],r);u.push(p)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,v=0,m=f.length;v<m;v++){var g=f[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{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),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,p=c.length;d<p;d++){var f=c[d];h.push(f.toJSON(e.data))}h.length>0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).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=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,p=0,f=d.length;p<f;p++){var v=d[p];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(),Ia=new Ai,Da=new Ti,Na=new gi,Oa=new Zr,Fa=new Zr,za=new Zr,Ba=new Zr,Ua=new Zr,Ga=new Zr,Va=new Zr,Ha=new Zr,Wa=new Zr,ja=new yr,qa=new yr,Xa=new yr,Ya=new Zr,Za=new Zr,Ja=exports.Mesh=function(e){m(n,Ki);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ha;return A(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}},{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(),Na.copy(n.boundingSphere),Na.applyMatrix4(i),!1!==e.ray.intersectsSphere(Na)&&(Ia.copy(i).invert(),Da.copy(e.ray).applyMatrix4(Ia),null===n.boundingBox||!1!==Da.intersectsBox(n.boundingBox)))){var a,o=n.index,s=n.attributes.position,l=n.morphAttributes.position,u=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,d=n.groups,p=n.drawRange;if(null!==o)if(Array.isArray(r))for(var f=0,v=d.length;f<v;f++)for(var m=d[f],g=r[m.materialIndex],y=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));y<x;y+=3){var _=o.getX(y),M=o.getX(y+1),b=o.getX(y+2);(a=Qa(this,g,e,Da,s,l,u,c,h,_,M,b))&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=m.materialIndex,t.push(a))}else for(var S=Math.max(0,p.start),w=Math.min(o.count,p.start+p.count);S<w;S+=3){var T=o.getX(S),A=o.getX(S+1),k=o.getX(S+2);(a=Qa(this,r,e,Da,s,l,u,c,h,T,A,k))&&(a.faceIndex=Math.floor(S/3),t.push(a))}else if(void 0!==s)if(Array.isArray(r))for(var E=0,C=d.length;E<C;E++)for(var L=d[E],R=r[L.materialIndex],P=Math.max(L.start,p.start),I=Math.min(s.count,Math.min(L.start+L.count,p.start+p.count));P<I;P+=3){(a=Qa(this,R,e,Da,s,l,u,c,h,P,P+1,P+2))&&(a.faceIndex=Math.floor(P/3),a.face.materialIndex=L.materialIndex,t.push(a))}else for(var D=Math.max(0,p.start),N=Math.min(s.count,p.start+p.count);D<N;D+=3){(a=Qa(this,r,e,Da,s,l,u,c,h,D,D+1,D+2))&&(a.faceIndex=Math.floor(D/3),t.push(a))}}}}]),n}();function Ka(e,t,n,r,i,a,o,s){if(null===(t.side===H?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==W,s)))return null;Za.copy(s),Za.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(Za);return l<n.near||l>n.far?null:{distance:l,point:Za.clone(),object:e}}function Qa(e,t,n,r,i,a,o,s,l,u,c,h){Oa.fromBufferAttribute(i,u),Fa.fromBufferAttribute(i,c),za.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(a&&d){Va.set(0,0,0),Ha.set(0,0,0),Wa.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var v=d[p],m=a[p];0!==v&&(Ba.fromBufferAttribute(m,u),Ua.fromBufferAttribute(m,c),Ga.fromBufferAttribute(m,h),o?(Va.addScaledVector(Ba,v),Ha.addScaledVector(Ua,v),Wa.addScaledVector(Ga,v)):(Va.addScaledVector(Ba.sub(Oa),v),Ha.addScaledVector(Ua.sub(Fa),v),Wa.addScaledVector(Ga.sub(za),v)))}Oa.add(Va),Fa.add(Ha),za.add(Wa)}e.isSkinnedMesh&&(e.boneTransform(u,Oa),e.boneTransform(c,Fa),e.boneTransform(h,za));var g=Ka(e,t,n,r,Oa,Fa,za,Ya);if(g){s&&(ja.fromBufferAttribute(s,u),qa.fromBufferAttribute(s,c),Xa.fromBufferAttribute(s,h),g.uv=la.getUV(Ya,Oa,Fa,za,ja,qa,Xa,new yr)),l&&(ja.fromBufferAttribute(l,u),qa.fromBufferAttribute(l,c),Xa.fromBufferAttribute(l,h),g.uv2=la.getUV(Ya,Oa,Fa,za,ja,qa,Xa,new yr));var y={a:u,b:c,c:h,normal:new Zr,materialIndex:0};la.getNormal(Oa,Fa,za,y.normal),g.face=y}return g}var $a=exports.BoxGeometry=exports.BoxBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;A(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=_(e);o=Math.floor(o),s=Math.floor(s),l=Math.floor(l);var c=[],h=[],d=[],p=[],f=0,v=0;function m(e,t,n,r,i,a,o,s,l,m,g){for(var y=a/l,x=o/m,_=a/2,M=o/2,b=s/2,S=l+1,w=m+1,T=0,A=0,k=new Zr,E=0;E<w;E++)for(var C=E*x-M,L=0;L<S;L++){var R=L*y-_;k[e]=R*r,k[t]=C*i,k[n]=b,h.push(k.x,k.y,k.z),k[e]=0,k[t]=0,k[n]=s>0?1:-1,d.push(k.x,k.y,k.z),p.push(L/l),p.push(1-E/m),T+=1}for(var P=0;P<m;P++)for(var I=0;I<l;I++){var D=f+I+S*P,N=f+I+S*(P+1),O=f+(I+1)+S*(P+1),F=f+(I+1)+S*P;c.push(D,N,F),c.push(N,O,F),A+=6}u.addGroup(v,A,g),v+=A,f+=T}return m("z","y","x",-1,-1,a,i,r,l,s,0),m("z","y","x",1,-1,a,i,-r,l,s,1),m("x","z","y",1,1,r,a,i,o,l,2),m("x","z","y",1,-1,r,a,-i,o,l,3),m("x","y","z",1,-1,r,i,a,o,s,4),m("x","y","z",-1,-1,r,i,-a,o,s,5),e.setIndex(c),e.setAttribute("position",new Sa(h,3)),e.setAttribute("normal",new Sa(d,3)),e.setAttribute("uv",new Sa(p,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}();function eo(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function to(e){for(var t={},n=0;n<e.length;n++){var r=eo(e[n]);for(var i in r)t[i]=r[i]}return t}var no=exports.UniformsUtils={clone:eo,merge:to},ro="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",io="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",ao=exports.ShaderMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isShaderMaterial=!0,r.type="ShaderMaterial",r.defines={},r.uniforms={},r.vertexShader=ro,r.fragmentShader=io,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!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),r.setValues(e)),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=eo(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(),oo=exports.Camera=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Ai,e.projectionMatrix=new Ai,e.projectionMatrixInverse=new Ai,e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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){f(b(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){f(b(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(),so=exports.PerspectiveCamera=function(e){m(n,oo);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return A(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=a,e.far=o,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Yn*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*Xn*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Yn*Math.atan(Math.tan(.5*Xn*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=this.near,t=e*Math.tan(.5*Xn*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(),lo=90,uo=1,co=exports.CubeCamera=function(e){m(n,Ki);var t=y(n);function n(e,r,i){var a;if(A(this,n),(a=t.call(this)).type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),x(a);a.renderTarget=i;var o=new so(lo,uo,e,r);o.layers=a.layers,o.up.set(0,-1,0),o.lookAt(new Zr(1,0,0)),a.add(o);var s=new so(lo,uo,e,r);s.layers=a.layers,s.up.set(0,-1,0),s.lookAt(new Zr(-1,0,0)),a.add(s);var l=new so(lo,uo,e,r);l.layers=a.layers,l.up.set(0,0,1),l.lookAt(new Zr(0,1,0)),a.add(l);var u=new so(lo,uo,e,r);u.layers=a.layers,u.up.set(0,0,-1),u.lookAt(new Zr(0,-1,0)),a.add(u);var c=new so(lo,uo,e,r);c.layers=a.layers,c.up.set(0,-1,0),c.lookAt(new Zr(0,0,1)),a.add(c);var h=new so(lo,uo,e,r);return h.layers=a.layers,h.up.set(0,-1,0),h.lookAt(new Zr(0,0,-1)),a.add(h),a}return E(n,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=l(this.children,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],c=r[5],h=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=Ae,e.xr.enabled=!1;var f=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,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=f,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}]),n}(),ho=exports.CubeTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h){var d;return A(this,n),e=void 0!==e?e:[],r=void 0!==r?r:Ie,(d=t.call(this,e,r,i,a,o,s,l,u,c,h)).isCubeTexture=!0,d.flipY=!1,d}return E(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(),po=exports.WebGLCubeRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,n),(r=t.call(this,e,e,i)).isWebGLCubeRenderTarget=!0;var a={width:e,height:e,depth:1},o=[a,a,a,a,a,a];return r.texture=new ho(o,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),r.texture.isRenderTargetTexture=!0,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:qe,r}return E(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\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",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new $a(5,5,5),o=new ao({name:"CubemapFromEquirect",uniforms:eo(n),vertexShader:r,fragmentShader:i,side:H,blending:X});o.uniforms.tEquirect.value=t;var s=new Ja(a,o),l=t.minFilter;return t.minFilter===Ze&&(t.minFilter=qe),new co(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.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)}}]),n}(),fo=new Zr,vo=new Zr,mo=new xr,go=exports.Plane=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return E(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){var r=fo.subVectors(n,t).cross(vo.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(fo),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(n).multiplyScalar(i).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{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){var n=t||mo.getNormalMatrix(e),r=this.coplanarPoint(fo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),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}(),yo=new gi,xo=new Zr,_o=exports.Frustum=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new go,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new go,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new go,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new go,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new go,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new go;A(this,e),this.planes=[t,n,r,i,a,o]}return E(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=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],p=n[10],f=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,c-s,f-h,y-v).normalize(),t[1].setComponents(o+r,c+s,f+h,y+v).normalize(),t[2].setComponents(o+i,c+l,f+d,y+m).normalize(),t[3].setComponents(o-i,c-l,f-d,y-m).normalize(),t[4].setComponents(o-a,c-u,f-p,y-g).normalize(),t[5].setComponents(o+a,c+u,f+p,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),yo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(yo)}},{key:"intersectsSprite",value:function(e){return yo.center.set(0,0,0),yo.radius=.7071067811865476,yo.applyMatrix4(e.matrixWorld),this.intersectsSphere(yo)}},{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(xo.x=r.normal.x>0?e.max.x:e.min.x,xo.y=r.normal.y>0?e.max.y:e.min.y,xo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(xo)<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 Mo(){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 bo(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){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=r.get(t);void 0===o?r.set(t,function(t,r){var i,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(r,s),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)i=5126;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=5131}else i=5123;else if(a instanceof Int16Array)i=5122;else if(a instanceof Uint32Array)i=5125;else if(a instanceof Int32Array)i=5124;else if(a instanceof Int8Array)i=5120;else if(a instanceof Uint8Array)i=5121;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=5121}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,t,i),o.version=t.version)}}}}var So=exports.PlaneGeometry=exports.PlaneBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,n),(e=t.call(this)).type="PlaneGeometry",e.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,v=[],m=[],g=[],y=[],x=0;x<d;x++)for(var _=x*f-l,M=0;M<h;M++){var b=M*p-s;m.push(b,-_,0),g.push(0,0,1),y.push(M/u),y.push(1-x/c)}for(var S=0;S<c;S++)for(var w=0;w<u;w++){var T=w+h*S,k=w+h*(S+1),E=w+1+h*(S+1),C=w+1+h*S;v.push(T,k,C),v.push(k,E,C)}return e.setIndex(v),e.setAttribute("position",new Sa(m,3)),e.setAttribute("normal",new Sa(g,3)),e.setAttribute("uv",new Sa(y,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(),wo="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",To="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Ao="#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",ko="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",Eo="#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.roughness );\n\t#endif\n#endif",Co="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Lo="vec3 transformed = vec3( position );",Ro="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Po="vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\nvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = mix(F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence);\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#endif\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}\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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",Io="#ifdef USE_IRIDESCENCE\nconst mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n);\nvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n}\nvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n}\nfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n}\nvec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( -pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[0] ) * exp( -4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 srgb = XYZ_TO_REC709 * xyz;\n return srgb;\n}\nvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float R21 = R12;\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[0] < iridescenceIOR ) phi23[0] = PI;\n if ( baseIOR[1] < iridescenceIOR ) phi23[1] = PI;\n if ( baseIOR[2] < iridescenceIOR ) phi23[2] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n}\n#endif",Do="#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",No="#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",Oo="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Fo="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",zo="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Bo="#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",Uo="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",Go="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",Vo="#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",Ho="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 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 precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat 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}",Wo="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define 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_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",jo="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",qo="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",Xo="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",Yo="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",Zo="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",Jo="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ko="vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",Qo="#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#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",$o="#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",es="#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",ts="#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",ns="#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",rs="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",is="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",as="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",os="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",ss="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",ls="#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",us="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",cs="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.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\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\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",hs="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",ds="#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",ps="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",fs="varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",vs="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",ms="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",gs="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, 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_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",ys="struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 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#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",xs="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\nfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\nif ( material.iridescenceThickness == 0.0 ) {\n\tmaterial.iridescence = 0.0;\n} else {\n\tmaterial.iridescence = saturate( material.iridescence );\n}\nif ( material.iridescence > 0.0 ) {\n\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= 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\tgetSpotLightInfo( 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\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= 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.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",_s="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",Ms="#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",bs="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Ss="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",ws="#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",Ts="#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",As="#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",ks="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Es="#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\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",Cs="#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",Ls="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Rs="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Ps="#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",Is="#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",Ds="#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",Ns="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",Os="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;",Fs="#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",zs="#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",Bs="#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",Us="#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",Gs="#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",Vs="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",Hs="#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",Ws="#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",js="#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",qs="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",Xs="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}",Ys="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Zs="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",Js="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Ks="#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",Qs="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",$s="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",el="#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",tl="#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",nl="#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",rl="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}",il="#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",al="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",ol="#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",sl="#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",ll="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",ul="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",cl="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",hl="#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; }",dl="#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\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;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",pl="#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in 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\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",fl="#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",vl="#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",ml="#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",gl="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",yl="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",xl="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",_l="#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",Ml="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}",bl="uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Sl="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}",wl="#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}",Tl="#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}",Al="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",kl="#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}",El="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",Cl="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",Ll="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Rl="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 <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Pl="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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Il="#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",Dl="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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <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\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Nl="#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 <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <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}",Ol="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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <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_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_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Fl="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",zl="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Bl="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",Ul="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",Gl="#define PHONG\nvarying vec3 vViewPosition;\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 <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Vl="#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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Hl="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",Wl="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",jl="#define TOON\nvarying vec3 vViewPosition;\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 <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",ql="#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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Xl="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 <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",Yl="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Zl="#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Jl="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}",Kl="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}",Ql="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",$l=exports.ShaderChunk={alphamap_fragment:wo,alphamap_pars_fragment:To,alphatest_fragment:Ao,alphatest_pars_fragment:ko,aomap_fragment:Eo,aomap_pars_fragment:Co,begin_vertex:Lo,beginnormal_vertex:Ro,bsdfs:Po,iridescence_fragment:Io,bumpmap_pars_fragment:Do,clipping_planes_fragment:No,clipping_planes_pars_fragment:Oo,clipping_planes_pars_vertex:Fo,clipping_planes_vertex:zo,color_fragment:Bo,color_pars_fragment:Uo,color_pars_vertex:Go,color_vertex:Vo,common:Ho,cube_uv_reflection_fragment:Wo,defaultnormal_vertex:jo,displacementmap_pars_vertex:qo,displacementmap_vertex:Xo,emissivemap_fragment:Yo,emissivemap_pars_fragment:Zo,encodings_fragment:Jo,encodings_pars_fragment:Ko,envmap_fragment:Qo,envmap_common_pars_fragment:$o,envmap_pars_fragment:es,envmap_pars_vertex:ts,envmap_physical_pars_fragment:ds,envmap_vertex:ns,fog_vertex:rs,fog_pars_vertex:is,fog_fragment:as,fog_pars_fragment:os,gradientmap_pars_fragment:ss,lightmap_fragment:ls,lightmap_pars_fragment:us,lights_lambert_vertex:cs,lights_pars_begin:hs,lights_toon_fragment:ps,lights_toon_pars_fragment:fs,lights_phong_fragment:vs,lights_phong_pars_fragment:ms,lights_physical_fragment:gs,lights_physical_pars_fragment:ys,lights_fragment_begin:xs,lights_fragment_maps:_s,lights_fragment_end:Ms,logdepthbuf_fragment:bs,logdepthbuf_pars_fragment:Ss,logdepthbuf_pars_vertex:ws,logdepthbuf_vertex:Ts,map_fragment:As,map_pars_fragment:ks,map_particle_fragment:Es,map_particle_pars_fragment:Cs,metalnessmap_fragment:Ls,metalnessmap_pars_fragment:Rs,morphcolor_vertex:Ps,morphnormal_vertex:Is,morphtarget_pars_vertex:Ds,morphtarget_vertex:Ns,normal_fragment_begin:Os,normal_fragment_maps:Fs,normal_pars_fragment:zs,normal_pars_vertex:Bs,normal_vertex:Us,normalmap_pars_fragment:Gs,clearcoat_normal_fragment_begin:Vs,clearcoat_normal_fragment_maps:Hs,clearcoat_pars_fragment:Ws,iridescence_pars_fragment:js,output_fragment:qs,packing:Xs,premultiplied_alpha_fragment:Ys,project_vertex:Zs,dithering_fragment:Js,dithering_pars_fragment:Ks,roughnessmap_fragment:Qs,roughnessmap_pars_fragment:$s,shadowmap_pars_fragment:el,shadowmap_pars_vertex:tl,shadowmap_vertex:nl,shadowmask_pars_fragment:rl,skinbase_vertex:il,skinning_pars_vertex:al,skinning_vertex:ol,skinnormal_vertex:sl,specularmap_fragment:ll,specularmap_pars_fragment:ul,tonemapping_fragment:cl,tonemapping_pars_fragment:hl,transmission_fragment:dl,transmission_pars_fragment:pl,uv_pars_fragment:fl,uv_pars_vertex:vl,uv_vertex:ml,uv2_pars_fragment:gl,uv2_pars_vertex:yl,uv2_vertex:xl,worldpos_vertex:_l,background_vert:Ml,background_frag:bl,cube_vert:Sl,cube_frag:wl,depth_vert:Tl,depth_frag:Al,distanceRGBA_vert:kl,distanceRGBA_frag:El,equirect_vert:Cl,equirect_frag:Ll,linedashed_vert:Rl,linedashed_frag:Pl,meshbasic_vert:Il,meshbasic_frag:Dl,meshlambert_vert:Nl,meshlambert_frag:Ol,meshmatcap_vert:Fl,meshmatcap_frag:zl,meshnormal_vert:Bl,meshnormal_frag:Ul,meshphong_vert:Gl,meshphong_frag:Vl,meshphysical_vert:Hl,meshphysical_frag:Wl,meshtoon_vert:jl,meshtoon_frag:ql,points_vert:Xl,points_frag:Yl,shadow_vert:Zl,shadow_frag:Jl,sprite_vert:Kl,sprite_frag:Ql},eu=exports.UniformsLib={common:{diffuse:{value:new Nr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new xr},uv2Transform:{value:new xr},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new yr(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 Nr(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 Nr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xr}},sprite:{diffuse:{value:new Nr(16777215)},opacity:{value:1},center:{value:new yr(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xr}}},tu=exports.ShaderLib={basic:{uniforms:to([eu.common,eu.specularmap,eu.envmap,eu.aomap,eu.lightmap,eu.fog]),vertexShader:$l.meshbasic_vert,fragmentShader:$l.meshbasic_frag},lambert:{uniforms:to([eu.common,eu.specularmap,eu.envmap,eu.aomap,eu.lightmap,eu.emissivemap,eu.fog,eu.lights,{emissive:{value:new Nr(0)}}]),vertexShader:$l.meshlambert_vert,fragmentShader:$l.meshlambert_frag},phong:{uniforms:to([eu.common,eu.specularmap,eu.envmap,eu.aomap,eu.lightmap,eu.emissivemap,eu.bumpmap,eu.normalmap,eu.displacementmap,eu.fog,eu.lights,{emissive:{value:new Nr(0)},specular:{value:new Nr(1118481)},shininess:{value:30}}]),vertexShader:$l.meshphong_vert,fragmentShader:$l.meshphong_frag},standard:{uniforms:to([eu.common,eu.envmap,eu.aomap,eu.lightmap,eu.emissivemap,eu.bumpmap,eu.normalmap,eu.displacementmap,eu.roughnessmap,eu.metalnessmap,eu.fog,eu.lights,{emissive:{value:new Nr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$l.meshphysical_vert,fragmentShader:$l.meshphysical_frag},toon:{uniforms:to([eu.common,eu.aomap,eu.lightmap,eu.emissivemap,eu.bumpmap,eu.normalmap,eu.displacementmap,eu.gradientmap,eu.fog,eu.lights,{emissive:{value:new Nr(0)}}]),vertexShader:$l.meshtoon_vert,fragmentShader:$l.meshtoon_frag},matcap:{uniforms:to([eu.common,eu.bumpmap,eu.normalmap,eu.displacementmap,eu.fog,{matcap:{value:null}}]),vertexShader:$l.meshmatcap_vert,fragmentShader:$l.meshmatcap_frag},points:{uniforms:to([eu.points,eu.fog]),vertexShader:$l.points_vert,fragmentShader:$l.points_frag},dashed:{uniforms:to([eu.common,eu.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$l.linedashed_vert,fragmentShader:$l.linedashed_frag},depth:{uniforms:to([eu.common,eu.displacementmap]),vertexShader:$l.depth_vert,fragmentShader:$l.depth_frag},normal:{uniforms:to([eu.common,eu.bumpmap,eu.normalmap,eu.displacementmap,{opacity:{value:1}}]),vertexShader:$l.meshnormal_vert,fragmentShader:$l.meshnormal_frag},sprite:{uniforms:to([eu.sprite,eu.fog]),vertexShader:$l.sprite_vert,fragmentShader:$l.sprite_frag},background:{uniforms:{uvTransform:{value:new xr},t2D:{value:null}},vertexShader:$l.background_vert,fragmentShader:$l.background_frag},cube:{uniforms:to([eu.envmap,{opacity:{value:1}}]),vertexShader:$l.cube_vert,fragmentShader:$l.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$l.equirect_vert,fragmentShader:$l.equirect_frag},distanceRGBA:{uniforms:to([eu.common,eu.displacementmap,{referencePosition:{value:new Zr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$l.distanceRGBA_vert,fragmentShader:$l.distanceRGBA_frag},shadow:{uniforms:to([eu.lights,eu.fog,{color:{value:new Nr(0)},opacity:{value:1}}]),vertexShader:$l.shadow_vert,fragmentShader:$l.shadow_frag}};function nu(e,t,n,r,i,a){var o,s,l=new Nr(0),u=!0===i?0:1,c=null,h=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,a)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),p(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){p(l,u=e)},render:function(n,i){var a=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=t.get(f));var v=e.xr,m=v.getSession&&v.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?p(l,u):f&&f.isColor&&(p(f,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.mapping===Fe)?(void 0===s&&((s=new Ja(new $a(1,1,1),new ao({name:"BackgroundCubeMaterial",uniforms:eo(tu.cube.uniforms),vertexShader:tu.cube.vertexShader,fragmentShader:tu.cube.fragmentShader,side:H,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=f,s.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,c===f&&h===f.version&&d===e.toneMapping||(s.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),s.layers.enableAll(),n.unshift(s,s.geometry,s.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new Ja(new So(2,2),new ao({name:"BackgroundMaterial",uniforms:eo(tu.background.uniforms),vertexShader:tu.background.vertexShader,fragmentShader:tu.background.fragmentShader,side:V,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&h===f.version&&d===e.toneMapping||(o.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function ru(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=p(null),u=l,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(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 f(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(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 g(){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 y(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 x(){_(),c=!0,u!==l&&h((u=l).object)}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,d,x,_){var M=!1;if(o){var b=function(t,n,i){var o=!0===i.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var u=l[n.id];void 0===u&&(u={},l[n.id]=u);var c=u[o];return void 0===c&&(c=p(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[o]=c),c}(x,d,l);u!==b&&h((u=b).object),(M=function(e,t,n,r){var i=u.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var l in s){var c=s[l];if(c.location>=0){var h=i[l],d=a[l];if(void 0===d&&("instanceMatrix"===l&&e.instanceMatrix&&(d=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(d=e.instanceColor)),void 0===h)return!0;if(h.attribute!==d)return!0;if(d&&h.data!==d.data)return!0;o++}}return u.attributesNum!==o||u.index!==r}(i,x,d,_))&&function(e,t,n,r){var i={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s){var c=s[l];if(c.location>=0){var h=a[l];void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor));var d={};d.attribute=h,h&&h.data&&(d.data=h.data),i[l]=d,o++}}u.attributes=i,u.attributesNum=o,u.index=r}(i,x,d,_)}else{var S=!0===l.wireframe;u.geometry===x.id&&u.program===d.id&&u.wireframe===S||(u.geometry=x.id,u.program=d.id,u.wireframe=S,M=!0)}null!==_&&n.update(_,34963),(M||c)&&(c=!1,function(i,a,o,s){if(!1!==r.isWebGL2||!i.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){f();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var p=l[h];if(void 0===p&&("instanceMatrix"===h&&i.instanceMatrix&&(p=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(p=i.instanceColor)),void 0!==p){var x=p.normalized,_=p.itemSize,M=n.get(p);if(void 0===M)continue;var b=M.buffer,S=M.type,w=M.bytesPerElement;if(p.isInterleavedBufferAttribute){var T=p.data,A=T.stride,k=p.offset;if(T.isInstancedInterleavedBuffer){for(var E=0;E<d.locationSize;E++)m(d.location+E,T.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)}else for(var C=0;C<d.locationSize;C++)v(d.location+C);e.bindBuffer(34962,b);for(var L=0;L<d.locationSize;L++)y(d.location+L,_/d.locationSize,S,x,A*w,(k+_/d.locationSize*L)*w)}else{if(p.isInstancedBufferAttribute){for(var R=0;R<d.locationSize;R++)m(d.location+R,p.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=p.meshPerAttribute*p.count)}else for(var P=0;P<d.locationSize;P++)v(d.location+P);e.bindBuffer(34962,b);for(var I=0;I<d.locationSize;I++)y(d.location+I,_/d.locationSize,S,x,_*w,_/d.locationSize*I*w)}}else if(void 0!==c){var D=c[h];if(void 0!==D)switch(D.length){case 2:e.vertexAttrib2fv(d.location,D);break;case 3:e.vertexAttrib3fv(d.location,D);break;case 4:e.vertexAttrib4fv(d.location,D);break;default:e.vertexAttrib1fv(d.location,D)}}}}g()}}(i,l,d,x),null!==_&&e.bindBuffer(34963,n.get(_).buffer))},reset:x,resetDefaultState:_,dispose:function(){for(var e in x(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)d(r[i].object),delete r[i];delete n[e.id]}}},initAttributes:f,enableAttribute:v,disableUnusedAttributes:g}}function iu(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 au(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"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);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function ou(e){var t=this,n=null,r=0,i=!1,a=!1,o=new go,s=new xr,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),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){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,p=r;d!==a;++d,p+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(u,p),u[p+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,f=e.get(t);if(!i||null===h||0===h.length||a&&!p)a?c(null):u();else{var v=a?0:r,m=4*v,g=f.clippingState||null;l.value=g,g=c(h,o,m,s);for(var y=0;y!==m;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function su(e){var t=new WeakMap;function n(e,t){return t===Ne?e.mapping=Ie:t===Oe&&(e.mapping=De),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(a===Ne||a===Oe){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new po(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}tu.physical={uniforms:to([tu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new yr(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Nr(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new yr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Nr(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Nr(1,1,1)},specularColorMap:{value:null}}]),vertexShader:$l.meshphysical_vert,fragmentShader:$l.meshphysical_frag};var lu=exports.OrthographicCamera=function(e){m(n,oo);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return A(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=a,e.bottom=o,e.near=s,e.far=l,e.updateProjectionMatrix(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{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,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(),uu=4,cu=[.125,.215,.35,.446,.526,.582],hu=20,du=new lu,pu=new Nr,fu=null,vu=(1+Math.sqrt(5))/2,mu=1/vu,gu=[new Zr(1,1,1),new Zr(-1,1,1),new Zr(1,1,-1),new Zr(-1,1,-1),new Zr(0,vu,mu),new Zr(0,vu,-mu),new Zr(mu,0,vu),new Zr(-mu,0,vu),new Zr(vu,mu,0),new Zr(-vu,mu,0)],yu=exports.PMREMGenerator=function(){function e(t){A(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return E(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;fu=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=wu(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Su(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(fu),e.scissorTest=!1,Mu(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e,t){e.mapping===Ie||e.mapping===De?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),fu=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qe,minFilter:qe,generateMipmaps:!1,type:it,format:ct,encoding:sn,depthBuffer:!1},r=_u(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_u(e,t,n);var i=this._lodMax,a=xu(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=bu(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new Ja(this._lodPlanes[0],e);this._renderer.compile(t,du)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new so(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.toneMapping;s.getClearColor(pu),s.toneMapping=Ae,s.autoClear=!1;var c=new ha({name:"PMREM.Background",side:H,depthWrite:!1,depthTest:!1}),h=new Ja(new $a,c),d=!1,p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,d=!0):(c.color.copy(pu),d=!0);for(var f=0;f<6;f++){var v=f%3;0===v?(i.up.set(0,a[f],0),i.lookAt(o[f],0,0)):1===v?(i.up.set(0,0,a[f]),i.lookAt(0,o[f],0)):(i.up.set(0,a[f],0),i.lookAt(0,0,o[f]));var m=this._cubeSize;Mu(r,v*m,f>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=p}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===Ie||e.mapping===De;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=wu()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Su());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new Ja(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;Mu(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,du)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=gu[(r-1)%gu.length];this._blur(e,r-1,r,i,a)}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 Ja(this._lodPlanes[r],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/(2*hu-1),p=i/d,f=isFinite(i)?1+Math.floor(3*p):hu;f>hu&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(hu));for(var v=[],m=0,g=0;g<hu;++g){var y=g/p,x=Math.exp(-y*y/2);v.push(x),0===g?m+=x:g<f&&(m+=2*x)}for(var _=0;_<v.length;_++)v[_]=v[_]/m;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var b=this._sizeLods[r];Mu(t,3*b*(r>M-uu?r-M+uu:0),4*(this._cubeSize-b),3*b,2*b),s.setRenderTarget(t),s.render(u,du)}}]),e}();function xu(e){for(var t=[],n=[],r=[],i=e,a=e-uu+1+cu.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var l=1/s;o>e-uu?l=cu[o-e+uu-1]:0===o&&(l=0),r.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=new Float32Array(108),f=new Float32Array(72),v=new Float32Array(36),m=0;m<6;m++){var g=m%3*2/3-1,y=m>2?0:-1,x=[g,y,0,g+2/3,y,0,g+2/3,y+1,0,g,y,0,g+2/3,y+1,0,g,y+1,0];p.set(x,18*m),f.set(d,12*m);var _=[m,m,m,m,m,m];v.set(_,6*m)}var M=new Pa;M.setAttribute("position",new fa(p,3)),M.setAttribute("uv",new fa(f,2)),M.setAttribute("faceIndex",new fa(v,1)),t.push(M),i>uu&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function _u(e,t,n){var r=new Vr(e,t,n);return r.texture.mapping=Fe,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Mu(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function bu(e,t,n){var r=new Float32Array(hu),i=new Zr(0,1,0);return new ao({name:"SphericalGaussianBlur",defines:{n:hu,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function Su(){return new ao({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function wu(){return new ao({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Tu(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:X,depthTest:!1,depthWrite:!1})}function Tu(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Au(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=a===Ne||a===Oe,s=a===Ie||a===De;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var l=t.get(i);return null===n&&(n=new yu(e)),l=o?n.fromEquirectangular(i,l):n.fromCubemap(i,l),t.set(i,l),l.texture}if(t.has(i))return t.get(i).texture;var u=i.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(u)){null===n&&(n=new yu(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ku(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,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"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Eu(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var u=a.get(s);u&&(t.remove(u),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{var p=i.array;o=i.version;for(var f=0,v=p.length/3-1;f<v;f+=3){var m=f+0,g=f+1,y=f+2;n.push(m,g,g,y,y,m)}}var x=new(_r(n)?Ma:xa)(n,1);x.version=o;var _=a.get(e);_&&t.remove(_),a.set(e,x)}return{get:function(e,t){return!0===i[t.id]?t:(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++,t)},update:function(e){var n=e.attributes;for(var r in n)t.update(n[r],34962);var i=e.morphAttributes;for(var a in i)for(var o=i[a],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function Cu(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 Lu(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 Ru(e,t){return e[0]-t[0]}function Pu(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Iu(e,t){var n=1,r=t.isInterleavedBufferAttribute?t.data.array:t.array;r instanceof Int8Array?n=127:r instanceof Uint8Array?n=255:r instanceof Uint16Array?n=65535:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),e.divideScalar(n)}function Du(e,t,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new Gr,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c,h){var d=l.morphTargetInfluences;if(!0===t.isWebGL2){var p=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,f=void 0!==p?p.length:0,v=a.get(u);if(void 0===v||v.count!==f){void 0!==v&&v.texture.dispose();var m=void 0!==u.morphAttributes.position,g=void 0!==u.morphAttributes.normal,y=void 0!==u.morphAttributes.color,x=u.morphAttributes.position||[],_=u.morphAttributes.normal||[],M=u.morphAttributes.color||[],b=0;!0===m&&(b=1),!0===g&&(b=2),!0===y&&(b=3);var S=u.attributes.position.count*b,w=1;S>t.maxTextureSize&&(w=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var T=new Float32Array(S*w*4*f),A=new Hr(T,S,w,f);A.type=rt,A.needsUpdate=!0;for(var k=4*b,E=0;E<f;E++)for(var C=x[E],L=_[E],R=M[E],P=S*w*4*E,I=0;I<C.count;I++){var D=I*k;!0===m&&(o.fromBufferAttribute(C,I),!0===C.normalized&&Iu(o,C),T[P+D+0]=o.x,T[P+D+1]=o.y,T[P+D+2]=o.z,T[P+D+3]=0),!0===g&&(o.fromBufferAttribute(L,I),!0===L.normalized&&Iu(o,L),T[P+D+4]=o.x,T[P+D+5]=o.y,T[P+D+6]=o.z,T[P+D+7]=0),!0===y&&(o.fromBufferAttribute(R,I),!0===R.normalized&&Iu(o,R),T[P+D+8]=o.x,T[P+D+9]=o.y,T[P+D+10]=o.z,T[P+D+11]=4===R.itemSize?o.w:1)}v={count:f,texture:A,size:new yr(S,w)},a.set(u,v),u.addEventListener("dispose",function e(){A.dispose(),a.delete(u),u.removeEventListener("dispose",e)})}for(var N=0,O=0;O<d.length;O++)N+=d[O];var F=u.morphTargetsRelative?1:1-N;h.getUniforms().setValue(e,"morphTargetBaseInfluence",F),h.getUniforms().setValue(e,"morphTargetInfluences",d),h.getUniforms().setValue(e,"morphTargetsTexture",v.texture,n),h.getUniforms().setValue(e,"morphTargetsTextureSize",v.size)}else{var z=void 0===d?0:d.length,B=r[u.id];if(void 0===B||B.length!==z){B=[];for(var U=0;U<z;U++)B[U]=[U,0];r[u.id]=B}for(var G=0;G<z;G++){var V=B[G];V[0]=G,V[1]=d[G]}B.sort(Pu);for(var H=0;H<8;H++)H<z&&B[H][1]?(s[H][0]=B[H][0],s[H][1]=B[H][1]):(s[H][0]=Number.MAX_SAFE_INTEGER,s[H][1]=0);s.sort(Ru);for(var W=u.morphAttributes.position,j=u.morphAttributes.normal,q=0,X=0;X<8;X++){var Y=s[X],Z=Y[0],J=Y[1];Z!==Number.MAX_SAFE_INTEGER&&J?(W&&u.getAttribute("morphTarget"+X)!==W[Z]&&u.setAttribute("morphTarget"+X,W[Z]),j&&u.getAttribute("morphNormal"+X)!==j[Z]&&u.setAttribute("morphNormal"+X,j[Z]),i[X]=J,q+=J):(W&&!0===u.hasAttribute("morphTarget"+X)&&u.deleteAttribute("morphTarget"+X),j&&!0===u.hasAttribute("morphNormal"+X)&&u.deleteAttribute("morphNormal"+X),i[X]=0)}var K=u.morphTargetsRelative?1:1-q;h.getUniforms().setValue(e,"morphTargetBaseInfluence",K),h.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function Nu(e,t,n,r){var i=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){var o=r.render.frame,s=e.geometry,l=t.get(e,s);return i.get(l)!==o&&(t.update(l),i.set(l,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)),l},dispose:function(){i=new WeakMap}}}var Ou=new Ur,Fu=new Hr,zu=new jr,Bu=new ho,Uu=[],Gu=[],Vu=new Float32Array(16),Hu=new Float32Array(9),Wu=new Float32Array(4);function ju(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=Uu[i];if(void 0===a&&(a=new Float32Array(i),Uu[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function qu(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Xu(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Yu(e,t){var n=Gu[t];void 0===n&&(n=new Int32Array(t),Gu[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Zu(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ju(e,t){var n=this.cache;if(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);else{if(qu(n,t))return;e.uniform2fv(this.addr,t),Xu(n,t)}}function Ku(e,t){var n=this.cache;if(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);else if(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);else{if(qu(n,t))return;e.uniform3fv(this.addr,t),Xu(n,t)}}function Qu(e,t){var n=this.cache;if(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);else{if(qu(n,t))return;e.uniform4fv(this.addr,t),Xu(n,t)}}function $u(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(qu(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Xu(n,t)}else{if(qu(n,r))return;Wu.set(r),e.uniformMatrix2fv(this.addr,!1,Wu),Xu(n,r)}}function ec(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(qu(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Xu(n,t)}else{if(qu(n,r))return;Hu.set(r),e.uniformMatrix3fv(this.addr,!1,Hu),Xu(n,r)}}function tc(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(qu(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Xu(n,t)}else{if(qu(n,r))return;Vu.set(r),e.uniformMatrix4fv(this.addr,!1,Vu),Xu(n,r)}}function nc(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function rc(e,t){var n=this.cache;qu(n,t)||(e.uniform2iv(this.addr,t),Xu(n,t))}function ic(e,t){var n=this.cache;qu(n,t)||(e.uniform3iv(this.addr,t),Xu(n,t))}function ac(e,t){var n=this.cache;qu(n,t)||(e.uniform4iv(this.addr,t),Xu(n,t))}function oc(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function sc(e,t){var n=this.cache;qu(n,t)||(e.uniform2uiv(this.addr,t),Xu(n,t))}function lc(e,t){var n=this.cache;qu(n,t)||(e.uniform3uiv(this.addr,t),Xu(n,t))}function uc(e,t){var n=this.cache;qu(n,t)||(e.uniform4uiv(this.addr,t),Xu(n,t))}function cc(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||Ou,i)}function hc(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||zu,i)}function dc(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||Bu,i)}function pc(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Fu,i)}function fc(e){switch(e){case 5126:return Zu;case 35664:return Ju;case 35665:return Ku;case 35666:return Qu;case 35674:return $u;case 35675:return ec;case 35676:return tc;case 5124:case 35670:return nc;case 35667:case 35671:return rc;case 35668:case 35672:return ic;case 35669:case 35673:return ac;case 5125:return oc;case 36294:return sc;case 36295:return lc;case 36296:return uc;case 35678:case 36198:case 36298:case 36306:case 35682:return cc;case 35679:case 36299:case 36307:return hc;case 35680:case 36300:case 36308:case 36293:return dc;case 36289:case 36303:case 36311:case 36292:return pc}}function vc(e,t){e.uniform1fv(this.addr,t)}function mc(e,t){var n=ju(t,this.size,2);e.uniform2fv(this.addr,n)}function gc(e,t){var n=ju(t,this.size,3);e.uniform3fv(this.addr,n)}function yc(e,t){var n=ju(t,this.size,4);e.uniform4fv(this.addr,n)}function xc(e,t){var n=ju(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function _c(e,t){var n=ju(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Mc(e,t){var n=ju(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function bc(e,t){e.uniform1iv(this.addr,t)}function Sc(e,t){e.uniform2iv(this.addr,t)}function wc(e,t){e.uniform3iv(this.addr,t)}function Tc(e,t){e.uniform4iv(this.addr,t)}function Ac(e,t){e.uniform1uiv(this.addr,t)}function kc(e,t){e.uniform2uiv(this.addr,t)}function Ec(e,t){e.uniform3uiv(this.addr,t)}function Cc(e,t){e.uniform4uiv(this.addr,t)}function Lc(e,t,n){var r=t.length,i=Yu(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2D(t[a]||Ou,i[a])}function Rc(e,t,n){var r=t.length,i=Yu(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture3D(t[a]||zu,i[a])}function Pc(e,t,n){var r=t.length,i=Yu(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTextureCube(t[a]||Bu,i[a])}function Ic(e,t,n){var r=t.length,i=Yu(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2DArray(t[a]||Fu,i[a])}function Dc(e){switch(e){case 5126:return vc;case 35664:return mc;case 35665:return gc;case 35666:return yc;case 35674:return xc;case 35675:return _c;case 35676:return Mc;case 5124:case 35670:return bc;case 35667:case 35671:return Sc;case 35668:case 35672:return wc;case 35669:case 35673:return Tc;case 5125:return Ac;case 36294:return kc;case 36295:return Ec;case 36296:return Cc;case 35678:case 36198:case 36298:case 36306:case 35682:return Lc;case 35679:case 36299:case 36307:return Rc;case 35680:case 36300:case 36308:case 36293:return Pc;case 36289:case 36303:case 36311:case 36292:return Ic}}var Nc=E(function e(t,n,r){A(this,e),this.id=t,this.addr=r,this.cache=[],this.setValue=fc(n.type)}),Oc=E(function e(t,n,r){A(this,e),this.id=t,this.addr=r,this.cache=[],this.size=n.size,this.setValue=Dc(n.type)}),Fc=function(){function e(t){A(this,e),this.id=t,this.seq=[],this.map={}}return E(e,[{key:"setValue",value: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)}}}]),e}(),zc=/(\w+)(\])?(\[|\.)?/g;function Bc(e,t){e.seq.push(t),e.map[t.id]=t}function Uc(e,t,n){var r=e.name,i=r.length;for(zc.lastIndex=0;;){var a=zc.exec(r),o=zc.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===i){Bc(n,void 0===u?new Nc(s,e,t):new Oc(s,e,t));break}var c=n.map[s];void 0===c&&Bc(n,c=new Fc(s)),n=c}}var Gc=function(){function e(t,n){A(this,e),this.seq=[],this.map={};for(var r=t.getProgramParameter(n,35718),i=0;i<r;++i){var a=t.getActiveUniform(n,i);Uc(a,t.getUniformLocation(n,a.name),this)}}return E(e,[{key:"setValue",value:function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)}},{key:"setOptional",value:function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)}}],[{key:"upload",value: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)}}},{key:"seqWithValue",value: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}}]),e}();function Vc(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var Hc=0;function Wc(e,t){for(var n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length),o=i;o<a;o++){var s=o+1;r.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}function jc(e){switch(e){case sn:return["Linear","( value )"];case ln:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function qc(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=/ERROR: 0:(\d+)/.exec(i);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+Wc(e.getShaderSource(t),o)}return i}function Xc(e,t){var n=jc(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Yc(e,t){var n;switch(t){case ke:n="Linear";break;case Ee:n="Reinhard";break;case Ce:n="OptimizedCineon";break;case Le:n="ACESFilmic";break;case Re:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Zc(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Qc).join("\n")}function Jc(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}function Kc(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name,s=1;35674===a.type&&(s=2),35675===a.type&&(s=3),35676===a.type&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}function Qc(e){return""!==e}function $c(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 eh(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var th=/^[ \t]*#include +<([\w\d./]+)>/gm;function nh(e){return e.replace(th,rh)}function rh(e,t){var n=$l[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return nh(n)}var ih=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ah=/#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 oh(e){return e.replace(ah,lh).replace(ih,sh)}function sh(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),lh(e,t,n,r)}function lh(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 uh(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 ch(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===B?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===U?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===G&&(t="SHADOWMAP_TYPE_VSM"),t}function hh(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Ie:case De:t="ENVMAP_TYPE_CUBE";break;case Fe:t="ENVMAP_TYPE_CUBE_UV"}return t}function dh(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case De:t="ENVMAP_MODE_REFRACTION"}return t}function ph(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case Se:t="ENVMAP_BLENDING_MULTIPLY";break;case we:t="ENVMAP_BLENDING_MIX";break;case Te:t="ENVMAP_BLENDING_ADD"}return t}function fh(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function vh(e,t,n,r){var i,a,o=e.getContext(),s=n.defines,l=n.vertexShader,u=n.fragmentShader,c=ch(n),h=hh(n),d=dh(n),p=ph(n),f=fh(n),v=n.isWebGL2?"":Zc(n),m=Jc(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[m].filter(Qc).join("\n")).length>0&&(i+="\n"),(a=[v,m].filter(Qc).join("\n")).length>0&&(a+="\n")):(i=[uh(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+d:"",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.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",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.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",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.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Qc).join("\n"),a=[v,uh(n),"#define SHADER_NAME "+n.shaderName,m,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 "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",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.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Ae?"#define TONE_MAPPING":"",n.toneMapping!==Ae?$l.tonemapping_pars_fragment:"",n.toneMapping!==Ae?Yc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",$l.encodings_pars_fragment,Xc("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Qc).join("\n")),l=eh(l=$c(l=nh(l),n),n),u=eh(u=$c(u=nh(u),n),n),l=oh(l),u=oh(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Vn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Vn?"":"#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);var x,_,M=y+a+u,b=Vc(o,35633,y+i+l),S=Vc(o,35632,M);if(o.attachShader(g,b),o.attachShader(g,S),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var w=o.getProgramInfoLog(g).trim(),T=o.getShaderInfoLog(b).trim(),A=o.getShaderInfoLog(S).trim(),k=!0,E=!0;if(!1===o.getProgramParameter(g,35714)){k=!1;var C=qc(o,b,"vertex"),L=qc(o,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+w+"\n"+C+"\n"+L)}else""!==w?console.warn("THREE.WebGLProgram: Program Info Log:",w):""!==T&&""!==A||(E=!1);E&&(this.diagnostics={runnable:k,programLog:w,vertexShader:{log:T,prefix:i},fragmentShader:{log:A,prefix:a}})}return o.deleteShader(b),o.deleteShader(S),this.getUniforms=function(){return void 0===x&&(x=new Gc(o,g)),x},this.getAttributes=function(){return void 0===_&&(_=Kc(o,g)),_},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=Hc++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=S,this}var mh=0,gh=function(){function e(){A(this,e),this.shaderCache=new Map,this.materialCache=new Map}return E(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=s(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var r=t.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(i){n.e(i)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache;return!1===t.has(e)&&t.set(e,new Set),t.get(e)}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache;if(!1===t.has(e)){var n=new yh(e);t.set(e,n)}return t.get(e)}}]),e}(),yh=E(function e(t){A(this,e),this.id=mh++,this.code=t,this.usedTimes=0});function xh(e,t,n,r,i,a,o){var s=new Fi,l=new gh,u=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,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"};return{getParameters:function(a,s,u,v,m){var g=v.fog,y=m.geometry,x=a.isMeshStandardMaterial?v.environment:null,_=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),M=_&&_.mapping===Fe?_.image.height:null,b=f[a.type];null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");var S,w,T,A,k=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,E=void 0!==k?k.length:0,C=0;if(void 0!==y.morphAttributes.position&&(C=1),void 0!==y.morphAttributes.normal&&(C=2),void 0!==y.morphAttributes.color&&(C=3),b){var L=tu[b];S=L.vertexShader,w=L.fragmentShader}else S=a.vertexShader,w=a.fragmentShader,l.update(a),T=l.getVertexShaderID(a),A=l.getFragmentShaderID(a);var R=e.getRenderTarget(),P=a.alphaTest>0,I=a.clearcoat>0,D=a.iridescence>0;return{isWebGL2:c,shaderID:b,shaderName:a.type,vertexShader:S,fragmentShader:w,defines:a.defines,customVertexShaderID:T,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===m.isInstancedMesh,instancingColor:!0===m.isInstancedMesh&&null!==m.instanceColor,supportsVertexTextures:d,outputEncoding:null===R?e.outputEncoding:!0===R.isXRRenderTarget?R.texture.encoding:sn,map:!!a.map,matcap:!!a.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUVHeight:M,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===dn,tangentSpaceNormalMap:a.normalMapType===hn,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===ln,clearcoat:I,clearcoatMap:I&&!!a.clearcoatMap,clearcoatRoughnessMap:I&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!a.clearcoatNormalMap,iridescence:D,iridescenceMap:D&&!!a.iridescenceMap,iridescenceThicknessMap:D&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&a.blending===Y,alphaMap:!!a.alphaMap,alphaTest:P,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.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.iridescenceMap||a.iridescenceThicknessMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!g,useFog:!0===a.fog,fogExp2:g&&g.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:E,morphTextureStride:C,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&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:Ae,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===W,flipSided:a.side===H,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,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:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.map&&s.enable(4),t.matcap&&s.enable(5),t.envMap&&s.enable(6),t.lightMap&&s.enable(7),t.aoMap&&s.enable(8),t.emissiveMap&&s.enable(9),t.bumpMap&&s.enable(10),t.normalMap&&s.enable(11),t.objectSpaceNormalMap&&s.enable(12),t.tangentSpaceNormalMap&&s.enable(13),t.clearcoat&&s.enable(14),t.clearcoatMap&&s.enable(15),t.clearcoatRoughnessMap&&s.enable(16),t.clearcoatNormalMap&&s.enable(17),t.iridescence&&s.enable(18),t.iridescenceMap&&s.enable(19),t.iridescenceThicknessMap&&s.enable(20),t.displacementMap&&s.enable(21),t.specularMap&&s.enable(22),t.roughnessMap&&s.enable(23),t.metalnessMap&&s.enable(24),t.gradientMap&&s.enable(25),t.alphaMap&&s.enable(26),t.alphaTest&&s.enable(27),t.vertexColors&&s.enable(28),t.vertexAlphas&&s.enable(29),t.vertexUvs&&s.enable(30),t.vertexTangents&&s.enable(31),t.uvsVertexOnly&&s.enable(32),t.fog&&s.enable(33),e.push(s.mask),s.disableAll(),t.useFog&&s.enable(0),t.flatShading&&s.enable(1),t.logarithmicDepthBuffer&&s.enable(2),t.skinning&&s.enable(3),t.morphTargets&&s.enable(4),t.morphNormals&&s.enable(5),t.morphColors&&s.enable(6),t.premultipliedAlpha&&s.enable(7),t.shadowMapEnabled&&s.enable(8),t.physicallyCorrectLights&&s.enable(9),t.doubleSided&&s.enable(10),t.flipSided&&s.enable(11),t.useDepthPacking&&s.enable(12),t.dithering&&s.enable(13),t.specularIntensityMap&&s.enable(14),t.specularColorMap&&s.enable(15),t.transmission&&s.enable(16),t.transmissionMap&&s.enable(17),t.thicknessMap&&s.enable(18),t.sheen&&s.enable(19),t.sheenColorMap&&s.enable(20),t.sheenRoughnessMap&&s.enable(21),t.decodeVideoTexture&&s.enable(22),t.opaque&&s.enable(23),e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=f[e.type];if(n){var r=tu[n];t=no.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=u.length;i<o;i++){var s=u[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new vh(e,n,t,a),u.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function _h(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(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 Mh(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function bh(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 Sh(){var e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Mh),r.length>1&&r.sort(t||bh),i.length>1&&i.sort(t||bh)}}}function wh(){var e=new WeakMap;return{get:function(t,n){var r;return!1===e.has(t)?(r=new Sh,e.set(t,[r])):n>=e.get(t).length?(r=new Sh,e.get(t).push(r)):r=e.get(t)[n],r},dispose:function(){e=new WeakMap}}}function Th(){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 Zr,color:new Nr};break;case"SpotLight":n={position:new Zr,direction:new Zr,color:new Nr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Zr,color:new Nr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Zr,skyColor:new Nr,groundColor:new Nr};break;case"RectAreaLight":n={color:new Nr,position:new Zr,halfWidth:new Zr,halfHeight:new Zr}}return e[t.id]=n,n}}}function Ah(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yr,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}var kh=0;function Eh(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Ch(e,t){for(var n=new Th,r=Ah(),i={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:[]},a=0;a<9;a++)i.probe.push(new Zr);var o=new Zr,s=new Ai,l=new Ai;return{setup:function(a,o){for(var s=0,l=0,u=0,c=0;c<9;c++)i.probe[c].set(0,0,0);var h=0,d=0,p=0,f=0,v=0,m=0,g=0,y=0;a.sort(Eh);for(var x=!0!==o?Math.PI:1,_=0,M=a.length;_<M;_++){var b=a[_],S=b.color,w=b.intensity,T=b.distance,A=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)s+=S.r*w*x,l+=S.g*w*x,u+=S.b*w*x;else if(b.isLightProbe)for(var k=0;k<9;k++)i.probe[k].addScaledVector(b.sh.coefficients[k],w);else if(b.isDirectionalLight){var E=n.get(b);if(E.color.copy(b.color).multiplyScalar(b.intensity*x),b.castShadow){var C=b.shadow,L=r.get(b);L.shadowBias=C.bias,L.shadowNormalBias=C.normalBias,L.shadowRadius=C.radius,L.shadowMapSize=C.mapSize,i.directionalShadow[h]=L,i.directionalShadowMap[h]=A,i.directionalShadowMatrix[h]=b.shadow.matrix,m++}i.directional[h]=E,h++}else if(b.isSpotLight){var R=n.get(b);if(R.position.setFromMatrixPosition(b.matrixWorld),R.color.copy(S).multiplyScalar(w*x),R.distance=T,R.coneCos=Math.cos(b.angle),R.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),R.decay=b.decay,b.castShadow){var P=b.shadow,I=r.get(b);I.shadowBias=P.bias,I.shadowNormalBias=P.normalBias,I.shadowRadius=P.radius,I.shadowMapSize=P.mapSize,i.spotShadow[p]=I,i.spotShadowMap[p]=A,i.spotShadowMatrix[p]=b.shadow.matrix,y++}i.spot[p]=R,p++}else if(b.isRectAreaLight){var D=n.get(b);D.color.copy(S).multiplyScalar(w),D.halfWidth.set(.5*b.width,0,0),D.halfHeight.set(0,.5*b.height,0),i.rectArea[f]=D,f++}else if(b.isPointLight){var N=n.get(b);if(N.color.copy(b.color).multiplyScalar(b.intensity*x),N.distance=b.distance,N.decay=b.decay,b.castShadow){var O=b.shadow,F=r.get(b);F.shadowBias=O.bias,F.shadowNormalBias=O.normalBias,F.shadowRadius=O.radius,F.shadowMapSize=O.mapSize,F.shadowCameraNear=O.camera.near,F.shadowCameraFar=O.camera.far,i.pointShadow[d]=F,i.pointShadowMap[d]=A,i.pointShadowMatrix[d]=b.shadow.matrix,g++}i.point[d]=N,d++}else if(b.isHemisphereLight){var z=n.get(b);z.skyColor.copy(b.color).multiplyScalar(w*x),z.groundColor.copy(b.groundColor).multiplyScalar(w*x),i.hemi[v]=z,v++}}f>0&&(t.isWebGL2?(i.rectAreaLTC1=eu.LTC_FLOAT_1,i.rectAreaLTC2=eu.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=eu.LTC_FLOAT_1,i.rectAreaLTC2=eu.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=eu.LTC_HALF_1,i.rectAreaLTC2=eu.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=l,i.ambient[2]=u;var B=i.hash;B.directionalLength===h&&B.pointLength===d&&B.spotLength===p&&B.rectAreaLength===f&&B.hemiLength===v&&B.numDirectionalShadows===m&&B.numPointShadows===g&&B.numSpotShadows===y||(i.directional.length=h,i.spot.length=p,i.rectArea.length=f,i.point.length=d,i.hemi.length=v,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotShadowMatrix.length=y,B.directionalLength=h,B.pointLength=d,B.spotLength=p,B.rectAreaLength=f,B.hemiLength=v,B.numDirectionalShadows=m,B.numPointShadows=g,B.numSpotShadows=y,i.version=kh++)},setupView:function(e,t){for(var n=0,r=0,a=0,u=0,c=0,h=t.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f=e[d];if(f.isDirectionalLight){var v=i.directional[n];v.direction.setFromMatrixPosition(f.matrixWorld),o.setFromMatrixPosition(f.target.matrixWorld),v.direction.sub(o),v.direction.transformDirection(h),n++}else if(f.isSpotLight){var m=i.spot[a];m.position.setFromMatrixPosition(f.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(f.matrixWorld),o.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(o),m.direction.transformDirection(h),a++}else if(f.isRectAreaLight){var g=i.rectArea[u];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(h),l.identity(),s.copy(f.matrixWorld),s.premultiply(h),l.extractRotation(s),g.halfWidth.set(.5*f.width,0,0),g.halfHeight.set(0,.5*f.height,0),g.halfWidth.applyMatrix4(l),g.halfHeight.applyMatrix4(l),u++}else if(f.isPointLight){var y=i.point[r];y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(h),r++}else if(f.isHemisphereLight){var x=i.hemi[c];x.direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(h),c++}}},state:i}}function Lh(e,t){var n=new Ch(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function Rh(e,t){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!1===n.has(r)?(i=new Lh(e,t),n.set(r,[i])):a>=n.get(r).length?(i=new Lh(e,t),n.get(r).push(i)):i=n.get(r)[a],i},dispose:function(){n=new WeakMap}}}var Ph=exports.MeshDepthMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshDepthMaterial=!0,r.type="MeshDepthMaterial",r.depthPacking=un,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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}}]),n}(),Ih=exports.MeshDistanceMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshDistanceMaterial=!0,r.type="MeshDistanceMaterial",r.referencePosition=new Zr,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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}}]),n}(),Dh="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Nh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function Oh(e,t,n){var r=new _o,i=new yr,a=new yr,o=new Gr,s=new Ph({depthPacking:cn}),l=new Ih,u={},c=n.maxTextureSize,h={0:H,1:V,2:W},d=new ao({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new yr},radius:{value:4}},vertexShader:Dh,fragmentShader:Nh}),p=d.clone();p.defines.HORIZONTAL_PASS=1;var f=new Pa;f.setAttribute("position",new fa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new Ja(f,d),m=this;function g(n,r){var a=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Vr(i.x,i.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,v,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,v,null)}function y(t,n,r,i,a,o){var c=null,d=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(c=void 0!==d?d:!0===r.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){var p=c.uuid,f=n.uuid,v=u[p];void 0===v&&(v={},u[p]=v);var m=v[f];void 0===m&&(m=c.clone(),v[f]=m),c=m}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=o===G?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function x(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===G)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;h<d;h++){var p=c[h],f=u[p.materialIndex];if(f&&f.visible){var v=y(n,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,n,p)}}else if(u.visible){var m=y(n,u,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,_=0,M=g.length;_<M;_++)x(g[_],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=B,this.render=function(t,n,s){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(X),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=t.length;p<f;p++){var v=t[p],y=v.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){i.copy(y.mapSize);var _=y.getFrameExtents();if(i.multiply(_),a.copy(y.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/_.x),i.x=a.x*_.x,y.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/_.y),i.y=a.y*_.y,y.mapSize.y=a.y)),null===y.map){var M=this.type!==G?{minFilter:Ge,magFilter:Ge}:{};y.map=new Vr(i.x,i.y,M),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var b=y.getViewportCount(),S=0;S<b;S++){var w=y.getViewport(S);o.set(a.x*w.x,a.y*w.y,a.x*w.z,a.y*w.w),d.viewport(o),y.updateMatrices(v,S),r=y.getFrustum(),x(n,s,y.camera,v,this.type)}!0!==y.isPointLightShadow&&this.type===G&&g(y,s),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(l,u,h)}}}function Fh(e,t,n){var r,i=n.isWebGL2;var a=new function(){var t=!1,n=new Gr,r=null,i=new Gr(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)}}},o=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?j(2929):q(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case ve:e.depthFunc(512);break;case me:e.depthFunc(519);break;case ge:e.depthFunc(513);break;case ye:e.depthFunc(515);break;case xe:e.depthFunc(514);break;case _e:e.depthFunc(518);break;case Me:e.depthFunc(516);break;case be: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,n=null,r=null,i=null}}},s=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?j(2960):q(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,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null}}},l={},u={},c=new WeakMap,h=[],d=null,p=!1,f=null,v=null,m=null,g=null,y=null,x=null,_=null,M=!1,b=null,w=null,T=null,A=null,k=null,E=e.getParameter(35661),C=!1,L=0,R=e.getParameter(7938);-1!==R.indexOf("WebGL")?(L=parseFloat(/^WebGL (\d)/.exec(R)[1]),C=L>=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),C=L>=2);var P=null,I={},F=e.getParameter(3088),z=e.getParameter(2978),B=(new Gr).fromArray(F),U=(new Gr).fromArray(z);function G(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 V={};function j(t){!0!==l[t]&&(e.enable(t),l[t]=!0)}function q(t){!1!==l[t]&&(e.disable(t),l[t]=!1)}V[3553]=G(3553,3553,1),V[34067]=G(34067,34069,6),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),j(2929),o.setFunc(ye),ke(!1),Ee(N),j(2884),Ae(X);var Se=S(S(S({},$,32774),ee,32778),te,32779);if(i)Se[ne]=32775,Se[re]=32776;else{var we=t.get("EXT_blend_minmax");null!==we&&(Se[ne]=we.MIN_EXT,Se[re]=we.MAX_EXT)}var Te=(S(S(S(S(S(S(S(S(S(S(r={},ie,0),ae,1),oe,768),le,770),fe,776),de,774),ce,772),se,769),ue,771),pe,775),S(r,he,773));function Ae(t,n,r,i,a,o,s,l){if(t!==X){if(!1===p&&(j(3042),p=!0),t===Q)a=a||n,o=o||r,s=s||i,n===v&&a===y||(e.blendEquationSeparate(Se[n],Se[a]),v=n,y=a),r===m&&i===g&&o===x&&s===_||(e.blendFuncSeparate(Te[r],Te[i],Te[o],Te[s]),m=r,g=i,x=o,_=s),f=t,M=null;else if(t!==f||l!==M){if(v===$&&y===$||(e.blendEquation(32774),v=$,y=$),l)switch(t){case Y:e.blendFuncSeparate(1,771,1,771);break;case Z:e.blendFunc(1,1);break;case J:e.blendFuncSeparate(0,769,0,1);break;case K:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case Y:e.blendFuncSeparate(770,771,1,771);break;case Z:e.blendFunc(770,1);break;case J:e.blendFuncSeparate(0,769,0,1);break;case K:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}m=null,g=null,x=null,_=null,f=t,M=l}}else!0===p&&(q(3042),p=!1)}function ke(t){b!==t&&(t?e.frontFace(2304):e.frontFace(2305),b=t)}function Ee(t){t!==D?(j(2884),t!==w&&(t===N?e.cullFace(1029):t===O?e.cullFace(1028):e.cullFace(1032))):q(2884),w=t}function Ce(t,n,r){t?(j(32823),A===n&&k===r||(e.polygonOffset(n,r),A=n,k=r)):q(32823)}function Le(t){void 0===t&&(t=33984+E-1),P!==t&&(e.activeTexture(t),P=t)}return{buffers:{color:a,depth:o,stencil:s},enable:j,disable:q,bindFramebuffer:function(t,n){return u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n,i&&(36009===t&&(u[36160]=n),36160===t&&(u[36009]=n)),!0)},drawBuffers:function(r,i){var a=h,o=!1;if(r)if(void 0===(a=c.get(i))&&(a=[],c.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||36064!==a[0]){for(var l=0,u=s.length;l<u;l++)a[l]=36064+l;a.length=s.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:Ae,setMaterial:function(e,t){e.side===W?q(2884):j(2884);var n=e.side===H;t&&(n=!n),ke(n),e.blending===Y&&!1===e.transparent?Ae(X):Ae(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),a.setMask(e.colorWrite);var r=e.stencilWrite;s.setTest(r),r&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Ce(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?j(32926):q(32926)},setFlipSided:ke,setCullFace:Ee,setLineWidth:function(t){t!==T&&(C&&e.lineWidth(t),T=t)},setPolygonOffset:Ce,setScissorTest:function(e){e?j(3089):q(3089)},activeTexture:Le,bindTexture:function(t,n){null===P&&Le();var r=I[P];void 0===r&&(r={type:void 0,texture:void 0},I[P]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||V[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=I[P];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(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(t){!1===B.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),B.copy(t))},viewport:function(t){!1===U.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),U.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===i&&(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),l={},P=null,I={},u={},c=new WeakMap,h=[],d=null,p=!1,f=null,v=null,m=null,g=null,y=null,x=null,_=null,M=!1,b=null,w=null,T=null,A=null,k=null,B.set(0,0,e.canvas.width,e.canvas.height),U.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}}}function zh(e,t,n,r,i,a,o){var s,l=i.isWebGL2,u=i.maxTextures,c=i.maxCubemapSize,h=i.maxTextureSize,d=i.maxSamples,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,f=/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap,m=new WeakMap,g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(H){}function y(e,t){return g?new OffscreenCanvas(e,t):Sr("canvas")}function x(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?pr:Math.floor,o=a(i*e.width),l=a(i*e.height);void 0===s&&(s=y(o,l));var u=n?y(o,l):s;return u.width=o,u.height=l,u.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return hr(e.width)&&hr(e.height)}function M(e,t){return e.generateMipmaps&&t&&e.minFilter!==Ge&&e.minFilter!==qe}function b(t){e.generateMipmap(t)}function w(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===l)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+"'")}var s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),33319===r&&(5126===i&&(s=33328),5131===i&&(s=33327),5121===i&&(s=33323)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=a===ln&&!1===o?35907:32856),32819===i&&(s=32854),32820===i&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function T(e,t,n){return!0===M(e,n)||e.isFramebufferTexture&&e.minFilter!==Ge&&e.minFilter!==qe?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return e===Ge||e===Ve||e===We?9728:9729}function k(e){var t=e.target;t.removeEventListener("dispose",k),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=m.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&C(e),0===Object.keys(i).length&&m.delete(n)}r.remove(e)}(t),t.isVideoTexture&&v.delete(t)}function E(t){var n=t.target;n.removeEventListener("dispose",E),function(t){var n=t.texture,i=r.get(t),a=r.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s]);else{if(e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(var l=0;l<i.__webglColorRenderbuffer.length;l++)i.__webglColorRenderbuffer[l]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[l]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var u=0,c=n.length;u<c;u++){var h=r.get(n[u]);h.__webglTexture&&(e.deleteTexture(h.__webglTexture),o.memory.textures--),r.remove(n[u])}r.remove(n),r.remove(t)}(n)}function C(t){var n=r.get(t);e.deleteTexture(n.__webglTexture);var i=t.source;delete m.get(i)[n.__cacheKey],o.memory.textures--}var L=0;function R(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;v.get(e)!==t&&(v.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&i.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void O(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}var P=S(S(S({},ze,10497),Be,33071),Ue,33648),I=S(S(S(S(S(S({},Ge,9728),Ve,9984),We,9986),qe,9729),Xe,9985),Ze,9987);function D(n,a,o){if(o?(e.texParameteri(n,10242,P[a.wrapS]),e.texParameteri(n,10243,P[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[a.wrapR]),e.texParameteri(n,10240,I[a.magFilter]),e.texParameteri(n,10241,I[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===Be&&a.wrapT===Be||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,A(a.magFilter)),e.texParameteri(n,10241,A(a.minFilter)),a.minFilter!==Ge&&a.minFilter!==qe&&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")){var s=t.get("EXT_texture_filter_anisotropic");if(a.type===rt&&!1===t.has("OES_texture_float_linear"))return;if(!1===l&&a.type===it&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function N(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",k));var i=n.source,a=m.get(i);void 0===a&&(a={},m.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&C(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function O(t,r,i){var o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);var s=N(t,r),u=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),u.version!==u.__currentVersion||!0===s){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);var c,d=function(e){return!l&&(e.wrapS!==Be||e.wrapT!==Be||e.minFilter!==Ge&&e.minFilter!==qe)}(r)&&!1===_(r.image),p=x(r.image,d,!1,h),f=_(p=V(r,p))||l,v=a.convert(r.format,r.encoding),m=a.convert(r.type),g=w(r.internalFormat,v,m,r.encoding,r.isVideoTexture);D(o,r,f);var y=r.mipmaps,S=l&&!0!==r.isVideoTexture,A=void 0===u.__currentVersion||!0===s,k=T(r,p,f);if(r.isDepthTexture)g=6402,l?g=r.type===rt?36012:r.type===nt?33190:r.type===st?35056:33189:r.type===rt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===pt&&6402===g&&r.type!==et&&r.type!==nt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=nt,m=a.convert(r.type)),r.format===ft&&6402===g&&(g=34041,r.type!==st&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=st,m=a.convert(r.type))),A&&(S?n.texStorage2D(3553,1,g,p.width,p.height):n.texImage2D(3553,0,g,p.width,p.height,0,v,m,null));else if(r.isDataTexture)if(y.length>0&&f){S&&A&&n.texStorage2D(3553,k,g,y[0].width,y[0].height);for(var E=0,C=y.length;E<C;E++)c=y[E],S?n.texSubImage2D(3553,E,0,0,c.width,c.height,v,m,c.data):n.texImage2D(3553,E,g,c.width,c.height,0,v,m,c.data);r.generateMipmaps=!1}else S?(A&&n.texStorage2D(3553,k,g,p.width,p.height),n.texSubImage2D(3553,0,0,0,p.width,p.height,v,m,p.data)):n.texImage2D(3553,0,g,p.width,p.height,0,v,m,p.data);else if(r.isCompressedTexture){S&&A&&n.texStorage2D(3553,k,g,y[0].width,y[0].height);for(var L=0,R=y.length;L<R;L++)c=y[L],r.format!==ct?null!==v?S?n.compressedTexSubImage2D(3553,L,0,0,c.width,c.height,v,c.data):n.compressedTexImage2D(3553,L,g,c.width,c.height,0,c.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):S?n.texSubImage2D(3553,L,0,0,c.width,c.height,v,m,c.data):n.texImage2D(3553,L,g,c.width,c.height,0,v,m,c.data)}else if(r.isDataArrayTexture)S?(A&&n.texStorage3D(35866,k,g,p.width,p.height,p.depth),n.texSubImage3D(35866,0,0,0,0,p.width,p.height,p.depth,v,m,p.data)):n.texImage3D(35866,0,g,p.width,p.height,p.depth,0,v,m,p.data);else if(r.isData3DTexture)S?(A&&n.texStorage3D(32879,k,g,p.width,p.height,p.depth),n.texSubImage3D(32879,0,0,0,0,p.width,p.height,p.depth,v,m,p.data)):n.texImage3D(32879,0,g,p.width,p.height,p.depth,0,v,m,p.data);else if(r.isFramebufferTexture){if(A)if(S)n.texStorage2D(3553,k,g,p.width,p.height);else for(var P=p.width,I=p.height,O=0;O<k;O++)n.texImage2D(3553,O,g,P,I,0,v,m,null),P>>=1,I>>=1}else if(y.length>0&&f){S&&A&&n.texStorage2D(3553,k,g,y[0].width,y[0].height);for(var F=0,z=y.length;F<z;F++)c=y[F],S?n.texSubImage2D(3553,F,0,0,v,m,c):n.texImage2D(3553,F,g,v,m,c);r.generateMipmaps=!1}else S?(A&&n.texStorage2D(3553,k,g,p.width,p.height),n.texSubImage2D(3553,0,0,0,v,m,p)):n.texImage2D(3553,0,g,v,m,p);M(r,f)&&b(o),u.__currentVersion=u.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}function F(t,i,o,s,l){var u=a.convert(o.format,o.encoding),c=a.convert(o.type),h=w(o.internalFormat,u,c,o.encoding);r.get(i).__hasExternalTextures||(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),G(i)?p.framebufferTexture2DMultisampleEXT(36160,s,l,r.get(o).__webglTexture,0,U(i)):e.framebufferTexture2D(36160,s,l,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function z(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r||G(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===rt?i=36012:o.type===nt&&(i=33190));var s=U(n);G(n)?p.renderbufferStorageMultisampleEXT(36161,s,i,n.width,n.height):e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=U(n);r&&!1===G(n)?e.renderbufferStorageMultisample(36161,l,35056,n.width,n.height):G(n)?p.renderbufferStorageMultisampleEXT(36161,l,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<u.length;c++){var h=u[c],d=a.convert(h.format,h.encoding),f=a.convert(h.type),v=w(h.internalFormat,d,f,h.encoding),m=U(n);r&&!1===G(n)?e.renderbufferStorageMultisample(36161,m,v,n.width,n.height):G(n)?p.renderbufferStorageMultisampleEXT(36161,m,v,n.width,n.height):e.renderbufferStorage(36161,v,n.width,n.height)}e.bindRenderbuffer(36161,null)}function B(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){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");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),R(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=U(i);if(i.depthTexture.format===pt)G(i)?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):e.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==ft)throw new Error("Unknown depthTexture format");G(i)?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):e.framebufferTexture2D(36160,33306,3553,a,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(),z(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),z(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}function U(e){return Math.min(d,e.samples)}function G(e){var n=r.get(e);return l&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(e,n){var r=e.encoding,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===Hn?n:(r!==sn&&(r===ln?!1===l?!0===t.has("EXT_sRGB")&&i===ct?(e.format=Hn,e.minFilter=qe,e.generateMipmaps=!1):n=Or.sRGBToLinear(n):i===ct&&a===Ke||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n)}this.allocateTextureUnit=function(){var e=L;return e>=u&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+u),L+=1,e},this.resetTextureUnits=function(){L=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6===r.image.length){var o=N(t,r),s=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),s.version!==s.__currentVersion||!0===o){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var u=r.isCompressedTexture||r.image[0].isCompressedTexture,h=r.image[0]&&r.image[0].isDataTexture,d=[],p=0;p<6;p++)d[p]=u||h?h?r.image[p].image:r.image[p]:x(r.image[p],!1,!0,c),d[p]=V(r,d[p]);var f,v=d[0],m=_(v)||l,g=a.convert(r.format,r.encoding),y=a.convert(r.type),S=w(r.internalFormat,g,y,r.encoding),A=l&&!0!==r.isVideoTexture,k=void 0===s.__currentVersion||!0===o,E=T(r,v,m);if(D(34067,r,m),u){A&&k&&n.texStorage2D(34067,E,S,v.width,v.height);for(var C=0;C<6;C++){f=d[C].mipmaps;for(var L=0;L<f.length;L++){var R=f[L];r.format!==ct?null!==g?A?n.compressedTexSubImage2D(34069+C,L,0,0,R.width,R.height,g,R.data):n.compressedTexImage2D(34069+C,L,S,R.width,R.height,0,R.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?n.texSubImage2D(34069+C,L,0,0,R.width,R.height,g,y,R.data):n.texImage2D(34069+C,L,S,R.width,R.height,0,g,y,R.data)}}}else{f=r.mipmaps,A&&k&&(f.length>0&&E++,n.texStorage2D(34067,E,S,d[0].width,d[0].height));for(var P=0;P<6;P++)if(h){A?n.texSubImage2D(34069+P,0,0,0,d[P].width,d[P].height,g,y,d[P].data):n.texImage2D(34069+P,0,S,d[P].width,d[P].height,0,g,y,d[P].data);for(var I=0;I<f.length;I++){var O=f[I],F=O.image[P].image;A?n.texSubImage2D(34069+P,I+1,0,0,F.width,F.height,g,y,F.data):n.texImage2D(34069+P,I+1,S,F.width,F.height,0,g,y,F.data)}}else{A?n.texSubImage2D(34069+P,0,0,0,g,y,d[P]):n.texImage2D(34069+P,0,S,g,y,d[P]);for(var z=0;z<f.length;z++){var B=f[z];A?n.texSubImage2D(34069+P,z+1,0,0,g,y,B.image[P]):n.texImage2D(34069+P,z+1,S,g,y,B.image[P])}}}M(r,m)&&b(34067),s.__currentVersion=s.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}}(o,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){var i=r.get(e);void 0!==t&&F(i.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&B(e)},this.setupRenderTarget=function(t){var s=t.texture,u=r.get(t),c=r.get(s);t.addEventListener("dispose",E),!0!==t.isWebGLMultipleRenderTargets&&(void 0===c.__webglTexture&&(c.__webglTexture=e.createTexture()),c.__version=s.version,o.memory.textures++);var h=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=_(t)||l;if(h){u.__webglFramebuffer=[];for(var f=0;f<6;f++)u.__webglFramebuffer[f]=e.createFramebuffer()}else{if(u.__webglFramebuffer=e.createFramebuffer(),d)if(i.drawBuffers)for(var v=t.texture,m=0,g=v.length;m<g;m++){var y=r.get(v[m]);void 0===y.__webglTexture&&(y.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(l&&t.samples>0&&!1===G(t)){var x=d?s:[s];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer);for(var S=0;S<x.length;S++){var T=x[S];u.__webglColorRenderbuffer[S]=e.createRenderbuffer(),e.bindRenderbuffer(36161,u.__webglColorRenderbuffer[S]);var A=a.convert(T.format,T.encoding),k=a.convert(T.type),C=w(T.internalFormat,A,k,T.encoding),L=U(t);e.renderbufferStorageMultisample(36161,L,C,t.width,t.height),e.framebufferRenderbuffer(36160,36064+S,36161,u.__webglColorRenderbuffer[S])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(u.__webglDepthRenderbuffer=e.createRenderbuffer(),z(u.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}}if(h){n.bindTexture(34067,c.__webglTexture),D(34067,s,p);for(var R=0;R<6;R++)F(u.__webglFramebuffer[R],t,s,36064,34069+R);M(s,p)&&b(34067),n.unbindTexture()}else if(d){for(var P=t.texture,I=0,N=P.length;I<N;I++){var O=P[I],V=r.get(O);n.bindTexture(3553,V.__webglTexture),D(3553,O,p),F(u.__webglFramebuffer,t,O,36064+I,3553),M(O,p)&&b(3553)}n.unbindTexture()}else{var H=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l?H=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(H,c.__webglTexture),D(H,s,p),F(u.__webglFramebuffer,t,s,36064,H),M(s,p)&&b(H),n.unbindTexture()}t.depthBuffer&&B(t)},this.updateRenderTargetMipmap=function(e){for(var t=_(e)||l,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=0,o=i.length;a<o;a++){var s=i[a];if(M(s,t)){var u=e.isWebGLCubeRenderTarget?34067:3553,c=r.get(s).__webglTexture;n.bindTexture(u,c),b(u),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(l&&t.samples>0&&!1===G(t)){var i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=16384,u=[],c=t.stencilBuffer?33306:36096,h=r.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(var p=0;p<i.length;p++)n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+p,36161,null),n.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+p,3553,null,0);n.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,h.__webglFramebuffer);for(var v=0;v<i.length;v++){u.push(36064+v),t.depthBuffer&&u.push(c);var m=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===m&&(t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024)),d&&e.framebufferRenderbuffer(36008,36064,36161,h.__webglColorRenderbuffer[v]),!0===m&&(e.invalidateFramebuffer(36008,[c]),e.invalidateFramebuffer(36009,[c])),d){var g=r.get(i[v]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,g,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),f&&e.invalidateFramebuffer(36008,u)}if(n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),d)for(var y=0;y<i.length;y++){n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+y,36161,h.__webglColorRenderbuffer[y]);var x=r.get(i[y]).__webglTexture;n.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+y,3553,x,0)}n.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=B,this.setupFrameBufferTexture=F,this.useMultisampledRTT=G}function Bh(e,t,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n===Ke)return 5121;if(n===at)return 32819;if(n===ot)return 32820;if(n===Qe)return 5120;if(n===$e)return 5122;if(n===et)return 5123;if(n===tt)return 5124;if(n===nt)return 5125;if(n===rt)return 5126;if(n===it)return r?5131:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(n===lt)return 6406;if(n===ct)return 6408;if(n===ht)return 6409;if(n===dt)return 6410;if(n===pt)return 6402;if(n===ft)return 34041;if(n===vt)return 6403;if(n===ut)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===Hn)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(n===mt)return 36244;if(n===gt)return 33319;if(n===yt)return 33320;if(n===xt)return 36249;if(n===_t||n===Mt||n===bt||n===St)if(a===ln){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===_t)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Mt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===bt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===St)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===_t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Mt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===bt)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===St)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===wt||n===Tt||n===At||n===kt){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===wt)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Tt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===At)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===kt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Et)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Ct||n===Lt){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===Ct)return a===ln?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Lt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===Rt||n===Pt||n===It||n===Dt||n===Nt||n===Ot||n===Ft||n===zt||n===Bt||n===Ut||n===Gt||n===Vt||n===Ht||n===Wt){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===Rt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Pt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===It)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Dt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Nt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ot)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ft)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===zt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Bt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ut)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Gt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Vt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Ht)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Wt)return a===ln?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===jt){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===jt)return a===ln?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===st?r?34042:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var Uh=exports.ArrayCamera=function(e){m(n,so);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return A(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=r,e}return E(n)}(),Gh=exports.Group=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return E(n)}(),Vh={type:"move"},Hh=function(){function e(){A(this,e),this._targetRay=null,this._grip=null,this._hand=null}return E(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Gh,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 Gh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Zr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Zr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Gh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Zr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Zr),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,o=this._targetRay,l=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var c,h=s(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d=c.value,p=t.getJointPose(d,n);if(void 0===u.joints[d.jointName]){var f=new Gh;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[d.jointName]=f,u.add(f)}var v=u.joints[d.jointName];null!==p&&(v.matrix.fromArray(p.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=p.radius),v.visible=null!==p}}catch(x){h.e(x)}finally{h.f()}var m=u.joints["index-finger-tip"],g=u.joints["thumb-tip"],y=m.position.distanceTo(g.position);u.inputState.pinching&&y>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&y<=.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);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Vh)))}return null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==i),null!==u&&(u.visible=null!==a),this}}]),e}(),Wh=exports.DepthTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h){var d;if(A(this,n),(h=void 0!==h?h:pt)!==pt&&h!==ft)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&h===pt&&(i=nt),void 0===i&&h===ft&&(i=st),(d=t.call(this,null,a,o,s,l,u,h,i,c)).isDepthTexture=!0,d.image={width:e,height:r},d.magFilter=void 0!==l?l:Ge,d.minFilter=void 0!==u?u:Ge,d.flipY=!1,d.generateMipmaps=!1,d}return E(n)}(),jh=function(e){m(n,Wn);var t=y(n);function n(e,r){var i;A(this,n);var a=_(i=t.call(this)),s=null,l=1,u=null,c="local-floor",h=null,d=null,p=null,f=null,v=null,m=null,g=r.getContextAttributes(),y=null,x=null,M=[],b=[],S=new so;S.layers.enable(1),S.viewport=new Gr;var T=new so;T.layers.enable(2),T.viewport=new Gr;var k=[S,T],E=new Uh;E.layers.enable(1),E.layers.enable(2);var C=null,L=null;function R(e){var t=b.indexOf(e.inputSource);if(-1!==t){var n=M[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}}function P(){s.removeEventListener("select",R),s.removeEventListener("selectstart",R),s.removeEventListener("selectend",R),s.removeEventListener("squeeze",R),s.removeEventListener("squeezestart",R),s.removeEventListener("squeezeend",R),s.removeEventListener("end",P),s.removeEventListener("inputsourceschange",I);for(var t=0;t<M.length;t++){var n=b[t];null!==n&&(b[t]=null,M[t].disconnect(n))}C=null,L=null,e.setRenderTarget(y),v=null,f=null,p=null,s=null,x=null,z.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function I(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],r=b.indexOf(n);r>=0&&(b[r]=null,M[r].dispatchEvent({type:"disconnected",data:n}))}for(var i=0;i<e.added.length;i++){var a=e.added[i],o=b.indexOf(a);if(-1===o){for(var s=0;s<M.length;s++){if(s>=b.length){b.push(a),o=s;break}if(null===b[s]){b[s]=a,o=s;break}}if(-1===o)break}var l=M[o];l&&l.dispatchEvent({type:"connected",data:a})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getGripSpace()},i.getHand=function(e){var t=M[e];return void 0===t&&(t=new Hh,M[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){l=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return h||u},i.setReferenceSpace=function(e){h=e},i.getBaseLayer=function(){return null!==f?f:v},i.getBinding=function(){return p},i.getFrame=function(){return m},i.getSession=function(){return s},i.setSession=function(){var t=o(w().mark(function t(n){var i,o,d,m,_;return w().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(s=n)){t.next=25;break}if(y=e.getRenderTarget(),s.addEventListener("select",R),s.addEventListener("selectstart",R),s.addEventListener("selectend",R),s.addEventListener("squeeze",R),s.addEventListener("squeezestart",R),s.addEventListener("squeezeend",R),s.addEventListener("end",P),s.addEventListener("inputsourceschange",I),!0===g.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||g.antialias,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:l},v=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:v}),x=new Vr(v.framebufferWidth,v.framebufferHeight,{format:ct,type:Ke,encoding:e.outputEncoding})):(o=null,d=null,m=null,g.depth&&(m=g.stencil?35056:33190,o=g.stencil?ft:pt,d=g.stencil?st:nt),_={colorFormat:32856,depthFormat:m,scaleFactor:l},p=new XRWebGLBinding(s,r),f=p.createProjectionLayer(_),s.updateRenderState({layers:[f]}),x=new Vr(f.textureWidth,f.textureHeight,{format:ct,type:Ke,depthTexture:new Wh(f.textureWidth,f.textureHeight,d,void 0,void 0,void 0,void 0,void 0,void 0,o),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0}),e.properties.get(x).__ignoreDepthValues=f.ignoreDepthValues),x.isXRRenderTarget=!0,this.setFoveation(1),h=null,t.next=20,s.requestReferenceSpace(c);case 20:u=t.sent,z.setContext(s),z.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}();var D=new Zr,N=new Zr;function O(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!==s){E.near=T.near=S.near=e.near,E.far=T.far=S.far=e.far,C===E.near&&L===E.far||(s.updateRenderState({depthNear:E.near,depthFar:E.far}),C=E.near,L=E.far);var t=e.parent,n=E.cameras;O(E,t);for(var r=0;r<n.length;r++)O(n[r],t);E.matrixWorld.decompose(E.position,E.quaternion,E.scale),e.position.copy(E.position),e.quaternion.copy(E.quaternion),e.scale.copy(E.scale),e.matrix.copy(E.matrix),e.matrixWorld.copy(E.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){D.setFromMatrixPosition(t.matrixWorld),N.setFromMatrixPosition(n.matrixWorld);var r=D.distanceTo(N),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[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*c,p=o*h,f=r/(-c+h),v=f*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+f,g=s+f,y=d-v,x=p+(r-v),_=l*s/g*m,M=u*s/g*m;e.projectionMatrix.makePerspective(y,x,_,M,m,g)}(E,S,T):E.projectionMatrix.copy(S.projectionMatrix)}},i.getCamera=function(){return E},i.getFoveation=function(){return null!==f?f.fixedFoveation:null!==v?v.fixedFoveation:void 0},i.setFoveation=function(e){null!==f&&(f.fixedFoveation=e),null!==v&&void 0!==v.fixedFoveation&&(v.fixedFoveation=e)};var F=null;var z=new Mo;return z.setAnimationLoop(function(t,n){if(d=n.getViewerPose(h||u),m=n,null!==d){var r=d.views;null!==v&&(e.setRenderTargetFramebuffer(x,v.framebuffer),e.setRenderTarget(x));var i=!1;r.length!==E.cameras.length&&(E.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var o=r[a],s=null;if(null!==v)s=v.getViewport(o);else{var l=p.getViewSubImage(f,o);s=l.viewport,0===a&&(e.setRenderTargetTextures(x,l.colorTexture,f.ignoreDepthValues?void 0:l.depthStencilTexture),e.setRenderTarget(x))}var c=k[a];void 0===c&&((c=new so).layers.enable(a),c.viewport=new Gr,k[a]=c),c.matrix.fromArray(o.transform.matrix),c.projectionMatrix.fromArray(o.projectionMatrix),c.viewport.set(s.x,s.y,s.width,s.height),0===a&&E.matrix.copy(c.matrix),!0===i&&E.cameras.push(c)}}for(var g=0;g<M.length;g++){var y=b[g],_=M[g];null!==y&&void 0!==_&&_.update(y,n,h||u)}F&&F(t,n),m=null}),i.setAnimationLoop=function(e){F=e},i.dispose=function(){},i}return E(n)}();function qh(e,t){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,r.side===H&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),r.side===H&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);var i,a,o=t.get(r).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;var s=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*s}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap?i=r.clearcoatRoughnessMap:r.iridescenceMap?i=r.iridescenceMap:r.iridescenceThicknessMap?i=r.iridescenceThicknessMap:r.specularIntensityMap?i=r.specularIntensityMap:r.specularColorMap?i=r.specularColorMap:r.transmissionMap?i=r.transmissionMap:r.thicknessMap?i=r.thicknessMap:r.sheenColorMap?i=r.sheenColorMap:r.sheenRoughnessMap&&(i=r.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),n.uvTransform.value.copy(i.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}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){r.isMeshBasicMaterial?n(e,r):r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(n(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,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===H&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap)),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,o)):r.isMeshMatcapMaterial?(n(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):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.alphaTest>0&&(e.alphaTest.value=t.alphaTest),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.alphaTest>0&&(e.alphaTest.value=t.alphaTest),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 Xh(){var e=Sr("canvas");return e.style.display="block",e}function Yh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.isWebGLRenderer=!0;var t,n=void 0!==e.canvas?e.canvas:Xh(),r=void 0!==e.context?e.context:null,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;t=null!==r?r.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;var h=null,d=null,p=[],f=[];this.domElement=n,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.outputEncoding=sn,this.physicallyCorrectLights=!1,this.toneMapping=Ae,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});var v=this,m=!1,g=0,y=0,x=null,_=-1,M=null,b=new Gr,S=new Gr,w=null,T=n.width,A=n.height,k=1,E=null,C=null,L=new Gr(0,0,T,A),P=new Gr(0,0,T,A),I=!1,D=new _o,N=!1,O=!1,F=null,z=new Ai,B=new yr,U=new Zr,G={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===x?k:1}var q,X,Y,Z,J,K,Q,$,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,pe,fe,ve=r;function me(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=n.getContext(i,t);if(null!==a)return a}return null}try{var ge={alpha:!0,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in n&&n.setAttribute("data-engine","three.js r".concat(R)),n.addEventListener("webglcontextlost",Me,!1),n.addEventListener("webglcontextrestored",be,!1),n.addEventListener("webglcontextcreationerror",Se,!1),null===ve){var ye=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&ye.shift(),null===(ve=me(ye,ge)))throw me(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ve.getShaderPrecisionFormat&&(ve.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Ne){throw console.error("THREE.WebGLRenderer: "+Ne.message),Ne}function xe(){q=new ku(ve),X=new au(ve,q,e),q.init(X),pe=new Bh(ve,q,X),Y=new Fh(ve,q,X),Z=new Lu,J=new _h,K=new zh(ve,q,Y,J,X,pe,Z),Q=new su(v),$=new Au(v),ee=new bo(ve,X),fe=new ru(ve,q,ee,X),te=new Eu(ve,ee,Z,fe),ne=new Nu(ve,te,ee,Z),ce=new Du(ve,X,K),se=new ou(J),re=new xh(v,Q,$,q,X,fe,se),ie=new qh(v,J),ae=new wh,oe=new Rh(q,X),ue=new nu(v,Q,Y,ne,t,s),le=new Oh(v,ne,X),he=new iu(ve,q,Z,X),de=new Cu(ve,q,Z,X),Z.programs=re.programs,v.capabilities=X,v.extensions=q,v.properties=J,v.renderLists=ae,v.shadowMap=le,v.state=Y,v.info=Z}xe();var _e=new jh(v,ve);function Me(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function be(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;var e=Z.autoReset,t=le.enabled,n=le.autoUpdate,r=le.needsUpdate,i=le.type;xe(),Z.autoReset=e,le.enabled=t,le.autoUpdate=n,le.needsUpdate=r,le.type=i}function Se(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function we(e){var t=e.target;t.removeEventListener("dispose",we),function(e){(function(e){var t=J.get(e).programs;void 0!==t&&(t.forEach(function(e){re.releaseProgram(e)}),e.isShaderMaterial&&re.releaseShaderCache(e))})(e),J.remove(e)}(t)}this.xr=_e,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){var e=q.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=q.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(e){void 0!==e&&(k=e,this.setSize(T,A,!1))},this.getSize=function(e){return e.set(T,A)},this.setSize=function(e,t,r){_e.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,A=t,n.width=Math.floor(e*k),n.height=Math.floor(t*k),!1!==r&&(n.style.width=e+"px",n.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(T*k,A*k).floor()},this.setDrawingBufferSize=function(e,t,r){T=e,A=t,k=r,n.width=Math.floor(e*r),n.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(b)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,r){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,r),Y.viewport(b.copy(L).multiplyScalar(k).floor())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,r){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,r),Y.scissor(S.copy(P).multiplyScalar(k).floor())},this.getScissorTest=function(){return I},this.setScissorTest=function(e){Y.setScissorTest(I=e)},this.setOpaqueSort=function(e){E=e},this.setTransparentSort=function(e){C=e},this.getClearColor=function(e){return e.copy(ue.getClearColor())},this.setClearColor=function(){ue.setClearColor.apply(ue,arguments)},this.getClearAlpha=function(){return ue.getClearAlpha()},this.setClearAlpha=function(){ue.setClearAlpha.apply(ue,arguments)},this.clear=function(){var e=0;(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(e|=16384),(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(e|=256),(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(e|=1024),ve.clear(e)},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(){n.removeEventListener("webglcontextlost",Me,!1),n.removeEventListener("webglcontextrestored",be,!1),n.removeEventListener("webglcontextcreationerror",Se,!1),ae.dispose(),oe.dispose(),J.dispose(),Q.dispose(),$.dispose(),ne.dispose(),fe.dispose(),re.dispose(),_e.dispose(),_e.removeEventListener("sessionstart",ke),_e.removeEventListener("sessionend",Ee),F&&(F.dispose(),F=null),Ce.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=G);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=function(e,t,n,r,i){!0!==t.isScene&&(t=G);K.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===x?v.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:sn,l=(r.isMeshStandardMaterial?$:Q).get(r.envMap||o),u=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,m=r.toneMapped?v.toneMapping:Ae,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==g?g.length:0,b=J.get(r),S=d.state.lights;if(!0===N&&(!0===O||e!==M)){var w=e===M&&r.id===_;se.setState(r,e,w)}var T=!1;r.version===b.__version?b.needsLights&&b.lightsStateVersion!==S.state.version?T=!0:b.outputEncoding!==s?T=!0:i.isInstancedMesh&&!1===b.instancing?T=!0:i.isInstancedMesh||!0!==b.instancing?i.isSkinnedMesh&&!1===b.skinning?T=!0:i.isSkinnedMesh||!0!==b.skinning?b.envMap!==l?T=!0:!0===r.fog&&b.fog!==a?T=!0:void 0===b.numClippingPlanes||b.numClippingPlanes===se.numPlanes&&b.numIntersection===se.numIntersection?b.vertexAlphas!==u?T=!0:b.vertexTangents!==c?T=!0:b.morphTargets!==h?T=!0:b.morphNormals!==p?T=!0:b.morphColors!==f?T=!0:b.toneMapping!==m?T=!0:!0===X.isWebGL2&&b.morphTargetsCount!==y&&(T=!0):T=!0:T=!0:T=!0:(T=!0,b.__version=r.version);var E=b.currentProgram;!0===T&&(E=Ie(r,t,i));var C=!1,L=!1,R=!1,P=E.getUniforms(),I=b.uniforms;Y.useProgram(E.program)&&(C=!0,L=!0,R=!0);r.id!==_&&(_=r.id,L=!0);if(C||M!==e){if(P.setValue(ve,"projectionMatrix",e.projectionMatrix),X.logarithmicDepthBuffer&&P.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),M!==e&&(M=e,L=!0,R=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var D=P.map.cameraPosition;void 0!==D&&D.setValue(ve,U.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&P.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&P.setValue(ve,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){P.setOptional(ve,i,"bindMatrix"),P.setOptional(ve,i,"bindMatrixInverse");var z=i.skeleton;z&&(X.floatVertexTextures?(null===z.boneTexture&&z.computeBoneTexture(),P.setValue(ve,"boneTexture",z.boneTexture,K),P.setValue(ve,"boneTextureSize",z.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var B=n.morphAttributes;(void 0!==B.position||void 0!==B.normal||void 0!==B.color&&!0===X.isWebGL2)&&ce.update(i,n,r,E);(L||b.receiveShadow!==i.receiveShadow)&&(b.receiveShadow=i.receiveShadow,P.setValue(ve,"receiveShadow",i.receiveShadow));L&&(P.setValue(ve,"toneMappingExposure",v.toneMappingExposure),b.needsLights&&(H=R,(V=I).ambientLightColor.needsUpdate=H,V.lightProbe.needsUpdate=H,V.directionalLights.needsUpdate=H,V.directionalLightShadows.needsUpdate=H,V.pointLights.needsUpdate=H,V.pointLightShadows.needsUpdate=H,V.spotLights.needsUpdate=H,V.spotLightShadows.needsUpdate=H,V.rectAreaLights.needsUpdate=H,V.hemisphereLights.needsUpdate=H),a&&!0===r.fog&&ie.refreshFogUniforms(I,a),ie.refreshMaterialUniforms(I,r,k,A,F),Gc.upload(ve,b.uniformsList,I,K));var V,H;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Gc.upload(ve,b.uniformsList,I,K),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&P.setValue(ve,"center",i.center);return P.setValue(ve,"modelViewMatrix",i.modelViewMatrix),P.setValue(ve,"normalMatrix",i.normalMatrix),P.setValue(ve,"modelMatrix",i.matrixWorld),E}(e,t,n,r,i);Y.setMaterial(r,o);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var c,h=1;!0===r.wireframe&&(l=te.getWireframeAttribute(n),h=2),fe.setup(i,r,s,n,l);var p=he;null!==l&&(c=ee.get(l),(p=de).setIndex(c));var f=null!==l?l.count:u.count,m=n.drawRange.start*h,g=n.drawRange.count*h,y=null!==a?a.start*h:0,b=null!==a?a.count*h:1/0,S=Math.max(m,y),w=Math.min(f,m+g,y+b)-1,T=Math.max(0,w-S+1);if(0!==T){if(i.isMesh)!0===r.wireframe?(Y.setLineWidth(r.wireframeLinewidth*j()),p.setMode(1)):p.setMode(4);else if(i.isLine){var E=r.linewidth;void 0===E&&(E=1),Y.setLineWidth(E*j()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(S,T,i.count);else if(n.isInstancedBufferGeometry){var C=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(S,T,C)}else p.render(S,T)}},this.compile=function(e,t){(d=oe.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(v.physicallyCorrectLights),e.traverse(function(t){var n=t.material;if(n)if(Array.isArray(n))for(var r=0;r<n.length;r++){Ie(n[r],e,t)}else Ie(n,e,t)}),f.pop(),d=null};var Te=null;function ke(){Ce.stop()}function Ee(){Ce.start()}var Ce=new Mo;function Le(e,t,n,r){var i=e.opaque,a=e.transmissive,s=e.transparent;d.setupLightsView(n),a.length>0&&function(e,t,n){var r=X.isWebGL2;null===F&&(F=new Vr(1,1,{generateMipmaps:!0,type:q.has("EXT_color_buffer_half_float")?it:Ke,minFilter:Ze,samples:r&&!0===o?4:0}));v.getDrawingBufferSize(B),r?F.setSize(B.x,B.y):F.setSize(pr(B.x),pr(B.y));var i=v.getRenderTarget();v.setRenderTarget(F),v.clear();var a=v.toneMapping;v.toneMapping=Ae,Re(e,t,n),v.toneMapping=a,K.updateMultisampleRenderTarget(F),K.updateRenderTargetMipmap(F),v.setRenderTarget(i)}(i,t,n),r&&Y.viewport(b.copy(r)),i.length>0&&Re(i,t,n),a.length>0&&Re(a,t,n),s.length>0&&Re(s,t,n),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1)}function Re(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,u=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&Pe(s,t,n,l,u,c)}}function Pe(e,t,n,r,i,a){e.onBeforeRender(v,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(v,t,n,r,e,a),!0===i.transparent&&i.side===W?(i.side=H,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=V,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=W):v.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(v,t,n,r,i,a)}function Ie(e,t,n){!0!==t.isScene&&(t=G);var r=J.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=re.getParameters(e,i.state,a,t,n),l=re.getProgramCacheKey(s),u=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?$:Q).get(e.envMap||r.environment),void 0===u&&(e.addEventListener("dispose",we),u=new Map,r.programs=u);var c=u.get(l);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return De(e,s),c}else s.uniforms=re.getUniforms(e),e.onBuild(n,s,v),e.onBeforeCompile(s,v),c=re.acquireProgram(s,l),u.set(l,c),r.uniforms=s.uniforms;var h=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=se.uniform),De(e,s),r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var p=c.getUniforms(),f=Gc.seqWithValue(p.seq,h);return r.currentProgram=c,r.uniformsList=f,c}function De(e,t){var n=J.get(e);n.outputEncoding=t.outputEncoding,n.instancing=t.instancing,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Ce.setAnimationLoop(function(e){Te&&Te(e)}),"undefined"!=typeof self&&Ce.setContext(self),this.setAnimationLoop=function(e){Te=e,_e.setAnimationLoop(e),null===e?Ce.stop():Ce.start()},_e.addEventListener("sessionstart",ke),_e.addEventListener("sessionend",Ee),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==m){!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(v,e,t,x),(d=oe.get(e,f.length)).init(),f.push(d),z.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(z),O=this.localClippingEnabled,N=se.init(this.clippingPlanes,O,t),(h=ae.get(e,p.length)).init(),p.push(h),function e(t,n,r,i){if(!1===t.visible)return;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){if(!t.frustumCulled||D.intersectsSprite(t)){i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z);var o=ne.update(t),s=t.material;s.visible&&h.push(t,o,s,r,U.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==Z.render.frame&&(t.skeleton.update(),t.skeleton.frame=Z.render.frame),!t.frustumCulled||D.intersectsObject(t))){i&&U.setFromMatrixPosition(t.matrixWorld).applyMatrix4(z);var l=ne.update(t),u=t.material;if(Array.isArray(u))for(var c=l.groups,p=0,f=c.length;p<f;p++){var v=c[p],m=u[v.materialIndex];m&&m.visible&&h.push(t,l,m,r,U.z,v)}else u.visible&&h.push(t,l,u,r,U.z,null)}var g=t.children;for(var y=0,x=g.length;y<x;y++)e(g[y],n,r,i)}(e,t,0,v.sortObjects),h.finish(),!0===v.sortObjects&&h.sort(E,C),!0===N&&se.beginShadows();var n=d.state.shadowsArray;if(le.render(n,e,t),!0===N&&se.endShadows(),!0===this.info.autoReset&&this.info.reset(),ue.render(h,e),d.setupLights(v.physicallyCorrectLights),t.isArrayCamera)for(var r=t.cameras,i=0,a=r.length;i<a;i++){var o=r[i];Le(h,e,o,o.viewport)}else Le(h,e,t);null!==x&&(K.updateMultisampleRenderTarget(x),K.updateRenderTargetMipmap(x)),!0===e.isScene&&e.onAfterRender(v,e,t),fe.resetDefaultState(),_=-1,M=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null}}else 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.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;var r=J.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;x=e,g=t,y=n;var r=!0;if(e){var i=J.get(e);void 0!==i.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?K.setupRenderTarget(e):i.__hasExternalTextures&&K.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture)}var a=null,o=!1,s=!1;if(e){var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture)&&(s=!0);var u=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=u[t],o=!0):a=X.isWebGL2&&e.samples>0&&!1===K.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:u,b.copy(e.viewport),S.copy(e.scissor),w=e.scissorTest}else b.copy(L).multiplyScalar(k).floor(),S.copy(P).multiplyScalar(k).floor(),w=I;if(Y.bindFramebuffer(36160,a)&&X.drawBuffers&&r&&Y.drawBuffers(e,a),Y.viewport(b),Y.scissor(S),Y.setScissorTest(w),o){var c=J.get(e.texture);ve.framebufferTexture2D(36160,36064,34069+t,c.__webglTexture,n)}else if(s){var h=J.get(e.texture),d=t||0;ve.framebufferTextureLayer(36160,36064,h.__webglTexture,n||0,d)}_=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Y.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==ct&&pe.convert(u)!==ve.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===it&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(c===Ke||pe.convert(c)===ve.getParameter(35738)||c===rt&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&ve.readPixels(t,n,r,i,pe.convert(u),pe.convert(c),a)}finally{var d=null!==x?J.get(x).__webglFramebuffer:null;Y.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&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);K.setTexture2D(t,0),ve.copyTexSubImage2D(3553,n,0,0,e.x,e.y,i,a),Y.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=pe.convert(n.format),s=pe.convert(n.type);K.setTexture2D(n,0),ve.pixelStorei(37440,n.flipY),ve.pixelStorei(37441,n.premultiplyAlpha),ve.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ve.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?ve.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):ve.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&ve.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(v.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=pe.convert(r.format),c=pe.convert(r.type);if(r.isData3DTexture)K.setTexture3D(r,0),a=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(r,0),a=35866}ve.pixelStorei(37440,r.flipY),ve.pixelStorei(37441,r.premultiplyAlpha),ve.pixelStorei(3317,r.unpackAlignment);var h=ve.getParameter(3314),d=ve.getParameter(32878),p=ve.getParameter(3316),f=ve.getParameter(3315),m=ve.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ve.pixelStorei(3314,g.width),ve.pixelStorei(32878,g.height),ve.pixelStorei(3316,e.min.x),ve.pixelStorei(3315,e.min.y),ve.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?ve.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."),ve.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,g.data)):ve.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g),ve.pixelStorei(3314,h),ve.pixelStorei(32878,d),ve.pixelStorei(3316,p),ve.pixelStorei(3315,f),ve.pixelStorei(32877,m),0===i&&r.generateMipmaps&&ve.generateMipmap(a),Y.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?K.setTextureCube(e,0):e.isData3DTexture?K.setTexture3D(e,0):e.isDataArrayTexture?K.setTexture2DArray(e,0):K.setTexture2D(e,0),Y.unbindTexture()},this.resetState=function(){g=0,y=0,x=null,Y.reset(),fe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Zh=exports.WebGL1Renderer=function(e){m(n,Yh);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();Zh.prototype.isWebGL1Renderer=!0;var Jh,Kh=exports.FogExp2=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;A(this,e),this.isFogExp2=!0,this.name="",this.color=new Nr(t),this.density=n}return E(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}(),Qh=exports.Fog=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;A(this,e),this.isFog=!0,this.name="",this.color=new Nr(t),this.near=n,this.far=r}return E(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}(),$h=exports.Scene=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:_(e)})),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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){var t=f(b(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}]),n}(),ed=exports.InterleavedBuffer=function(){function e(t,n){A(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Pn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Zn()}return E(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){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Zn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{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=Zn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}(),td=new Zr,nd=exports.InterleavedBufferAttribute=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];A(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=!0===i}return E(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++)td.fromBufferAttribute(this,t),td.applyMatrix4(e),this.setXYZ(t,td.x,td.y,td.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)td.fromBufferAttribute(this,t),td.applyNormalMatrix(e),this.setXYZ(t,td.x,td.y,td.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)td.fromBufferAttribute(this,t),td.transformDirection(e),this.setXYZ(t,td.x,td.y,td.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){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved 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 fa(new this.array.constructor(n),this.itemSize,this.normalized)}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)}},{key:"toJSON",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved 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}}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}}}]),e}(),rd=exports.SpriteMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isSpriteMaterial=!0,r.type="SpriteMaterial",r.color=new Nr(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),id=new Zr,ad=new Zr,od=new Zr,sd=new yr,ld=new yr,ud=new Ai,cd=new Zr,hd=new Zr,dd=new Zr,pd=new yr,fd=new yr,vd=new yr,md=exports.Sprite=function(e){m(n,Ki);var t=y(n);function n(e){var r;if(A(this,n),(r=t.call(this)).isSprite=!0,r.type="Sprite",void 0===Jh){Jh=new Pa;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new ed(i,5);Jh.setIndex([0,1,2,0,2,3]),Jh.setAttribute("position",new nd(a,3,0,!1)),Jh.setAttribute("uv",new nd(a,2,3,!1))}return r.geometry=Jh,r.material=void 0!==e?e:new rd,r.center=new yr(.5,.5),r}return E(n,[{key:"raycast",value:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ad.setFromMatrixScale(this.matrixWorld),ud.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),od.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ad.multiplyScalar(-od.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;gd(cd.set(-.5,-.5,0),od,a,ad,n,r),gd(hd.set(.5,-.5,0),od,a,ad,n,r),gd(dd.set(.5,.5,0),od,a,ad,n,r),pd.set(0,0),fd.set(1,0),vd.set(1,1);var o=e.ray.intersectTriangle(cd,hd,dd,!1,id);if(null!==o||(gd(hd.set(-.5,.5,0),od,a,ad,n,r),fd.set(0,1),null!==(o=e.ray.intersectTriangle(cd,dd,hd,!1,id)))){var s=e.ray.origin.distanceTo(id);s<e.near||s>e.far||t.push({distance:s,point:id.clone(),uv:la.getUV(id,cd,hd,dd,pd,fd,vd,new yr),face:null,object:this})}}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}();function gd(e,t,n,r,i,a){sd.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(ld.x=a*sd.x-i*sd.y,ld.y=i*sd.x+a*sd.y):ld.copy(sd),e.copy(t),e.x+=ld.x,e.y+=ld.y,e.applyMatrix4(ud)}var yd=new Zr,xd=new Zr,_d=exports.LOD=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this))._currentLevel=0,e.type="LOD",Object.defineProperties(_(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return E(n,[{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r<i;r++){var a=t[r];this.addLevel(a.object.clone(),a.distance)}return this.autoUpdate=e.autoUpdate,this}},{key:"addLevel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t=Math.abs(t);var n,r=this.levels;for(n=0;n<r.length&&!(t<r[n].distance);n++);return r.splice(n,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(t.length>0){var n,r;for(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){if(this.levels.length>0){yd.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(yd);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){yd.setFromMatrixPosition(e.matrixWorld),xd.setFromMatrixPosition(this.matrixWorld);var n,r,i=yd.distanceTo(xd)/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 t=f(b(n.prototype),"toJSON",this).call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}]),n}(),Md=new Zr,bd=new Gr,Sd=new Gr,wd=new Zr,Td=new Ai,Ad=exports.SkinnedMesh=function(e){m(n,Ja);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isSkinnedMesh=!0,i.type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new Ai,i.bindMatrixInverse=new Ai,i}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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 Gr,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,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){f(b(n.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;bd.fromBufferAttribute(r.attributes.skinIndex,e),Sd.fromBufferAttribute(r.attributes.skinWeight,e),Md.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=Sd.getComponent(i);if(0!==a){var o=bd.getComponent(i);Td.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(wd.copy(Md).applyMatrix4(Td),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}]),n}(),kd=exports.Bone=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return E(n)}(),Ed=exports.DataTexture=function(e){m(n,Ur);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Ge,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Ge,p=arguments.length>10?arguments[10]:void 0,f=arguments.length>11?arguments[11]:void 0;return A(this,n),(e=t.call(this,null,l,u,c,h,d,o,s,p,f)).isDataTexture=!0,e.image={data:r,width:i,height:a},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return E(n)}(),Cd=new Ai,Ld=new Ai,Rd=exports.Skeleton=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];A(this,e),this.uuid=Zn(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return E(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 Ai)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new Ai;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:Ld;Cd.multiplyMatrices(o,t[i]),Cd.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=Math.sqrt(4*this.bones.length);e=dr(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new Ed(t,e,e,ct,rt);return n.needsUpdate=!0,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 kd),this.bones.push(a),this.boneInverses.push((new Ai).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);var o=n[r];e.boneInverses.push(o.toArray())}return e}}]),e}(),Pd=exports.InstancedBufferAttribute=function(e){m(n,fa);var t=y(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),"number"==typeof i&&(o=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),(a=t.call(this,e,r,i)).isInstancedBufferAttribute=!0,a.meshPerAttribute=o,a}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(),Id=new Ai,Dd=new Ai,Nd=[],Od=new Ja,Fd=exports.InstancedMesh=function(e){m(n,Ja);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,r)).isInstancedMesh=!0,a.instanceMatrix=new Pd(new Float32Array(16*i),16),a.instanceColor=null,a.count=i,a.frustumCulled=!1,a}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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(Od.geometry=this.geometry,Od.material=this.material,void 0!==Od.material)for(var i=0;i<r;i++){this.getMatrixAt(i,Id),Dd.multiplyMatrices(n,Id),Od.matrixWorld=Dd,Od.raycast(e,Nd);for(var a=0,o=Nd.length;a<o;a++){var s=Nd[a];s.instanceId=i,s.object=this,t.push(s)}Nd.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new Pd(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"})}}]),n}(),zd=exports.LineBasicMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isLineBasicMaterial=!0,r.type="LineBasicMaterial",r.color=new Nr(16777215),r.linewidth=1,r.linecap="round",r.linejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}]),n}(),Bd=new Zr,Ud=new Zr,Gd=new Ai,Vd=new Ti,Hd=new gi,Wd=exports.Line=function(e){m(n,Ki);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new zd;return A(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Bd.fromBufferAttribute(t,r-1),Ud.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Bd.distanceTo(Ud);e.setAttribute("lineDistance",new Sa(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");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(),Hd.copy(n.boundingSphere),Hd.applyMatrix4(r),Hd.radius+=i,!1!==e.ray.intersectsSphere(Hd)){Gd.copy(r).invert(),Vd.copy(e.ray).applyMatrix4(Gd);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new Zr,u=new Zr,c=new Zr,h=new Zr,d=this.isLineSegments?2:1,p=n.index,f=n.attributes.position;if(null!==p)for(var v=Math.max(0,a.start),m=Math.min(p.count,a.start+a.count)-1;v<m;v+=d){var g=p.getX(v),y=p.getX(v+1);if(l.fromBufferAttribute(f,g),u.fromBufferAttribute(f,y),!(Vd.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(h);x<e.near||x>e.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),M=Math.min(f.count,a.start+a.count)-1;_<M;_+=d){if(l.fromBufferAttribute(f,_),u.fromBufferAttribute(f,_+1),!(Vd.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(h);b<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(),jd=new Zr,qd=new Zr,Xd=exports.LineSegments=function(e){m(n,Wd);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isLineSegments=!0,i.type="LineSegments",i}return E(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)jd.fromBufferAttribute(t,r),qd.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+jd.distanceTo(qd);e.setAttribute("lineDistance",new Sa(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(),Yd=exports.LineLoop=function(e){m(n,Wd);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isLineLoop=!0,i.type="LineLoop",i}return E(n)}(),Zd=exports.PointsMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isPointsMaterial=!0,r.type="PointsMaterial",r.color=new Nr(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),Jd=new Ai,Kd=new Ti,Qd=new gi,$d=new Zr,ep=exports.Points=function(e){m(n,Ki);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pa,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zd;return A(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),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(),Qd.copy(n.boundingSphere),Qd.applyMatrix4(r),Qd.radius+=i,!1!==e.ray.intersectsSphere(Qd)){Jd.copy(r).invert(),Kd.copy(e.ray).applyMatrix4(Jd);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);$d.fromBufferAttribute(u,d),tp($d,d,s,r,e,t,this)}else for(var p=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);p<f;p++)$d.fromBufferAttribute(u,p),tp($d,p,s,r,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}();function tp(e,t,n,r,i,a,o){var s=Kd.distanceSqToPoint(e);if(s<n){var l=new Zr;Kd.closestPointToPoint(e,l),l.applyMatrix4(r);var u=i.ray.origin.distanceTo(l);if(u<i.near||u>i.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}var np=exports.VideoTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c){var h;A(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isVideoTexture=!0,h.minFilter=void 0!==s?s:qe,h.magFilter=void 0!==o?o:qe,h.generateMipmaps=!1;var d=_(h);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){d.needsUpdate=!0,e.requestVideoFrameCallback(t)}),h}return E(n,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(),rp=exports.FramebufferTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,{width:e,height:r})).isFramebufferTexture=!0,a.format=i,a.magFilter=Ge,a.minFilter=Ge,a.generateMipmaps=!1,a.needsUpdate=!0,a}return E(n)}(),ip=exports.CompressedTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c,h,d,p){var f;return A(this,n),(f=t.call(this,null,s,l,u,c,h,a,o,d,p)).isCompressedTexture=!0,f.image={width:r,height:i},f.mipmaps=e,f.flipY=!1,f.generateMipmaps=!1,f}return E(n)}(),ap=exports.CanvasTexture=function(e){m(n,Ur);var t=y(n);function n(e,r,i,a,o,s,l,u,c){var h;return A(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).isCanvasTexture=!0,h.needsUpdate=!0,h}return E(n)}(),op=exports.Curve=function(){function e(){A(this,e),this.type="Curve",this.arcLengthDivisions=200}return E(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&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=arguments.length>0&&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=arguments.length>0&&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,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=t||(i.isVector2?new yr:new Zr);return o.copy(a).sub(i).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Zr,r=[],i=[],a=[],o=new Zr,s=new Ai,l=0;l<=e;l++){var u=l/e;r[l]=this.getTangentAt(u,new Zr)}i[0]=new Zr,a[0]=new Zr;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=e;f++){if(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();var v=Math.acos(Jn(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,v))}a[f].crossVectors(r[f],i[f])}if(!0===t){var m=Math.acos(Jn(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}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}(),sp=exports.EllipseCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return A(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=a,e.yRadius=o,e.aStartAngle=s,e.aEndAngle=l,e.aClockwise=u,e.aRotation=c,e}return E(n,[{key:"getPoint",value:function(e,t){for(var n=t||new yr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)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);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)}},{key:"copy",value:function(e){return f(b(n.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=f(b(n.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 f(b(n.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}}]),n}(),lp=exports.ArcCurve=function(e){m(n,sp);var t=y(n);function n(e,r,i,a,o,s){var l;return A(this,n),(l=t.call(this,e,r,i,i,a,o,s)).isArcCurve=!0,l.type="ArcCurve",l}return E(n)}();function up(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*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){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,u=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,l*=o,u*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}var cp=new Zr,hp=new up,dp=new up,pp=new up,fp=exports.CatmullRomCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return A(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=a,e.tension=o,e}return E(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,i=this.points,a=i.length,o=(a-(this.closed?0:1))*e,s=Math.floor(o),l=o-s;this.closed?s+=s>0?0:(Math.floor(Math.abs(s)/a)+1)*a:0===l&&s===a-1&&(s=a-2,l=1),this.closed||s>0?t=i[(s-1)%a]:(cp.subVectors(i[0],i[1]).add(i[0]),t=cp);var u=i[s%a],c=i[(s+1)%a];if(this.closed||s+2<a?n=i[(s+2)%a]:(cp.subVectors(i[a-1],i[a-2]).add(i[a-1]),n=cp),"centripetal"===this.curveType||"chordal"===this.curveType){var h="chordal"===this.curveType?.5:.25,d=Math.pow(t.distanceToSquared(u),h),p=Math.pow(u.distanceToSquared(c),h),f=Math.pow(c.distanceToSquared(n),h);p<1e-4&&(p=1),d<1e-4&&(d=p),f<1e-4&&(f=p),hp.initNonuniformCatmullRom(t.x,u.x,c.x,n.x,d,p,f),dp.initNonuniformCatmullRom(t.y,u.y,c.y,n.y,d,p,f),pp.initNonuniformCatmullRom(t.z,u.z,c.z,n.z,d,p,f)}else"catmullrom"===this.curveType&&(hp.initCatmullRom(t.x,u.x,c.x,n.x,this.tension),dp.initCatmullRom(t.y,u.y,c.y,n.y,this.tension),pp.initCatmullRom(t.z,u.z,c.z,n.z,this.tension));return r.set(hp.calc(l),dp.calc(l),pp.calc(l)),r}},{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){f(b(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Zr).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}();function vp(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function mp(e,t){var n=1-e;return n*n*t}function gp(e,t){return 2*(1-e)*e*t}function yp(e,t){return e*e*t}function xp(e,t,n,r){return mp(e,t)+gp(e,n)+yp(e,r)}function _p(e,t){var n=1-e;return n*n*n*t}function Mp(e,t){var n=1-e;return 3*n*n*e*t}function bp(e,t){return 3*(1-e)*e*e*t}function Sp(e,t){return e*e*e*t}function wp(e,t,n,r,i){return _p(e,t)+Mp(e,n)+bp(e,r)+Sp(e,i)}var Tp=exports.CubicBezierCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new yr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new yr;return A(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(wp(e,n.x,r.x,i.x,a.x),wp(e,n.y,r.y,i.y,a.y)),t}},{key:"copy",value:function(e){return f(b(n.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=f(b(n.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 f(b(n.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}}]),n}(),Ap=exports.CubicBezierCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Zr;return A(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,n=this.v0,r=this.v1,i=this.v2,a=this.v3;return t.set(wp(e,n.x,r.x,i.x,a.x),wp(e,n.y,r.y,i.y,a.y),wp(e,n.z,r.z,i.z,a.z)),t}},{key:"copy",value:function(e){return f(b(n.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=f(b(n.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 f(b(n.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}}]),n}(),kp=exports.LineCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr;return A(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=r,e.v2=i,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr;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){var n=t||new yr;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Ep=exports.LineCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;return A(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=r,e.v2=i,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;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 f(b(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Cp=exports.QuadraticBezierCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new yr;return A(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=a,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.v0,r=this.v1,i=this.v2;return t.set(xp(e,n.x,r.x,i.x),xp(e,n.y,r.y,i.y)),t}},{key:"copy",value:function(e){return f(b(n.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=f(b(n.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 f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Lp=exports.QuadraticBezierCurve3=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Zr;return A(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr,n=this.v0,r=this.v1,i=this.v2;return t.set(xp(e,n.x,r.x,i.x),xp(e,n.y,r.y,i.y),xp(e,n.z,r.z,i.z)),t}},{key:"copy",value:function(e){return f(b(n.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=f(b(n.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 f(b(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(),Rp=exports.SplineCurve=function(e){m(n,op);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return A(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=r,e}return E(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr,n=this.points,r=(n.length-1)*e,i=Math.floor(r),a=r-i,o=n[0===i?i:i-1],s=n[i],l=n[i>n.length-2?n.length-1:i+1],u=n[i>n.length-3?n.length-1:i+2];return t.set(vp(a,o.x,s.x,l.x,u.x),vp(a,o.y,s.y,l.y,u.y)),t}},{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){f(b(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new yr).fromArray(i))}return this}}]),n}(),Pp=Object.freeze({__proto__:null,ArcCurve:lp,CatmullRomCurve3:fp,CubicBezierCurve:Tp,CubicBezierCurve3:Ap,EllipseCurve:sp,LineCurve:kp,LineCurve3:Ep,QuadraticBezierCurve:Cp,QuadraticBezierCurve3:Lp,SplineCurve:Rp}),Ip=exports.CurvePath=function(e){m(n,op);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return E(n,[{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 kp(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}i++}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,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){f(b(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){f(b(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push((new Pp[i.type]).fromJSON(i))}return this}}]),n}(),Dp=exports.Path=function(e){m(n,Ip);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).type="Path",r.currentPoint=new yr,e&&r.setFromPoints(e),r}return E(n,[{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 kp(this.currentPoint.clone(),new yr(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){var i=new Cp(this.currentPoint.clone(),new yr(e,t),new yr(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){var o=new Tp(this.currentPoint.clone(),new yr(e,t),new yr(n,r),new yr(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new Rp(t);return this.curves.push(n),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){var l=new sp(e,t,n,r,i,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return f(b(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(),Np=exports.LatheGeometry=exports.LatheBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new yr(0,.5),new yr(.5,0),new yr(0,-.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;A(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:r,segments:i,phiStart:a,phiLength:o},i=Math.floor(i),o=Jn(o,0,2*Math.PI);for(var s=[],l=[],u=[],c=[],h=[],d=1/i,p=new Zr,f=new yr,v=new Zr,m=new Zr,g=new Zr,y=0,x=0,_=0;_<=r.length-1;_++)switch(_){case 0:y=r[_+1].x-r[_].x,x=r[_+1].y-r[_].y,v.x=1*x,v.y=-y,v.z=0*x,g.copy(v),v.normalize(),c.push(v.x,v.y,v.z);break;case r.length-1:c.push(g.x,g.y,g.z);break;default:y=r[_+1].x-r[_].x,x=r[_+1].y-r[_].y,v.x=1*x,v.y=-y,v.z=0*x,m.copy(v),v.x+=g.x,v.y+=g.y,v.z+=g.z,v.normalize(),c.push(v.x,v.y,v.z),g.copy(m)}for(var M=0;M<=i;M++)for(var b=a+M*d*o,S=Math.sin(b),w=Math.cos(b),T=0;T<=r.length-1;T++){p.x=r[T].x*S,p.y=r[T].y,p.z=r[T].x*w,l.push(p.x,p.y,p.z),f.x=M/i,f.y=T/(r.length-1),u.push(f.x,f.y);var k=c[3*T+0]*S,E=c[3*T+1],C=c[3*T+0]*w;h.push(k,E,C)}for(var L=0;L<i;L++)for(var R=0;R<r.length-1;R++){var P=R+L*r.length,I=P,D=P+r.length,N=P+r.length+1,O=P+1;s.push(I,D,O),s.push(N,O,D)}return e.setIndex(s),e.setAttribute("position",new Sa(l,3)),e.setAttribute("uv",new Sa(u,2)),e.setAttribute("normal",new Sa(h,3)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}}]),n}(),Op=exports.CapsuleGeometry=exports.CapsuleBufferGeometry=function(e){m(n,Np);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;A(this,n);var s=new Dp;return s.absarc(0,-i/2,r,1.5*Math.PI,0),s.absarc(0,i/2,r,0,.5*Math.PI),(e=t.call(this,s.getPoints(a),o)).type="CapsuleGeometry",e.parameters={radius:r,height:i,capSegments:a,radialSegments:o},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.length,e.capSegments,e.radialSegments)}}]),n}(),Fp=exports.CircleGeometry=exports.CircleBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;A(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:r,segments:i,thetaStart:a,thetaLength:o},i=Math.max(3,i);var s=[],l=[],u=[],c=[],h=new Zr,d=new yr;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 v=a+p/i*o;h.x=r*Math.cos(v),h.y=r*Math.sin(v),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 m=1;m<=i;m++)s.push(m,m+1,0);return e.setIndex(s),e.setAttribute("position",new Sa(l,3)),e.setAttribute("normal",new Sa(u,3)),e.setAttribute("uv",new Sa(c,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(),zp=exports.CylinderGeometry=exports.CylinderBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;A(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:r,radiusBottom:i,height:a,radialSegments:o,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};var h=_(e);o=Math.floor(o),s=Math.floor(s);var d=[],p=[],f=[],v=[],m=0,g=[],y=a/2,x=0;function M(e){for(var t=m,n=new yr,a=new Zr,s=0,l=!0===e?r:i,g=!0===e?1:-1,_=1;_<=o;_++)p.push(0,y*g,0),f.push(0,g,0),v.push(.5,.5),m++;for(var M=m,b=0;b<=o;b++){var S=b/o*c+u,w=Math.cos(S),T=Math.sin(S);a.x=l*T,a.y=y*g,a.z=l*w,p.push(a.x,a.y,a.z),f.push(0,g,0),n.x=.5*w+.5,n.y=.5*T*g+.5,v.push(n.x,n.y),m++}for(var A=0;A<o;A++){var k=t+A,E=M+A;!0===e?d.push(E,E+1,k):d.push(E+1,E,k),s+=3}h.addGroup(x,s,!0===e?1:2),x+=s}return function(){for(var e=new Zr,t=new Zr,n=0,l=(i-r)/a,_=0;_<=s;_++){for(var M=[],b=_/s,S=b*(i-r)+r,w=0;w<=o;w++){var T=w/o,A=T*c+u,k=Math.sin(A),E=Math.cos(A);t.x=S*k,t.y=-b*a+y,t.z=S*E,p.push(t.x,t.y,t.z),e.set(k,l,E).normalize(),f.push(e.x,e.y,e.z),v.push(T,1-b),M.push(m++)}g.push(M)}for(var C=0;C<o;C++)for(var L=0;L<s;L++){var R=g[L][C],P=g[L+1][C],I=g[L+1][C+1],D=g[L][C+1];d.push(R,P,D),d.push(P,I,D),n+=6}h.addGroup(x,n,0),x+=n}(),!1===l&&(r>0&&M(!0),i>0&&M(!1)),e.setIndex(d),e.setAttribute("position",new Sa(p,3)),e.setAttribute("normal",new Sa(f,3)),e.setAttribute("uv",new Sa(v,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(),Bp=exports.ConeGeometry=exports.ConeBufferGeometry=function(e){m(n,zp);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return A(this,n),(e=t.call(this,0,r,i,a,o,s,l,u)).type="ConeGeometry",e.parameters={radius:r,height:i,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:l,thetaLength:u},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(),Up=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;A(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:r,indices:i,radius:a,detail:o};var s=[],l=[];function u(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),u=i-o,h=0;h<=u;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/u)}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?(c(a[d][f+1]),c(a[d+1][f]),c(a[d][f])):(c(a[d][f+1]),c(a[d+1][f+1]),c(a[d+1][f]))}}function c(e){s.push(e.x,e.y,e.z)}function h(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function d(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 p(e){return Math.atan2(e.z,-e.x)}return function(e){for(var t=new Zr,n=new Zr,r=new Zr,a=0;a<i.length;a+=3)h(i[a+0],t),h(i[a+1],n),h(i[a+2],r),u(t,n,r,e)}(o),function(e){for(var t=new Zr,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 Zr,t=0;t<s.length;t+=3){e.x=s[t+0],e.y=s[t+1],e.z=s[t+2];var n=p(e)/2/Math.PI+.5,r=(i=e,Math.atan2(-i.y,Math.sqrt(i.x*i.x+i.z*i.z))/Math.PI+.5);l.push(n,1-r)}var i;(function(){for(var e=new Zr,t=new Zr,n=new Zr,r=new Zr,i=new yr,a=new yr,o=new yr,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 h=p(r);d(i,c+0,e,h),d(a,c+2,t,h),d(o,c+4,n,h)}})(),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);i>.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}()}(),e.setAttribute("position",new Sa(s,3)),e.setAttribute("normal",new Sa(s.slice(),3)),e.setAttribute("uv",new Sa(l,2)),0===o?e.computeVertexNormals():e.normalizeNormals(),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(),Gp=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);var a=(1+Math.sqrt(5))/2,o=1/a,s=[-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,-o,-a,0,-o,a,0,o,-a,0,o,a,-o,-a,0,-o,a,0,o,-a,0,o,a,0,-a,0,-o,a,0,-o,-a,0,o,a,0,o];return(e=t.call(this,s,[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],r,i)).type="DodecahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Vp=new Zr,Hp=new Zr,Wp=new Zr,jp=new la,qp=exports.EdgesGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(A(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:r,thresholdAngle:i},null!==r){for(var a=Math.pow(10,4),o=Math.cos(Xn*i),s=r.getIndex(),l=r.getAttribute("position"),u=s?s.count:l.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),p={},f=[],v=0;v<u;v+=3){s?(c[0]=s.getX(v),c[1]=s.getX(v+1),c[2]=s.getX(v+2)):(c[0]=v,c[1]=v+1,c[2]=v+2);var m=jp.a,g=jp.b,y=jp.c;if(m.fromBufferAttribute(l,c[0]),g.fromBufferAttribute(l,c[1]),y.fromBufferAttribute(l,c[2]),jp.getNormal(Wp),d[0]="".concat(Math.round(m.x*a),",").concat(Math.round(m.y*a),",").concat(Math.round(m.z*a)),d[1]="".concat(Math.round(g.x*a),",").concat(Math.round(g.y*a),",").concat(Math.round(g.z*a)),d[2]="".concat(Math.round(y.x*a),",").concat(Math.round(y.y*a),",").concat(Math.round(y.z*a)),d[0]!==d[1]&&d[1]!==d[2]&&d[2]!==d[0])for(var x=0;x<3;x++){var _=(x+1)%3,M=d[x],b=d[_],S=jp[h[x]],w=jp[h[_]],T="".concat(M,"_").concat(b),k="".concat(b,"_").concat(M);k in p&&p[k]?(Wp.dot(p[k].normal)<=o&&(f.push(S.x,S.y,S.z),f.push(w.x,w.y,w.z)),p[k]=null):T in p||(p[T]={index0:c[x],index1:c[_],normal:Wp.clone()})}}for(var E in p)if(p[E]){var C=p[E],L=C.index0,R=C.index1;Vp.fromBufferAttribute(l,L),Hp.fromBufferAttribute(l,R),f.push(Vp.x,Vp.y,Vp.z),f.push(Hp.x,Hp.y,Hp.z)}e.setAttribute("position",new Sa(f,3))}return e}return E(n)}(),Xp=exports.Shape=function(e){m(n,Dp);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).uuid=Zn(),r.type="Shape",r.holes=[],r}return E(n,[{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){f(b(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){f(b(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push((new Dp).fromJSON(i))}return this}}]),n}(),Yp={triangulate:function(e,t){var n,r,i,a,o,s,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=Zp(e,0,h,u,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=nf(e,t,d,u)),e.length>80*u){n=i=e[0],r=a=e[1];for(var f=u;f<h;f+=u)(o=e[f])<n&&(n=o),(s=e[f+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);l=0!==(l=Math.max(i-n,a-r))?1/l:0}return Kp(d,p,u,n,r,l),p}};function Zp(e,t,n,r,i){var a,o;if(i===Af(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Sf(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Sf(a,e[a],e[a+1],o);return o&&vf(o,o.next)&&(wf(o),o=o.next),o}function Jp(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!vf(r,r.next)&&0!==ff(r.prev,r,r.next))r=r.next;else{if(wf(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Kp(e,t,n,r,i,a,o){if(e){!o&&a&&lf(e,r,i,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?$p(e,r,i,a):Qp(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),wf(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Kp(e=ef(Jp(e),t,n),t,n,r,i,a,2):2===o&&tf(e,t,n,r,i,a):Kp(Jp(e),t,n,r,i,a,1);break}}}function Qp(e){var t=e.prev,n=e,r=e.next;if(ff(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(df(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&ff(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function $p(e,t,n,r){var i=e.prev,a=e,o=e.next;if(ff(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,u=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=cf(s,l,t,n,r),d=cf(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&&df(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ff(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ff(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ff(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&df(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ff(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ef(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!vf(i,a)&&mf(i,r,r.next,a)&&_f(i,a)&&_f(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),wf(r),wf(r.next),r=e=a),r=r.next}while(r!==e);return Jp(r)}function tf(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&pf(o,s)){var l=bf(o,s);return o=Jp(o,o.next),l=Jp(l,l.next),Kp(o,t,n,r,i,a),void Kp(l,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function nf(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=Zp(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(hf(o));for(s.sort(rf),i=0;i<s.length;i++)af(s[i],n),n=Jp(n,n.next);return n}function rf(e,t){return e.x-t.x}function af(e,t){if(t=of(e,t)){var n=bf(t,e);Jp(t,t.next),Jp(n,n.next)}}function of(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&&s>o){if(o=s,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}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n;var l,u=n,c=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&df(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),_f(r,e)&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&sf(n,r)))&&(n=r,d=l)),r=r.next}while(r!==u);return n}function sf(e,t){return ff(e.prev,e,t.prev)<0&&ff(t.next,e,e.next)<0}function lf(e,t,n,r){var i=e;do{null===i.z&&(i.z=cf(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,uf(i)}function uf(e){var t,n,r,i,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1);return e}function cf(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 hf(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function df(e,t,n,r,i,a,o,s){return(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)>=0}function pf(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!xf(e,t)&&(_f(e,t)&&_f(t,e)&&Mf(e,t)&&(ff(e.prev,e,t.prev)||ff(e,t.prev,t))||vf(e,t)&&ff(e.prev,e,e.next)>0&&ff(t.prev,t,t.next)>0)}function ff(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function vf(e,t){return e.x===t.x&&e.y===t.y}function mf(e,t,n,r){var i=yf(ff(e,t,n)),a=yf(ff(e,t,r)),o=yf(ff(n,r,e)),s=yf(ff(n,r,t));return i!==a&&o!==s||(!(0!==i||!gf(e,n,t))||(!(0!==a||!gf(e,r,t))||(!(0!==o||!gf(n,e,r))||!(0!==s||!gf(n,t,r)))))}function gf(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 yf(e){return e>0?1:e<0?-1:0}function xf(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&&mf(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function _f(e,t){return ff(e.prev,e,e.next)<0?ff(e,t,e.next)>=0&&ff(e,e.prev,t)>=0:ff(e,t,e.prev)<0||ff(e,e.next,t)<0}function Mf(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{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}while(n!==e);return r}function bf(e,t){var n=new Tf(e.i,e.x,e.y),r=new Tf(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Sf(e,t,n,r){var i=new Tf(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function wf(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 Tf(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}function Af(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}var kf=exports.ShapeUtils=function(){function e(){A(this,e)}return E(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=[];Ef(e),Cf(n,e);var a=e.length;t.forEach(Ef);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Cf(n,t[o]);for(var s=Yp.triangulate(n,r),l=0;l<s.length;l+=3)i.push(s.slice(l,l+3));return i}}]),e}();function Ef(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Cf(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Lf=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Xp([new yr(.5,.5),new yr(-.5,.5),new yr(-.5,-.5),new yr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var a=_(e),o=[],s=[],l=0,u=r.length;l<u;l++){c(r[l])}function c(e){var t=[],n=void 0!==i.curveSegments?i.curveSegments:12,r=void 0!==i.steps?i.steps:1,l=void 0!==i.depth?i.depth:1,u=void 0===i.bevelEnabled||i.bevelEnabled,c=void 0!==i.bevelThickness?i.bevelThickness:.2,h=void 0!==i.bevelSize?i.bevelSize:c-.1,d=void 0!==i.bevelOffset?i.bevelOffset:0,p=void 0!==i.bevelSegments?i.bevelSegments:3,f=i.extrudePath,v=void 0!==i.UVGenerator?i.UVGenerator:Rf;void 0!==i.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=i.amount);var m,g,y,x,_,M=!1;f&&(m=f.getSpacedPoints(r),M=!0,u=!1,g=f.computeFrenetFrames(r,!1),y=new Zr,x=new Zr,_=new Zr),u||(p=0,c=0,h=0,d=0);var b=e.extractPoints(n),S=b.shape,w=b.holes;if(!kf.isClockWise(S)){S=S.reverse();for(var T=0,A=w.length;T<A;T++){var k=w[T];kf.isClockWise(k)&&(w[T]=k.reverse())}}for(var E=kf.triangulateShape(S,w),C=S,L=0,R=w.length;L<R;L++){var P=w[L];S=S.concat(P)}function I(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var D=S.length,N=E.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=t.x-s/d,v=t.y+o/d,m=((n.x-u/p-f)*u-(n.y+l/p-v)*l)/(o*u-s*l),g=(r=f+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new yr(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new yr(r/a,i/a)}for(var F=[],z=0,B=C.length,U=B-1,G=z+1;z<B;z++,U++,G++)U===B&&(U=0),G===B&&(G=0),F[z]=O(C[z],C[U],C[G]);for(var V,H=[],W=F.concat(),j=0,q=w.length;j<q;j++){var X=w[j];V=[];for(var Y=0,Z=X.length,J=Z-1,K=Y+1;Y<Z;Y++,J++,K++)J===Z&&(J=0),K===Z&&(K=0),V[Y]=O(X[Y],X[J],X[K]);H.push(V),W=W.concat(V)}for(var Q=0;Q<p;Q++){for(var $=Q/p,ee=c*Math.cos($*Math.PI/2),te=h*Math.sin($*Math.PI/2)+d,ne=0,re=C.length;ne<re;ne++){var ie=I(C[ne],F[ne],te);Re(ie.x,ie.y,-ee)}for(var ae=0,oe=w.length;ae<oe;ae++){var se=w[ae];V=H[ae];for(var le=0,ue=se.length;le<ue;le++){var ce=I(se[le],V[le],te);Re(ce.x,ce.y,-ee)}}}for(var he=h+d,de=0;de<D;de++){var pe=u?I(S[de],W[de],he):S[de];M?(x.copy(g.normals[0]).multiplyScalar(pe.x),y.copy(g.binormals[0]).multiplyScalar(pe.y),_.copy(m[0]).add(x).add(y),Re(_.x,_.y,_.z)):Re(pe.x,pe.y,0)}for(var fe=1;fe<=r;fe++)for(var ve=0;ve<D;ve++){var me=u?I(S[ve],W[ve],he):S[ve];M?(x.copy(g.normals[fe]).multiplyScalar(me.x),y.copy(g.binormals[fe]).multiplyScalar(me.y),_.copy(m[fe]).add(x).add(y),Re(_.x,_.y,_.z)):Re(me.x,me.y,l/r*fe)}for(var ge=p-1;ge>=0;ge--){for(var ye=ge/p,xe=c*Math.cos(ye*Math.PI/2),_e=h*Math.sin(ye*Math.PI/2)+d,Me=0,be=C.length;Me<be;Me++){var Se=I(C[Me],F[Me],_e);Re(Se.x,Se.y,l+xe)}for(var we=0,Te=w.length;we<Te;we++){var Ae=w[we];V=H[we];for(var ke=0,Ee=Ae.length;ke<Ee;ke++){var Ce=I(Ae[ke],V[ke],_e);M?Re(Ce.x,Ce.y+m[r-1].y,m[r-1].x+xe):Re(Ce.x,Ce.y,l+xe)}}}function Le(e,t){for(var n=e.length;--n>=0;){var i=n,a=n-1;a<0&&(a=e.length-1);for(var o=0,s=r+2*p;o<s;o++){var l=D*o,u=D*(o+1);Ie(t+i+l,t+a+l,t+a+u,t+i+u)}}}function Re(e,n,r){t.push(e),t.push(n),t.push(r)}function Pe(e,t,n){De(e),De(t),De(n);var r=o.length/3,i=v.generateTopUV(a,o,r-3,r-2,r-1);Ne(i[0]),Ne(i[1]),Ne(i[2])}function Ie(e,t,n,r){De(e),De(t),De(r),De(t),De(n),De(r);var i=o.length/3,s=v.generateSideWallUV(a,o,i-6,i-3,i-2,i-1);Ne(s[0]),Ne(s[1]),Ne(s[3]),Ne(s[1]),Ne(s[2]),Ne(s[3])}function De(e){o.push(t[3*e+0]),o.push(t[3*e+1]),o.push(t[3*e+2])}function Ne(e){s.push(e.x),s.push(e.y)}!function(){var e=o.length/3;if(u){for(var t=0,n=D*t,i=0;i<N;i++){var s=E[i];Pe(s[2]+n,s[1]+n,s[0]+n)}n=D*(t=r+2*p);for(var l=0;l<N;l++){var c=E[l];Pe(c[0]+n,c[1]+n,c[2]+n)}}else{for(var h=0;h<N;h++){var d=E[h];Pe(d[2],d[1],d[0])}for(var f=0;f<N;f++){var v=E[f];Pe(v[0]+D*r,v[1]+D*r,v[2]+D*r)}}a.addGroup(e,o.length/3-e,0)}(),function(){var e=o.length/3,t=0;Le(C,t),t+=C.length;for(var n=0,r=w.length;n<r;n++){var i=w[n];Le(i,t),t+=i.length}a.addGroup(e,o.length/3-e,1)}()}return e.setAttribute("position",new Sa(o,3)),e.setAttribute("uv",new Sa(s,2)),e.computeVertexNormals(),e}return E(n,[{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return Pf(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new Pp[s.type]).fromJSON(s)),new n(r,e.options)}}]),n}(),Rf={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],u=t[3*i],c=t[3*i+1];return[new yr(a,o),new yr(s,l),new yr(u,c)]},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],f=t[3*i+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new yr(o,1-l),new yr(u,1-h),new yr(d,1-f),new yr(v,1-g)]:[new yr(s,1-l),new yr(c,1-h),new yr(p,1-f),new yr(m,1-g)]}};function Pf(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 n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var If=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);var a=(1+Math.sqrt(5))/2,o=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1];return(e=t.call(this,o,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,i)).type="IcosahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Df=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);return(e=t.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],r,i)).type="OctahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Nf=exports.RingGeometry=exports.RingBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;A(this,n),(e=t.call(this)).type="RingGeometry",e.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)),v=new Zr,m=new yr,g=0;g<=o;g++){for(var y=0;y<=a;y++){var x=s+y/a*l;v.x=p*Math.cos(x),v.y=p*Math.sin(x),c.push(v.x,v.y,v.z),h.push(0,0,1),m.x=(v.x/i+1)/2,m.y=(v.y/i+1)/2,d.push(m.x,m.y)}p+=f}for(var _=0;_<o;_++)for(var M=_*(a+1),b=0;b<a;b++){var S=b+M,w=S,T=S+a+1,k=S+a+2,E=S+1;u.push(w,T,E),u.push(T,k,E)}return e.setIndex(u),e.setAttribute("position",new Sa(c,3)),e.setAttribute("normal",new Sa(h,3)),e.setAttribute("uv",new Sa(d,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(),Of=exports.ShapeGeometry=exports.ShapeBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Xp([new yr(0,.5),new yr(-.5,-.5),new yr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;A(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var a=[],o=[],s=[],l=[],u=0,c=0;if(!1===Array.isArray(r))d(r);else for(var h=0;h<r.length;h++)d(r[h]),e.addGroup(u,c,h),u+=c,c=0;function d(e){var t=o.length/3,n=e.extractPoints(i),r=n.shape,u=n.holes;!1===kf.isClockWise(r)&&(r=r.reverse());for(var h=0,d=u.length;h<d;h++){var p=u[h];!0===kf.isClockWise(p)&&(u[h]=p.reverse())}for(var f=kf.triangulateShape(r,u),v=0,m=u.length;v<m;v++){var g=u[v];r=r.concat(g)}for(var y=0,x=r.length;y<x;y++){var _=r[y];o.push(_.x,_.y,0),s.push(0,0,1),l.push(_.x,_.y)}for(var M=0,b=f.length;M<b;M++){var S=f[M],w=S[0]+t,T=S[1]+t,A=S[2]+t;a.push(w,T,A),c+=3}}return e.setIndex(a),e.setAttribute("position",new Sa(o,3)),e.setAttribute("normal",new Sa(s,3)),e.setAttribute("uv",new Sa(l,2)),e}return E(n,[{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return Ff(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}return new n(r,e.curveSegments)}}]),n}();function Ff(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}var zf=exports.SphereGeometry=exports.SphereBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;A(this,n),(e=t.call(this)).type="SphereGeometry",e.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 Zr,f=new Zr,v=[],m=[],g=[],y=[],x=0;x<=a;x++){var _=[],M=x/a,b=0;0==x&&0==l?b=.5/i:x==a&&c==Math.PI&&(b=-.5/i);for(var S=0;S<=i;S++){var w=S/i;p.x=-r*Math.cos(o+w*s)*Math.sin(l+M*u),p.y=r*Math.cos(l+M*u),p.z=r*Math.sin(o+w*s)*Math.sin(l+M*u),m.push(p.x,p.y,p.z),f.copy(p).normalize(),g.push(f.x,f.y,f.z),y.push(w+b,1-M),_.push(h++)}d.push(_)}for(var T=0;T<a;T++)for(var k=0;k<i;k++){var E=d[T][k+1],C=d[T][k],L=d[T+1][k],R=d[T+1][k+1];(0!==T||l>0)&&v.push(E,C,R),(T!==a-1||c<Math.PI)&&v.push(C,L,R)}return e.setIndex(v),e.setAttribute("position",new Sa(m,3)),e.setAttribute("normal",new Sa(g,3)),e.setAttribute("uv",new Sa(y,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(),Bf=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=function(e){m(n,Up);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,n);return(e=t.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],r,i)).type="TetrahedronGeometry",e.parameters={radius:r,detail:i},e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(),Uf=exports.TorusGeometry=exports.TorusBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;A(this,n),(e=t.call(this)).type="TorusGeometry",e.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 Zr,p=new Zr,f=new Zr,v=0;v<=a;v++)for(var m=0;m<=o;m++){var g=m/o*s,y=v/a*Math.PI*2;p.x=(r+i*Math.cos(y))*Math.cos(g),p.y=(r+i*Math.cos(y))*Math.sin(g),p.z=i*Math.sin(y),u.push(p.x,p.y,p.z),d.x=r*Math.cos(g),d.y=r*Math.sin(g),f.subVectors(p,d).normalize(),c.push(f.x,f.y,f.z),h.push(m/o),h.push(v/a)}for(var x=1;x<=a;x++)for(var _=1;_<=o;_++){var M=(o+1)*x+_-1,b=(o+1)*(x-1)+_-1,S=(o+1)*(x-1)+_,w=(o+1)*x+_;l.push(M,b,w),l.push(b,S,w)}return e.setIndex(l),e.setAttribute("position",new Sa(u,3)),e.setAttribute("normal",new Sa(c,3)),e.setAttribute("uv",new Sa(h,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(),Gf=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;A(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.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 Zr,f=new Zr,v=new Zr,m=new Zr,g=new Zr,y=new Zr,x=new Zr,_=0;_<=a;++_){var M=_/a*s*Math.PI*2;I(M,s,l,r,v),I(M+.01,s,l,r,m),y.subVectors(m,v),x.addVectors(m,v),g.crossVectors(y,x),x.crossVectors(g,y),g.normalize(),x.normalize();for(var b=0;b<=o;++b){var S=b/o*Math.PI*2,w=-i*Math.cos(S),T=i*Math.sin(S);p.x=v.x+(w*x.x+T*g.x),p.y=v.y+(w*x.y+T*g.y),p.z=v.z+(w*x.z+T*g.z),c.push(p.x,p.y,p.z),f.subVectors(p,v).normalize(),h.push(f.x,f.y,f.z),d.push(_/a),d.push(b/o)}}for(var k=1;k<=a;k++)for(var E=1;E<=o;E++){var C=(o+1)*(k-1)+(E-1),L=(o+1)*k+(E-1),R=(o+1)*k+E,P=(o+1)*(k-1)+E;u.push(C,L,P),u.push(L,R,P)}function I(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);i.x=r*(2+l)*.5*a,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(s)*.5}return e.setIndex(u),e.setAttribute("position",new Sa(c,3)),e.setAttribute("normal",new Sa(h,3)),e.setAttribute("uv",new Sa(d,2)),e}return E(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(),Vf=exports.TubeGeometry=exports.TubeBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Lp(new Zr(-1,-1,0),new Zr(-1,1,0),new Zr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];A(this,n),(e=t.call(this)).type="TubeGeometry",e.parameters={path:r,tubularSegments:i,radius:a,radialSegments:o,closed:s};var l=r.computeFrenetFrames(i,s);e.tangents=l.tangents,e.normals=l.normals,e.binormals=l.binormals;var u=new Zr,c=new Zr,h=new yr,d=new Zr,p=[],f=[],v=[],m=[];function g(e){d=r.getPointAt(e/i,d);for(var t=l.normals[e],n=l.binormals[e],s=0;s<=o;s++){var h=s/o*Math.PI*2,v=Math.sin(h),m=-Math.cos(h);c.x=m*t.x+v*n.x,c.y=m*t.y+v*n.y,c.z=m*t.z+v*n.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++)g(e);g(!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,v.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;m.push(n,r,s),m.push(r,a,s)}}()}(),e.setIndex(m),e.setAttribute("position",new Sa(p,3)),e.setAttribute("normal",new Sa(f,3)),e.setAttribute("uv",new Sa(v,2)),e}return E(n,[{key:"toJSON",value:function(){var e=f(b(n.prototype),"toJSON",this).call(this);return e.path=this.parameters.path.toJSON(),e}}],[{key:"fromJSON",value:function(e){return new n((new Pp[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}]),n}(),Hf=exports.WireframeGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(A(this,n),(e=t.call(this)).type="WireframeGeometry",e.parameters={geometry:r},null!==r){var i=[],a=new Set,o=new Zr,s=new Zr;if(null!==r.index){var l=r.attributes.position,u=r.index,c=r.groups;0===c.length&&(c=[{start:0,count:u.count,materialIndex:0}]);for(var h=0,d=c.length;h<d;++h)for(var p=c[h],f=p.start,v=f,m=f+p.count;v<m;v+=3)for(var g=0;g<3;g++){var y=u.getX(v+g),x=u.getX(v+(g+1)%3);o.fromBufferAttribute(l,y),s.fromBufferAttribute(l,x),!0===Wf(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}}else for(var _=r.attributes.position,M=0,b=_.count/3;M<b;M++)for(var S=0;S<3;S++){var w=3*M+S,T=3*M+(S+1)%3;o.fromBufferAttribute(_,w),s.fromBufferAttribute(_,T),!0===Wf(o,s,a)&&(i.push(o.x,o.y,o.z),i.push(s.x,s.y,s.z))}e.setAttribute("position",new Sa(i,3))}return e}return E(n)}();function Wf(e,t,n){var r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),i="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var jf=Object.freeze({__proto__:null,BoxGeometry:$a,BoxBufferGeometry:$a,CapsuleGeometry:Op,CapsuleBufferGeometry:Op,CircleGeometry:Fp,CircleBufferGeometry:Fp,ConeGeometry:Bp,ConeBufferGeometry:Bp,CylinderGeometry:zp,CylinderBufferGeometry:zp,DodecahedronGeometry:Gp,DodecahedronBufferGeometry:Gp,EdgesGeometry:qp,ExtrudeGeometry:Lf,ExtrudeBufferGeometry:Lf,IcosahedronGeometry:If,IcosahedronBufferGeometry:If,LatheGeometry:Np,LatheBufferGeometry:Np,OctahedronGeometry:Df,OctahedronBufferGeometry:Df,PlaneGeometry:So,PlaneBufferGeometry:So,PolyhedronGeometry:Up,PolyhedronBufferGeometry:Up,RingGeometry:Nf,RingBufferGeometry:Nf,ShapeGeometry:Of,ShapeBufferGeometry:Of,SphereGeometry:zf,SphereBufferGeometry:zf,TetrahedronGeometry:Bf,TetrahedronBufferGeometry:Bf,TorusGeometry:Uf,TorusBufferGeometry:Uf,TorusKnotGeometry:Gf,TorusKnotBufferGeometry:Gf,TubeGeometry:Vf,TubeBufferGeometry:Vf,WireframeGeometry:Hf}),qf=exports.ShadowMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isShadowMaterial=!0,r.type="ShadowMaterial",r.color=new Nr(0),r.transparent=!0,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(),Xf=exports.RawShaderMaterial=function(e){m(n,ao);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).isRawShaderMaterial=!0,r.type="RawShaderMaterial",r}return E(n)}(),Yf=exports.MeshStandardMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshStandardMaterial=!0,r.defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new Nr(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 Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(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.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(),Zf=exports.MeshPhysicalMaterial=function(e){m(r,Yf);var n=y(r);function r(e){var t;return A(this,r),(t=n.call(this)).isMeshPhysicalMaterial=!0,t.defines={STANDARD:"",PHYSICAL:""},t.type="MeshPhysicalMaterial",t.clearcoatMap=null,t.clearcoatRoughness=0,t.clearcoatRoughnessMap=null,t.clearcoatNormalScale=new yr(1,1),t.clearcoatNormalMap=null,t.ior=1.5,Object.defineProperty(_(t),"reflectivity",{get:function(){return Jn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),t.iridescenceMap=null,t.iridescenceIOR=1.3,t.iridescenceThicknessRange=[100,400],t.iridescenceThicknessMap=null,t.sheenColor=new Nr(0),t.sheenColorMap=null,t.sheenRoughness=1,t.sheenRoughnessMap=null,t.transmissionMap=null,t.thickness=0,t.thicknessMap=null,t.attenuationDistance=0,t.attenuationColor=new Nr(1,1,1),t.specularIntensity=1,t.specularIntensityMap=null,t.specularColor=new Nr(1,1,1),t.specularColorMap=null,t._sheen=0,t._clearcoat=0,t._iridescence=0,t._transmission=0,t.setValues(e),t}return E(r,[{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return f(b(r.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.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=t(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),r}(),Jf=exports.MeshPhongMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshPhongMaterial=!0,r.type="MeshPhongMaterial",r.color=new Nr(16777215),r.specular=new Nr(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),Kf=exports.MeshToonMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshToonMaterial=!0,r.defines={TOON:""},r.type="MeshToonMaterial",r.color=new Nr(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(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.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),Qf=exports.MeshNormalMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshNormalMaterial=!0,r.type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.flatShading=!1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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}}]),n}(),$f=exports.MeshLambertMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshLambertMaterial=!0,r.type="MeshLambertMaterial",r.color=new Nr(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new Nr(0),r.emissiveIntensity=1,r.emissiveMap=null,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=Se,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),ev=exports.MeshMatcapMaterial=function(e){m(n,ca);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isMeshMatcapMaterial=!0,r.defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new Nr(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new yr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.fog=!0,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.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.fog=e.fog,this}}]),n}(),tv=exports.LineDashedMaterial=function(e){m(n,zd);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).isLineDashedMaterial=!0,r.type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(),nv=exports.AnimationUtils={arraySlice:function(e,t,n){return nv.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))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,n,r){var i=arguments.length>4&&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||p>=r)){c.push(l.times[d]);for(var f=0;f<u;++f)h.push(l.values[d*u+f])}}0!==c.length&&(l.times=nv.convertArray(c,l.times.constructor),l.values=nv.convertArray(h,l.values.constructor),o.push(l))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(){var t=n.tracks[s],r=t.ValueTypeName;if("bool"===r||"string"===r)return 0;var i=e.tracks.find(function(e){return e.name===t.name&&e.ValueTypeName===r});if(void 0===i)return 0;var o=0,l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);var u=0,c=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h,d=t.times.length-1;if(a<=t.times[0]){var p=o,f=l-o;h=nv.arraySlice(t.values,p,f)}else if(a>=t.times[d]){var v=d*l+o,m=v+l-o;h=nv.arraySlice(t.values,v,m)}else{var g=t.createInterpolant(),y=o,x=l-o;g.evaluate(a),h=nv.arraySlice(g.resultBuffer,y,x)}"quaternion"===r&&(new Yr).fromArray(h).normalize().conjugate().toArray(h);for(var _=i.times.length,M=0;M<_;++M){var b=M*c+u;if("quaternion"===r)Yr.multiplyQuaternionsFlat(i.values,b,h,0,i.values,b);else for(var S=c-2*u,w=0;w<S;++w)i.values[b+w]-=h[w]}},s=0;s<i;++s)o();return e.blendMode=nn,e}},rv=exports.Interpolant=function(){function e(t,n,r,i){A(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 E(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(var l=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var u=n+a>>>1;e<t[u]?a=u:n=u+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}},{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}(),iv=exports.CubicInterpolant=function(e){m(n,rv);var t=y(n);function n(e,r,i,a){var o;return A(this,n),(o=t.call(this,e,r,i,a))._weightPrev=-0,o._offsetPrev=-0,o._weightNext=-0,o._offsetNext=-0,o.DefaultSettings_={endingStart:Qt,endingEnd:Qt},o}return E(n,[{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 $t:i=e,o=2*t-n;break;case en: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 $t:a=e,s=2*n-t;break;case en:a=1,s=n+r[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=this._weightNext,p=(n-t)/(r-t),f=p*p,v=f*p,m=-h*v+2*h*f-h*p,g=(1+h)*v+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*v+(1.5+d)*f+.5*p,x=d*v-d*f,_=0;_!==o;++_)i[_]=m*a[u+_]+g*a[l+_]+y*a[s+_]+x*a[c+_];return i}}]),n}(),av=exports.LinearInterpolant=function(e){m(n,rv);var t=y(n);function n(e,r,i,a){return A(this,n),t.call(this,e,r,i,a)}return E(n,[{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}}]),n}(),ov=exports.DiscreteInterpolant=function(e){m(n,rv);var t=y(n);function n(e,r,i,a){return A(this,n),t.call(this,e,r,i,a)}return E(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(),sv=exports.KeyframeTrack=function(){function e(t,n,r,i){if(A(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=nv.convertArray(n,this.TimeBufferType),this.values=nv.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return E(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new ov(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new av(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new iv(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case Zt:t=this.InterpolantFactoryMethodDiscrete;break;case Jt:t=this.InterpolantFactoryMethodLinear;break;case Kt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){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}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Zt;case this.InterpolantFactoryMethodLinear:return Jt;case this.InterpolantFactoryMethodSmooth:return Kt}}},{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=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=nv.arraySlice(n,i,a),this.values=nv.arraySlice(this.values,i*o,a*o)}return 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&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&nv.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=nv.arraySlice(this.times),t=nv.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Kt,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,v=a*n,m=0;m!==n;++m)t[v+m]=t[f+m]}++a}}if(i>0){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=nv.arraySlice(e,0,a),this.values=nv.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=nv.arraySlice(this.times,0),t=nv.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:nv.convertArray(e.times,Array),values:nv.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();sv.prototype.TimeBufferType=Float32Array,sv.prototype.ValueBufferType=Float32Array,sv.prototype.DefaultInterpolation=Jt;var lv=exports.BooleanKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();lv.prototype.ValueTypeName="bool",lv.prototype.ValueBufferType=Array,lv.prototype.DefaultInterpolation=Zt,lv.prototype.InterpolantFactoryMethodLinear=void 0,lv.prototype.InterpolantFactoryMethodSmooth=void 0;var uv=exports.ColorKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();uv.prototype.ValueTypeName="color";var cv=exports.NumberKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();cv.prototype.ValueTypeName="number";var hv=exports.QuaternionLinearInterpolant=function(e){m(n,rv);var t=y(n);function n(e,r,i,a){return A(this,n),t.call(this,e,r,i,a)}return E(n,[{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)Yr.slerpFlat(i,0,a,l-o,a,l,s);return i}}]),n}(),dv=exports.QuaternionKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new hv(this.times,this.values,this.getValueSize(),e)}}]),n}();dv.prototype.ValueTypeName="quaternion",dv.prototype.DefaultInterpolation=Jt,dv.prototype.InterpolantFactoryMethodSmooth=void 0;var pv=exports.StringKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();pv.prototype.ValueTypeName="string",pv.prototype.ValueBufferType=Array,pv.prototype.DefaultInterpolation=Zt,pv.prototype.InterpolantFactoryMethodLinear=void 0,pv.prototype.InterpolantFactoryMethodSmooth=void 0;var fv=exports.VectorKeyframeTrack=function(e){m(n,sv);var t=y(n);function n(){return A(this,n),t.apply(this,arguments)}return E(n)}();fv.prototype.ValueTypeName="vector";var vv=exports.AnimationClip=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:tn;A(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Zn(),this.duration<0&&this.resetDuration()}return E(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(gv(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={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(sv.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var u=nv.getKeyframeOrder(s);s=nv.sortedArray(s,1,u),l=nv.sortedArray(l,1,u),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new cv(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];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=e[a],l=s.name.match(i);if(l&&l.length>1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],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){if(0!==n.length){var a=[],o=[];nv.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},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=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var p=0;p<c[d].morphTargets.length;p++)h[c[d].morphTargets[p]]=-1;for(var f in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===f?1:0)}r.push(new cv(".morphTargetInfluence["+f+"]",v,m))}s=h.length*a}else{var x=".bones["+t[u].name+"]";n(fv,x+".position",c,"pos",r),n(dv,x+".quaternion",c,"rot",r),n(fv,x+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}();function mv(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return cv;case"vector":case"vector2":case"vector3":case"vector4":return fv;case"color":return uv;case"quaternion":return dv;case"bool":case"boolean":return lv;case"string":return pv}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function gv(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=mv(e.type);if(void 0===e.times){var n=[],r=[];nv.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var yv,xv=exports.Cache={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={}}},_v=exports.LoadingManager=E(function e(t,n,r){A(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){var t=u.indexOf(e);return-1!==t&&u.splice(t,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}}),Mv=exports.DefaultLoadingManager=new _v,bv=exports.Loader=function(){function e(t){A(this,e),this.manager=void 0!==t?t:Mv,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return E(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}(),Sv={},wv=exports.FileLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=xv.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(void 0===Sv[e]){Sv[e]=[],Sv[e].push({onLoad:t,onProgress:n,onError:r});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,l=this.responseType;fetch(o).then(function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=Sv[e],r=t.body.getReader(),i=t.headers.get("Content-Length"),a=i?parseInt(i):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){r.read().then(function(r){var i=r.done,l=r.value;if(i)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}e.enqueue(l),t()}})}()}});return new Response(l)}throw Error('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText))}).then(function(e){switch(l){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(function(e){return(new DOMParser).parseFromString(e,s)});case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(function(e){return r.decode(e)})}}).then(function(t){xv.add(e,t);var n=Sv[e];delete Sv[e];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(t)}}).catch(function(t){var n=Sv[e];if(void 0===n)throw i.manager.itemError(e),t;delete Sv[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e)}).finally(function(){i.manager.itemEnd(e)}),this.manager.itemStart(e)}else Sv[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}}]),n}(),Tv=exports.AnimationLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new wv(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(a){r?r(a):console.error(a),i.manager.itemError(e)}},n,r)}},{key:"parse",value:function(e){for(var t=[],n=0;n<e.length;n++){var r=vv.parse(e[n]);t.push(r)}return t}}]),n}(),Av=exports.CompressedTextureLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=[],o=new ip,s=new wv(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var l=0;function u(u){s.load(e[u],function(e){var n=i.parse(e,!0);a[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=qe),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var c=0,h=e.length;c<h;++c)u(c);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=qe),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}}]),n}(),kv=exports.ImageLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{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=xv.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=Sr("img");function s(){u(),xv.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){u(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),n}(),Ev=exports.CubeTextureLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=new ho,a=new kv(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var l=0;l<e.length;++l)s(l);return i}}]),n}(),Cv=exports.DataTextureLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Ed,o=new wv(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){var n=i.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Be,a.wrapT=void 0!==n.wrapT?n.wrapT:Be,a.magFilter=void 0!==n.magFilter?n.magFilter:qe,a.minFilter=void 0!==n.minFilter?n.minFilter:qe,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Ze),1===n.mipmapCount&&(a.minFilter=qe),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n))},n,r),a}}]),n}(),Lv=exports.TextureLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=new Ur,a=new kv(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i}}]),n}(),Rv=exports.Light=function(e){m(n,Ki);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return A(this,n),(r=t.call(this)).isLight=!0,r.type="Light",r.color=new Nr(e),r.intensity=i,r}return E(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(),Pv=exports.HemisphereLight=function(e){m(n,Rv);var t=y(n);function n(e,r,i){var a;return A(this,n),(a=t.call(this,e,i)).isHemisphereLight=!0,a.type="HemisphereLight",a.position.copy(Ki.DefaultUp),a.updateMatrix(),a.groundColor=new Nr(r),a}return E(n,[{key:"copy",value:function(e,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}(),Iv=new Ai,Dv=new Zr,Nv=new Zr,Ov=function(){function e(t){A(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new yr(512,512),this.map=null,this.mapPass=null,this.matrix=new Ai,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new _o,this._frameExtents=new yr(1,1),this._viewportCount=1,this._viewports=[new Gr(0,0,1,1)]}return E(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;Dv.setFromMatrixPosition(e.matrixWorld),t.position.copy(Dv),Nv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Nv),t.updateMatrixWorld(),Iv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Iv),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}(),Fv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new so(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return E(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*Yn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),f(b(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(),zv=exports.SpotLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return A(this,n),(i=t.call(this,e,r)).isSpotLight=!0,i.type="SpotLight",i.position.copy(Ki.DefaultUp),i.updateMatrix(),i.target=new Ki,i.distance=a,i.angle=o,i.penumbra=s,i.decay=l,i.shadow=new Fv,i}return E(n,[{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,t){return f(b(n.prototype),"copy",this).call(this,e,t),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}}]),n}(),Bv=new Ai,Uv=new Zr,Gv=new Zr,Vv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new so(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new yr(4,2),e._viewportCount=6,e._viewports=[new Gr(2,1,1,1),new Gr(0,1,1,1),new Gr(3,1,1,1),new Gr(1,1,1,1),new Gr(3,0,1,1),new Gr(1,0,1,1)],e._cubeDirections=[new Zr(1,0,0),new Zr(-1,0,0),new Zr(0,0,1),new Zr(0,0,-1),new Zr(0,1,0),new Zr(0,-1,0)],e._cubeUps=[new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,1,0),new Zr(0,0,1),new Zr(0,0,-1)],e}return E(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&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()),Uv.setFromMatrixPosition(e.matrixWorld),n.position.copy(Uv),Gv.copy(n.position),Gv.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Gv),n.updateMatrixWorld(),r.makeTranslation(-Uv.x,-Uv.y,-Uv.z),Bv.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bv)}}]),n}(),Hv=exports.PointLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,n),(i=t.call(this,e,r)).isPointLight=!0,i.type="PointLight",i.distance=a,i.decay=o,i.shadow=new Vv,i}return E(n,[{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,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(),Wv=function(e){m(n,Ov);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this,new lu(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return E(n)}(),jv=exports.DirectionalLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Ki.DefaultUp),i.updateMatrix(),i.target=new Ki,i.shadow=new Wv,i}return E(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(),qv=exports.AmbientLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i;return A(this,n),(i=t.call(this,e,r)).isAmbientLight=!0,i.type="AmbientLight",i}return E(n)}(),Xv=exports.RectAreaLight=function(e){m(n,Rv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return A(this,n),(i=t.call(this,e,r)).isRectAreaLight=!0,i.type="RectAreaLight",i.width=a,i.height=o,i}return E(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(),Yv=exports.SphericalHarmonics3=function(){function e(){A(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Zr)}return E(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,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[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=arguments.length>1&&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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&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,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}]),e}(),Zv=exports.LightProbe=function(e){m(n,Rv);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yv,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return A(this,n),(e=t.call(this,void 0,i)).isLightProbe=!0,e.sh=r,e}return E(n,[{key:"copy",value:function(e){return f(b(n.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){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.object.sh=this.sh.toArray(),t}}]),n}(),Jv=exports.MaterialLoader=function(e){m(n,bv);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).textures={},r}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new wv(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(a){r?r(a):console.error(a),i.manager.itemError(e)}},n,r)}},{key:"parse",value:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=n.createMaterialFromType(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=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new Nr).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),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.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),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.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),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.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),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=e.vertexColors>0: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=r(o.value);break;case"c":i.uniforms[a].value=(new Nr).setHex(o.value);break;case"v2":i.uniforms[a].value=(new yr).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Zr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new Gr).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new xr).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new Ai).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];if(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=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var l=e.normalScale;!1===Array.isArray(l)&&(l=[l,l]),i.normalScale=(new yr).fromArray(l)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(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=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new yr).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:qf,SpriteMaterial:rd,RawShaderMaterial:Xf,ShaderMaterial:ao,PointsMaterial:Zd,MeshPhysicalMaterial:Zf,MeshStandardMaterial:Yf,MeshPhongMaterial:Jf,MeshToonMaterial:Kf,MeshNormalMaterial:Qf,MeshLambertMaterial:$f,MeshDepthMaterial:Ph,MeshDistanceMaterial:Ih,MeshBasicMaterial:ha,MeshMatcapMaterial:ev,LineDashedMaterial:tv,LineBasicMaterial:zd,Material:ca}[e]}}]),n}(),Kv=exports.LoaderUtils=function(){function e(){A(this,e)}return E(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(i){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}}]),e}(),Qv=exports.InstancedBufferGeometry=function(e){m(n,Pa);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}return E(n,[{key:"copy",value:function(e){return f(b(n.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=f(b(n.prototype),"toJSON",this).call(this,this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),n}(),$v=exports.BufferGeometryLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new wv(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(a){r?r(a):console.error(a),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],a=function(e,t){if(void 0!==n[t])return n[t];var r=e.arrayBuffers[t],i=new Uint32Array(r).buffer;return n[t]=i,i}(e,i.buffer),o=br(i.type,a),s=new ed(o,i.stride);return s.uuid=i.uuid,t[r]=s,s}var i=e.isInstancedBufferGeometry?new Qv:new Pa,a=e.data.index;if(void 0!==a){var o=br(a.type,a.array);i.setIndex(new fa(o,1))}var s=e.data.attributes;for(var l in s){var u=s[l],c=void 0;if(u.isInterleavedBufferAttribute){var h=r(e.data,u.data);c=new nd(h,u.itemSize,u.offset,u.normalized)}else{var d=br(u.type,u.array);c=new(u.isInstancedBufferAttribute?Pd:fa)(d,u.itemSize,u.normalized)}void 0!==u.name&&(c.name=u.name),void 0!==u.usage&&c.setUsage(u.usage),void 0!==u.updateRange&&(c.updateRange.offset=u.updateRange.offset,c.updateRange.count=u.updateRange.count),i.setAttribute(l,c)}var p=e.data.morphAttributes;if(p)for(var f in p){for(var v=p[f],m=[],g=0,y=v.length;g<y;g++){var x=v[g],_=void 0;if(x.isInterleavedBufferAttribute){var M=r(e.data,x.data);_=new nd(M,x.itemSize,x.offset,x.normalized)}else{var b=br(x.type,x.array);_=new fa(b,x.itemSize,x.normalized)}void 0!==x.name&&(_.name=x.name),m.push(_)}i.morphAttributes[f]=m}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var S=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==S)for(var w=0,T=S.length;w!==T;++w){var A=S[w];i.addGroup(A.start,A.count,A.materialIndex)}var k=e.data.boundingSphere;if(void 0!==k){var E=new Zr;void 0!==k.center&&E.fromArray(k.center),i.boundingSphere=new gi(E,k.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}]),n}(),em=exports.ObjectLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=""===this.path?Kv.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new wv(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(s){return void 0!==r&&r(s),void console.error("THREE:ObjectLoader: Can't parse "+e+".",s.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)},n,r)}},{key:"loadAsync",value:function(){var e=o(w().mark(function e(t,n){var r,i,a,o,s,l;return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,i=""===this.path?Kv.extractUrlBase(t):this.path,this.resourcePath=this.resourcePath||i,(a=new wv(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),e.next=9,a.loadAsync(t,n);case 9:if(o=e.sent,s=JSON.parse(o),void 0!==(l=s.metadata)&&void 0!==l.type&&"geometry"!==l.type.toLowerCase()){e.next=14;break}throw new Error("THREE.ObjectLoader: Can't load "+t);case 14:return e.next=16,r.parseAsync(s);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}},e,this)}));return function(t,n){return e.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(l)}),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,s,o,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),void 0!==t){var c=!1;for(var h in a)if(a[h].data instanceof HTMLImageElement){c=!0;break}!1===c&&t(l)}return l}},{key:"parseAsync",value:function(){var e=o(w().mark(function e(t){var n,r,i,a,o,s,l,u;return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),e.next=5,this.parseImagesAsync(t.images);case 5:return a=e.sent,o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,i,s,o,n),u=this.parseSkeletons(t.skeletons,l),this.bindSkeletons(l,u),e.abrupt("return",l);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.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 Xp).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 Rd).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 $v,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 jf?o=jf[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 Jv;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],i=vv.parse(r);t[i.uuid]=i}return t}},{key:"parseImages",value:function(e,t){var n,r=this,i={};function a(e){if("string"==typeof e){var t=e;return function(e){return r.manager.itemStart(e),n.load(e,function(){r.manager.itemEnd(e)},void 0,function(){r.manager.itemError(e),r.manager.itemEnd(e)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:r.resourcePath+t)}return e.data?{data:br(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){var o=new _v(t);(n=new kv(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=e.length;s<l;s++){var u=e[s],c=u.url;if(Array.isArray(c)){for(var h=[],d=0,p=c.length;d<p;d++){var f=a(c[d]);null!==f&&(f instanceof HTMLImageElement?h.push(f):h.push(new Ed(f.data,f.width,f.height)))}i[u.uuid]=new Fr(h)}else{var v=a(u.url);i[u.uuid]=new Fr(v)}}}return i}},{key:"parseImagesAsync",value:function(){var e=o(w().mark(function e(t){var n,r,i,a,s,l,u,c,h,d,p,f,v,m,g;return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(){return(s=o(w().mark(function e(t){var r,a;return w().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=8;break}return a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r=t)?r:n.resourcePath+r,e.next=5,i.loadAsync(a);case 5:return e.abrupt("return",e.sent);case 8:if(!t.data){e.next=12;break}return e.abrupt("return",{data:br(t.type,t.data),width:t.width,height:t.height});case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}},e)}))).apply(this,arguments)},a=function(e){return s.apply(this,arguments)},n=this,r={},!(void 0!==t&&t.length>0)){e.next=33;break}(i=new kv(this.manager)).setCrossOrigin(this.crossOrigin),l=0,u=t.length;case 8:if(!(l<u)){e.next=33;break}if(c=t[l],h=c.url,!Array.isArray(h)){e.next=26;break}d=[],p=0,f=h.length;case 14:if(!(p<f)){e.next=23;break}return v=h[p],e.next=18,a(v);case 18:null!==(m=e.sent)&&(m instanceof HTMLImageElement?d.push(m):d.push(new Ed(m.data,m.width,m.height)));case 20:p++,e.next=14;break;case 23:r[c.uuid]=new Fr(d),e.next=30;break;case 26:return e.next=28,a(c.url);case 28:g=e.sent,r[c.uuid]=new Fr(g);case 30:l++,e.next=8;break;case 33:return e.abrupt("return",r);case 34:case"end":return e.stop()}},e,this)}));return 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=t[o.image],l=s.data,u=void 0;Array.isArray(l)?(u=new ho,6===l.length&&(u.needsUpdate=!0)):(u=l&&l.data?new Ed:new Ur,l&&(u.needsUpdate=!0)),u.source=s,u.uuid=o.uuid,void 0!==o.name&&(u.name=o.name),void 0!==o.mapping&&(u.mapping=n(o.mapping,tm)),void 0!==o.offset&&u.offset.fromArray(o.offset),void 0!==o.repeat&&u.repeat.fromArray(o.repeat),void 0!==o.center&&u.center.fromArray(o.center),void 0!==o.rotation&&(u.rotation=o.rotation),void 0!==o.wrap&&(u.wrapS=n(o.wrap[0],nm),u.wrapT=n(o.wrap[1],nm)),void 0!==o.format&&(u.format=o.format),void 0!==o.type&&(u.type=o.type),void 0!==o.encoding&&(u.encoding=o.encoding),void 0!==o.minFilter&&(u.minFilter=n(o.minFilter,rm)),void 0!==o.magFilter&&(u.magFilter=n(o.magFilter,rm)),void 0!==o.anisotropy&&(u.anisotropy=o.anisotropy),void 0!==o.flipY&&(u.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(u.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(u.unpackAlignment=o.unpackAlignment),void 0!==o.userData&&(u.userData=o.userData),r[o.uuid]=u}return r}},{key:"parseObject",value:function(e,t,n,r,i){var a,o,s;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function u(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 c(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":a=new $h,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new Nr(e.background):a.background=c(e.background)),void 0!==e.environment&&(a.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new Qh(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new Kh(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new so(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new lu(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new qv(e.color,e.intensity);break;case"DirectionalLight":a=new jv(e.color,e.intensity);break;case"PointLight":a=new Hv(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Xv(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new zv(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Pv(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=(new Zv).fromJSON(e);break;case"SkinnedMesh":o=l(e.geometry),s=u(e.material),a=new Ad(o,s),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":o=l(e.geometry),s=u(e.material),a=new Ja(o,s);break;case"InstancedMesh":o=l(e.geometry),s=u(e.material);var h=e.count,d=e.instanceMatrix,p=e.instanceColor;(a=new Fd(o,s,h)).instanceMatrix=new Pd(new Float32Array(d.array),16),void 0!==p&&(a.instanceColor=new Pd(new Float32Array(p.array),p.itemSize));break;case"LOD":a=new _d;break;case"Line":a=new Wd(l(e.geometry),u(e.material));break;case"LineLoop":a=new Yd(l(e.geometry),u(e.material));break;case"LineSegments":a=new Xd(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new ep(l(e.geometry),u(e.material));break;case"Sprite":a=new md(u(e.material));break;case"Group":a=new Gh;break;case"Bone":a=new kd;break;default:a=new Ki}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children)for(var f=e.children,v=0;v<f.length;v++)a.add(this.parseObject(f[v],t,n,r,i));if(void 0!==e.animations)for(var m=e.animations,g=0;g<m.length;g++){var y=m[g];a.animations.push(i[y])}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);for(var x=e.levels,_=0;_<x.length;_++){var M=x[_],b=a.getObjectByProperty("uuid",M.object);void 0!==b&&a.addLevel(b,M.distance)}}return a}},{key:"bindSkeletons",value:function(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var n=t[e.skeleton];void 0===n?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)}}]),n}(),tm={UVMapping:Pe,CubeReflectionMapping:Ie,CubeRefractionMapping:De,EquirectangularReflectionMapping:Ne,EquirectangularRefractionMapping:Oe,CubeUVReflectionMapping:Fe},nm={RepeatWrapping:ze,ClampToEdgeWrapping:Be,MirroredRepeatWrapping:Ue},rm={NearestFilter:Ge,NearestMipmapNearestFilter:Ve,NearestMipmapLinearFilter:We,LinearFilter:qe,LinearMipmapNearestFilter:Xe,LinearMipmapLinearFilter:Ze},im=exports.ImageBitmapLoader=function(e){m(n,bv);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return E(n,[{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=xv.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){xv.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)}}]),n}(),am=exports.AudioContext={getContext:function(){return void 0===yv&&(yv=new(window.AudioContext||window.webkitAudioContext)),yv},setContext:function(e){yv=e}},om=exports.AudioLoader=function(e){m(n,bv);var t=y(n);function n(e){return A(this,n),t.call(this,e)}return E(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new wv(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);am.getContext().decodeAudioData(a,function(e){t(e)})}catch(o){r?r(o):console.error(o),i.manager.itemError(e)}},n,r)}}]),n}(),sm=exports.HemisphereLightProbe=function(e){m(n,Zv);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;A(this,n),(i=t.call(this,void 0,a)).isHemisphereLightProbe=!0;var o=(new Nr).set(e),s=(new Nr).set(r),l=new Zr(o.r,o.g,o.b),u=new Zr(s.r,s.g,s.b),c=Math.sqrt(Math.PI),h=c*Math.sqrt(.75);return i.sh.coefficients[0].copy(l).add(u).multiplyScalar(c),i.sh.coefficients[1].copy(l).sub(u).multiplyScalar(h),i}return E(n)}(),lm=exports.AmbientLightProbe=function(e){m(n,Zv);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;A(this,n),(r=t.call(this,void 0,i)).isAmbientLightProbe=!0;var a=(new Nr).set(e);return r.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return E(n)}(),um=new Ai,cm=new Ai,hm=new Ai,dm=exports.StereoCamera=function(){function e(){A(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new so,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new so,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 E(e,[{key:"update",value:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,hm.copy(e.projectionMatrix);var n,r,i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(Xn*t.fov*.5)/t.zoom;cm.elements[12]=-i,um.elements[12]=i,n=-o*t.aspect+a,r=o*t.aspect+a,hm.elements[0]=2*t.near/(r-n),hm.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(hm),n=-o*t.aspect-a,r=o*t.aspect-a,hm.elements[0]=2*t.near/(r-n),hm.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(hm)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(cm),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(um)}}]),e}(),pm=exports.Clock=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];A(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return E(e,[{key:"start",value:function(){this.startTime=fm(),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=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=fm();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function fm(){return("undefined"==typeof performance?Date:performance).now()}var vm=new Zr,mm=new Yr,gm=new Zr,ym=new Zr,xm=exports.AudioListener=function(e){m(n,Ki);var t=y(n);function n(){var e;return A(this,n),(e=t.call(this)).type="AudioListener",e.context=am.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new pm,e}return E(n,[{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){f(b(n.prototype),"updateMatrixWorld",this).call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(vm,mm,gm),ym.set(0,0,-1).applyQuaternion(mm),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(vm.x,i),t.positionY.linearRampToValueAtTime(vm.y,i),t.positionZ.linearRampToValueAtTime(vm.z,i),t.forwardX.linearRampToValueAtTime(ym.x,i),t.forwardY.linearRampToValueAtTime(ym.y,i),t.forwardZ.linearRampToValueAtTime(ym.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(vm.x,vm.y,vm.z),t.setOrientation(ym.x,ym.y,ym.z,r.x,r.y,r.z)}}]),n}(),_m=exports.Audio=function(e){m(n,Ki);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this)).type="Audio",r.listener=e,r.context=e.context,r.gain=r.context.createGain(),r.gain.connect(e.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 E(n,[{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=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,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(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}},{key:"disconnect",value:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._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}}]),n}(),Mm=new Zr,bm=new Yr,Sm=new Zr,wm=new Zr,Tm=exports.PositionalAudio=function(e){m(n,_m);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this,e)).panner=r.context.createPanner(),r.panner.panningModel="HRTF",r.panner.connect(r.gain),r}return E(n,[{key:"disconnect",value:function(){f(b(n.prototype),"disconnect",this).call(this),this.panner.disconnect(this.gain)}},{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){if(f(b(n.prototype),"updateMatrixWorld",this).call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Mm,bm,Sm),wm.set(0,0,1).applyQuaternion(bm);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Mm.x,r),t.positionY.linearRampToValueAtTime(Mm.y,r),t.positionZ.linearRampToValueAtTime(Mm.z,r),t.orientationX.linearRampToValueAtTime(wm.x,r),t.orientationY.linearRampToValueAtTime(wm.y,r),t.orientationZ.linearRampToValueAtTime(wm.z,r)}else t.setPosition(Mm.x,Mm.y,Mm.z),t.setOrientation(wm.x,wm.y,wm.z)}}}]),n}(),Am=exports.AudioAnalyser=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2048;A(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return E(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}(),km=exports.PropertyMixer=function(){function e(t,n,r){var i,a,o;switch(A(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 E(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{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;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+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(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){Yr.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;Yr.multiplyQuaternionsFlat(e,a,e,t,e,n),Yr.slerpFlat(e,t,e,t,e,a,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}(),Em="\\[\\]\\.:\\/",Cm=new RegExp("["+Em+"]","g"),Lm="[^"+Em+"]",Rm="[^"+Em.replace("\\.","")+"]",Pm=/((?:WC+[\/:])*)/.source.replace("WC",Lm),Im=/(WCOD+)?/.source.replace("WCOD",Rm),Dm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Lm),Nm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Lm),Om=new RegExp("^"+Pm+Im+Dm+Nm+"$"),Fm=["material","materials","bones"],zm=function(){function e(t,n,r){A(this,e);var i=r||Bm.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return E(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.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}(),Bm=exports.PropertyBinding=function(){function e(t,n,r){A(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 E(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[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;this.targetObject=t,void 0!==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.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{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+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 t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Cm,"")}},{key:"parseTrackName",value:function(e){var t=Om.exec(e);if(null===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){var i=n.nodeName.substring(r+1);-1!==Fm.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(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(void 0===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}if(e.children){var r=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(r)return r}return null}}]),e}();Bm.Composite=zm,Bm.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Bm.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Bm.prototype.GetterByBindingType=[Bm.prototype._getValue_direct,Bm.prototype._getValue_array,Bm.prototype._getValue_arrayElement,Bm.prototype._getValue_toArray],Bm.prototype.SetterByBindingTypeAndVersioning=[[Bm.prototype._setValue_direct,Bm.prototype._setValue_direct_setNeedsUpdate,Bm.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Bm.prototype._setValue_array,Bm.prototype._setValue_array_setNeedsUpdate,Bm.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Bm.prototype._setValue_arrayElement,Bm.prototype._setValue_arrayElement_setNeedsUpdate,Bm.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Bm.prototype._setValue_fromArray,Bm.prototype._setValue_fromArray_setNeedsUpdate,Bm.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Um=exports.AnimationObjectGroup=function(){function e(){A(this,e),this.isAnimationObjectGroup=!0,this.uuid=Zn(),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 E(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,v=a;f!==v;++f)i[f].push(new Bm(h,n[f],r[f]))}else if(p<l){o=e[p];var m=--l,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=h;for(var y=0,x=a;y!==x;++y){var _=i[y],M=_[m],b=_[p];_[p]=M,void 0===b&&(b=new Bm(h,n[y],r[y])),_[m]=b}}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&&u>=i){var c=i++,h=e[c];t[h.uuid]=u,e[u]=h,t[l]=c,e[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],v=f[c],m=f[u];f[u]=v,f[c]=m}}}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=arguments[o].uuid,u=t[l];if(void 0!==u)if(delete t[l],u<i){var c=--i,h=e[c],d=--a,p=e[d];t[h.uuid]=u,e[u]=h,t[p.uuid]=c,e[c]=p,e.pop();for(var f=0,v=r;f!==v;++f){var m=n[f],g=m[c],y=m[d];m[u]=g,m[c]=y,m.pop()}}else{var x=--a,_=e[x];x>0&&(t[_.uuid]=u),e[u]=_,e.pop();for(var M=0,b=r;M!==b;++M){var S=n[M];S[u]=S[x],S.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 Bm(p,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),e}(),Gm=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;A(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:Qt,endingEnd:Qt},u=0;u!==o;++u){var c=a[u].createInterpolant(null);s[u]=c,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=Xt,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 E(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){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return 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;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/a,l[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){var a=(e-i)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case nn:for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);break;case tn:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),u[d].accumulate(r,s)}}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Yt;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===qt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=$t,r.endingEnd=$t):(r.endingStart=e?this.zeroSlopeAtStart?$t:Qt:en,r.endingEnd=t?this.zeroSlopeAtEnd?$t:Qt:en)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}]),e}(),Vm=new Float32Array(1),Hm=exports.AnimationMixer=function(e){m(n,Wn);var t=y(n);function n(e){var r;return A(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return E(n,[{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=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var h=r[c],d=h.name,p=u[d];if(void 0!==p)++p.referenceCount,a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new km(Bm.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var 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){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}},{key:"_addInactiveAction",value:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}},{key:"_removeInactiveAction",value:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,l=s[s.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],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];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new av(new Float32Array(2),new Float32Array(2),1,Vm)).__cacheIndex=t,e[t]=n),n}},{key:"_takeBackControlInterpolant",value:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}},{key:"clipAction",value:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?vv.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:tn),void 0!==s){var u=s.actionByRoot[i];if(void 0!==u&&u.blendMode===n)return u;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new Gm(this,a,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,i),c}},{key:"existingAction",value:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?vv.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--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){this.time=0;for(var t=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,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}}},{key:"uncacheRoot",value:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}}},{key:"uncacheAction",value:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(),Wm=exports.Uniform=function(){function e(t){A(this,e),"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}return E(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}(),jm=exports.InstancedInterleavedBuffer=function(e){m(n,ed);var t=y(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return A(this,n),(i=t.call(this,e,r)).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=a,i}return E(n,[{key:"copy",value:function(e){return f(b(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var t=f(b(n.prototype),"clone",this).call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t}},{key:"toJSON",value:function(e){var t=f(b(n.prototype),"toJSON",this).call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}]),n}(),qm=exports.GLBufferAttribute=function(){function e(t,n,r,i,a){A(this,e),this.isGLBufferAttribute=!0,this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=a,this.version=0}return E(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}(),Xm=exports.Raycaster=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;A(this,e),this.ray=new Ti(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new Fi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return E(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,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.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=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Zm(e,this,n,t),n.sort(Ym),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r<i;r++)Zm(e[r],this,n,t);return n.sort(Ym),n}}]),e}();function Ym(e,t){return e.distance-t.distance}function Zm(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++)Zm(i[a],t,n,!0)}var Jm=exports.Spherical=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,e),this.radius=t,this.phi=n,this.theta=r,this}return E(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(Jn(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Km=exports.Cylindrical=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,e),this.radius=t,this.theta=n,this.y=r,this}return E(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}(),Qm=new yr,$m=exports.Box2=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new yr(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yr(-1/0,-1/0);A(this,e),this.isBox2=!0,this.min=t,this.max=n}return E(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){var n=Qm.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 Qm.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}(),eg=new Zr,tg=new Zr,ng=exports.Line3=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr;A(this,e),this.start=t,this.end=n}return E(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){eg.subVectors(e,this.start),tg.subVectors(this.end,this.start);var n=tg.dot(tg),r=tg.dot(eg)/n;return t&&(r=Jn(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).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}(),rg=new Zr,ig=exports.SpotLightHelper=function(e){m(n,Ki);var t=y(n);function n(e,r){var i;A(this,n),(i=t.call(this)).light=e,i.light.updateMatrixWorld(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r;for(var a=new Pa,o=[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],s=0,l=1;s<32;s++,l++){var u=s/32*Math.PI*2,c=l/32*Math.PI*2;o.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}a.setAttribute("position",new Sa(o,3));var h=new zd({fog:!1,toneMapped:!1});return i.cone=new Xd(a,h),i.add(i.cone),i.update(),i}return E(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),rg.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(rg),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(),ag=new Zr,og=new Ai,sg=new Ai,lg=exports.SkeletonHelper=function(e){m(n,Xd);var t=y(n);function n(e){var r;A(this,n);for(var i=ug(e),a=new Pa,o=[],s=[],l=new Nr(0,0,1),u=new Nr(0,1,0),c=0;c<i.length;c++){var h=i[c];h.parent&&h.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(l.r,l.g,l.b),s.push(u.r,u.g,u.b))}a.setAttribute("position",new Sa(o,3)),a.setAttribute("color",new Sa(s,3));var d=new zd({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=t.call(this,a,d)).isSkeletonHelper=!0,r.type="SkeletonHelper",r.root=e,r.bones=i,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r}return E(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");sg.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<t.length;a++){var s=t[a];s.parent&&s.parent.isBone&&(og.multiplyMatrices(sg,s.matrixWorld),ag.setFromMatrixPosition(og),i.setXYZ(o,ag.x,ag.y,ag.z),og.multiplyMatrices(sg,s.parent.matrixWorld),ag.setFromMatrixPosition(og),i.setXYZ(o+1,ag.x,ag.y,ag.z),o+=2)}r.getAttribute("position").needsUpdate=!0,f(b(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}();function ug(e){var t=[];!0===e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,ug(e.children[n]));return t}var cg=exports.PointLightHelper=function(e){m(n,Ja);var t=y(n);function n(e,r,i){var a;A(this,n);var o=new zf(r,4,2),s=new ha({wireframe:!0,fog:!1,toneMapped:!1});return(a=t.call(this,o,s)).light=e,a.light.updateMatrixWorld(),a.color=i,a.type="PointLightHelper",a.matrix=a.light.matrixWorld,a.matrixAutoUpdate=!1,a.update(),a}return E(n,[{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)}}]),n}(),hg=new Zr,dg=new Nr,pg=new Nr,fg=exports.HemisphereLightHelper=function(e){m(n,Ki);var t=y(n);function n(e,r,i){var a;A(this,n),(a=t.call(this)).light=e,a.light.updateMatrixWorld(),a.matrix=e.matrixWorld,a.matrixAutoUpdate=!1,a.color=i;var o=new Df(r);o.rotateY(.5*Math.PI),a.material=new ha({wireframe:!0,fog:!1,toneMapped:!1}),void 0===a.color&&(a.material.vertexColors=!0);var s=o.getAttribute("position"),l=new Float32Array(3*s.count);return o.setAttribute("color",new fa(l,3)),a.add(new Ja(o,a.material)),a.update(),a}return E(n,[{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");dg.copy(this.light.color),pg.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?dg:pg;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(hg.setFromMatrixPosition(this.light.matrixWorld).negate())}}]),n}(),vg=exports.GridHelper=function(e){m(n,Xd);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;A(this,n),a=new Nr(a),o=new Nr(o);for(var s=i/2,l=r/i,u=r/2,c=[],h=[],d=0,p=0,f=-u;d<=i;d++,f+=l){c.push(-u,0,f,u,0,f),c.push(f,0,-u,f,0,u);var v=d===s?a:o;v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3}var m=new Pa;m.setAttribute("position",new Sa(c,3)),m.setAttribute("color",new Sa(h,3));var g=new zd({vertexColors:!0,toneMapped:!1});return(e=t.call(this,m,g)).type="GridHelper",e}return E(n)}(),mg=exports.PolarGridHelper=function(e){m(n,Xd);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;A(this,n),s=new Nr(s),l=new Nr(l);for(var u=[],c=[],h=0;h<=i;h++){var d=h/i*(2*Math.PI),p=Math.sin(d)*r,f=Math.cos(d)*r;u.push(0,0,0),u.push(p,0,f);var v=1&h?s:l;c.push(v.r,v.g,v.b),c.push(v.r,v.g,v.b)}for(var m=0;m<=a;m++)for(var g=1&m?s:l,y=r-r/a*m,x=0;x<o;x++){var _=x/o*(2*Math.PI),M=Math.sin(_)*y,b=Math.cos(_)*y;u.push(M,0,b),c.push(g.r,g.g,g.b),_=(x+1)/o*(2*Math.PI),M=Math.sin(_)*y,b=Math.cos(_)*y,u.push(M,0,b),c.push(g.r,g.g,g.b)}var S=new Pa;S.setAttribute("position",new Sa(u,3)),S.setAttribute("color",new Sa(c,3));var w=new zd({vertexColors:!0,toneMapped:!1});return(e=t.call(this,S,w)).type="PolarGridHelper",e}return E(n)}(),gg=new Zr,yg=new Zr,xg=new Zr,_g=exports.DirectionalLightHelper=function(e){m(n,Ki);var t=y(n);function n(e,r,i){var a;A(this,n),(a=t.call(this)).light=e,a.light.updateMatrixWorld(),a.matrix=e.matrixWorld,a.matrixAutoUpdate=!1,a.color=i,void 0===r&&(r=1);var o=new Pa;o.setAttribute("position",new Sa([-r,r,0,r,r,0,r,-r,0,-r,-r,0,-r,r,0],3));var s=new zd({fog:!1,toneMapped:!1});return a.lightPlane=new Wd(o,s),a.add(a.lightPlane),(o=new Pa).setAttribute("position",new Sa([0,0,0,0,0,1],3)),a.targetLine=new Wd(o,s),a.add(a.targetLine),a.update(),a}return E(n,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){gg.setFromMatrixPosition(this.light.matrixWorld),yg.setFromMatrixPosition(this.light.target.matrixWorld),xg.subVectors(yg,gg),this.lightPlane.lookAt(yg),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(yg),this.targetLine.scale.z=xg.length()}}]),n}(),Mg=new Zr,bg=new oo,Sg=exports.CameraHelper=function(e){m(n,Xd);var t=y(n);function n(e){var r;A(this,n);var i=new Pa,a=new zd({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],s=[],l={};function u(e,t){c(e),c(t)}function c(e){o.push(0,0,0),s.push(0,0,0),void 0===l[e]&&(l[e]=[]),l[e].push(o.length/3-1)}u("n1","n2"),u("n2","n4"),u("n4","n3"),u("n3","n1"),u("f1","f2"),u("f2","f4"),u("f4","f3"),u("f3","f1"),u("n1","f1"),u("n2","f2"),u("n3","f3"),u("n4","f4"),u("p","n1"),u("p","n2"),u("p","n3"),u("p","n4"),u("u1","u2"),u("u2","u3"),u("u3","u1"),u("c","t"),u("p","c"),u("cn1","cn2"),u("cn3","cn4"),u("cf1","cf2"),u("cf3","cf4"),i.setAttribute("position",new Sa(o,3)),i.setAttribute("color",new Sa(s,3)),(r=t.call(this,i,a)).type="CameraHelper",r.camera=e,r.camera.updateProjectionMatrix&&r.camera.updateProjectionMatrix(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.pointMap=l,r.update();var h=new Nr(16755200),d=new Nr(16711680),p=new Nr(43775),f=new Nr(16777215),v=new Nr(3355443);return r.setColors(h,d,p,f,v),r}return E(n,[{key:"setColors",value:function(e,t,n,r,i){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,i.r,i.g,i.b),a.setXYZ(41,i.r,i.g,i.b),a.setXYZ(42,i.r,i.g,i.b),a.setXYZ(43,i.r,i.g,i.b),a.setXYZ(44,i.r,i.g,i.b),a.setXYZ(45,i.r,i.g,i.b),a.setXYZ(46,i.r,i.g,i.b),a.setXYZ(47,i.r,i.g,i.b),a.setXYZ(48,i.r,i.g,i.b),a.setXYZ(49,i.r,i.g,i.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;bg.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),wg("c",t,e,bg,0,0,-1),wg("t",t,e,bg,0,0,1),wg("n1",t,e,bg,-1,-1,-1),wg("n2",t,e,bg,1,-1,-1),wg("n3",t,e,bg,-1,1,-1),wg("n4",t,e,bg,1,1,-1),wg("f1",t,e,bg,-1,-1,1),wg("f2",t,e,bg,1,-1,1),wg("f3",t,e,bg,-1,1,1),wg("f4",t,e,bg,1,1,1),wg("u1",t,e,bg,.7,1.1,-1),wg("u2",t,e,bg,-.7,1.1,-1),wg("u3",t,e,bg,0,2,-1),wg("cf1",t,e,bg,-1,0,1),wg("cf2",t,e,bg,1,0,1),wg("cf3",t,e,bg,0,-1,1),wg("cf4",t,e,bg,0,1,1),wg("cn1",t,e,bg,-1,0,-1),wg("cn2",t,e,bg,1,0,-1),wg("cn3",t,e,bg,0,-1,-1),wg("cn4",t,e,bg,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}();function wg(e,t,n,r,i,a,o){Mg.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],Mg.x,Mg.y,Mg.z)}var Tg,Ag,kg=new Qr,Eg=exports.BoxHelper=function(e){m(n,Xd);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;A(this,n);var a=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]),o=new Float32Array(24),s=new Pa;return s.setIndex(new fa(a,1)),s.setAttribute("position",new fa(o,3)),(r=t.call(this,s,new zd({color:i,toneMapped:!1}))).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return E(n,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&kg.setFromObject(this.object),!kg.isEmpty()){var t=kg.min,n=kg.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[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,t){return f(b(n.prototype),"copy",this).call(this,e,t),this.object=e.object,this}}]),n}(),Cg=exports.Box3Helper=function(e){m(n,Xd);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;A(this,n);var a=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]),o=new Pa;return o.setIndex(new fa(a,1)),o.setAttribute("position",new Sa([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=t.call(this,o,new zd({color:i,toneMapped:!1}))).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return E(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),f(b(n.prototype),"updateMatrixWorld",this).call(this,e))}}]),n}(),Lg=exports.PlaneHelper=function(e){m(n,Wd);var t=y(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;A(this,n);var o=a,s=new Pa;s.setAttribute("position",new Sa([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)),s.computeBoundingSphere(),(r=t.call(this,s,new zd({color:o,toneMapped:!1}))).type="PlaneHelper",r.plane=e,r.size=i;var l=new Pa;return l.setAttribute("position",new Sa([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),l.computeBoundingSphere(),r.add(new Ja(l,new ha({color:o,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}return E(n,[{key:"updateMatrixWorld",value:function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?H:V,this.lookAt(this.plane.normal),f(b(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(),Rg=new Zr,Pg=exports.ArrowHelper=function(e){m(n,Ki);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Zr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zr(0,0,0),a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*a,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*s;return A(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Tg&&((Tg=new Pa).setAttribute("position",new Sa([0,0,0,0,1,0],3)),(Ag=new zp(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new Wd(Tg,new zd({color:o,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new Ja(Ag,new ha({color:o,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(r),e.setLength(a,s,l),e}return E(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Rg.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Rg,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&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 f(b(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}]),n}(),Ig=exports.AxesHelper=function(e){m(n,Xd);var t=y(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;A(this,n);var i=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],a=new Pa;a.setAttribute("position",new Sa(i,3)),a.setAttribute("color",new Sa([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var o=new zd({vertexColors:!0,toneMapped:!1});return(e=t.call(this,a,o)).type="AxesHelper",e}return E(n,[{key:"setColors",value:function(e,t,n){var r=new Nr,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()}}]),n}(),Dg=exports.ShapePath=function(){function e(){A(this,e),this.type="ShapePath",this.color=new Nr,this.subPaths=[],this.currentPath=null}return E(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Dp,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 Xp;a.curves=i.curves,t.push(a)}return t}function r(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)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=u*(e.x-o.x)-l*(e.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i,a,o,s=kf.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===t)return n(l);var u=[];if(1===l.length)return a=l[0],(o=new Xp).curves=a.curves,u.push(o),u;var c=!s(l[0].getPoints());c=e?!c:c;var h,d,p=[],f=[],v=[],m=0;f[m]=void 0,v[m]=[];for(var g=0,y=l.length;g<y;g++)i=s(h=(a=l[g]).getPoints()),(i=e?!i:i)?(!c&&f[m]&&m++,f[m]={s:new Xp,p:h},f[m].s.curves=a.curves,c&&m++,v[m]=[]):v[m].push({h:a,p:h[0]});if(!f[0])return n(l);if(f.length>1){for(var x=!1,_=0,M=0,b=f.length;M<b;M++)p[M]=[];for(var S=0,w=f.length;S<w;S++)for(var T=v[S],A=0;A<T.length;A++){for(var k=T[A],E=!0,C=0;C<f.length;C++)r(k.p,f[C].p)&&(S!==C&&_++,E?(E=!1,p[C].push(k)):x=!0);E&&p[S].push(k)}_>0&&!1===x&&(v=p)}for(var L=0,R=f.length;L<R;L++){o=f[L].s,u.push(o);for(var P=0,I=(d=v[L]).length;P<I;P++)o.holes.push(d[P].h)}return u}}]),e}(),Ng=Hg(),Og=Ng.floatView,Fg=Ng.uint32View,zg=Ng.baseTable,Bg=Ng.shiftTable,Ug=Ng.mantissaTable,Gg=Ng.exponentTable,Vg=Ng.offsetTable;function Hg(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(r[a]=0,r[256|a]=32768,i[a]=24,i[256|a]=24):o<-14?(r[a]=1024>>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var p=1024;p<2048;++p)s[p]=939524096+(p-1024<<13);for(var f=1;f<31;++f)l[f]=f<<23;l[31]=1199570944,l[32]=2147483648;for(var v=33;v<63;++v)l[v]=2147483648+(v-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:l,offsetTable:u}}function Wg(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Jn(e,-65504,65504),Og[0]=e;var t=Fg[0],n=t>>23&511;return zg[n]+((8388607&t)>>Bg[n])}function jg(e){var t=e>>10;return Fg[0]=Ug[Vg[t]+(1023&e)]+Gg[t],Og[0]}var qg=exports.DataUtils=Object.freeze({__proto__:null,toHalfFloat:Wg,fromHalfFloat:jg}),Xg=exports.ParametricGeometry=function(e){m(n,Pa);var t=y(n);function n(){return A(this,n),console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),t.call(this)}return E(n)}(),Yg=exports.TextGeometry=function(e){m(n,Pa);var t=y(n);function n(){return A(this,n),console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),t.call(this)}return E(n)}();function Zg(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function Jg(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function Kg(){console.error("THREE.ImmediateRenderObject has been removed.")}var Qg=exports.WebGLMultisampleRenderTarget=function(e){m(n,Vr);var t=y(n);function n(e,r,i){var a;return A(this,n),console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),(a=t.call(this,e,r,i)).samples=4,a}return E(n)}(),$g=exports.DataTexture2DArray=function(e){m(n,Hr);var t=y(n);function n(e,r,i,a){return A(this,n),console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),t.call(this,e,r,i,a)}return E(n)}(),ey=exports.DataTexture3D=function(e){m(n,jr);var t=y(n);function n(e,r,i,a){return A(this,n),console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),t.call(this,e,r,i,a)}return E(n)}();"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:R}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=R);
|
|
},{}],"AJno":[function(require,module,exports) {
|
|
module.exports="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform float time;\n\nvoid main() {\nvUv = uv;\n\ngl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}";
|
|
},{}],"maiY":[function(require,module,exports) {
|
|
module.exports="#define GLSLIFY 1\nvarying vec2 vUv;\nuniform float time;\nuniform sampler2D u_texture;\n\n// https://www.shadertoy.com/view/4djSRW\nfloat hash12(vec2 p){\n vec3 p3 = fract(vec3(p.xyx) * .1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvoid main() {\n vec2 uv = vUv;\n\n uv.x *= 3.142596;\n\n const float numbers = 9.0;\n\n vec2 repeat = vec2(6.0, 12.0);\n\n vec2 cell = (uv * repeat);\n\n cell.x *= numbers;\n cell = floor(cell);\n\n float rand = 100.0 * hash12(cell);\n\n float offset = mod(floor(time + rand), numbers) / numbers;\n uv = fract(uv * repeat);\n uv.x = fract(uv.x + offset);\n\n vec4 color = texture2D(u_texture, uv);\n\n color -= 0.05 * vec4(vec3(rand), 1.0);\n gl_FragColor = color;\n}";
|
|
},{}],"EU5I":[function(require,module,exports) {
|
|
module.exports="/123.dc54f579.png";
|
|
},{}],"H99C":[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("./styles.css");var e=a(require("three")),t=i(require("./shaders/vertex.glsl")),r=i(require("./shaders/fragment.glsl")),n=i(require("./123.png"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(o=function(e){return e?r:t})(e)}function a(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=o(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(n,a,s):n[a]=e[a]}return n.default=e,r&&r.set(e,n),n}function s(e){return(s="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 u(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=d();return function(){var r,n=m(e);if(t){var i=m(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(){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 m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function v(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function b(e){var t=w(e,"string");return"symbol"==s(t)?t:String(t)}function w(e,t){if("object"!=s(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var g=0,P=!1,O=exports.default=function(){function i(t){p(this,i),this.clock=new e.Clock,this.time=0,this.container=t.domElement,this.height=this.container.offsetHeight,this.width=this.container.offsetWidth,this.camera=new e.PerspectiveCamera(75,this.width/this.height,.1,1e3),this.camera.position.set(0,0,10),this.scene=new e.Scene,this.renderer=new e.WebGLRenderer({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(2*window.devicePixelRatio),this.container.appendChild(this.renderer.domElement),this.normal=new e.Vector3,this.binormal=new e.Vector3,this.resize(),this.addObjects(),this.render(),this.setUpResize()}return v(i,[{key:"addObjects",value:function(){var i=(new e.TextureLoader).load(n.default,function(t){t.minFilter=e.NearestFilter,t.magFilter=e.NearestFilter});this.material=new e.ShaderMaterial({side:e.DoubleSide,uniforms:{time:{type:"f",value:0},uResolution:{type:"v4",value:new e.Vector4},u_texture:{type:"t",value:i}},vertexShader:t.default,fragmentShader:r.default});var o=new(function(t){u(n,e.Curve);var r=l(n);function n(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(this,n),(e=r.call(this)).scale=t,e}return v(n,[{key:"getPoint",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new e.Vector3,n=Math.cos(2*Math.PI*t),i=Math.sin(2*Math.PI*t),o=.1*Math.sin(8*Math.PI*t);return r.set(n,i,o).multiplyScalar(this.scale)}}]),n}())(10);this.geometry=new e.TubeGeometry(o,200,.5,20,!1),this.mesh=new e.Mesh(this.geometry,this.material),this.scene.add(this.mesh)}},{key:"render",value:function(){this.time=g;var e=this.time%1e4/1e4,t=this.geometry.parameters.path.getPointAt(e),r=this.geometry.tangents.length,n=e*r,i=Math.floor(n),o=(i+1)%r;this.binormal.subVectors(this.geometry.binormals[o],this.geometry.binormals[i]),this.binormal.multiplyScalar(n-i).add(this.geometry.binormals[i]);var a=this.geometry.parameters.path.getTangentAt(e);this.normal.copy(this.binormal).cross(a),t.add(this.normal.clone().multiplyScalar(0)),this.camera.position.copy(t);var s=this.geometry.parameters.path.getPointAt((e+1/this.geometry.parameters.path.getLength())%1);this.camera.matrix.lookAt(this.camera.position,s,this.normal),this.camera.rotation.setFromRotationMatrix(this.camera.matrix,this.camera.rotation.order),this.material.uniforms.time.value=this.clock.getElapsedTime(),requestAnimationFrame(this.render.bind(this)),this.renderer.render(this.scene,this.camera)}},{key:"resize",value:function(){this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.renderer.setSize(this.width,this.height),this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix()}},{key:"setUpResize",value:function(){window.addEventListener("resize",this.resize.bind(this))}}]),i}();new O({domElement:document.getElementById("container")}),window.addEventListener("mousedown",function(e){P=!0}),window.addEventListener("mouseup",function(e){P=!1}),window.addEventListener("mousemove",function(e){P&&(g+=10*(e.clientY/window.innerHeight*2-1)),g<=0&&(g=0)}),setInterval(function(){g+=1},10);
|
|
},{"./styles.css":"D9Nj","three":"gBK8","./shaders/vertex.glsl":"AJno","./shaders/fragment.glsl":"maiY","./123.png":"EU5I"}]},{},["H99C"], null)
|
|
//# sourceMappingURL=/src.5600be97.js.map
|