1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3737],{40687:function(e,t,r){let i,n,a,s,o;r.r(t),r.d(t,{ACESFilmicToneMapping:function(){return eo},AddEquation:function(){return P},AddOperation:function(){return er},AdditiveAnimationBlendMode:function(){return tA},AdditiveBlending:function(){return A},AlphaFormat:function(){return eG},AlwaysDepth:function(){return X},AlwaysStencilFunc:function(){return t1},AmbientLight:function(){return AmbientLight},AmbientLightProbe:function(){return AmbientLightProbe},AnimationClip:function(){return AnimationClip},AnimationLoader:function(){return AnimationLoader},AnimationMixer:function(){return AnimationMixer},AnimationObjectGroup:function(){return AnimationObjectGroup},AnimationUtils:function(){return n6},ArcCurve:function(){return ArcCurve},ArrayCamera:function(){return ArrayCamera},ArrowHelper:function(){return ArrowHelper},Audio:function(){return Audio},AudioAnalyser:function(){return AudioAnalyser},AudioContext:function(){return AudioContext},AudioListener:function(){return AudioListener},AudioLoader:function(){return AudioLoader},AxesHelper:function(){return AxesHelper},BackSide:function(){return b},BasicDepthPacking:function(){return tI},BasicShadowMap:function(){return m},Bone:function(){return Bone},BooleanKeyframeTrack:function(){return BooleanKeyframeTrack},Box2:function(){return Box2},Box3:function(){return Box3},Box3Helper:function(){return Box3Helper},BoxBufferGeometry:function(){return BoxBufferGeometry},BoxGeometry:function(){return BoxGeometry},BoxHelper:function(){return BoxHelper},BufferAttribute:function(){return BufferAttribute},BufferGeometry:function(){return BufferGeometry},BufferGeometryLoader:function(){return BufferGeometryLoader},ByteType:function(){return eL},Cache:function(){return n8},Camera:function(){return Camera},CameraHelper:function(){return CameraHelper},CanvasTexture:function(){return CanvasTexture},CapsuleBufferGeometry:function(){return CapsuleBufferGeometry},CapsuleGeometry:function(){return CapsuleGeometry},CatmullRomCurve3:function(){return CatmullRomCurve3},CineonToneMapping:function(){return es},CircleBufferGeometry:function(){return CircleBufferGeometry},CircleGeometry:function(){return CircleGeometry},ClampToEdgeWrapping:function(){return eg},Clock:function(){return Clock},Color:function(){return Color},ColorKeyframeTrack:function(){return ColorKeyframeTrack},ColorManagement:function(){return ry},CompressedArrayTexture:function(){return CompressedArrayTexture},CompressedTexture:function(){return CompressedTexture},CompressedTextureLoader:function(){return CompressedTextureLoader},ConeBufferGeometry:function(){return ConeBufferGeometry},ConeGeometry:function(){return ConeGeometry},CubeCamera:function(){return CubeCamera},CubeReflectionMapping:function(){return eh},CubeRefractionMapping:function(){return ec},CubeTexture:function(){return CubeTexture},CubeTextureLoader:function(){return CubeTextureLoader},CubeUVReflectionMapping:function(){return ef},CubicBezierCurve:function(){return CubicBezierCurve},CubicBezierCurve3:function(){return CubicBezierCurve3},CubicInterpolant:function(){return CubicInterpolant},CullFaceBack:function(){return d},CullFaceFront:function(){return p},CullFaceFrontBack:function(){return f},CullFaceNone:function(){return c},Curve:function(){return Curve},CurvePath:function(){return CurvePath},CustomBlending:function(){return L},CustomToneMapping:function(){return el},CylinderBufferGeometry:function(){return CylinderBufferGeometry},CylinderGeometry:function(){return CylinderGeometry},Cylindrical:function(){return Cylindrical},Data3DTexture:function(){return Data3DTexture},DataArrayTexture:function(){return DataArrayTexture},DataTexture:function(){return DataTexture},DataTextureLoader:function(){return DataTextureLoader},DataUtils:function(){return aJ},DecrementStencilOp:function(){return tH},DecrementWrapStencilOp:function(){return tq},DefaultLoadingManager:function(){return n7},DepthFormat:function(){return eW},DepthStencilFormat:function(){return eH},DepthTexture:function(){return DepthTexture},DirectionalLight:function(){return DirectionalLight},DirectionalLightHelper:function(){return DirectionalLightHelper},DiscreteInterpolant:function(){return DiscreteInterpolant},DisplayP3ColorSpace:function(){return tG},DodecahedronBufferGeometry:function(){return DodecahedronBufferGeometry},DodecahedronGeometry:function(){return DodecahedronGeometry},DoubleSide:function(){return M},DstAlphaFactor:function(){return F},DstColorFactor:function(){return W},DynamicCopyUsage:function(){return t9},DynamicDrawUsage:function(){return t2},DynamicReadUsage:function(){return t6},EdgesGeometry:function(){return EdgesGeometry},EllipseCurve:function(){return EllipseCurve},EqualDepth:function(){return J},EqualStencilFunc:function(){return tJ},EquirectangularReflectionMapping:function(){return ed},EquirectangularRefractionMapping:function(){return ep},Euler:function(){return Euler},EventDispatcher:function(){return EventDispatcher},ExtrudeBufferGeometry:function(){return ExtrudeBufferGeometry},ExtrudeGeometry:function(){return ExtrudeGeometry},FileLoader:function(){return FileLoader},Float16BufferAttribute:function(){return Float16BufferAttribute},Float32BufferAttribute:function(){return Float32BufferAttribute},Float64BufferAttribute:function(){return Float64BufferAttribute},FloatType:function(){return eB},Fog:function(){return Fog},FogExp2:function(){return FogExp2},FramebufferTexture:function(){return FramebufferTexture},FrontSide:function(){return _},Frustum:function(){return Frustum},GLBufferAttribute:function(){return GLBufferAttribute},GLSL1:function(){return rt},GLSL3:function(){return rr},GreaterDepth:function(){return Q},GreaterEqualDepth:function(){return K},GreaterEqualStencilFunc:function(){return t0},GreaterStencilFunc:function(){return tQ},GridHelper:function(){return GridHelper},Group:function(){return Group},HalfFloatType:function(){return eV},HemisphereLight:function(){return HemisphereLight},HemisphereLightHelper:function(){return HemisphereLightHelper},HemisphereLightProbe:function(){return HemisphereLightProbe},IcosahedronBufferGeometry:function(){return IcosahedronBufferGeometry},IcosahedronGeometry:function(){return IcosahedronGeometry},ImageBitmapLoader:function(){return ImageBitmapLoader},ImageLoader:function(){return ImageLoader},ImageUtils:function(){return ImageUtils},IncrementStencilOp:function(){return tW},IncrementWrapStencilOp:function(){return tj},InstancedBufferAttribute:function(){return InstancedBufferAttribute},InstancedBufferGeometry:function(){return InstancedBufferGeometry},InstancedInterleavedBuffer:function(){return InstancedInterleavedBuffer},InstancedMesh:function(){return InstancedMesh},Int16BufferAttribute:function(){return Int16BufferAttribute},Int32BufferAttribute:function(){return Int32BufferAttribute},Int8BufferAttribute:function(){return Int8BufferAttribute},IntType:function(){return eI},InterleavedBuffer:function(){return InterleavedBuffer},InterleavedBufferAttribute:function(){return InterleavedBufferAttribute},Interpolant:function(){return Interpolant},InterpolateDiscrete:function(){return tx},InterpolateLinear:function(){return t_},InterpolateSmooth:function(){return tb},InvertStencilOp:function(){return tX},KeepStencilOp:function(){return tF},KeyframeTrack:function(){return KeyframeTrack},LOD:function(){return LOD},LatheBufferGeometry:function(){return LatheBufferGeometry},LatheGeometry:function(){return LatheGeometry},Layers:function(){return Layers},LessDepth:function(){return Y},LessEqualDepth:function(){return Z},LessEqualStencilFunc:function(){return tK},LessStencilFunc:function(){return tZ},Light:function(){return Light},LightProbe:function(){return LightProbe},Line:function(){return Line},Line3:function(){return Line3},LineBasicMaterial:function(){return LineBasicMaterial},LineCurve:function(){return LineCurve},LineCurve3:function(){return LineCurve3},LineDashedMaterial:function(){return LineDashedMaterial},LineLoop:function(){return LineLoop},LineSegments:function(){return LineSegments},LinearEncoding:function(){return tP},LinearFilter:function(){return eS},LinearInterpolant:function(){return LinearInterpolant},LinearMipMapLinearFilter:function(){return eC},LinearMipMapNearestFilter:function(){return eT},LinearMipmapLinearFilter:function(){return eA},LinearMipmapNearestFilter:function(){return ew},LinearSRGBColorSpace:function(){return tz},LinearToneMapping:function(){return en},Loader:function(){return Loader},LoaderUtils:function(){return LoaderUtils},LoadingManager:function(){return LoadingManager}
1,LoopOnce:function(){return tg},LoopPingPong:function(){return ty},LoopRepeat:function(){return tv},LuminanceAlphaFormat:function(){return ek},LuminanceFormat:function(){return eF},MOUSE:function(){return u},Material:function(){return Material},MaterialLoader:function(){return MaterialLoader},MathUtils:function(){return rl},Matrix3:function(){return Matrix3},Matrix4:function(){return Matrix4},MaxEquation:function(){return B},Mesh:function(){return Mesh},MeshBasicMaterial:function(){return MeshBasicMaterial},MeshDepthMaterial:function(){return MeshDepthMaterial},MeshDistanceMaterial:function(){return MeshDistanceMaterial},MeshLambertMaterial:function(){return MeshLambertMaterial},MeshMatcapMaterial:function(){return MeshMatcapMaterial},MeshNormalMaterial:function(){return MeshNormalMaterial},MeshPhongMaterial:function(){return MeshPhongMaterial},MeshPhysicalMaterial:function(){return MeshPhysicalMaterial},MeshStandardMaterial:function(){return MeshStandardMaterial},MeshToonMaterial:function(){return MeshToonMaterial},MinEquation:function(){return D},MirroredRepeatWrapping:function(){return ev},MixOperation:function(){return et},MultiplyBlending:function(){return E},MultiplyOperation:function(){return ee},NearestFilter:function(){return ey},NearestMipMapLinearFilter:function(){return eM},NearestMipMapNearestFilter:function(){return e_},NearestMipmapLinearFilter:function(){return eb},NearestMipmapNearestFilter:function(){return ex},NeverDepth:function(){return q},NeverStencilFunc:function(){return tY},NoBlending:function(){return w},NoColorSpace:function(){return tO},NoToneMapping:function(){return ei},NormalAnimationBlendMode:function(){return tT},NormalBlending:function(){return T},NotEqualDepth:function(){return $},NotEqualStencilFunc:function(){return t$},NumberKeyframeTrack:function(){return NumberKeyframeTrack},Object3D:function(){return Object3D},ObjectLoader:function(){return ObjectLoader},ObjectSpaceNormalMap:function(){return tV},OctahedronBufferGeometry:function(){return OctahedronBufferGeometry},OctahedronGeometry:function(){return OctahedronGeometry},OneFactor:function(){return O},OneMinusDstAlphaFactor:function(){return k},OneMinusDstColorFactor:function(){return H},OneMinusSrcAlphaFactor:function(){return U},OneMinusSrcColorFactor:function(){return z},OrthographicCamera:function(){return OrthographicCamera},PCFShadowMap:function(){return g},PCFSoftShadowMap:function(){return y},PMREMGenerator:function(){return PMREMGenerator},Path:function(){return Path},PerspectiveCamera:function(){return PerspectiveCamera},Plane:function(){return Plane},PlaneBufferGeometry:function(){return PlaneBufferGeometry},PlaneGeometry:function(){return PlaneGeometry},PlaneHelper:function(){return PlaneHelper},PointLight:function(){return PointLight},PointLightHelper:function(){return PointLightHelper},Points:function(){return Points},PointsMaterial:function(){return PointsMaterial},PolarGridHelper:function(){return PolarGridHelper},PolyhedronBufferGeometry:function(){return PolyhedronBufferGeometry},PolyhedronGeometry:function(){return PolyhedronGeometry},PositionalAudio:function(){return PositionalAudio},PropertyBinding:function(){return PropertyBinding},PropertyMixer:function(){return PropertyMixer},QuadraticBezierCurve:function(){return QuadraticBezierCurve},QuadraticBezierCurve3:function(){return QuadraticBezierCurve3},Quaternion:function(){return Quaternion},QuaternionKeyframeTrack:function(){return QuaternionKeyframeTrack},QuaternionLinearInterpolant:function(){return QuaternionLinearInterpolant},RED_GREEN_RGTC2_Format:function(){return tf},RED_RGTC1_Format:function(){return td},REVISION:function(){return l},RGBADepthPacking:function(){return tD},RGBAFormat:function(){return eU},RGBAIntegerFormat:function(){return eZ},RGBA_ASTC_10x10_Format:function(){return tl},RGBA_ASTC_10x5_Format:function(){return ta},RGBA_ASTC_10x6_Format:function(){return ts},RGBA_ASTC_10x8_Format:function(){return to},RGBA_ASTC_12x10_Format:function(){return tu},RGBA_ASTC_12x12_Format:function(){return th},RGBA_ASTC_4x4_Format:function(){return e8},RGBA_ASTC_5x4_Format:function(){return e7},RGBA_ASTC_5x5_Format:function(){return e9},RGBA_ASTC_6x5_Format:function(){return te},RGBA_ASTC_6x6_Format:function(){return tt},RGBA_ASTC_8x5_Format:function(){return tr},RGBA_ASTC_8x6_Format:function(){return ti},RGBA_ASTC_8x8_Format:function(){return tn},RGBA_BPTC_Format:function(){return tc},RGBA_ETC2_EAC_Format:function(){return e6},RGBA_PVRTC_2BPPV1_Format:function(){return e2},RGBA_PVRTC_4BPPV1_Format:function(){return e3},RGBA_S3TC_DXT1_Format:function(){return eK},RGBA_S3TC_DXT3_Format:function(){return eQ},RGBA_S3TC_DXT5_Format:function(){return e$},RGB_ETC1_Format:function(){return e4},RGB_ETC2_Format:function(){return e5},RGB_PVRTC_2BPPV1_Format:function(){return e1},RGB_PVRTC_4BPPV1_Format:function(){return e0},RGB_S3TC_DXT1_Format:function(){return eJ},RGFormat:function(){return eX},RGIntegerFormat:function(){return eY}
1,RawShaderMaterial:function(){return RawShaderMaterial},Ray:function(){return Ray},Raycaster:function(){return Raycaster},RectAreaLight:function(){return RectAreaLight},RedFormat:function(){return ej},RedIntegerFormat:function(){return eq},ReinhardToneMapping:function(){return ea},RepeatWrapping:function(){return em},ReplaceStencilOp:function(){return tk},ReverseSubtractEquation:function(){return I},RingBufferGeometry:function(){return RingBufferGeometry},RingGeometry:function(){return RingGeometry},SIGNED_RED_GREEN_RGTC2_Format:function(){return tm},SIGNED_RED_RGTC1_Format:function(){return tp},SRGBColorSpace:function(){return tN},Scene:function(){return Scene},ShaderChunk:function(){return iX},ShaderLib:function(){return iZ},ShaderMaterial:function(){return ShaderMaterial},ShadowMaterial:function(){return ShadowMaterial},Shape:function(){return Shape},ShapeBufferGeometry:function(){return ShapeBufferGeometry},ShapeGeometry:function(){return ShapeGeometry},ShapePath:function(){return ShapePath},ShapeUtils:function(){return ShapeUtils},ShortType:function(){return eP},Skeleton:function(){return Skeleton},SkeletonHelper:function(){return SkeletonHelper},SkinnedMesh:function(){return SkinnedMesh},Source:function(){return Source},Sphere:function(){return Sphere},SphereBufferGeometry:function(){return SphereBufferGeometry},SphereGeometry:function(){return SphereGeometry},Spherical:function(){return Spherical},SphericalHarmonics3:function(){return SphericalHarmonics3},SplineCurve:function(){return SplineCurve},SpotLight:function(){return SpotLight},SpotLightHelper:function(){return SpotLightHelper},Sprite:function(){return Sprite},SpriteMaterial:function(){return SpriteMaterial},SrcAlphaFactor:function(){return G},SrcAlphaSaturateFactor:function(){return j},SrcColorFactor:function(){return N},StaticCopyUsage:function(){return t7},StaticDrawUsage:function(){return t3},StaticReadUsage:function(){return t5},StereoCamera:function(){return StereoCamera},StreamCopyUsage:function(){return re},StreamDrawUsage:function(){return t4},StreamReadUsage:function(){return t8},StringKeyframeTrack:function(){return StringKeyframeTrack},SubtractEquation:function(){return R},SubtractiveBlending:function(){return C},TOUCH:function(){return h},TangentSpaceNormalMap:function(){return tB},TetrahedronBufferGeometry:function(){return TetrahedronBufferGeometry},TetrahedronGeometry:function(){return TetrahedronGeometry},Texture:function(){return Texture},TextureLoader:function(){return TextureLoader},TorusBufferGeometry:function(){return TorusBufferGeometry},TorusGeometry:function(){return TorusGeometry},TorusKnotBufferGeometry:function(){return TorusKnotBufferGeometry},TorusKnotGeometry:function(){return TorusKnotGeometry},Triangle:function(){return Triangle},TriangleFanDrawMode:function(){return tL},TriangleStripDrawMode:function(){return tE},TrianglesDrawMode:function(){return tC},TubeBufferGeometry:function(){return TubeBufferGeometry},TubeGeometry:function(){return TubeGeometry},TwoPassDoubleSide:function(){return S},UVMapping:function(){return eu},Uint16BufferAttribute:function(){return Uint16BufferAttribute},Uint32BufferAttribute:function(){return Uint32BufferAttribute},Uint8BufferAttribute:function(){return Uint8BufferAttribute},Uint8ClampedBufferAttribute:function(){return Uint8ClampedBufferAttribute},Uniform:function(){return Uniform},UniformsGroup:function(){return UniformsGroup},UniformsLib:function(){return iY},UniformsUtils:function(){return iF},UnsignedByteType:function(){return eE},UnsignedInt248Type:function(){return ez},UnsignedIntType:function(){return eD},UnsignedShort4444Type:function(){return eO},UnsignedShort5551Type:function(){return eN},UnsignedShortType:function(){return eR},VSMShadowMap:function(){return x},Vector2:function(){return Vector2},Vector3:function(){return Vector3},Vector4:function(){return Vector4},VectorKeyframeTrack:function(){return VectorKeyframeTrack},VideoTexture:function(){return VideoTexture},WebGL1Renderer:function(){return WebGL1Renderer},WebGL3DRenderTarget:function(){return WebGL3DRenderTarget},WebGLArrayRenderTarget:function(){return WebGLArrayRenderTarget}
1,WebGLCubeRenderTarget:function(){return WebGLCubeRenderTarget},WebGLMultipleRenderTargets:function(){return WebGLMultipleRenderTargets},WebGLRenderTarget:function(){return WebGLRenderTarget},WebGLRenderer:function(){return WebGLRenderer},WebGLUtils:function(){return WebGLUtils},WireframeGeometry:function(){return WireframeGeometry},WrapAroundEnding:function(){return tw},ZeroCurvatureEnding:function(){return tM},ZeroFactor:function(){return V},ZeroSlopeEnding:function(){return tS},ZeroStencilOp:function(){return tU},_SRGBAFormat:function(){return ri},sRGBEncoding:function(){return tR}});/** 2 * @license 3 * Copyright 2010-2023 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */let l="150",u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},h={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},c=0,d=1,p=2,f=3,m=0,g=1,y=2,x=3,_=0,b=1,M=2,S=2,w=0,T=1,A=2,C=3,E=4,L=5,P=100,R=101,I=102,D=103,B=104,V=200,O=201,N=202,z=203,G=204,U=205,F=206,k=207,W=208,H=209,j=210,q=0,X=1,Y=2,Z=3,J=4,K=5,Q=6,$=7,ee=0,et=1,er=2,ei=0,en=1,ea=2,es=3,eo=4,el=5,eu=300,eh=301,ec=302,ed=303,ep=304,ef=306,em=1e3,eg=1001,ev=1002,ey=1003,ex=1004,e_=1004,eb=1005,eM=1005,eS=1006,ew=1007,eT=1007,eA=1008,eC=1008,eE=1009,eL=1010,eP=1011,eR=1012,eI=1013,eD=1014,eB=1015,eV=1016,eO=1017,eN=1018,ez=1020,eG=1021,eU=1023,eF=1024,ek=1025,eW=1026,eH=1027,ej=1028,eq=1029,eX=1030,eY=1031,eZ=1033,eJ=33776,eK=33777,eQ=33778,e$=33779,e0=35840,e1=35841,e3=35842,e2=35843,e4=36196,e5=37492,e6=37496,e8=37808,e7=37809,e9=37810,te=37811,tt=37812,tr=37813,ti=37814,tn=37815,ta=37816,ts=37817,to=37818,tl=37819,tu=37820,th=37821,tc=36492,td=36283,tp=36284,tf=36285,tm=36286,tg=2200,tv=2201,ty=2202,tx=2300,t_=2301,tb=2302,tM=2400,tS=2401,tw=2402,tT=2500,tA=2501,tC=0,tE=1,tL=2,tP=3e3,tR=3001,tI=3200,tD=3201,tB=0,tV=1,tO="",tN="srgb",tz="srgb-linear",tG="display-p3",tU=0,tF=7680,tk=7681,tW=7682,tH=7683,tj=34055,tq=34056,tX=5386,tY=512,tZ=513,tJ=514,tK=515,tQ=516,t$=517,t0=518,t1=519,t3=35044,t2=35048,t4=35040,t5=35045,t6=35049,t8=35041,t7=35046,t9=35050,re=35042,rt="100",rr="300 es",ri=1035;let EventDispatcher=class EventDispatcher{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners,i=r[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;let t=r.slice(0);for(let r=0,i=t.length;r<i;r++)t[r].call(this,e);e.target=null}}};let rn=["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"],ra=1234567,rs=Math.PI/180,ro=180/Math.PI;function generateUUID(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=rn[255&e]+rn[e>>8&255]+rn[e>>16&255]+rn[e>>24&255]+"-"+rn[255&t]+rn[t>>8&255]+"-"+rn[t>>16&15|64]+rn[t>>24&255]+"-"+rn[63&r|128]+rn[r>>8&255]+"-"+rn[r>>16&255]+rn[r>>24&255]+rn[255&i]+rn[i>>8&255]+rn[i>>16&255]+rn[i>>24&255];return n.toLowerCase()}function clamp(e,t,r){return Math.max(t,Math.min(r,e))}function euclideanModulo(e,t){return(e%t+t)%t}function lerp(e,t,r){return(1-r)*e+r*t}function isPowerOfTwo(e){return(e&e-1)==0&&0!==e}function ceilPowerOfTwo(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function floorPowerOfTwo(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function denormalize(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 Error("Invalid component type.")}}function normalize(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 Error("Invalid component type.")}}let rl={DEG2RAD:rs,RAD2DEG:ro,generateUUID:generateUUID,clamp:clamp,euclideanModulo:euclideanModulo,mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},inverseLerp:function(e,t,r){return e!==t?(r-e)/(t-e):0},lerp:lerp,damp:function(e,t,r,i){return lerp(e,t,1-Math.exp(-r*i))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(euclideanModulo(e,2*t)-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(ra=e);let t=ra+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*rs},radToDeg:function(e){return e*ro},isPowerOfTwo:isPowerOfTwo,ceilPowerOfTwo:ceilPowerOfTwo,floorPowerOfTwo:floorPowerOfTwo,setQuaternionFromProperEuler:function(e,t,r,i,n){let a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),u=a((t+i)/2),h=s((t+i)/2),c=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(n){case"XYX":e.set(o*h,l*c,l*d,o*u);break;case"YZY":e.set(l*d,o*h,l*c,o*u);break;case"ZXZ":e.set(l*c,l*d,o*h,o*u);break;case"XZX":e.set(o*h,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*h,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*h,o*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}},normalize:normalize,denormalize:denormalize};let Vector2=class Vector2{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
5sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){let e=Math.atan2(-this.y,-this.x)+Math.PI;return e}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*r-a*i+e.x,this.y=n*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){Vector2.prototype.isVector2=!0,this.x=e,this.y=t}};let Matrix3=class Matrix3{set(e,t,r,i,n,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=n,u[5]=o,u[6]=r,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[3],o=r[6],l=r[1],u=r[4],h=r[7],c=r[2],d=r[5],p=r[8],f=i[0],m=i[3],g=i[6],y=i[1],x=i[4],_=i[7],b=i[2],M=i[5],S=i[8];return n[0]=a*f+s*y+o*b,n[3]=a*m+s*x+o*M,n[6]=a*g+s*_+o*S,n[1]=l*f+u*y+h*b,n[4]=l*m+u*x+h*M,n[7]=l*g+u*_+h*S,n[2]=c*f+d*y+p*b,n[5]=c*m+d*x+p*M,n[8]=c*g+d*_+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-r*n*u+r*s*o+i*n*l-i*a*o}invert(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=u*a-s*l,c=s*o-u*n,d=l*n-a*o,p=t*h+r*c+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(i*l-u*r)*f,e[2]=(s*r-i*a)*f,e[3]=c*f,e[4]=(u*t-i*o)*f,e[5]=(i*n-s*t)*f,e[6]=d*f,e[7]=(r*o-l*t)*f,e[8]=(a*t-r*n)*f,this}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,n,a,s){let o=Math.cos(n),l=Math.sin(n);return this.set(r*o,r*l,-r*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(ru.makeScale(e,t)),this}rotate(e){return this.premultiply(ru.makeRotation(-e)),this}translate(e,t){return this.premultiply(ru.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<9;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}constructor(){Matrix3.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}};let ru=new Matrix3;function arrayNeedsUint32(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}let rh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function getTypedArray(e,t){return new rh[e](t)}function createElementNS(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}let Quaternion=class Quaternion{static slerpFlat(e,t,r,i,n,a,s){let o=r[i+0],l=r[i+1],u=r[i+2],h=r[i+3],c=n[a+0],d=n[a+1],p=n[a+2],f=n[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(1===s){e[t+0]=c,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(h!==f||o!==c||l!==d||u!==p){let e=1-s,t=o*c+l*d+u*p+h*f,r=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){let n=Math.sqrt(i),a=Math.atan2(n,t*r);e=Math.sin(e*a)/n,s=Math.sin(s*a)/n}let n=s*r;if(o=o*e+c*n,l=l*e+d*n,u=u*e+p*n,h=h*e+f*n,e===1-s){let e=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=e,l*=e,u*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,n,a){let s=r[i],o=r[i+1],l=r[i+2],u=r[i+3],h=n[a],c=n[a+1],d=n[a+2],p=n[a+3];
5return e[t]=s*p+u*h+o*d-l*c,e[t+1]=o*p+u*c+l*h-s*d,e[t+2]=l*p+u*d+s*c-o*h,e[t+3]=u*p-s*h-o*c-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let r=e._x,i=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),u=s(i/2),h=s(n/2),c=o(r/2),d=o(i/2),p=o(n/2);switch(a){case"XYZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"YXZ":this._x=c*u*h+l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"ZXY":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h-c*d*p;break;case"ZYX":this._x=c*u*h-l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h+c*d*p;break;case"YZX":this._x=c*u*h+l*d*p,this._y=l*d*h+c*u*p,this._z=l*u*p-c*d*h,this._w=l*u*h-c*d*p;break;case"XZY":this._x=c*u*h-l*d*p,this._y=l*d*h-c*u*p,this._z=l*u*p+c*d*h,this._w=l*u*h+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],h=t[10],c=r+s+h;if(c>0){let e=.5/Math.sqrt(c+1);this._w=.25/e,this._x=(u-o)*e,this._y=(n-l)*e,this._z=(a-i)*e}else if(r>s&&r>h){let e=2*Math.sqrt(1+r-s-h);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(n+l)/e}else if(s>h){let e=2*Math.sqrt(1+s-r-h);this._w=(n-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+h-r-s);this._w=(a-i)/e,this._x=(n+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=r,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(clamp(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);return 0===r||this.slerp(e,Math.min(1,t/r)),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=r*u+a*s+i*l-n*o,this._y=i*u+a*o+n*s-r*l,this._z=n*u+a*l+r*o-i*s,this._w=a*u-r*s-i*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let r=this._x,i=this._y,n=this._z,a=this._w,s=a*e._w+r*e._x+i*e._y+n*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=r,this._y=i,this._z=n,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*r+t*this._x,this._y=e*i+t*this._y,this._z=e*n+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),u=Math.atan2(l,s),h=Math.sin((1-t)*u)/l,c=Math.sin(t*u)/l;return this._w=a*h+this._w*c,this._x=r*h+this._x*c,this._y=i*h+this._y*c,this._z=n*h+this._z*c,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),n=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(n),r*Math.cos(n),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}};let Vector3=class Vector3{set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}
5sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(rd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(rd.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,i=this.z,n=e.elements,a=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*a,this}applyQuaternion(e){let t=this.x,r=this.y,i=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*i-s*r,u=o*r+s*t-n*i,h=o*i+n*r-a*t,c=-n*t-a*r-s*i;return this.x=l*o+-(c*n)+-(u*s)- -(h*a),this.y=u*o+-(c*a)+-(h*n)- -(l*s),this.z=h*o+-(c*s)+-(l*a)- -(u*n),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(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}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let r=e.x,i=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*a-r*o,this.z=r*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return rc.copy(this).projectOnVector(e),this.sub(rc)}reflect(e){return this.sub(rc.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let r=this.dot(e)/t;return Math.acos(clamp(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){let i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,r=0){Vector3.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}};let rc=new Vector3,rd=new Quaternion;function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}
5function LinearToSRGB(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let rp=new Matrix3().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-.0000001,1e-7,.9105199]),rf=new Matrix3().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),rm=new Vector3,rg={[tz]:e=>e,[tN]:e=>e.convertSRGBToLinear(),[tG]:function(e){return e.convertSRGBToLinear(),rm.set(e.r,e.g,e.b).applyMatrix3(rf),e.setRGB(rm.x,rm.y,rm.z)}},rv={[tz]:e=>e,[tN]:e=>e.convertLinearToSRGB(),[tG]:function(e){return rm.set(e.r,e.g,e.b).applyMatrix3(rp),e.setRGB(rm.x,rm.y,rm.z).convertLinearToSRGB()}},ry={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(legacyMode){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!legacyMode},get workingColorSpace(){return tz},set workingColorSpace(colorSpace){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,r){if(!1===this.enabled||t===r||!t||!r)return e;let i=rg[t],n=rv[r];if(void 0===i||void 0===n)throw Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(r,'".'));return n(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}};let ImageUtils=class ImageUtils{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===i&&(i=createElementNS("canvas")),i.width=e.width,i.height=e.height;let r=i.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=i}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")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=createElementNS("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let i=r.getImageData(0,0,e.width,e.height),n=i.data;for(let e=0;e<n.length;e++)n[e]=255*SRGBToLinear(n[e]/255);return r.putImageData(i,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*SRGBToLinear(t[e]/255)):t[e]=SRGBToLinear(t[e]);return{data:t,width:e.width,height:e.height}}}};let Source=class Source{set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let r={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,r=i.length;t<r;t++)i[t].isDataTexture?e.push(serializeImage(i[t].image)):e.push(serializeImage(i[t]))}else e=serializeImage(i);r.url=e}return t||(e.images[this.uuid]=r),r}constructor(e=null){this.isSource=!0,this.uuid=generateUUID(),this.data=e,this.version=0}};function serializeImage(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ImageUtils.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."),{})}let rx=0;let Texture=class Texture extends EventDispatcher{get image(){return this.source.data}set image(e){void 0===e&&(e=null),this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(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}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let r={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,internalFormat:this.internalFormat,type:this.t
5ype,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==eu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case em:e.x=e.x-Math.floor(e.x);break;case eg:e.x=e.x<0?0:1;break;case ev: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 em:e.y=e.y-Math.floor(e.y);break;case eg:e.y=e.y<0?0:1;break;case ev: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}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}constructor(e=Texture.DEFAULT_IMAGE,t=Texture.DEFAULT_MAPPING,r=eg,i=eg,n=eS,a=eA,s=eU,o=eE,l=Texture.DEFAULT_ANISOTROPY,u=tP){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rx++}),this.uuid=generateUUID(),this.name="",this.source=new Source(e),this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}};Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=eu,Texture.DEFAULT_ANISOTROPY=1;let Vector4=class Vector4{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(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 Error("index is out of range: "+e)}return this}getComponent(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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,r=this.y,i=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*t+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*t+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*t+a[7]*r+a[11]*i+a[15]*n,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i;let n=e.elements,a=n[0],s=n[4],o=n[8],l=n[1],u=n[5],h=n[9],c=n[2],d=n[6],p=n[10];if(.01>Math.abs(s-l)&&.01>Math.abs(o-c)&&.01>Math.abs(h-d)){if(.1>Math.abs(s+l)&&.1>Math.abs(o+c)&&.1>Math.abs(h+d)&&.1>Math.abs(a+u+p-3))return this.set(1,0,0,0),this;let e=(a+1)/2,n=(u+1)/2,f=(p+1)/2,m=(s+l)/4,g=(o+c)/4,y=(h+d)/4;return e>n&&e>f?e<.01?(t=0,r=.707106781,i=.707106781):(r=m/(t=Math.sqrt(e)),i=g/t):n>f?n<.01?(t=.707106781,r=0,i=.707106781):(t=m/(r=Math.sqrt(n)),i=y/r):f<.01?(t=.707106781,r=.707106781,i=0):(t=g/(i=Math.sqrt(f)),r=y/i),this.set(t,r,i,Math.PI),this}let f=Math.sqrt((d-h)*(d-h)+(o-c)*(o-c)+(l-s)*(l-s));return .001>Math.abs(f)&&(f=1),this.x=(d-h)/f,this.y=(o-c)/f,this.z=(l-s)/f,this.w=Math.acos((a+u+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(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}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){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}
5round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}constructor(e=0,t=0,r=0,i=1){Vector4.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}};let WebGLRenderTarget=class WebGLRenderTarget extends EventDispatcher{setSize(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(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;let t=Object.assign({},e.texture.image);return this.texture.source=new Source(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Vector4(0,0,e,t),this.scissorTest=!1,this.viewport=new Vector4(0,0,e,t),this.texture=new Texture({width:e,height:t,depth:1},r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.internalFormat=void 0!==r.internalFormat?r.internalFormat:null,this.texture.minFilter=void 0!==r.minFilter?r.minFilter:eS,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null,this.samples=void 0!==r.samples?r.samples:0}};let DataArrayTexture=class DataArrayTexture extends Texture{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=ey,this.minFilter=ey,this.wrapR=eg,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let WebGLArrayRenderTarget=class WebGLArrayRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new DataArrayTexture(null,e,t,r),this.texture.isRenderTargetTexture=!0}};let Data3DTexture=class Data3DTexture extends Texture{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=ey,this.minFilter=ey,this.wrapR=eg,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let WebGL3DRenderTarget=class WebGL3DRenderTarget extends WebGLRenderTarget{constructor(e=1,t=1,r=1){super(e,t),this.isWebG
5L3DRenderTarget=!0,this.depth=r,this.texture=new Data3DTexture(null,e,t,r),this.texture.isRenderTargetTexture=!0}};let WebGLMultipleRenderTargets=class WebGLMultipleRenderTargets extends WebGLRenderTarget{setSize(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,n=this.texture.length;i<n;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=r;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(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(let t=0,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;let n=this.texture;this.texture=[];for(let e=0;e<r;e++)this.texture[e]=n.clone(),this.texture[e].isRenderTargetTexture=!0}};let Box3=class Box3{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=Infinity,r=Infinity,i=Infinity,n=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.length;o<l;o+=3){let l=e[o],u=e[o+1],h=e[o+2];l<t&&(t=l),u<r&&(r=u),h<i&&(i=h),l>n&&(n=l),u>a&&(a=u),h>s&&(s=h)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromBufferAttribute(e){let t=Infinity,r=Infinity,i=Infinity,n=-1/0,a=-1/0,s=-1/0;for(let o=0,l=e.count;o<l;o++){let l=e.getX(o),u=e.getY(o),h=e.getZ(o);l<t&&(t=l),u<r&&(r=u),h<i&&(i=h),l>n&&(n=l),u>a&&(a=u),h>s&&(s=h)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=rb.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let r=e.geometry;if(void 0!==r){if(t&&void 0!=r.attributes&&void 0!==r.attributes.position){let t=r.attributes.position;for(let r=0,i=t.count;r<i;r++)rb.fromBufferAttribute(t,r).applyMatrix4(e.matrixWorld),this.expandByPoint(rb)}else null===r.boundingBox&&r.computeBoundingBox(),rM.copy(r.boundingBox),rM.applyMatrix4(e.matrixWorld),this.union(rM)}let i=e.children;for(let e=0,r=i.length;e<r;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)&&!(e.z<this.min.z)&&!(e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(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))}intersectsBox(e){return!(e.max.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)&&!(e.max.z<this.min.z)&&!(e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,rb),rb.distanceToSquared(e.center)<=e.radius*e.radiu
5s}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rL),rP.subVectors(this.max,rL),rS.subVectors(e.a,rL),rw.subVectors(e.b,rL),rT.subVectors(e.c,rL),rA.subVectors(rw,rS),rC.subVectors(rT,rw),rE.subVectors(rS,rT);let t=[0,-rA.z,rA.y,0,-rC.z,rC.y,0,-rE.z,rE.y,rA.z,0,-rA.x,rC.z,0,-rC.x,rE.z,0,-rE.x,-rA.y,rA.x,0,-rC.y,rC.x,0,-rE.y,rE.x,0];return!!(satForAxes(t,rS,rw,rT,rP)&&satForAxes(t=[1,0,0,0,1,0,0,0,1],rS,rw,rT,rP))&&(rR.crossVectors(rA,rC),satForAxes(t=[rR.x,rR.y,rR.z],rS,rw,rT,rP))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rb).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(rb).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(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}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new Vector3(Infinity,Infinity,Infinity),t=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}};let r_=[new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3,new Vector3],rb=new Vector3,rM=new Box3,rS=new Vector3,rw=new Vector3,rT=new Vector3,rA=new Vector3,rC=new Vector3,rE=new Vector3,rL=new Vector3,rP
5=new Vector3,rR=new Vector3,rI=new Vector3;function satForAxes(e,t,r,i,n){for(let a=0,s=e.length-3;a<=s;a+=3){rI.fromArray(e,a);let s=n.x*Math.abs(rI.x)+n.y*Math.abs(rI.y)+n.z*Math.abs(rI.z),o=t.dot(rI),l=r.dot(rI),u=i.dot(rI);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let rD=new Box3,rB=new Vector3,rV=new Vector3;let Sphere=class Sphere{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;void 0!==t?r.copy(t):rD.setFromPoints(e).getCenter(r);let i=0;for(let t=0,n=e.length;t<n;t++)i=Math.max(i,r.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;rB.subVectors(e,this.center);let t=rB.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),r=(e-this.radius)*.5;this.center.addScaledVector(rB,r/e),this.radius+=r}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(rV.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rB.copy(e.center).add(rV)),this.expandByPoint(rB.copy(e.center).sub(rV)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=-1){this.center=e,this.radius=t}};let rO=new Vector3,rN=new Vector3,rz=new Vector3,rG=new Vector3,rU=new Vector3,rF=new Vector3,rk=new Vector3;let Ray=class Ray{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rO)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rO.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rO.copy(this.origin).addScaledVector(this.direction,t),rO.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){let n,a,s,o;rN.copy(e).add(t).multiplyScalar(.5),rz.copy(t).sub(e).normalize(),rG.copy(this.origin).sub(rN);let l=.5*e.distanceTo(t),u=-this.direction.dot(rz),h=rG.dot(this.direction),c=-rG.dot(rz),d=rG.lengthSq(),p=Math.abs(1-u*u);if(p>0){if(n=u*c-h,a=u*h-c,o=l*p,n>=0){if(a>=-o){if(a<=o){let e=1/p;n*=e,a*=e,s=n*(n+u*a+2*h)+a*(u*n+a+2*c)+d}else s=-(n=Math.max(0,-(u*(a=l)+h)))*n+a*(a+2*c)+d}else s=-(n=Math.max(0,-(u*(a=-l)+h)))*n+a*(a+2*c)+d}else a<=-o?(a=(n=Math.max(0,-(-u*l+h)))>0?-l:Math.min(Math.max(-l,-c),l),s=-n*n+a*(a+2*c)+d):a<=o?(n=0,s=(a=Math.min(Math.max(-l,-c),l))*(a+2*c)+d):(a=(n=Math.max(0,-(u*l+h)))>0?l:Math.min(Math.max(-l,-c),l),s=-n*n+a*(a+2*c)+d)}else a=u>0?-l:l,s=-(n=Math.max(0,-(u*a+h)))*n+a*(a+2*c)+d;return r&&r.copy(this.origin).addScaledVector(this.direction,n),i&&i.copy(rN).addScaledVector(rz,a),s}intersectSphere(e,t){rO.subVectors(e.center,this.origin);let r=rO.dot(this.direction),i=rO.dot(rO)-r*r,n=e.radius*e.radiu
5s;if(i>n)return null;let a=Math.sqrt(n-i),s=r-a,o=r+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);if(0===t)return!0;let r=e.normal.dot(this.direction);return r*t<0}intersectBox(e,t){let r,i,n,a,s,o;let l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,c=this.origin;return(l>=0?(r=(e.min.x-c.x)*l,i=(e.max.x-c.x)*l):(r=(e.max.x-c.x)*l,i=(e.min.x-c.x)*l),u>=0?(n=(e.min.y-c.y)*u,a=(e.max.y-c.y)*u):(n=(e.max.y-c.y)*u,a=(e.min.y-c.y)*u),r>a||n>i)?null:((n>r||isNaN(r))&&(r=n),(a<i||isNaN(i))&&(i=a),h>=0?(s=(e.min.z-c.z)*h,o=(e.max.z-c.z)*h):(s=(e.max.z-c.z)*h,o=(e.min.z-c.z)*h),r>o||s>i)?null:((s>r||r!=r)&&(r=s),(o<i||i!=i)&&(i=o),i<0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return null!==this.intersectBox(e,rO)}intersectTriangle(e,t,r,i,n){let a;rU.subVectors(t,e),rF.subVectors(r,e),rk.crossVectors(rU,rF);let s=this.direction.dot(rk);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rG.subVectors(this.origin,e);let o=a*this.direction.dot(rF.crossVectors(rG,rF));if(o<0)return null;let l=a*this.direction.dot(rU.cross(rG));if(l<0||o+l>s)return null;let u=-a*rG.dot(rk);return u<0?null:this.at(u/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=new Vector3(0,0,-1)){this.origin=e,this.direction=t}};let Matrix4=class Matrix4{set(e,t,r,i,n,a,s,o,l,u,h,c,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=n,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=h,g[14]=c,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Matrix4().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){let 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}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,r=e.elements,i=1/rW.setFromMatrixColumn(e,0).length(),n=1/rW.setFromMatrixColumn(e,1).length(),a=1/rW.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*n,t[5]=r[5]*n,t[6]=r[6]*n,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,r=e.x,i=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),o=Math.cos(i),l=Math.sin(i),u=Math.cos(n),h=Math.sin(n);if("XYZ"===e.order){let e=a*u,r=a*h,i=s*u,n=s*h;t[0]=o*u,t[4]=-o*h,t[8]=l,t[1]=r+i*l,t[5]=e-n*l,t[9]=-s*o,t[2]=n-e*l,t[6]=i+r*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,r=o*h,i=l*u,n=l*h;t[0]=e+n*s,t[4]=i*s-r,t[8]=a*l,t[1]=a*h,t[5]=a*u,t[9]=-s,t[2]=r*s-i,t[6]=n+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,r=o*h,i=l*u,n=l*h;t[0]=e-n*s,t[4]=-a*h,t[8]=i+r*s,t[1]=r+i*s,t[5]=a*u,t[9]=n-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,r=a*h,i=s*u,n=s*h;t[0]=o*u,t[4]=i*l-r,t[8]=e*l+n,t[1]=o*h,t[5]=n*l+e,t[9]=r*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,r=a*l,i=s*o,n=s*l;t[0]=o*u,t[4]=n-e*h,t[8]=i*h+r,t[1]=h,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=r*h+i,t[10]=e-n*h}else if("XZY"===e.order){let e=a*o,r=a*l,i=s*o,n=s*l;t[0]=o*u,t[4]=-h,t[8]=l*u,t[1]=e*h+n,t[5]=a*u,t[9]=r*h-i,t[2]=i*h-r,t[6]=s*u,t[10]=n*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rj,e,rq)}lookAt(e,t,r){let i=this.elements;return rZ.subVectors(e,t),0===rZ.lengthSq()&&(rZ.z=1),rZ.normalize(),rX.crossVectors(r,rZ),0===rX.lengthSq()&&(1===Math.abs(r.z)?rZ.x+=1e-4:rZ.z+=1e-4,rZ.normalize(),rX.crossVectors(r,rZ)),rX.normalize(),rY.crossVectors(rZ,rX),i[0]=rX.x,i[4]=rY.x,i[8]=rZ.x,i[1]=rX.y,i[5]=rY.y,i[9]=rZ.y,i[2]=rX.z,i[6]=rY.z,i[10]=rZ.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[4],o=r[8],l=r[12],u=r[1],h=r[5],c=r[9],d=r[13],p=r[2],f=r[6],m=r[10],g=r[14],y=r[3],x=r[7],_=r[11],b=r[15],M=i[0],S=i[4],w=i[8],T=i[12],A=i[1],C=i[5],E=i[9],L=i[13],P=i[2],R=i[6],I=i[10],D=i[14],B=i[3],V=i[7],O=i[11],N=i[15];return n[0]=a*M+s*A+o*P+l*B,n[4]=a*S+s*C+o*R+l*V,n[8]=a*w+s*E+o*I+l*O,n[12]=a*T+s*L+o*D+l*N,n[1]=u*M+h*A+c*P+d*B,n[5]=u*S+h*C+c*R+d*V,n[9]=u*w+h*E+c*I+d*O,n[13]=u*T+h*L+c*D+d*N,n[2]=p*M+f*A+m*P+g*B,n[6]=p*S+f*C+m*R+g*V,n[10]=p*w+f*E+m*I+g*O,n[14]=p*T+f*L+m*D+g*N,n[3]=y*M+x*A+_*P+b*B,n[7]=y*S+x*C+_*R+b*V,n[11]=y*w+x*E+_*I+b*O,n[15]=y*T+x*L+_*D+b*N,this}multiplyScalar(e){let 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}determinant(){let e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],h=e[6],c=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+n*o*h-i*l*h-n*s*c+r*l*c+i*s*d-r*o*d)+f*(+t*o*d-t*l*c+n*a*c-i*a*d+i*l*u-n*o*u)+m*(+t*l*h-t*s*d-n*a*h+r*a*d+n*s*u-r*l*u)+g*(-i*s*u-t*o*h+t*s*c+i*a*h-r*a*c+r*o*u)}transpose(){let e;let t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,r){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=e[9],c=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],y=h*m*l-f*c*l+f*o*d-s*m*d-h*o*g+s*c*g,x=p*c*l-u*m*l-p*o*d+a*m*d+u*o*g-a*c*g,_=u*f*l-p*h*l+p*s*d-a*f*d-u*s*g+a*h
5*g,b=p*h*o-u*f*o-p*s*c+a*f*c+u*s*m-a*h*m,M=t*y+r*x+i*_+n*b;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return e[0]=y*S,e[1]=(f*c*n-h*m*n-f*i*d+r*m*d+h*i*g-r*c*g)*S,e[2]=(s*m*n-f*o*n+f*i*l-r*m*l-s*i*g+r*o*g)*S,e[3]=(h*o*n-s*c*n-h*i*l+r*c*l+s*i*d-r*o*d)*S,e[4]=x*S,e[5]=(u*m*n-p*c*n+p*i*d-t*m*d-u*i*g+t*c*g)*S,e[6]=(p*o*n-a*m*n-p*i*l+t*m*l+a*i*g-t*o*g)*S,e[7]=(a*c*n-u*o*n+u*i*l-t*c*l-a*i*d+t*o*d)*S,e[8]=_*S,e[9]=(p*h*n-u*f*n-p*r*d+t*f*d+u*r*g-t*h*g)*S,e[10]=(a*f*n-p*s*n+p*r*l-t*f*l-a*r*g+t*s*g)*S,e[11]=(u*s*n-a*h*n-u*r*l+t*h*l+a*r*d-t*s*d)*S,e[12]=b*S,e[13]=(u*f*i-p*h*i+p*r*c-t*f*c-u*r*m+t*h*m)*S,e[14]=(p*s*i-a*f*i-p*r*o+t*f*o+a*r*m-t*s*m)*S,e[15]=(a*h*i-u*s*i+u*r*o-t*h*o-a*r*c+t*s*c)*S,this}scale(e){let t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),i=Math.sin(t),n=1-r,a=e.x,s=e.y,o=e.z,l=n*a,u=n*s;return this.set(l*a+r,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+r,u*o-i*a,0,l*o-i*s,u*o+i*a,n*o*o+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,n,a){return this.set(1,r,n,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){let i=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,u=a+a,h=s+s,c=n*l,d=n*u,p=n*h,f=a*u,m=a*h,g=s*h,y=o*l,x=o*u,_=o*h,b=r.x,M=r.y,S=r.z;return i[0]=(1-(f+g))*b,i[1]=(d+_)*b,i[2]=(p-x)*b,i[3]=0,i[4]=(d-_)*M,i[5]=(1-(c+g))*M,i[6]=(m+y)*M,i[7]=0,i[8]=(p+x)*S,i[9]=(m-y)*S,i[10]=(1-(c+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){let i=this.elements,n=rW.set(i[0],i[1],i[2]).length(),a=rW.set(i[4],i[5],i[6]).length(),s=rW.set(i[8],i[9],i[10]).length(),o=this.determinant();o<0&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],rH.copy(this);let l=1/n,u=1/a,h=1/s;return rH.elements[0]*=l,rH.elements[1]*=l,rH.elements[2]*=l,rH.elements[4]*=u,rH.elements[5]*=u,rH.elements[6]*=u,rH.elements[8]*=h,rH.elements[9]*=h,rH.elements[10]*=h,t.setFromRotationMatrix(rH),r.x=n,r.y=a,r.z=s,this}makePerspective(e,t,r,i,n,a){let s=this.elements;return s[0]=2*n/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*n/(r-i),s[9]=(r+i)/(r-i),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+n)/(a-n),s[14]=-2*a*n/(a-n),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,r,i,n,a){let s=this.elements,o=1/(t-e),l=1/(r-i),u=1/(a-n);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-((t+e)*o),s[1]=0,s[5]=2*l,s[9]=0,s[13]=-((r+i)*l),s[2]=0,s[6]=0,s[10]=-2*u,s[14]=-((a+n)*u),s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<16;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}constructor(){Matrix4.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}};let rW=new Vector3,rH=new Matrix4,rj=new Vector3(0,0,0),rq=new Vector3(1,1,1),rX=new Vector3,rY=new Vector3,rZ=new Vector3,rJ=new Matrix4,rK=new Quaternion;let Euler=class Euler{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e.elements,n=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],h=i[2],
5c=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(clamp(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(c,l),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,n),this._z=0);break;case"ZXY":this._x=Math.asin(clamp(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-clamp(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(clamp(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,n)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-clamp(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(c,l),this._y=Math.atan2(s,n)):(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===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return rJ.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rJ,t,r)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return rK.setFromEuler(this),this.setFromQuaternion(rK,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let 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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}constructor(e=0,t=0,r=0,i=Euler.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}};Euler.DEFAULT_ORDER="XYZ";let Layers=class Layers{set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}constructor(){this.mask=1}};let rQ=0,r$=new Vector3,r0=new Quaternion,r1=new Matrix4,r3=new Vector3,r2=new Vector3,r4=new Vector3,r5=new Quaternion,r6=new Vector3(1,0,0),r8=new Vector3(0,1,0),r7=new Vector3(0,0,1),r9={type:"added"},ie={type:"removed"};
5let Object3D=class Object3D extends EventDispatcher{onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return r0.setFromAxisAngle(e,t),this.quaternion.multiply(r0),this}rotateOnWorldAxis(e,t){return r0.setFromAxisAngle(e,t),this.quaternion.premultiply(r0),this}rotateX(e){return this.rotateOnAxis(r6,e)}rotateY(e){return this.rotateOnAxis(r8,e)}rotateZ(e){return this.rotateOnAxis(r7,e)}translateOnAxis(e,t){return r$.copy(e).applyQuaternion(this.quaternion),this.position.add(r$.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(r6,e)}translateY(e){return this.translateOnAxis(r8,e)}translateZ(e){return this.translateOnAxis(r7,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(r1.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?r3.copy(e):r3.set(e,t,r);let i=this.parent;this.updateWorldMatrix(!0,!1),r2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?r1.lookAt(r2,r3,this.up):r1.lookAt(r3,r2,this.up),this.quaternion.setFromRotationMatrix(r1),i&&(r1.extractRotation(i.matrixWorld),r0.setFromRotationMatrix(r1),this.quaternion.premultiply(r0.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(r9)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ie)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(ie)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),r1.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),r1.multiply(e.parent.matrixWorld)),e.applyMatrix4(r1),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,i=this.children.length;r<i;r++){let i=this.children[r],n=i.getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t){let r=[];this[e]===t&&r.push(this);for(let i=0,n=this.children.length;i<n;i++){let n=this.children[i].getObjectsByProperty(e,t);n.length>0&&(r=r.concat(n))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r2,e,r4),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(r2,r5,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let r=0,i=t.length;r<i;r++){let i=t[r];(!0===i.matrixWorldAutoUpdate||!0===e)&&i.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let r=this.parent;if(!0===e&&null!==r&&!0===r.matrixWorldAutoUpdate&&r.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){let e=this.children;for(let t=0,r=e.length;t<r;t++){let r=e[t];!0===r.matrixWorldAutoUpdate&&r.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let i={};function serialize(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=serialize(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let r=t.shapes;if(Array.isArray(r))for(let t=0,i=r.length;t<i;t++){let i=r[t];serialize(e.shapes,i)}else serialize(e.shapes,r)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(serialize(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let t=[];for(let r=0,i=this.material.length;r<i;r++)t.push(serialize(e.materials,this.material[r]));i.material=t}else i.material=serialize(e.materials,this.material)}if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){let r=this.animations[t];i.animations.push(serialize(e.animations,r))}}if(t){let t=extractFromCache(e.geometries),i=extractFromCache(e.materials),n=extractFromCache(e.textures),a=extractFromCache(e.images),s=extractFromCache(e.shapes),o=extractFromCache(e.skeletons),l=extractFromCache(e.animations),u=extractFromCache(e.nodes);t.length>0&&(r.geometries=t),i.length>0&&(r.materials=i),n.length>0&&(r.textures=n),a.length>0&&(r.images=a),s.length>0&&(r.shapes=s),o.length>0&&(r.skeletons=o),l.length>0&&(r.animations=l),u.length>0&&(r.nodes=u)}return r.object=i,r;function extractFromCache(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let 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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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(let t=0;t<e.children.length;t++){let r=e.children[t];this.add(r.clone())}return this}constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rQ++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Object3D.DEFAULT_UP.clone();let e=new Vector3,t=new Euler,r=new Quaternion,i=new Vector3(1,1,1);t._onChange(function(){r.setFromEuler(t,!1)}),r._onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=Object3D.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Layers,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}};Object3D.DEFAULT_UP=new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let it=new Vector3,ir=new Vector3,ii=new Vector3,ia=new Vector3,is=new Vector3,io=new Vector3,il=new Vector3,iu=new Vector3,ih=new Vector3,ic=new Vector3;
vendor: 11,174 bytes, line 5
5let Triangle=class Triangle{static getNormal(e,t,r,i){i.subVectors(r,t),it.subVectors(e,t),i.cross(it);let n=i.lengthSq();return n>0?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(e,t,r,i,n){it.subVectors(i,t),ir.subVectors(r,t),ii.subVectors(e,t);let a=it.dot(it),s=it.dot(ir),o=it.dot(ii),l=ir.dot(ir),u=ir.dot(ii),h=a*l-s*s;if(0===h)return n.set(-2,-1,-1);let c=1/h,d=(l*o-s*u)*c,p=(a*u-s*o)*c;return n.set(1-d-p,p,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,ia),ia.x>=0&&ia.y>=0&&ia.x+ia.y<=1}static getUV(e,t,r,i,n,a,s,o){return this.getBarycoord(e,t,r,i,ia),o.set(0,0),o.addScaledVector(n,ia.x),o.addScaledVector(a,ia.y),o.addScaledVector(s,ia.z),o}static isFrontFacing(e,t,r,i){return it.subVectors(r,t),ir.subVectors(e,t),0>it.cross(ir).dot(i)}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return it.subVectors(this.c,this.b),ir.subVectors(this.a,this.b),.5*it.cross(ir).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Triangle.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Triangle.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,n){return Triangle.getUV(e,this.a,this.b,this.c,t,r,i,n)}containsPoint(e){return Triangle.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Triangle.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r,i;let n=this.a,a=this.b,s=this.c;is.subVectors(a,n),io.subVectors(s,n),iu.subVectors(e,n);let o=is.dot(iu),l=io.dot(iu);if(o<=0&&l<=0)return t.copy(n);ih.subVectors(e,a);let u=is.dot(ih),h=io.dot(ih);if(u>=0&&h<=u)return t.copy(a);let c=o*h-u*l;if(c<=0&&o>=0&&u<=0)return r=o/(o-u),t.copy(n).addScaledVector(is,r);ic.subVectors(e,s);let d=is.dot(ic),p=io.dot(ic);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(n).addScaledVector(io,i);let m=u*p-d*h;if(m<=0&&h-u>=0&&d-p>=0)return il.subVectors(s,a),i=(h-u)/(h-u+(d-p)),t.copy(a).addScaledVector(il,i);let g=1/(m+f+c);return r=f*g,i=c*g,t.copy(n).addScaledVector(is,r).addScaledVector(io,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new Vector3,t=new Vector3,r=new Vector3){this.a=e,this.b=t,this.c=r}};let id=0;let Material=class Material extends EventDispatcher{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let r=e[t];if(void 0===r){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let i=this[t];if(void 0===i){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function extractFromCache(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),void 0!==this.sheen&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(r.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(r.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(r.combine=this.combine)),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(r.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(r.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(r.size=this.size),null!==this.shadowSide&&(r.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==T&&(r.blending=this.blending),this.side!==_&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(r.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(r.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(r.flatShading=this.flatShading),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),!1===this.fog&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData),t){let t=extractFromCache(e.textures),i=extractFromCache(e.images);t.length>0&&(r.textures=t),i.length>0&&(r.images=i)}return r}clone(){return new this.constructor().copy(this)}copy(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;let t=e.clippingPlanes,r=null;if(null!==t){let e=t.length;r=Array(e);for(let i=0;i!==e;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
5adows,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.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:id++}),this.uuid=generateUUID(),this.name="",this.type="Material",this.blending=T,this.side=_,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=G,this.blendDst=U,this.blendEquation=P,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Z,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=t1,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=tF,this.stencilZFail=tF,this.stencilZPass=tF,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}};let ip={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},im={h:0,s:0,l:0},ig={h:0,s:0,l:0};function hue2rgb(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*6*(2/3-r):e}let Color=class Color{set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tN;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ry.toWorkingColorSpace(this,t),this}setRGB(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ry.workingColorSpace;return this.r=e,this.g=t,this.b=r,ry.toWorkingColorSpace(this,i),this}setHSL(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ry.workingColorSpace;if(e=euclideanModulo(e,1),t=clamp(t,0,1),r=clamp(r,0,1),0===t)this.r=this.g=this.b=r;else{let i=r<=.5?r*(1+t):r+t-r*t,n=2*r-i;this.r=hue2rgb(n,i,e+1/3),this.g=hue2rgb(n,i,e),this.b=hue2rgb(n,i,e-1/3)}return ry.toWorkingColorSpace(this,i),this}setStyle(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tN;function handleAlpha(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;let n=t[1],a=t[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){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,ry.toWorkingColorSpace(this,r),handleAlpha(i[4]);break}(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))&&(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,ry.toWorkingColorSpace(this,r),handleAlpha(i[4]));break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){let e=parseFloat(i[1])/360,t=parseFloat(i[2])/100,n=parseFloat(i[3])/100;return handleAlpha(i[4]),this.setHSL(e,t,n,r)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=t[1],n=i.length;3===n?(this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,ry.toWorkingColorSpace(this,r)):6===n?(this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,ry.toWorkingColorSpace(this,r)):console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,r);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tN,r=ip[e.toLowerCase()];return void 0!==r?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=SRGBToLinear(e.r),this.g=SRGBToLinear(e.g),this.b=SRGBToLinear(e.b),this}copyLinearToSRGB(e){return this.r=LinearToSRGB(e.r),this.g=LinearToSRGB(e.g),this.b=LinearToSRGB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tN;return ry.fromWorkingColorSpace(iv.copy(this),e),clamp(255*iv.r,0,255)<<16^clamp(255*iv.g,0,255)<<8^clamp(255*iv.b,0,255)<<0}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tN;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ry.workingColorSpace;ry.fromWorkingColorSpace(iv.copy(this),i);let n=iv.r,a=iv.g,s=iv.b,o=Math.max(n,a,s),l=Math.min(n,a,s),u=(l+o)/2;if(l===o)t=0,r=0;else{let e=o-l;switch(r=u<=.5?e/(o+l):e/(2-o-l),o){case n:t=(a-s)/e+(a<s?6:0);break;case a:t=(s-n)/e+2;break;case s:t=(n-a)/e+4}t/=6}return e.h=t,e.s=r,e.l=u,e}getRGB(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ry.workingColorSpace;return ry.fromWorkingColorSpace(iv.copy(this),t),e.r=iv.r,e.g=iv.g,e.b=iv.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:tN;ry.fromWorkingColorSpace(iv.copy(this),e);let t=iv.r,r=iv.g,i=iv.b;return e!==tN?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(r.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(255*t|0,",").concat(255*r|0,",").concat(255*i|0,")")}offsetHSL(e,t,r){return this.getHSL(im),im.h+=e,im.s+=t,im.l+=r,this.setHSL(im.h,im.s,im.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(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}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(im),e.getHSL(ig);let r=lerp(im.h,ig.h,t),i=lerp(im.s,ig.s,t),n=lerp(im.l,ig.l,t);return this.setHSL(r,i,n),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let 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}toArray(){let 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}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,r){if(this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===r)return this.set(e);return this.setRGB(e,t,r)}};let iv=new Color;Color.NAMES=ip;let MeshBasicMaterial=class MeshBasicMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}};let iy=new Vector3,ix=new Vector2;let BufferAttribute=class BufferAttribute{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(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}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;
5for(let i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,r=this.count;t<r;t++)ix.fromBufferAttribute(this,t),ix.applyMatrix3(e),this.setXY(t,ix.x,ix.y);else if(3===this.itemSize)for(let t=0,r=this.count;t<r;t++)iy.fromBufferAttribute(this,t),iy.applyMatrix3(e),this.setXYZ(t,iy.x,iy.y,iy.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)iy.fromBufferAttribute(this,t),iy.applyMatrix4(e),this.setXYZ(t,iy.x,iy.y,iy.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)iy.fromBufferAttribute(this,t),iy.applyNormalMatrix(e),this.setXYZ(t,iy.x,iy.y,iy.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)iy.fromBufferAttribute(this,t),iy.transformDirection(e),this.setXYZ(t,iy.x,iy.y,iy.z);return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=denormalize(t,this.array)),t}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=denormalize(t,this.array)),t}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=denormalize(t,this.array)),t}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=denormalize(t,this.array)),t}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),i=normalize(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),i=normalize(i,this.array),n=normalize(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let 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!==t3&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}constructor(e,t,r=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=r,this.usage=t3,this.updateRange={offset:0,count:-1},this.version=0}};let Int8BufferAttribute=class Int8BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Int8Array(e),t,r)}};let Uint8BufferAttribute=class Uint8BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint8Array(e),t,r)}};let Uint8ClampedBufferAttribute=class Uint8ClampedBufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}};let Int16BufferAttribute=class Int16BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Int16Array(e),t,r)}};let Uint16BufferAttribute=class Uint16BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint16Array(e),t,r)}};let Int32BufferAttribute=class Int32BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Int32Array(e),t,r)}};let Uint32BufferAttribute=class Uint32BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint32Array(e),t,r)}};let Float16BufferAttribute=class Float16BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}};let Float32BufferAttribute=class Float32BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Float32Array(e),t,r)}};let Float64BufferAttribute=class Float64BufferAttribute extends BufferAttribute{constructor(e,t,r){super(new Float64Array(e),t,r)}};let i_=0,ib=new Matrix4,iM=new Object3D,iS=new Vector3,iw=new Box3,iT=new Box3,iA=new Vector3;
5let BufferGeometry=class BufferGeometry extends EventDispatcher{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(arrayNeedsUint32(e)?Uint32BufferAttribute:Uint16BufferAttribute)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let r=this.attributes.normal;if(void 0!==r){let t=new Matrix3().getNormalMatrix(e);r.applyNormalMatrix(t),r.needsUpdate=!0}let 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}applyQuaternion(e){return ib.makeRotationFromQuaternion(e),this.applyMatrix4(ib),this}rotateX(e){return ib.makeRotationX(e),this.applyMatrix4(ib),this}rotateY(e){return ib.makeRotationY(e),this.applyMatrix4(ib),this}rotateZ(e){return ib.makeRotationZ(e),this.applyMatrix4(ib),this}translate(e,t,r){return ib.makeTranslation(e,t,r),this.applyMatrix4(ib),this}scale(e,t,r){return ib.makeScale(e,t,r),this.applyMatrix4(ib),this}lookAt(e){return iM.lookAt(e),iM.updateMatrix(),this.applyMatrix4(iM.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(iS).negate(),this.translate(iS.x,iS.y,iS.z),this}setFromPoints(e){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Float32BufferAttribute(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Box3);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingBox.set(new Vector3(-1/0,-1/0,-1/0),new Vector3(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];iw.setFromBufferAttribute(r),this.morphTargetsRelative?(iA.addVectors(this.boundingBox.min,iw.min),this.boundingBox.expandByPoint(iA),iA.addVectors(this.boundingBox.max,iw.max),this.boundingBox.expandByPoint(iA)):(this.boundingBox.expandByPoint(iw.min),this.boundingBox.expandByPoint(iw.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)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Sphere);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
5se".',this),this.boundingSphere.set(new Vector3,1/0);return}if(e){let r=this.boundingSphere.center;if(iw.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];iT.setFromBufferAttribute(r),this.morphTargetsRelative?(iA.addVectors(iw.min,iT.min),iw.expandByPoint(iA),iA.addVectors(iw.max,iT.max),iw.expandByPoint(iA)):(iw.expandByPoint(iT.min),iw.expandByPoint(iT.max))}iw.getCenter(r);let i=0;for(let t=0,n=e.count;t<n;t++)iA.fromBufferAttribute(e,t),i=Math.max(i,r.distanceToSquared(iA));if(t)for(let n=0,a=t.length;n<a;n++){let a=t[n],s=this.morphTargetsRelative;for(let t=0,n=a.count;t<n;t++)iA.fromBufferAttribute(a,t),s&&(iS.fromBufferAttribute(e,t),iA.add(iS)),i=Math.max(i,r.distanceToSquared(iA))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let r=e.array,i=t.position.array,n=t.normal.array,a=t.uv.array,s=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new BufferAttribute(new Float32Array(4*s),4));let o=this.getAttribute("tangent").array,l=[],u=[];for(let e=0;e<s;e++)l[e]=new Vector3,u[e]=new Vector3;let h=new Vector3,c=new Vector3,d=new Vector3,p=new Vector2,f=new Vector2,m=new Vector2,g=new Vector3,y=new Vector3,x=this.groups;0===x.length&&(x=[{start:0,count:r.length}]);for(let e=0,t=x.length;e<t;++e){let t=x[e],n=t.start,s=t.count;for(let e=n,t=n+s;e<t;e+=3)!function(e,t,r){h.fromArray(i,3*e),c.fromArray(i,3*t),d.fromArray(i,3*r),p.fromArray(a,2*e),f.fromArray(a,2*t),m.fromArray(a,2*r),c.sub(h),d.sub(h),f.sub(p),m.sub(p);let n=1/(f.x*m.y-m.x*f.y);isFinite(n)&&(g.copy(c).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(n),y.copy(d).multiplyScalar(f.x).addScaledVector(c,-m.x).multiplyScalar(n),l[e].add(g),l[t].add(g),l[r].add(g),u[e].add(y),u[t].add(y),u[r].add(y))}(r[e+0],r[e+1],r[e+2])}let _=new Vector3,b=new Vector3,M=new Vector3,S=new Vector3;function handleVertex(e){M.fromArray(n,3*e),S.copy(M);let t=l[e];_.copy(t),_.sub(M.multiplyScalar(M.dot(t))).normalize(),b.crossVectors(S,t);let r=b.dot(u[e]);o[4*e]=_.x,o[4*e+1]=_.y,o[4*e+2]=_.z,o[4*e+3]=r<0?-1:1}for(let e=0,t=x.length;e<t;++e){let t=x[e],i=t.start,n=t.count;for(let e=i,t=i+n;e<t;e+=3)handleVertex(r[e+0]),handleVertex(r[e+1]),handleVertex(r[e+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let r=this.getAttribute("normal");if(void 0===r)r=new BufferAttribute(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(let e=0,t=r.count;e<t;e++)r.setXYZ(e,0,0,0);let i=new Vector3,n=new Vector3,a=new Vector3,s=new Vector3,o=new Vector3,l=new Vector3,u=new Vector3,h=new Vector3;if(e)for(let c=0,d=e.count;c<d;c+=3){let d=e.getX(c+0),p=e.getX(c+1),f=e.getX(c+2);i.fromBufferAttribute(t,d),n.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,n),h.subVectors(i,n),u.cross(h),s.fromBufferAttribute(r,d),o.fromBufferAttribute(r,p),l.fromBufferAttribute(r,f),s.add(u),o.add(u),l.add(u),r.setXYZ(d,s.x,s.y,s.z),r.setXYZ(p,o.x,o.y,o.z),r.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),n.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,n),h.subVectors(i,n),u.cross(h),r.setXYZ(e+0,u.x,u.y,u.z),r.setXYZ(e+1,u.x,u.y,u.z),r.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)iA.fromBufferAttribute(e,t),iA.normalize(),e.setXYZ(t,iA.x,iA.y,iA.z)}toNonIndexed(){function convertBufferAttribute(e,t){let r=e.array,i=e.itemSize,n=e.normalized,a=new r.constructor(t.length*i),s=0,o=0;for(let n=0,l=t.length;n<l;n++){s=e.isInterleavedBufferAttribute?t[n]*e.data.stride+e.offset:t[n]*i;for(let e=0;e<i;e++)a[o++]=r[s++]}return new BufferAttribute(a,i,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new BufferGeometry,t=this.index.array,r=this.attributes;for(let i in r){let n=r[i],a=convertBufferAttribute(n,t);e.setAttribute(i,a)}let i=this.morphAttributes;for(let r in i){let n=[],a=i[r];for(let e=0,r=a.length;e<r;e++){let r=a[e],i=convertBufferAttribute(r,t);n.push(i)}e.morphAttributes[r]=n}e.morphTargetsRelative=this.morphTargetsRelative;let n=this.groups;for(let t=0,r=n.length;t<r;t++){let r=n[t];e.addGroup(r.start,r.count,r.materialIndex)}return e}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
5if(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){let t=this.parameters;for(let r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let r=this.attributes;for(let t in r){let i=r[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},n=!1;for(let t in this.morphAttributes){let r=this.morphAttributes[t],a=[];for(let t=0,i=r.length;t<i;t++){let i=r[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,n=!0)}n&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;null!==r&&this.setIndex(r.clone(t));let i=e.attributes;for(let e in i){let r=i[e];this.setAttribute(e,r.clone(t))}let n=e.morphAttributes;for(let e in n){let r=[],i=n[e];for(let e=0,n=i.length;e<n;e++)r.push(i[e].clone(t));this.morphAttributes[e]=r}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:i_++}),this.uuid=generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}};let iC=new Matrix4,iE=new Ray,iL=new Sphere,iP=new Vector3,iR=new Vector3,iI=new Vector3,iD=new Vector3,iB=new Vector3,iV=new Vector3,iO=new Vector2,iN=new Vector2,iz=new Vector2,iG=new Vector3,iU=new Vector3;let Mesh=class Mesh extends Object3D{copy(e,t){return super.copy(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}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let e=t[r[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,r=e.length;t<r;t++){let r=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}}}getVertexPosition(e,t){let r=this.geometry,i=r.attributes.position,n=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(i,e);let s=this.morphTargetInfluences;if(n&&s){iV.set(0,0,0);for(let r=0,i=n.length;r<i;r++){let i=s[r],o=n[r];0!==i&&(iB.fromBufferAttribute(o,e),a?iV.addScaledVector(iB,i):iV.addScaledVector(iB.sub(t),i))}t.add(iV)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){let r;let i=this.geometry,n=this.material,a=this.matrixWorld;if(void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),iL.copy(i.boundingSphere),iL.applyMatrix4(a),iE.copy(e.ray).recast(e.near),!1===iL.containsPoint(iE.origin)&&(null===iE.intersectSphere(iL,iP)||iE.origin.distanceToSquared(iP)>(e.far-e.near)**2))||(iC.copy(a).invert(),iE.copy(e.ray).applyMatrix4(iC),null!==i.boundingBox&&!1===iE.intersectsBox(i.boundingBox)))return;let s=i.index,o=i.attributes.position,l=i.attributes.uv,u=i.attributes.uv2,h=i.groups,c=i.drawRange;if(null!==s){if(Array.isArray(n))for(let i=0,a=h.length;i<a;i++){let a=h[i],o=n[a.materialIndex],d=Math.max(a.start,c.start),p=Math.min(s.count,Math.min(a.start+a.count,c.start+c.count));for(let i=d;i<p;i+=3){let n=s.getX(i),h=s.getX(i+1),c=s.getX(i+2);(r=checkBufferGeometryIntersection(this,o,e,iE,l,u,n,h,c))&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=a.materialIndex,t.push(r))}}else{let i=Math.max(0,c.start),a=Math.min(s.count,c.start+c.count);for(let o=i;o<a;o+=3){let i=s.getX(o),a=s.getX(o+1),h=s.getX(o+2);(r=checkBufferGeometryIntersection(this,n,e,iE,l,u,i,a,h))&&(r.faceIndex=Math.floor(o/3),t.pu
5sh(r))}}}else if(void 0!==o){if(Array.isArray(n))for(let i=0,a=h.length;i<a;i++){let a=h[i],s=n[a.materialIndex],d=Math.max(a.start,c.start),p=Math.min(o.count,Math.min(a.start+a.count,c.start+c.count));for(let i=d;i<p;i+=3){let n=i,o=i+1,h=i+2;(r=checkBufferGeometryIntersection(this,s,e,iE,l,u,n,o,h))&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=a.materialIndex,t.push(r))}}else{let i=Math.max(0,c.start),a=Math.min(o.count,c.start+c.count);for(let s=i;s<a;s+=3){let i=s,a=s+1,o=s+2;(r=checkBufferGeometryIntersection(this,n,e,iE,l,u,i,a,o))&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}constructor(e=new BufferGeometry,t=new MeshBasicMaterial){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}};function checkBufferGeometryIntersection(e,t,r,i,n,a,s,o,l){e.getVertexPosition(s,iR),e.getVertexPosition(o,iI),e.getVertexPosition(l,iD);let u=function(e,t,r,i,n,a,s,o){if(null===(t.side===b?i.intersectTriangle(s,a,n,!0,o):i.intersectTriangle(n,a,s,t.side===_,o)))return null;iU.copy(o),iU.applyMatrix4(e.matrixWorld);let l=r.ray.origin.distanceTo(iU);return l<r.near||l>r.far?null:{distance:l,point:iU.clone(),object:e}}(e,t,r,i,iR,iI,iD,iG);if(u){n&&(iO.fromBufferAttribute(n,s),iN.fromBufferAttribute(n,o),iz.fromBufferAttribute(n,l),u.uv=Triangle.getUV(iG,iR,iI,iD,iO,iN,iz,new Vector2)),a&&(iO.fromBufferAttribute(a,s),iN.fromBufferAttribute(a,o),iz.fromBufferAttribute(a,l),u.uv2=Triangle.getUV(iG,iR,iI,iD,iO,iN,iz,new Vector2));let e={a:s,b:o,c:l,normal:new Vector3,materialIndex:0};Triangle.getNormal(iR,iI,iD,e.normal),u.face=e}return u}let BoxGeometry=class BoxGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new BoxGeometry(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,r=1,i=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:a};let s=this;i=Math.floor(i),n=Math.floor(n),a=Math.floor(a);let o=[],l=[],u=[],h=[],c=0,d=0;function buildPlane(e,t,r,i,n,a,p,f,m,g,y){let x=a/m,_=p/g,b=a/2,M=p/2,S=f/2,w=m+1,T=g+1,A=0,C=0,E=new Vector3;for(let a=0;a<T;a++){let s=a*_-M;for(let o=0;o<w;o++){let c=o*x-b;E[e]=c*i,E[t]=s*n,E[r]=S,l.push(E.x,E.y,E.z),E[e]=0,E[t]=0,E[r]=f>0?1:-1,u.push(E.x,E.y,E.z),h.push(o/m),h.push(1-a/g),A+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let r=c+t+w*e,i=c+t+w*(e+1),n=c+(t+1)+w*(e+1),a=c+(t+1)+w*e;o.push(r,i,a),o.push(i,n,a),C+=6}s.addGroup(d,C,y),d+=C,c+=A}buildPlane("z","y","x",-1,-1,r,t,e,a,n,0),buildPlane("z","y","x",1,-1,r,t,-e,a,n,1),buildPlane("x","z","y",1,1,e,r,t,i,a,2),buildPlane("x","z","y",1,-1,e,r,-t,i,a,3),buildPlane("x","y","z",1,-1,e,t,r,i,n,4),buildPlane("x","y","z",-1,-1,e,t,-r,i,n,5),this.setIndex(o),this.setAttribute("position",new Float32BufferAttribute(l,3)),this.setAttribute("normal",new Float32BufferAttribute(u,3)),this.setAttribute("uv",new Float32BufferAttribute(h,2))}};function cloneUniforms(e){let t={};for(let r in e)for(let i in t[r]={},e[r]){let n=e[r][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?t[r][i]=n.clone():Array.isArray(n)?t[r][i]=n.slice():t[r][i]=n}return t}function mergeUniforms(e){let t={};for(let r=0;r<e.length;r++){let i=cloneUniforms(e[r]);for(let e in i)t[e]=i[e]}return t}function getUnlitUniformColorSpace(e){return null===e.getRenderTarget()&&e.outputEncoding===tR?tN:tz}let iF={clone:cloneUniforms,merge:mergeUniforms};let ShaderMaterial=class ShaderMaterial extends Material{copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cloneUniforms(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let i=this.uniforms[r],n=i.value;n&&n.isTexture?t.uniforms[r]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:"m4",value:n.toArray()}:t.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let r={};for(let e in this.extensions)!0===this.extensions[e]&&(r[e]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}};let Camera=class Camera extends Object3D{copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Matrix4,this.projectionMatrix=new Matrix4,this.projectionMatrixInverse=new Matrix4}};let PerspectiveCamera=class PerspectiveCamera extends Camera{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*ro*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*rs*this.fov);return .5*this.getFilmHeight()/e}
5getEffectiveFOV(){return 2*ro*Math.atan(Math.tan(.5*rs*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*rs*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;n+=a.offsetX*i/e,t-=a.offsetY*r/s,i*=a.width/e,r*=a.height/s}let s=this.filmOffset;0!==s&&(n+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}};let CubeCamera=class CubeCamera extends Object3D{update(e,t){null===this.parent&&this.updateMatrixWorld();let r=this.renderTarget,[i,n,a,s,o,l]=this.children,u=e.getRenderTarget(),h=e.toneMapping,c=e.xr.enabled;e.toneMapping=ei,e.xr.enabled=!1;let d=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,n),e.setRenderTarget(r,2),e.render(t,a),e.setRenderTarget(r,3),e.render(t,s),e.setRenderTarget(r,4),e.render(t,o),r.texture.generateMipmaps=d,e.setRenderTarget(r,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=c,r.texture.needsPMREMUpdate=!0}constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;let i=new PerspectiveCamera(-90,1,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);let n=new PerspectiveCamera(-90,1,e,t);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(-1,0,0),this.add(n);let a=new PerspectiveCamera(-90,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let s=new PerspectiveCamera(-90,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(0,-1,0),this.add(s);let o=new PerspectiveCamera(-90,1,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new PerspectiveCamera(-90,1,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}};let CubeTexture=class CubeTexture extends Texture{get images(){return this.image}set images(e){this.image=e}constructor(e,t,r,i,n,a,s,o,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:eh,r,i,n,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}};let WebGLCubeRenderTarget=class WebGLCubeRenderTarget extends WebGLRenderTarget{fromEquirectangularTexture(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;let r={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n "},i=new BoxGeometry(5,5,5),n=new ShaderMaterial({name:"CubemapFromEquirect",uniforms:cloneUniforms(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:b,blending:w});n.uniforms.tEquirect.value=t;let a=new Mesh(i,n),s=t.minFilter;t.minFilter===eA&&(t.minFilter=eS);let o=new CubeCamera(1,10,this);return o.update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}
5clear(e,t,r,i){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,r,i);e.setRenderTarget(n)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new CubeTexture(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:eS}};let ik=new Vector3,iW=new Vector3,iH=new Matrix3;let Plane=class Plane{set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let i=ik.subVectors(r,t).cross(iW.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let r=e.delta(ik),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/i;return n<0||n>1?null:t.copy(e.start).addScaledVector(r,n)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let r=t||iH.getNormalMatrix(e),i=this.coplanarPoint(ik).applyMatrix4(e),n=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}};let ij=new Sphere,iq=new Vector3;let Frustum=class Frustum{set(e,t,r,i,n,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(i),s[4].copy(n),s[5].copy(a),this}copy(e){let t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){let t=this.planes,r=e.elements,i=r[0],n=r[1],a=r[2],s=r[3],o=r[4],l=r[5],u=r[6],h=r[7],c=r[8],d=r[9],p=r[10],f=r[11],m=r[12],g=r[13],y=r[14],x=r[15];return t[0].setComponents(s-i,h-o,f-c,x-m).normalize(),t[1].setComponents(s+i,h+o,f+c,x+m).normalize(),t[2].setComponents(s+n,h+l,f+d,x+g).normalize(),t[3].setComponents(s-n,h-l,f-d,x-g).normalize(),t[4].setComponents(s-a,h-u,f-p,x-y).normalize(),t[5].setComponents(s+a,h+u,f+p,x+y).normalize(),this}intersectsObject(e){let t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ij.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ij)}intersectsSprite(e){return ij.center.set(0,0,0),ij.radius=.7071067811865476,ij.applyMatrix4(e.matrixWorld),this.intersectsSphere(ij)}intersectsSphere(e){let t=this.planes,r=e.center,i=-e.radius;for(let e=0;e<6;e++){let n=t[e].distanceToPoint(r);if(n<i)return!1}return!0}intersectsBox(e){let t=this.planes;for(let r=0;r<6;r++){let i=t[r];if(iq.x=i.normal.x>0?e.max.x:e.min.x,iq.y=i.normal.y>0?e.max.y:e.min.y,iq.z=i.normal.z>0?e.max.z:e.min.z,0>i.distanceToPoint(iq))return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r<6;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new Plane,t=new Plane,r=new Plane,i=new Plane,n=new Plane,a=new Plane){this.planes=[e,t,r,i,n,a]}};function WebGLAnimation(){let e=null,t=!1,r=null,i=null;function onAnimationFrame(t,n){r(t,n),i=e.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==t&&null!==r&&(i=e.requestAnimationFrame(onAnimationFrame),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function WebGLAttributes(e,t){let r=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let r=i.get(t);r&&(e.deleteBuffer(r.buffer),i.delete(t))},update:function(t,n){if(t.isGLBufferAttribute){let e=i.get(t);
5(!e||e.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version});return}t.isInterleavedBufferAttribute&&(t=t.data);let a=i.get(t);void 0===a?i.set(t,function(t,i){let n;let a=t.array,s=t.usage,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,a,s),t.onUploadCallback(),a instanceof Float32Array)n=5126;else if(a instanceof Uint16Array){if(t.isFloat16BufferAttribute){if(r)n=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else n=5123}else if(a instanceof Int16Array)n=5122;else if(a instanceof Uint32Array)n=5125;else if(a instanceof Int32Array)n=5124;else if(a instanceof Int8Array)n=5120;else if(a instanceof Uint8Array)n=5121;else if(a instanceof Uint8ClampedArray)n=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:o,type:n,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,n)):a.version<t.version&&(!function(t,i,n){let a=i.array,s=i.updateRange;e.bindBuffer(n,t),-1===s.count?e.bufferSubData(n,0,a):(r?e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1),i.onUploadCallback()}(a.buffer,t,n),a.version=t.version)}}}let PlaneGeometry=class PlaneGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PlaneGeometry(e.width,e.height,e.widthSegments,e.heightSegments)}constructor(e=1,t=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};let n=e/2,a=t/2,s=Math.floor(r),o=Math.floor(i),l=s+1,u=o+1,h=e/s,c=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<u;e++){let t=e*c-a;for(let r=0;r<l;r++){let i=r*h-n;p.push(i,-t,0),f.push(0,0,1),m.push(r/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){let r=t+l*e,i=t+l*(e+1),n=t+1+l*(e+1),a=t+1+l*e;d.push(r,i,a),d.push(i,n,a)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}};let iX={alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return 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 float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return 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 float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );
5\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n vec3 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 float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x >
5 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const 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 );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 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 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 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 );
5\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",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
5placementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #if defined( ENVMAP_TYPE_CUBE_UV )\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #if defined( ENVMAP_TYPE_CUBE_UV )\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n }
5 else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometry.position;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }
5\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometry.position;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULARINTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n #endif\n #ifdef USE_SPECULARCOLORMAP\n specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;
5\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEENCOLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEENROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n #endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #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 float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return 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 vec2 fab = DFGApprox( normal, viewDir, roughness );\n return 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 vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometry.normal;\n vec3 viewDir = geometry.viewDir;\n vec3 position = geometry.position;
5\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n #endif\n #ifdef USE_IRIDESCENCE\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n #else\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n #endif\n reflectedLight.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 reflectedLight.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 #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat c
5omputeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n geometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometry.viewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometry, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometry.normal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = 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 #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n #ifdef USE_TANGENT\n vec3 tangent = normalize( vTangent );\n vec3 bitangent = normalize( vBitangent );\n #ifdef DOUBLE_SIDED\n tangent = tangent * faceDirection;\n bitangent = bitangent * faceDirection;\n #endif\n #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n mat3 vTBN = mat3( tangent, bitangent, normal );\n #endif\n #endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n #ifdef USE_TANGENT\n normal = normalize( vTBN * mapN );
5\n #else\n normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n #endif\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n #ifdef USE_TANGENT\n clearcoatNormal = normalize( vTBN * clearcoatMapN );\n #else\n clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n #endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;
5\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;
5\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
5\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
5\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmission = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n \n vec2 lodFudge = pow( 1.95, lod ) / fullSize;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec2 fullSize = vec2( textureSize( sampler, 0 ) );\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return radiance;\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n }\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n #ifdef UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n uniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n varying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n attribute vec2 uv2;\n varying vec2 vUv2;\n uniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
5IGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform 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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying 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 <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\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 #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
5\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying 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 #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying 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 #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#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 #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying 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 #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n #ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;
5\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
5\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#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 #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}"},iY={common:{diffuse:{value:new Color(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Matrix3},uv2Transform:{value:new Matrix3},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 Vector2(1,1)}}
vendor: 6,065 bytes, line 5
5,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 Color(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Color(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}},sprite:{diffuse:{value:new Color(16777215)},opacity:{value:1},center:{value:new Vector2(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Matrix3}}},iZ={basic:{uniforms:mergeUniforms([iY.common,iY.specularmap,iY.envmap,iY.aomap,iY.lightmap,iY.fog]),vertexShader:iX.meshbasic_vert,fragmentShader:iX.meshbasic_frag},lambert:{uniforms:mergeUniforms([iY.common,iY.specularmap,iY.envmap,iY.aomap,iY.lightmap,iY.emissivemap,iY.bumpmap,iY.normalmap,iY.displacementmap,iY.fog,iY.lights,{emissive:{value:new Color(0)}}]),vertexShader:iX.meshlambert_vert,fragmentShader:iX.meshlambert_frag},phong:{uniforms:mergeUniforms([iY.common,iY.specularmap,iY.envmap,iY.aomap,iY.lightmap,iY.emissivemap,iY.bumpmap,iY.normalmap,iY.displacementmap,iY.fog,iY.lights,{emissive:{value:new Color(0)},specular:{value:new Color(1118481)},shininess:{value:30}}]),vertexShader:iX.meshphong_vert,fragmentShader:iX.meshphong_frag},standard:{uniforms:mergeUniforms([iY.common,iY.envmap,iY.aomap,iY.lightmap,iY.emissivemap,iY.bumpmap,iY.normalmap,iY.displacementmap,iY.roughnessmap,iY.metalnessmap,iY.fog,iY.lights,{emissive:{value:new Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:iX.meshphysical_vert,fragmentShader:iX.meshphysical_frag},toon:{uniforms:mergeUniforms([iY.common,iY.aomap,iY.lightmap,iY.emissivemap,iY.bumpmap,iY.normalmap,iY.displacementmap,iY.gradientmap,iY.fog,iY.lights,{emissive:{value:new Color(0)}}]),vertexShader:iX.meshtoon_vert,fragmentShader:iX.meshtoon_frag},matcap:{uniforms:mergeUniforms([iY.common,iY.bumpmap,iY.normalmap,iY.displacementmap,iY.fog,{matcap:{value:null}}]),vertexShader:iX.meshmatcap_vert,fragmentShader:iX.meshmatcap_frag},points:{uniforms:mergeUniforms([iY.points,iY.fog]),vertexShader:iX.points_vert,fragmentShader:iX.points_frag},dashed:{uniforms:mergeUniforms([iY.common,iY.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:iX.linedashed_vert,fragmentShader:iX.linedashed_frag},depth:{uniforms:mergeUniforms([iY.common,iY.displacementmap]),vertexShader:iX.depth_vert,fragmentShader:iX.depth_frag},normal:{uniforms:mergeUniforms([iY.common,iY.bumpmap,iY.normalmap,iY.displacementmap,{opacity:{value:1}}]),vertexShader:iX.meshnormal_vert,fragmentShader:iX.meshnormal_frag},sprite:{uniforms:mergeUniforms([iY.sprite,iY.fog]),vertexShader:iX.sprite_vert,fragmentShader:iX.sprite_frag},background:{uniforms:{uvTransform:{value:new Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:iX.background_vert,fragmentShader:iX.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:iX.backgroundCube_vert,fragmentShader:iX.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:iX.cube_vert,fragmentShader:iX.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:iX.equirect_vert,fragmentShader:iX.equirect_frag},distanceRGBA:{uniforms:mergeUniforms([iY.common,iY.displacementmap,{referencePosition:{value:new Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:iX.distanceRGBA_vert,fragmentShader:iX.distanceRGBA_frag},shadow:{uniforms:mergeUniforms([iY.lights,iY.fog,{color:{value:new Color(0)},opacity:{value:1}}]),vertexShader:iX.shadow_vert,fragmentShader:iX.shadow_frag}};iZ.physical={uniforms:mergeUniforms([iZ.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Vector2(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 Color(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Color(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Color(1,1,1)},specularColorMap:{value:null}}]),vertexShader:iX.meshphysical_vert,fragmentShader:iX.meshphysical_frag};let iJ={r:0,b:0,g:0};
5function WebGLBackground(e,t,r,i,n,a,s){let o,l;let u=new Color(0),h=!0===a?0:1,c=null,d=0,p=null;function setClear(t,r){t.getRGB(iJ,getUnlitUniformColorSpace(e)),i.buffers.color.setClear(iJ.r,iJ.g,iJ.b,r,s)}return{getClearColor:function(){return u},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),setClear(u,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){setClear(u,h=e)},render:function(i,a){let s=!1,f=!0===a.isScene?a.background:null;if(f&&f.isTexture){let e=a.backgroundBlurriness>0;f=(e?r:t).get(f)}let m=e.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?setClear(u,h):f&&f.isColor&&(setClear(f,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.mapping===ef)?(void 0===l&&((l=new Mesh(new BoxGeometry(1,1,1),new ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:cloneUniforms(iZ.backgroundCube.uniforms),vertexShader:iZ.backgroundCube.vertexShader,fragmentShader:iZ.backgroundCube.fragmentShader,side:b,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=f,l.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=a.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,l.material.toneMapped=f.encoding!==tR,(c!==f||d!==f.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,c=f,d=f.version,p=e.toneMapping),l.layers.enableAll(),i.unshift(l,l.geometry,l.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new Mesh(new PlaneGeometry(2,2),new ShaderMaterial({name:"BackgroundMaterial",uniforms:cloneUniforms(iZ.background.uniforms),vertexShader:iZ.background.vertexShader,fragmentShader:iZ.background.fragmentShader,side:_,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=f,o.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,o.material.toneMapped=f.encoding!==tR,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),(c!==f||d!==f.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,c=f,d=f.version,p=e.toneMapping),o.layers.enableAll(),i.unshift(o,o.geometry,o.material,0,0,null))}}}function WebGLBindingStates(e,t,r,i){let n=e.getParameter(34921),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),s=i.isWebGL2||null!==a,o={},l=createBindingState(null),u=l,h=!1;function bindVertexArrayObject(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function deleteVertexArrayObject(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function createBindingState(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function initAttributes(){let e=u.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function enableAttribute(e){enableAttributeAndDivisor(e,0)}function enableAttributeAndDivisor(r,n){let a=u.newAttributes,s=u.enabledAttributes,o=u.attributeDivisors;if(a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),o[r]!==n){let a=i.isWebGL2?e:t.get("ANGLE_instanced_arrays");a[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,n),o[r]=n}}function disableUnusedAttributes(){let t=u.newAttributes,r=u.enabledAttributes;for(let i=0,n=r.length;i<n;i++)r[i]!==t[i]&&(e.disableVertexAttribArray(i),r[i]=0)}function vertexAttribPointer(t,r,n,a,s,o){!0===i.isWebGL2&&(5124===n||5125===n)?e.vertexAttribIPointer(t,r,n,s,o):e.vertexAttribPointer(t,r,n,a,s,o)}function reset(){resetDefaultState(),h=!0,u!==l&&bindVertexArrayObject((u=l).object)}function resetDefaultState(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(n,l,c,d,p){let f=!1;if(s){let t=function(t,r,n){let s=!0===n.wireframe,l=o[t.id];void 0===l&&(l={},o[t.id]=l);let u=l[r.id];void 0===u&&(u={},l[r.id]=u);let h=u[s];
5return void 0===h&&(h=createBindingState(i.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[s]=h),h}(d,c,l);u!==t&&bindVertexArrayObject((u=t).object),(f=function(e,t,r,i){let n=u.attributes,a=t.attributes,s=0,o=r.getAttributes();for(let t in o){let r=o[t];if(r.location>=0){let r=n[t],i=a[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===r||r.attribute!==i||i&&r.data!==i.data)return!0;s++}}return u.attributesNum!==s||u.index!==i}(n,d,c,p))&&function(e,t,r,i){let n={},a=t.attributes,s=0,o=r.getAttributes();for(let t in o){let r=o[t];if(r.location>=0){let r=a[t];void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor));let i={};i.attribute=r,r&&r.data&&(i.data=r.data),n[t]=i,s++}}u.attributes=n,u.attributesNum=s,u.index=i}(n,d,c,p)}else{let e=!0===l.wireframe;(u.geometry!==d.id||u.program!==c.id||u.wireframe!==e)&&(u.geometry=d.id,u.program=c.id,u.wireframe=e,f=!0)}null!==p&&r.update(p,34963),(f||h)&&(h=!1,function(n,a,s,o){if(!1===i.isWebGL2&&(n.isInstancedMesh||o.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;initAttributes();let l=o.attributes,u=s.getAttributes(),h=a.defaultAttributeValues;for(let t in u){let i=u[t];if(i.location>=0){let a=l[t];if(void 0===a&&("instanceMatrix"===t&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===t&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){let t=a.normalized,s=a.itemSize,l=r.get(a);if(void 0===l)continue;let u=l.buffer,h=l.type,c=l.bytesPerElement;if(a.isInterleavedBufferAttribute){let r=a.data,l=r.stride,d=a.offset;if(r.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)enableAttributeAndDivisor(i.location+e,r.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=r.meshPerAttribute*r.count)}else for(let e=0;e<i.locationSize;e++)enableAttribute(i.location+e);e.bindBuffer(34962,u);for(let e=0;e<i.locationSize;e++)vertexAttribPointer(i.location+e,s/i.locationSize,h,t,l*c,(d+s/i.locationSize*e)*c)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)enableAttributeAndDivisor(i.location+e,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<i.locationSize;e++)enableAttribute(i.location+e);e.bindBuffer(34962,u);for(let e=0;e<i.locationSize;e++)vertexAttribPointer(i.location+e,s/i.locationSize,h,t,s*c,s/i.locationSize*e*c)}}else if(void 0!==h){let r=h[t];if(void 0!==r)switch(r.length){case 2:e.vertexAttrib2fv(i.location,r);break;case 3:e.vertexAttrib3fv(i.location,r);break;case 4:e.vertexAttrib4fv(i.location,r);break;default:e.vertexAttrib1fv(i.location,r)}}}}disableUnusedAttributes()}(n,l,c,d),null!==p&&e.bindBuffer(34963,r.get(p).buffer))},reset:reset,resetDefaultState:resetDefaultState,dispose:function(){for(let e in reset(),o){let t=o[e];for(let e in t){let r=t[e];for(let e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete o[e]}},releaseStatesOfGeometry:function(e){if(void 0===o[e.id])return;let t=o[e.id];for(let e in t){let r=t[e];for(let e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete o[e.id]},releaseStatesOfProgram:function(e){for(let t in o){let r=o[t];if(void 0===r[e.id])continue;let i=r[e.id];for(let e in i)deleteVertexArrayObject(i[e].object),delete i[e];delete r[e.id]}},initAttributes:initAttributes,enableAttribute:enableAttribute,disableUnusedAttributes:disableUnusedAttributes}}function WebGLBufferRenderer(e,t,r,i){let n;let a=i.isWebGL2;this.setMode=function(e){n=e},this.render=function(t,i){e.drawArrays(n,t,i),r.update(i,n,1)},this.renderInstances=function(i,s,o){let l,u;if(0!==o){if(a)l=e,u="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),u="drawArraysInstancedANGLE",null===l){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}l[u](n,i,s,o),r.update(s,n,o)}}}function WebGLCapabilities(e,t,r){let i;function getMaxPrecision(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"}let n="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,a=void 0!==r.precision?r.precision:"highp",s=getMaxPrecision(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);let o=n||t.has("WEBGL_draw_buffers"),l=!0===r.logarithmicDepthBuffer,u=e.getParameter(34930),h=e.getParameter(35660),c=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=n||t.has("OES_texture_float"),_=n?e.getParameter(36183):0;return{isWebGL2:n,drawBuffers:o,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){let r=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:getMaxPrecision,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:c,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:_}}function WebGLClipping(e){let t=this,r=null,i=0,n=!1,a=!1,s=new Plane,o=new Matrix3,l={value:null,needsUpdate:!1};function projectPlanes(e,r,i,n){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==n||null===u){let t=i+4*a,n=r.matrixWorldInverse;o.getNormalMatrix(n),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,r=i;t!==a;++t,r+=4)s.copy(e[t]).applyMatrix4(n,o),s.normal.toArray(u,r),u[r+3]=s.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){let r=0!==e.length||t||0!==i||n;return n=t,i=e.length,r},this.beginShadows=function(){a=!0,projectPlanes(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){r=projectPlanes(e,t,0)},this.setState=function(s,o,u){let h=s.clippingPlanes,c=s.clipIntersection,d=s.clipShadows,p=e.get(s);if(n&&null!==h&&0!==h.length&&(!a||d)){let e=a?0:i,t=4*e,n=p.clippingState||null;l.value=n,n=projectPlanes(h,o,t,u);for(let e=0;e!==t;++e)n[e]=r[e];p.clippingState=n,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=e}else a?projectPlanes(null):(l.value!==r&&(l.value=r,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0)}}function WebGLCubeMaps(e){let t=new WeakMap;function mapTextureMapping(e,t){return t===ed?e.mapping=eh:t===ep&&(e.mapping=ec),e}function onTextureDispose(e){let r=e.target;r.removeEventListener("dispose",onTextureDispose);let i=t.get(r);void 0!==i&&(t.delete(r),i.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let i=r.mapping;if(i===ed||i===ep){if(t.has(r)){let e=t.get(r).texture;return mapTextureMapping(e,r.mapping)}{let i=r.image;if(!i||!(i.height>0))return null;
5{let n=new WebGLCubeRenderTarget(i.height/2);return n.fromEquirectangularTexture(e,r),t.set(r,n),r.addEventListener("dispose",onTextureDispose),mapTextureMapping(n.texture,r.mapping)}}}}return r},dispose:function(){t=new WeakMap}}}let OrthographicCamera=class OrthographicCamera extends Camera{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-e,a=r+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(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}constructor(e=-1,t=1,r=1,i=-1,n=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=n,this.far=a,this.updateProjectionMatrix()}};let iK=[.125,.215,.35,.446,.526,.582],iQ=new OrthographicCamera,i$=new Color,i0=null,i1=(1+Math.sqrt(5))/2,i3=1/i1,i2=[new Vector3(1,1,1),new Vector3(-1,1,1),new Vector3(1,1,-1),new Vector3(-1,1,-1),new Vector3(0,i1,i3),new Vector3(0,i1,-i3),new Vector3(i3,0,i1),new Vector3(-i3,0,i1),new Vector3(i1,i3,0),new Vector3(-i1,i3,0)];let PMREMGenerator=class PMREMGenerator{fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;i0=this._renderer.getRenderTarget(),this._setSize(256);let n=this._allocateTargets();return n.depthBuffer=!0,this._sceneToCubeUV(e,r,i,n),t>0&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(i0),e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===eh||e.mapping===ec?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),i0=this._renderer.getRenderTarget();let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:eS,minFilter:eS,generateMipmaps:!1,type:eV,format:eU,encoding:tP,depthBuffer:!1},i=_createRenderTarget(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,r);let{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}
5=function(e){let t=[],r=[],i=[],n=e,a=e-4+1+iK.length;for(let s=0;s<a;s++){let a=Math.pow(2,n);r.push(a);let o=1/a;s>e-4?o=iK[s-e+4-1]:0===s&&(o=0),i.push(o);let l=1/(a-2),u=-l,h=1+l,c=[u,u,h,u,h,h,u,u,h,h,u,h],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,r=e>2?0:-1,i=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0];d.set(i,18*e),p.set(c,12*e);let n=[e,e,e,e,e,e];f.set(n,6*e)}let m=new BufferGeometry;m.setAttribute("position",new BufferAttribute(d,3)),m.setAttribute("uv",new BufferAttribute(p,2)),m.setAttribute("faceIndex",new BufferAttribute(f,1)),t.push(m),n>4&&n--}return{lodPlanes:t,sizeLods:r,sigmas:i}}(i)),this._blurMaterial=function(e,t,r){let i=new Float32Array(20),n=new Vector3(0,1,0),a=new ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/r,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:w,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return i}_compileMaterial(e){let t=new Mesh(this._lodPlanes[0],e);this._renderer.compile(t,iQ)}_sceneToCubeUV(e,t,r,i){let n=new PerspectiveCamera(90,1,t,r),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,u=o.toneMapping;o.getClearColor(i$),o.toneMapping=ei,o.autoClear=!1;
5let h=new MeshBasicMaterial({name:"PMREM.Background",side:b,depthWrite:!1,depthTest:!1}),c=new Mesh(new BoxGeometry,h),d=!1,p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(i$),d=!0);for(let t=0;t<6;t++){let r=t%3;0===r?(n.up.set(0,a[t],0),n.lookAt(s[t],0,0)):1===r?(n.up.set(0,0,a[t]),n.lookAt(0,s[t],0)):(n.up.set(0,a[t],0),n.lookAt(0,0,s[t]));let l=this._cubeSize;_setViewport(i,r*l,t>2?l:0,l,l),o.setRenderTarget(i),d&&o.render(c,n),o.render(e,n)}c.geometry.dispose(),c.material.dispose(),o.toneMapping=u,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let r=this._renderer,i=e.mapping===eh||e.mapping===ec;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());let n=i?this._cubemapMaterial:this._equirectMaterial,a=new Mesh(this._lodPlanes[0],n),s=n.uniforms;s.envMap.value=e;let o=this._cubeSize;_setViewport(t,0,0,3*o,2*o),r.setRenderTarget(t),r.render(a,iQ)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){let r=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),i=i2[(t-1)%i2.length];this._blur(e,t-1,t,r,i)}t.autoClear=r}_blur(e,t,r,i,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,"latitudinal",n),this._halfBlur(a,e,r,r,i,"longitudinal",n)}_halfBlur(e,t,r,i,n,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let u=new Mesh(this._lodPlanes[i],l),h=l.uniforms,c=this._sizeLods[r]-1,d=isFinite(n)?Math.PI/(2*c):2*Math.PI/39,p=n/d,f=isFinite(n)?1+Math.floor(3*p):20;f>20&&console.warn("sigmaRadians, ".concat(n,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(20));let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,r=Math.exp(-t*t/2);m.push(r),0===e?g+=r:e<f&&(g+=2*r)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);let{_lodMax:y}=this;h.dTheta.value=d,h.mipInt.value=y-r;let x=this._sizeLods[i],_=3*x*(i>y-4?i-y+4:0),b=4*(this._cubeSize-x);_setViewport(t,_,b,3*x,2*x),o.setRenderTarget(t),o.render(u,iQ)}constructor(e){this._renderer=e,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)}};function _createRenderTarget(e,t,r){let i=new WebGLRenderTarget(e,t,r);return i.texture.mapping=ef,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function _setViewport(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function _getEquirectMaterial(){return new ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:w,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:w,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function WebGLCubeUVMaps(e){let t=new WeakMap,r=null;function onTextureDispose(e){let r=e.target;r.removeEventListener("dispose",onTextureDispose);let i=t.get(r);void 0!==i&&(t.delete(r),i.dispose())}return{get:function(i){if(i&&i.isTexture){let n=i.mapping,a=n===ed||n===ep,s=n===eh||n===ec;if(a||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;let n=t.get(i);return null===r&&(r=new PMREMGenerator(e)),n=a?r.fromEquirectangular(i,n):r.fromCubemap(i,n),t.set(i,n),n.texture}if(t.has(i))return t.get(i).texture;{let n=i.image;if(!(a&&n&&n.height>0||s&&n&&function(e){let t=0;for(let r=0;r<6;r++)void 0!==e[r]&&t++;return 6===t}
5(n)))return null;{null===r&&(r=new PMREMGenerator(e));let n=a?r.fromEquirectangular(i):r.fromCubemap(i);return t.set(i,n),i.addEventListener("dispose",onTextureDispose),n.texture}}}}return i},dispose:function(){t=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function WebGLExtensions(e){let t={};function getExtension(r){let i;if(void 0!==t[r])return t[r];switch(r){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(r)}return t[r]=i,i}return{has:function(e){return null!==getExtension(e)},init:function(e){e.isWebGL2?getExtension("EXT_color_buffer_float"):(getExtension("WEBGL_depth_texture"),getExtension("OES_texture_float"),getExtension("OES_texture_half_float"),getExtension("OES_texture_half_float_linear"),getExtension("OES_standard_derivatives"),getExtension("OES_element_index_uint"),getExtension("OES_vertex_array_object"),getExtension("ANGLE_instanced_arrays")),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture")},get:function(e){let t=getExtension(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function WebGLGeometries(e,t,r,i){let n={},a=new WeakMap;function onGeometryDispose(e){let s=e.target;for(let e in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[e]);s.removeEventListener("dispose",onGeometryDispose),delete n[s.id];let o=a.get(s);o&&(t.remove(o),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,r.memory.geometries--}function updateWireframeAttribute(e){let r=[],i=e.index,n=e.attributes.position,s=0;if(null!==i){let e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){let i=e[t+0],n=e[t+1],a=e[t+2];r.push(i,n,n,a,a,i)}}else{let e=n.array;s=n.version;for(let t=0,i=e.length/3-1;t<i;t+=3){let e=t+0,i=t+1,n=t+2;r.push(e,i,i,n,n,e)}}let o=new(arrayNeedsUint32(r)?Uint32BufferAttribute:Uint16BufferAttribute)(r,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===n[t.id]||(t.addEventListener("dispose",onGeometryDispose),n[t.id]=!0,r.memory.geometries++),t},update:function(e){let r=e.attributes;for(let e in r)t.update(r[e],34962);let i=e.morphAttributes;for(let e in i){let r=i[e];for(let e=0,i=r.length;e<i;e++)t.update(r[e],34962)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let r=e.index;null!==r&&t.version<r.version&&updateWireframeAttribute(e)}else updateWireframeAttribute(e);return a.get(e)}}}function WebGLIndexedBufferRenderer(e,t,r,i){let n,a,s;let o=i.isWebGL2;this.setMode=function(e){n=e},this.setIndex=function(e){a=e.type,s=e.bytesPerElement},this.render=function(t,i){e.drawElements(n,i,a,t*s),r.update(i,n,1)},this.renderInstances=function(i,l,u){let h,c;if(0!==u){if(o)h=e,c="drawElementsInstanced";else if(h=t.get("ANGLE_instanced_arrays"),c="drawElementsInstancedANGLE",null===h){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[c](n,l,a,i*s,u),r.update(l,n,u)}}}function WebGLInfo(e){let 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,r,i){switch(t.calls++,r){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function numericalSort(e,t){return e[0]-t[0]}function absNumericalSort(e,t){return Math.abs(t[1])-Math.abs(e[1])}function WebGLMorphtargets(e,t,r){let i={},n=new Float32Array(8),a=new WeakMap,s=new Vector4,o=[];for(let e=0;e<8;e++)o[e]=[e,0];return{update:function(l,u,h){let c=l.morphTargetInfluences;if(!0===t.isWebGL2){let i=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,n=void 0!==i?i.length:0,o=a.get(u);if(void 0===o||o.count!==n){void 0!==o&&o.texture.dispose();let e=void 0!==u.morphAttributes.position,r=void 0!==u.morphAttributes.normal,i=void 0!==u.morphAttributes.color,l=u.morphAttributes.position||[],h=u.morphAttributes.normal||[],c=u.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===r&&(d=2),!0===i&&(d=3);let p=u.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*n),g=new DataArrayTexture(m,p,f,n);g.type=eB,g.needsUpdate=!0;let y=4*d;for(let t=0;t<n;t++){let n=l[t],a=h[t],o=c[t],u=p*f*4*t;for(let t=0;t<n.count;t++){let l=t*y;!0===e&&(s.fromBufferAttribute(n,t),m[u+l+0]=s.x,m[u+l+1]=s.y,m[u+l+2]=s.z,m[u+l+3]=0),!0===r&&(s.fromBufferAttribute(a,t),m[u+l+4]=s.x,m[u+l+5]=s.y,m[u+l+6]=s.z,m[u+l+7]=0),!0===i&&(s.fromBufferAttribute(o,t),m[u+l+8]=s.x,m[u+l+9]=s.y,m[u+l+10]=s.z,m[u+l+11]=4===o.itemSize?s.w:1)}}o={count:n,texture:g,size:new Vector2(p,f)},a.set(u,o),u.addEventListener("dispose",function disposeTexture(){g.dispose(),a.delete(u),u.removeEventListener("dispose",disposeTexture)})}let l=0;for(let e=0;e<c.length;e++)l+=c[e];let d=u.morphTargetsRelative?1:1-l;h.getUniforms().setValue(e,"morphTargetBaseInfluence",d),h.getUniforms().setValue(e,"morphTargetInfluences",c),h.getUniforms().setValue(e,"morphTargetsTexture",o.texture,r),h.getUniforms().setValue(e,"morphTargetsTextureSize",o.size)}else{let t=void 0===c?0:c.length,r=i[u.id];if(void 0===r||r.length!==t){r=[];for(let e=0;e<t;e++)r[e]=[e,0];i[u.id]=r}for(let e=0;e<t;e++){let t=r[e];t[0]=e,t[1]=c[e]}r.sort(absNumericalSort);for(let e=0;e<8;e++)e<t&&r[e][1]?(o[e][0]=r[e][0],o[e][1]=r[e][1]):(o[e][0]=Number.MAX_SAFE_INTEGER,o[e][1]=0);o.sort(numericalSort);let a=u.morphAttributes.position,s=u.morphAttributes.normal,l=0;for(let e=0;e<8;
5e++){let t=o[e],r=t[0],i=t[1];r!==Number.MAX_SAFE_INTEGER&&i?(a&&u.getAttribute("morphTarget"+e)!==a[r]&&u.setAttribute("morphTarget"+e,a[r]),s&&u.getAttribute("morphNormal"+e)!==s[r]&&u.setAttribute("morphNormal"+e,s[r]),n[e]=i,l+=i):(a&&!0===u.hasAttribute("morphTarget"+e)&&u.deleteAttribute("morphTarget"+e),s&&!0===u.hasAttribute("morphNormal"+e)&&u.deleteAttribute("morphNormal"+e),n[e]=0)}let d=u.morphTargetsRelative?1:1-l;h.getUniforms().setValue(e,"morphTargetBaseInfluence",d),h.getUniforms().setValue(e,"morphTargetInfluences",n)}}}}function WebGLObjects(e,t,r,i){let n=new WeakMap;function onInstancedMeshDispose(e){let t=e.target;t.removeEventListener("dispose",onInstancedMeshDispose),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function(e){let a=i.render.frame,s=e.geometry,o=t.get(e,s);return n.get(o)!==a&&(t.update(o),n.set(o,a)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",onInstancedMeshDispose)&&e.addEventListener("dispose",onInstancedMeshDispose),r.update(e.instanceMatrix,34962),null!==e.instanceColor&&r.update(e.instanceColor,34962)),o},dispose:function(){n=new WeakMap}}}let i4=new Texture,i5=new DataArrayTexture,i6=new Data3DTexture,i8=new CubeTexture,i7=[],i9=[],ne=new Float32Array(16),nt=new Float32Array(9),nr=new Float32Array(4);function flatten(e,t,r){let i=e[0];if(i<=0||i>0)return e;let n=t*r,a=i7[n];if(void 0===a&&(a=new Float32Array(n),i7[n]=a),0!==t){i.toArray(a,0);for(let i=1,n=0;i!==t;++i)n+=r,e[i].toArray(a,n)}return a}function arraysEqual(e,t){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(e[r]!==t[r])return!1;return!0}function copyArray(e,t){for(let r=0,i=t.length;r<i;r++)e[r]=t[r]}function allocTexUnits(e,t){let r=i9[t];void 0===r&&(r=new Int32Array(t),i9[t]=r);for(let i=0;i!==t;++i)r[i]=e.allocateTextureUnit();return r}function setValueV1f(e,t){let r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function setValueV2f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2fv(this.addr,t),copyArray(r,t)}}function setValueV3f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(arraysEqual(r,t))return;e.uniform3fv(this.addr,t),copyArray(r,t)}}function setValueV4f(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4fv(this.addr,t),copyArray(r,t)}}function setValueM2(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(arraysEqual(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,i))return;nr.set(i),e.uniformMatrix2fv(this.addr,!1,nr),copyArray(r,i)}}function setValueM3(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(arraysEqual(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,i))return;nt.set(i),e.uniformMatrix3fv(this.addr,!1,nt),copyArray(r,i)}}function setValueM4(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(arraysEqual(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,i))return;ne.set(i),e.uniformMatrix4fv(this.addr,!1,ne),copyArray(r,i)}}function setValueV1i(e,t){let r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function setValueV2i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2iv(this.addr,t),copyArray(r,t)}}function setValueV3i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3iv(this.addr,t),copyArray(r,t)}}function setValueV4i(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4iv(this.addr,t),copyArray(r,t)}}function setValueV1ui(e,t){let r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function setValueV2ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2uiv(this.addr,t),copyArray(r,t)}}function setValueV3ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3uiv(this.addr,t),copyArray(r,t)}}function setValueV4ui(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4uiv(this.addr,t),copyArray(r,t)}}function setValueT1(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture2D(t||i4,n)}function setValueT3D1(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture3D(t||i6,n)}function setValueT6(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTextureCube(t||i8,n)}function setValueT2DArray1(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture2DArray(t||i5,n)}function setValueV1fArray(e,t){e.uniform1fv(this.addr,t)}function setValueV2fArray(e,t){let r=flatten(t,this.size,2);e.uniform2fv(this.addr,r)}function setValueV3fArray(e,t){let r=flatten(t,this.size,3);e.uniform3fv(this.addr,r)}function setValueV4fArray(e,t){let r=flatten(t,this.size,4);e.uniform4fv(this.addr,r)}function setValueM2Array(e,t){let r=flatten(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function setValueM3Array(e,t){let r=flatten(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function setValueM4Array(e,t){let r=flatten(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function setValueV1iArray(e,t){e.uniform1iv(this.addr,t)}function setValueV2iArray(e,t){e.uniform2iv(this.addr,t)}function setValueV3iArray(e,t){e.uniform3iv(this.addr,t)}function setValueV4iArray(e,t){e.uniform4iv(this.addr,t)}function setValueV1uiArray(e,t){e.uniform1uiv(this.addr,t)}function setValueV2uiArray(e,t){e.uniform2uiv(this.addr,t)}function setValueV3uiArray(e,t){e.uniform3uiv(this.addr,t)}function setValueV4uiArray(e,t){e.uniform4uiv(this.addr,t)}function setValueT1Array(e,t,r){let i=this.cache,n=t.length,a=allocTexUnits(r,n);arraysEqual(i,a)||(e.uniform1iv(this.addr,a),copyArray(i,a));for(let e=0;e!==n;++e)r.setTexture2D(t[e]||i4,a[e])}function setValueT3DArray(e,t,r){let i=this.cache,n=t.length,a=allocTexUnits(r,n);arraysEqual(i,a)||(e.uniform1iv(this.addr,a),copyArray(i,a));for(let e=0;e!==n;++e)r.setTexture3D(t[e]||i6,a[e])}function setValueT6Array(e,t,r){let i=this.cache,n=t.length,a=allocTexUnits(r,n);arraysEqual(i,a)||(e.uniform1iv(this.addr,a),copyArray(i,a));for(let e=0;e!==n;++e)r.setTextureCube(t[e]||i8,a[e])}function setValueT2DArrayArray(e,t,r){let i=this.cache,n=t.length,a=allocTexUnits(r,n);arraysEqual(i,a)||(e.uniform1iv(this.addr,a),copyArray(i,a));for(let e=0;e!==n;++e)r.setTexture2DArray(t[e]||i5,a[e])}let SingleUniform=class SingleUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(t.type)}};let PureArrayUniform=class PureArrayUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(t.type)}};let StructuredUniform=class StructuredUniform{setValue(e,t,r){let i=this.seq;for(let n=0,a=i.length;n!==a;++n){let a=i[n];a.setValue(e,t[a.id],r)}}constructor(e){this.id=e,this.seq=[],this.map={}}};let ni=/(\w+)(\])?(\[|\.)?/g;function addUniform(e,t){e.seq.push(t),e.map[t.id]=t}
5let WebGLUniforms=class WebGLUniforms{setValue(e,t,r,i){let n=this.map[t];void 0!==n&&n.setValue(e,r,i)}setOptional(e,t,r){let i=t[r];void 0!==i&&this.setValue(e,r,i)}static upload(e,t,r,i){for(let n=0,a=t.length;n!==a;++n){let a=t[n],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){let r=[];for(let i=0,n=e.length;i!==n;++i){let n=e[i];n.id in t&&r.push(n)}return r}constructor(e,t){this.seq=[],this.map={};let r=e.getProgramParameter(t,35718);for(let i=0;i<r;++i){let r=e.getActiveUniform(t,i),n=e.getUniformLocation(t,r.name);!function(e,t,r){let i=e.name,n=i.length;for(ni.lastIndex=0;;){let a=ni.exec(i),s=ni.lastIndex,o=a[1],l="]"===a[2],u=a[3];if(l&&(o|=0),void 0===u||"["===u&&s+2===n){addUniform(r,void 0===u?new SingleUniform(o,e,t):new PureArrayUniform(o,e,t));break}{let e=r.map,t=e[o];void 0===t&&addUniform(r,t=new StructuredUniform(o)),r=t}}}(r,n,this)}}};function WebGLShader(e,t,r){let i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),i}let nn=0;function getShaderErrors(e,t,r){let i=e.getShaderParameter(t,35713),n=e.getShaderInfoLog(t).trim();if(i&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let i=parseInt(a[1]);return r.toUpperCase()+"\n\n"+n+"\n\n"+function(e,t){let r=e.split("\n"),i=[],n=Math.max(t-6,0),a=Math.min(t+6,r.length);for(let e=n;e<a;e++){let n=e+1;i.push("".concat(n===t?">":" "," ").concat(n,": ").concat(r[e]))}return i.join("\n")}(e.getShaderSource(t),i)}}function filterEmptyLine(e){return""!==e}function replaceLightNums(e,t){let r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).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_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function replaceClippingPlaneNums(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let na=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(e){return e.replace(na,includeReplacer)}function includeReplacer(e,t){let r=iX[t];if(void 0===r)throw Error("Can not resolve #include <"+t+">");return resolveIncludes(r)}let ns=/#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 unrollLoops(e){return e.replace(ns,loopReplacer)}function loopReplacer(e,t,r,i){let n="";for(let e=parseInt(t);e<parseInt(r);e++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return n}function generatePrecision(e){let 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 WebGLProgram(e,t,r,i){let n,a,s,o,l,u;let h=e.getContext(),c=r.defines,d=r.vertexShader,p=r.fragmentShader,f=(l="SHADOWMAP_TYPE_BASIC",r.shadowMapType===g?l="SHADOWMAP_TYPE_PCF":r.shadowMapType===y?l="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===x&&(l="SHADOWMAP_TYPE_VSM"),l),m=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case eh:case ec:t="ENVMAP_TYPE_CUBE";break;case ef:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),_=(u="ENVMAP_MODE_REFLECTION",r.envMap&&r.envMapMode===ec&&(u="ENVMAP_MODE_REFRACTION"),u),b=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case ee:t="ENVMAP_BLENDING_MULTIPLY";break;case et:t="ENVMAP_BLENDING_MIX";break;case er:t="ENVMAP_BLENDING_ADD"}return t}(r),M=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let r=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,r),112)),texelHeight:1/t,maxMip:r}}(r),S=r.isWebGL2?"":function(e){let t=[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":""];return t.filter(filterEmptyLine).join("\n")}(r),w=function(e){let t=[];for(let r in e){let i=e[r];!1!==i&&t.push("#define "+r+" "+i)}return t.join("\n")}(c),T=h.createProgram(),A=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?((n=[w].filter(filterEmptyLine).join("\n")).length>0&&(n+="\n"),(a=[S,w].filter(filterEmptyLine).join("\n")).length>0&&(a+="\n")):(n=[generatePrecision(r),"#define SHADER_NAME "+r.shaderName,w,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.supportsVertexTextures?"#define VERTEX_TEXTURES":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+_:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IR
5IDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",r.specularColorMap?"#define USE_SPECULARCOLORMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEENCOLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors&&r.isWebGL2?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+f:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),a=[S,generatePrecision(r),"#define SHADER_NAME "+r.shaderName,w,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+m:"",r.envMap?"#define "+_:"",r.envMap?"#define "+b:"",M?"#define CUBEUV_TEXEL_WIDTH "+M.texelWidth:"",M?"#define CUBEUV_TEXEL_HEIGHT "+M.texelHeight:"",M?"#define CUBEUV_MAX_MIP "+M.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescence?"#define USE_IRIDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IR
5IDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",r.specularColorMap?"#define USE_SPECULARCOLORMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEENCOLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+f:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping!==ei?"#define TONE_MAPPING":"",r.toneMapping!==ei?iX.tonemapping_pars_fragment:"",r.toneMapping!==ei?function(e,t){let r;switch(t){case en:r="Linear";break;case ea:r="Reinhard";break;case es:r="OptimizedCineon";break;case eo:r="ACESFilmic";break;case el:r="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),r="Linear"}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",iX.encodings_pars_fragment,function(e,t){let r=function(e){switch(e){case tP:return["Linear","( value )"];case tR:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}("linearToOutputTexel",r.outputEncoding),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),d=replaceClippingPlaneNums(d=replaceLightNums(d=resolveIncludes(d),r),r),p=replaceClippingPlaneNums(p=replaceLightNums(p=resolveIncludes(p),r),r),d=unrollLoops(d),p=unrollLoops(p),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(A="#version 300 es\n",n="precision mediump sampler2DArray;\n#define attribute in\n#define varying out\n#define texture2D texture\n"+n,a=["#define varying in",r.glslVersion===rr?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===rr?"":"#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);let C=A+n+d,E=A+a+p,L=WebGLShader(h,35633,C),P=WebGLShader(h,35632,E);if(h.attachShader(T,L),h.attachShader(T,P),void 0!==r.index0AttributeName?h.bindAttribLocation(T,0,r.index0AttributeName):!0===r.morphTargets&&h.bindAttribLocation(T,0,"position"),h.linkProgram(T),e.debug.checkShaderErrors){let e=h.getProgramInfoLog(T).trim(),t=h.getShaderInfoLog(L).trim(),r=h.getShaderInfoLog(P).trim(),i=!0,s=!0;if(!1===h.getProgramParameter(T,35714)){i=!1;let t=getShaderErrors(h,L,"vertex"),r=getShaderErrors(h,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+h.getError()+" - VALIDATE_STATUS "+h.getProgramParameter(T,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+r)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):(""===t||""===r)&&(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:n},fragmentShader:{log:r,prefix:a}})}return h.deleteShader(L),h.deleteShader(P),this.getUniforms=function(){return void 0===s&&(s=new WebGLUniforms(h,T)),s},this.getAttributes=function(){return void 0===o&&(o=function(e,t){let r={},i=e.getProgramParameter(t,35721);for(let n=0;n<i;n++){let i=e.getActiveAttrib(t,n),a=i.name,s=1;
535674===i.type&&(s=2),35675===i.type&&(s=3),35676===i.type&&(s=4),r[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return r}(h,T)),o},this.destroy=function(){i.releaseStatesOfProgram(this),h.deleteProgram(T),this.program=void 0},this.name=r.shaderName,this.id=nn++,this.cacheKey=t,this.usedTimes=1,this.program=T,this.vertexShader=L,this.fragmentShader=P,this}let no=0;let WebGLShaderCache=class WebGLShaderCache{update(e){let t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),n=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(n)&&(a.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){let t=this.shaderCache,r=t.get(e);return void 0===r&&(r=new WebGLShaderStage(e),t.set(e,r)),r}constructor(){this.shaderCache=new Map,this.materialCache=new Map}};let WebGLShaderStage=class WebGLShaderStage{constructor(e){this.id=no++,this.code=e,this.usedTimes=0}};function WebGLPrograms(e,t,r,i,n,a,s){let o=new Layers,l=new WebGLShaderCache,u=[],h=n.isWebGL2,c=n.logarithmicDepthBuffer,d=n.vertexTextures,p=n.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,o,u,m,g){let y,x,_,S;let w=m.fog,A=g.geometry,C=a.isMeshStandardMaterial?m.environment:null,E=(a.isMeshStandardMaterial?r:t).get(a.envMap||C),L=E&&E.mapping===ef?E.image.height:null,P=f[a.type];null!==a.precision&&(p=n.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let R=A.morphAttributes.position||A.morphAttributes.normal||A.morphAttributes.color,I=void 0!==R?R.length:0,D=0;if(void 0!==A.morphAttributes.position&&(D=1),void 0!==A.morphAttributes.normal&&(D=2),void 0!==A.morphAttributes.color&&(D=3),P){let e=iZ[P];y=e.vertexShader,x=e.fragmentShader}else y=a.vertexShader,x=a.fragmentShader,l.update(a),_=l.getVertexShaderID(a),S=l.getFragmentShaderID(a);let B=e.getRenderTarget(),V=a.alphaTest>0,O=a.clearcoat>0,N=a.iridescence>0,z={isWebGL2:h,shaderID:P,shaderName:a.type,vertexShader:y,fragmentShader:x,defines:a.defines,customVertexShaderID:_,customFragmentShaderID:S,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===B?e.outputEncoding:!0===B.isXRRenderTarget?B.texture.encoding:tP,map:!!a.map,matcap:!!a.matcap,envMap:!!E,envMapMode:E&&E.mapping,envMapCubeUVHeight:L,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:a.normalMapType===tV,tangentSpaceNormalMap:a.normalMapType===tB,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===tR,clearcoat:O,clearcoatMap:O&&!!a.clearcoatMap,clearcoatRoughnessMap:O&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:O&&!!a.clearcoatNormalMap,iridescence:N,iridescenceMap:N&&!!a.iridescenceMap,iridescenceThicknessMap:N&&!!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===T,alphaMap:!!a.alphaMap,alphaTest:V,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&&!!A.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!A.attributes.color&&4===A.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:!!w,useFog:!0===a.fog,fogExp2:w&&w.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==A.morphAttributes.position,morphNormals:void 0!==A.morphAttributes.normal,morphColors:void 0!==A.morphAttributes.color,morphTargetsCount:I,morphTextureStride:D,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:ei,useLegacyLights:e.useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===M,flipSided:a.side===b,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:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()};return z},getProgramCacheKey:function(t){let r=[];
5if(t.shaderID?r.push(t.shaderID):(r.push(t.customVertexShaderID),r.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)r.push(e),r.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(r.push(t.precision),r.push(t.outputEncoding),r.push(t.envMapMode),r.push(t.envMapCubeUVHeight),r.push(t.combine),r.push(t.vertexUvs),r.push(t.fogExp2),r.push(t.sizeAttenuation),r.push(t.morphTargetsCount),r.push(t.morphAttributeCount),r.push(t.numDirLights),r.push(t.numPointLights),r.push(t.numSpotLights),r.push(t.numSpotLightMaps),r.push(t.numHemiLights),r.push(t.numRectAreaLights),r.push(t.numDirLightShadows),r.push(t.numPointLightShadows),r.push(t.numSpotLightShadows),r.push(t.numSpotLightShadowsWithMaps),r.push(t.shadowMapType),r.push(t.toneMapping),r.push(t.numClippingPlanes),r.push(t.numClipIntersection),r.push(t.depthPacking),o.disableAll(),t.isWebGL2&&o.enable(0),t.supportsVertexTextures&&o.enable(1),t.instancing&&o.enable(2),t.instancingColor&&o.enable(3),t.map&&o.enable(4),t.matcap&&o.enable(5),t.envMap&&o.enable(6),t.lightMap&&o.enable(7),t.aoMap&&o.enable(8),t.emissiveMap&&o.enable(9),t.bumpMap&&o.enable(10),t.normalMap&&o.enable(11),t.objectSpaceNormalMap&&o.enable(12),t.tangentSpaceNormalMap&&o.enable(13),t.clearcoat&&o.enable(14),t.clearcoatMap&&o.enable(15),t.clearcoatRoughnessMap&&o.enable(16),t.clearcoatNormalMap&&o.enable(17),t.iridescence&&o.enable(18),t.iridescenceMap&&o.enable(19),t.iridescenceThicknessMap&&o.enable(20),t.displacementMap&&o.enable(21),t.specularMap&&o.enable(22),t.roughnessMap&&o.enable(23),t.metalnessMap&&o.enable(24),t.gradientMap&&o.enable(25),t.alphaMap&&o.enable(26),t.alphaTest&&o.enable(27),t.vertexColors&&o.enable(28),t.vertexAlphas&&o.enable(29),t.vertexUvs&&o.enable(30),t.vertexTangents&&o.enable(31),t.uvsVertexOnly&&o.enable(32),r.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.useLegacyLights&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.specularIntensityMap&&o.enable(15),t.specularColorMap&&o.enable(16),t.transmission&&o.enable(17),t.transmissionMap&&o.enable(18),t.thicknessMap&&o.enable(19),t.sheen&&o.enable(20),t.sheenColorMap&&o.enable(21),t.sheenRoughnessMap&&o.enable(22),t.decodeVideoTexture&&o.enable(23),t.opaque&&o.enable(24),r.push(o.mask),r.push(e.outputEncoding)),r.push(t.customProgramCacheKey),r.join()},getUniforms:function(e){let t;let r=f[e.type];if(r){let e=iZ[r];t=iF.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,r){let i;for(let e=0,t=u.length;e<t;e++){let t=u[e];if(t.cacheKey===r){i=t,++i.usedTimes;break}}return void 0===i&&(i=new WebGLProgram(e,r,t,a),u.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){let 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 WebGLProperties(){let e=new WeakMap;return{get:function(t){let r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,i){e.get(t)[r]=i},dispose:function(){e=new WeakMap}}}function painterSortStable(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 reversePainterSortStable(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 WebGLRenderList(){let e=[],t=0,r=[],i=[],n=[];function getNextRenderItem(r,i,n,a,s,o){let l=e[t];return void 0===l?(l={id:r.id,object:r,geometry:i,material:n,groupOrder:a,renderOrder:r.renderOrder,z:s,group:o},e[t]=l):(l.id=r.id,l.object=r,l.geometry=i,l.material=n,l.groupOrder=a,l.renderOrder=r.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:r,transmissive:i,transparent:n,init:function(){t=0,r.length=0,i.length=0,n.length=0},push:function(e,t,a,s,o,l){let u=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?i.push(u):!0===a.transparent?n.push(u):r.push(u)},unshift:function(e,t,a,s,o,l){let u=getNextRenderItem(e,t,a,s,o,l);a.transmission>0?i.unshift(u):!0===a.transparent?n.unshift(u):r.unshift(u)},finish:function(){for(let r=t,i=e.length;r<i;r++){let t=e[r];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){r.length>1&&r.sort(e||painterSortStable),i.length>1&&i.sort(t||reversePainterSortStable),n.length>1&&n.sort(t||reversePainterSortStable)}}}function WebGLRenderLists(){let e=new WeakMap;return{get:function(t,r){let i;let n=e.get(t);return void 0===n?(i=new WebGLRenderList,e.set(t,[i])):r>=n.length?(i=new WebGLRenderList,n.push(i)):i=n[r],i},dispose:function(){e=new WeakMap}}}function UniformsCache(){let e={};return{get:function(t){let r;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":r={direction:new Vector3,color:new Color};break;case"SpotLight":r={position:new Vector3,direction:new Vector3,color:new Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new Vector3,color:new Color,distance:0,decay:0};break;case"HemisphereLight":r={direction:new Vector3,skyColor:new Color,groundColor:new Color};break;case"RectAreaLight":r={color:new Color,position:new Vector3,halfWidth:new Vector3,halfHeight:new Vector3}}return e[t.id]=r,r}}}let nl=0;function shadowCastingAndTexturingLightsFirst(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function WebGLLights(e,t){let r=new UniformsCache,i=function(){let e={};return{get:function(t){let r;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)n.probe.push(new Vector3);let a=new Vector3,s=new Matrix4,o=new Matrix4;return{setup:function(a,s){let o=0,l=0,u=0;for(let e=0;e<9;e++)n.probe[e].set(0,0,0);let h=0,c=0,d=0,p=0,f=0,m=0,g=0,y=0,x=0,_=0;a.sort(shadowCastingAndTexturingLightsFirst);let b=!0===s?Math.PI:1;for(let e=0,t=a.length;e<t;e++){let t=a[e],s=t.color,M=t.intensity,S=t.distance,w=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)o+=s.r*M*b,l+=s.g*M*b,u+=s.b*M*b;else if(t.isLightProbe)for(let e=0;e<9;e++)n.probe[e].addScaledVector(t.sh.coefficients[e],M);else if(t.isDirectionalLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*b),t.castShadow){let e=t.shadow,r=i.get(t);
5r.shadowBias=e.bias,r.shadowNormalBias=e.normalBias,r.shadowRadius=e.radius,r.shadowMapSize=e.mapSize,n.directionalShadow[h]=r,n.directionalShadowMap[h]=w,n.directionalShadowMatrix[h]=t.shadow.matrix,m++}n.directional[h]=e,h++}else if(t.isSpotLight){let e=r.get(t);e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(s).multiplyScalar(M*b),e.distance=S,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,n.spot[d]=e;let a=t.shadow;if(t.map&&(n.spotLightMap[x]=t.map,x++,a.updateMatrices(t),t.castShadow&&_++),n.spotLightMatrix[d]=a.matrix,t.castShadow){let e=i.get(t);e.shadowBias=a.bias,e.shadowNormalBias=a.normalBias,e.shadowRadius=a.radius,e.shadowMapSize=a.mapSize,n.spotShadow[d]=e,n.spotShadowMap[d]=w,y++}d++}else if(t.isRectAreaLight){let e=r.get(t);e.color.copy(s).multiplyScalar(M),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),n.rectArea[p]=e,p++}else if(t.isPointLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*b),e.distance=t.distance,e.decay=t.decay,t.castShadow){let e=t.shadow,r=i.get(t);r.shadowBias=e.bias,r.shadowNormalBias=e.normalBias,r.shadowRadius=e.radius,r.shadowMapSize=e.mapSize,r.shadowCameraNear=e.camera.near,r.shadowCameraFar=e.camera.far,n.pointShadow[c]=r,n.pointShadowMap[c]=w,n.pointShadowMatrix[c]=t.shadow.matrix,g++}n.point[c]=e,c++}else if(t.isHemisphereLight){let e=r.get(t);e.skyColor.copy(t.color).multiplyScalar(M*b),e.groundColor.copy(t.groundColor).multiplyScalar(M*b),n.hemi[f]=e,f++}}p>0&&(t.isWebGL2?(n.rectAreaLTC1=iY.LTC_FLOAT_1,n.rectAreaLTC2=iY.LTC_FLOAT_2):!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=iY.LTC_FLOAT_1,n.rectAreaLTC2=iY.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(n.rectAreaLTC1=iY.LTC_HALF_1,n.rectAreaLTC2=iY.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=o,n.ambient[1]=l,n.ambient[2]=u;let M=n.hash;(M.directionalLength!==h||M.pointLength!==c||M.spotLength!==d||M.rectAreaLength!==p||M.hemiLength!==f||M.numDirectionalShadows!==m||M.numPointShadows!==g||M.numSpotShadows!==y||M.numSpotMaps!==x)&&(n.directional.length=h,n.spot.length=d,n.rectArea.length=p,n.point.length=c,n.hemi.length=f,n.directionalShadow.length=m,n.directionalShadowMap.length=m,n.pointShadow.length=g,n.pointShadowMap.length=g,n.spotShadow.length=y,n.spotShadowMap.length=y,n.directionalShadowMatrix.length=m,n.pointShadowMatrix.length=g,n.spotLightMatrix.length=y+x-_,n.spotLightMap.length=x,n.numSpotLightShadowsWithMaps=_,M.directionalLength=h,M.pointLength=c,M.spotLength=d,M.rectAreaLength=p,M.hemiLength=f,M.numDirectionalShadows=m,M.numPointShadows=g,M.numSpotShadows=y,M.numSpotMaps=x,n.version=nl++)},setupView:function(e,t){let r=0,i=0,l=0,u=0,h=0,c=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=n.directional[r];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(c),r++}else if(d.isSpotLight){let e=n.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(c),l++}else if(d.isRectAreaLight){let e=n.rectArea[u];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),o.identity(),s.copy(d.matrixWorld),s.premultiply(c),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(d.isPointLight){let e=n.point[i];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(c),i++}else if(d.isHemisphereLight){let e=n.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(c),h++}}},state:n}}function WebGLRenderState(e,t){let r=new WebGLLights(e,t),i=[],n=[];return{init:function(){i.length=0,n.length=0},state:{lightsArray:i,shadowsArray:n,lights:r},setupLights:function(e){r.setup(i,e)},setupLightsView:function(e){r.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function WebGLRenderStates(e,t){let r=new WeakMap;return{get:function(i){let n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=r.get(i);return void 0===s?(n=new WebGLRenderState(e,t),r.set(i,[n])):a>=s.length?(n=new WebGLRenderState(e,t),s.push(n)):n=s[a],n},dispose:function(){r=new WeakMap}}}let MeshDepthMaterial=class MeshDepthMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=tI,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}};let MeshDistanceMaterial=class MeshDistanceMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Vector3,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}};function WebGLShadowMap(e,t,r){let i=new Frustum,n=new Vector2,a=new Vector2,s=new Vector4,o=new MeshDepthMaterial({depthPacking:tD}),l=new MeshDistanceMaterial,u={},h=r.maxTextureSize,c={[_]:b,[b]:_,[M]:M}
5,d=new ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new BufferGeometry;f.setAttribute("position",new BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Mesh(f,d),y=this;function getDepthMaterial(t,r,i,n,a,s){let h=null,d=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==d)h=d;else if(h=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0){let e=h.uuid,t=r.uuid,i=u[e];void 0===i&&(i={},u[e]=i);let n=i[t];void 0===n&&(n=h.clone(),i[t]=n),h=n}return h.visible=r.visible,h.wireframe=r.wireframe,s===x?h.side=null!==r.shadowSide?r.shadowSide:r.side:h.side=null!==r.shadowSide?r.shadowSide:c[r.side],h.alphaMap=r.alphaMap,h.alphaTest=r.alphaTest,h.map=r.map,h.clipShadows=r.clipShadows,h.clippingPlanes=r.clippingPlanes,h.clipIntersection=r.clipIntersection,h.displacementMap=r.displacementMap,h.displacementScale=r.displacementScale,h.displacementBias=r.displacementBias,h.wireframeLinewidth=r.wireframeLinewidth,h.linewidth=r.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=n,h.farDistance=a),h}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=g,this.render=function(r,o,l){if(!1===y.enabled||!1===y.autoUpdate&&!1===y.needsUpdate||0===r.length)return;let u=e.getRenderTarget(),c=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.state;g.setBlending(w),g.buffers.color.setClear(1,1,1,1),g.buffers.depth.setTest(!0),g.setScissorTest(!1);for(let u=0,c=r.length;u<c;u++){let c=r[u],f=c.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;n.copy(f.mapSize);let y=f.getFrameExtents();if(n.multiply(y),a.copy(f.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(a.x=Math.floor(h/y.x),n.x=a.x*y.x,f.mapSize.x=a.x),n.y>h&&(a.y=Math.floor(h/y.y),n.y=a.y*y.y,f.mapSize.y=a.y)),null===f.map){let e=this.type!==x?{minFilter:ey,magFilter:ey}:{};f.map=new WebGLRenderTarget(n.x,n.y,e),f.map.texture.name=c.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let _=f.getViewportCount();for(let r=0;r<_;r++){let n=f.getViewport(r);s.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),g.viewport(s),f.updateMatrices(c,r),i=f.getFrustum(),function renderObject(r,n,a,s,o){if(!1===r.visible)return;let l=r.layers.test(n.layers);if(l&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&o===x)&&(!r.frustumCulled||i.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,r.matrixWorld);let i=t.update(r),n=r.material;if(Array.isArray(n)){let t=i.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],h=n[u.materialIndex];if(h&&h.visible){let t=getDepthMaterial(r,h,s,a.near,a.far,o);e.renderBufferDirect(a,null,i,t,r,u)}}}else if(n.visible){let t=getDepthMaterial(r,n,s,a.near,a.far,o);e.renderBufferDirect(a,null,i,t,r,null)}}let u=r.children;for(let e=0,t=u.length;e<t;e++)renderObject(u[e],n,a,s,o)}(o,l,f.camera,c,this.type)}!0!==f.isPointLightShadow&&this.type===x&&function(r,i){let a=t.update(m);d.defines.VSM_SAMPLES!==r.blurSamples&&(d.defines.VSM_SAMPLES=r.blurSamples,p.defines.VSM_SAMPLES=r.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new WebGLRenderTarget(n.x,n.y)),d.uniforms.shadow_pass.value=r.map.texture,d.uniforms.resolution.value=r.mapSize,d.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,a,d,m,null),p.uniforms.shadow_pass.value=r.mapPass.texture,p.uniforms.resolution.value=r.mapSize,p.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,a,p,m,null)}(f,l),f.needsUpdate=!1}y.needsUpdate=!1,e.setRenderTarget(u,c,f)}}function WebGLState(e,t,r){let i=r.isWebGL2,n=new function(){let t=!1,r=new Vector4,i=null,n=new Vector4(0,0,0,0);return{setMask:function(r){i===r||t||(e.colorMask(r,r,r,r),i=r)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),r.set(t,i,a,s),!1===n.equals(r)&&(e.clearColor(t,i,a,s),n.copy(r))},reset:function(){t=!1,i=null,n.set(-1,0,0,0)}}},a=new function(){let t=!1,r=null,i=null,n=null;return{setTest:function(e){e?enable(2929):disable(2929)},setMask:function(i){r===i||t||(e.depthMask(i),r=i)},setFunc:function(t){if(i!==t){switch(t){case q:e.depthFunc(512);break;case X:e.depthFunc(519);break;case Y:e.depthFunc(513);break;
5case Z:e.depthFunc(515);break;case J:e.depthFunc(514);break;case K:e.depthFunc(518);break;case Q:e.depthFunc(516);break;case $:e.depthFunc(517);break;default:e.depthFunc(515)}i=t}},setLocked:function(e){t=e},setClear:function(t){n!==t&&(e.clearDepth(t),n=t)},reset:function(){t=!1,r=null,i=null,n=null}}},s=new function(){let t=!1,r=null,i=null,n=null,a=null,s=null,o=null,l=null,u=null;return{setTest:function(e){t||(e?enable(2960):disable(2960))},setMask:function(i){r===i||t||(e.stencilMask(i),r=i)},setFunc:function(t,r,s){(i!==t||n!==r||a!==s)&&(e.stencilFunc(t,r,s),i=t,n=r,a=s)},setOp:function(t,r,i){(s!==t||o!==r||l!==i)&&(e.stencilOp(t,r,i),s=t,o=r,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,r=null,i=null,n=null,a=null,s=null,o=null,l=null,u=null}}},o=new WeakMap,l=new WeakMap,u={},h={},f=new WeakMap,m=[],g=null,y=!1,x=null,_=null,S=null,ee=null,et=null,er=null,ei=null,en=!1,ea=null,es=null,eo=null,el=null,eu=null,eh=e.getParameter(35661),ec=!1,ed=e.getParameter(7938);-1!==ed.indexOf("WebGL")?ec=parseFloat(/^WebGL (\d)/.exec(ed)[1])>=1:-1!==ed.indexOf("OpenGL ES")&&(ec=parseFloat(/^OpenGL ES (\d)/.exec(ed)[1])>=2);let ep=null,ef={},em=e.getParameter(3088),eg=e.getParameter(2978),ev=new Vector4().fromArray(em),ey=new Vector4().fromArray(eg);function createTexture(t,r,i){let n=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<i;t++)e.texImage2D(r+t,0,6408,1,1,0,6408,5121,n);return a}let ex={};function enable(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function disable(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}ex[3553]=createTexture(3553,3553,1),ex[34067]=createTexture(34067,34069,6),n.setClear(0,0,0,1),a.setClear(1),s.setClear(0),enable(2929),a.setFunc(Z),setFlipSided(!1),setCullFace(d),enable(2884),setBlending(w);let e_={[P]:32774,[R]:32778,[I]:32779};if(i)e_[D]=32775,e_[B]=32776;else{let e=t.get("EXT_blend_minmax");null!==e&&(e_[D]=e.MIN_EXT,e_[B]=e.MAX_EXT)}let eb={[V]:0,[O]:1,[N]:768,[G]:770,[j]:776,[W]:774,[F]:772,[z]:769,[U]:771,[H]:775,[k]:773};function setBlending(t,r,i,n,a,s,o,l){if(t===w){!0===y&&(disable(3042),y=!1);return}if(!1===y&&(enable(3042),y=!0),t!==L){if(t!==x||l!==en){if((_!==P||et!==P)&&(e.blendEquation(32774),_=P,et=P),l)switch(t){case T:e.blendFuncSeparate(1,771,1,771);break;case A:e.blendFunc(1,1);break;case C:e.blendFuncSeparate(0,769,0,1);break;case E:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case T:e.blendFuncSeparate(770,771,1,771);break;case A:e.blendFunc(770,1);break;case C:e.blendFuncSeparate(0,769,0,1);break;case E:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}S=null,ee=null,er=null,ei=null,x=t,en=l}return}a=a||r,s=s||i,o=o||n,(r!==_||a!==et)&&(e.blendEquationSeparate(e_[r],e_[a]),_=r,et=a),(i!==S||n!==ee||s!==er||o!==ei)&&(e.blendFuncSeparate(eb[i],eb[n],eb[s],eb[o]),S=i,ee=n,er=s,ei=o),x=t,en=!1}function setFlipSided(t){ea!==t&&(t?e.frontFace(2304):e.frontFace(2305),ea=t)}function setCullFace(t){t!==c?(enable(2884),t!==es&&(t===d?e.cullFace(1029):t===p?e.cullFace(1028):e.cullFace(1032))):disable(2884),es=t}function setPolygonOffset(t,r,i){t?(enable(32823),(el!==r||eu!==i)&&(e.polygonOffset(r,i),el=r,eu=i)):disable(32823)}return{buffers:{color:n,depth:a,stencil:s},enable:enable,disable:disable,bindFramebuffer:function(t,r){return h[t]!==r&&(e.bindFramebuffer(t,r),h[t]=r,i&&(36009===t&&(h[36160]=r),36160===t&&(h[36009]=r)),!0)},drawBuffers:function(i,n){let a=m,s=!1;if(i){if(void 0===(a=f.get(n))&&(a=[],f.set(n,a)),i.isWebGLMultipleRenderTargets){let e=i.texture;if(a.length!==e.length||36064!==a[0]){for(let t=0,r=e.length;t<r;t++)a[t]=36064+t;a.length=e.length,s=!0}}else 36064!==a[0]&&(a[0]=36064,s=!0)}else 1029!==a[0]&&(a[0]=1029,s=!0);s&&(r.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return g!==t&&(e.useProgram(t),g=t,!0)},setBlending:setBlending,setMaterial:function(e,t){e.side===M?disable(2884):enable(2884);let r=e.side===b;t&&(r=!r),setFlipSided(r),e.blending===T&&!1===e.transparent?setBlending(w):setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),n.setMask(e.colorWrite);let i=e.stencilWrite;s.setTest(i),i&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?enable(32926):disable(32926)}
5,setFlipSided:setFlipSided,setCullFace:setCullFace,setLineWidth:function(t){t!==eo&&(ec&&e.lineWidth(t),eo=t)},setPolygonOffset:setPolygonOffset,setScissorTest:function(e){e?enable(3089):disable(3089)},activeTexture:function(t){void 0===t&&(t=33984+eh-1),ep!==t&&(e.activeTexture(t),ep=t)},bindTexture:function(t,r,i){void 0===i&&(i=null===ep?33984+eh-1:ep);let n=ef[i];void 0===n&&(n={type:void 0,texture:void 0},ef[i]=n),(n.type!==t||n.texture!==r)&&(ep!==i&&(e.activeTexture(i),ep=i),e.bindTexture(t,r||ex[t]),n.type=t,n.texture=r)},unbindTexture:function(){let t=ef[ep];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,r){let i=l.get(r);void 0===i&&(i=new WeakMap,l.set(r,i));let n=i.get(t);void 0===n&&(n=e.getUniformBlockIndex(r,t.name),i.set(t,n))},uniformBlockBinding:function(t,r){let i=l.get(r),n=i.get(t);o.get(r)!==n&&(e.uniformBlockBinding(r,n,t.__bindingPointIndex),o.set(r,n))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===ev.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ev.copy(t))},viewport:function(t){!1===ey.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),ey.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),u={},ep=null,ef={},h={},f=new WeakMap,m=[],g=null,y=!1,x=null,_=null,S=null,ee=null,et=null,er=null,ei=null,en=!1,ea=null,es=null,eo=null,el=null,eu=null,ev.set(0,0,e.canvas.width,e.canvas.height),ey.set(0,0,e.canvas.width,e.canvas.height),n.reset(),a.reset(),s.reset()}}}function WebGLTextures(e,t,r,i,n,a,s){let o;let l=n.isWebGL2,u=n.maxTextures,h=n.maxCubemapSize,c=n.maxTextureSize,d=n.maxSamples,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,f="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap,g=new WeakMap,y=!1;try{y="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function createCanvas(e,t){return y?new OffscreenCanvas(e,t):createElementNS("canvas")}function resizeImage(e,t,r,i){let n=1;if((e.width>i||e.height>i)&&(n=i/Math.max(e.width,e.height)),n<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let i=t?floorPowerOfTwo:Math.floor,a=i(n*e.width),s=i(n*e.height);void 0===o&&(o=createCanvas(a,s));let l=r?createCanvas(a,s):o;l.width=a,l.height=s;let u=l.getContext("2d");return u.drawImage(e,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+s+")."),l}
5"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").")}return e}function isPowerOfTwo$1(e){return isPowerOfTwo(e.width)&&isPowerOfTwo(e.height)}function textureNeedsGenerateMipmaps(e,t){return e.generateMipmaps&&t&&e.minFilter!==ey&&e.minFilter!==eS}function generateMipmap(t){e.generateMipmap(t)}function getInternalFormat(r,i,n,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===l)return i;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}let o=i;return 6403===i&&(5126===n&&(o=33326),5131===n&&(o=33325),5121===n&&(o=33321)),33319===i&&(5126===n&&(o=33328),5131===n&&(o=33327),5121===n&&(o=33323)),6408===i&&(5126===n&&(o=34836),5131===n&&(o=34842),5121===n&&(o=a===tR&&!1===s?35907:32856),32819===n&&(o=32854),32820===n&&(o=32855)),(33325===o||33326===o||33327===o||33328===o||34842===o||34836===o)&&t.get("EXT_color_buffer_float"),o}function getMipLevels(e,t,r){return!0===textureNeedsGenerateMipmaps(e,r)||e.isFramebufferTexture&&e.minFilter!==ey&&e.minFilter!==eS?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 filterFallback(e){return e===ey||e===ex||e===eb?9728:9729}function onTextureDispose(e){let t=e.target;t.removeEventListener("dispose",onTextureDispose),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let r=e.source,n=g.get(r);if(n){let i=n[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&deleteTexture(e),0===Object.keys(n).length&&g.delete(r)}i.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function onRenderTargetDispose(t){let r=t.target;r.removeEventListener("dispose",onRenderTargetDispose),function(t){let r=t.texture,n=i.get(t),a=i.get(r);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t]);else{if(e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let t=0,n=r.length;t<n;t++){let n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[t])}i.remove(r),i.remove(t)}(r)}function deleteTexture(t){let r=i.get(t);e.deleteTexture(r.__webglTexture);let n=t.source,a=g.get(n);delete a[r.__cacheKey],s.memory.textures--}let x=0;function setTexture2D(e,t){let n=i.get(e);if(e.isVideoTexture&&function(e){let t=s.render.frame;m.get(e)!==t&&(m.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&n.__version!==e.version){let r=e.image;if(null===r)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===r.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{uploadTexture(n,e,t);return}}r.bindTexture(3553,n.__webglTexture,33984+t)}let _={[em]:10497,[eg]:33071,[ev]:33648},b={[ey]:9728,[ex]:9984,[eb]:9986,[eS]:9729,[ew]:9985,[eA]:9987};function setTextureParameters(r,a,s){if(s?(e.texParameteri(r,10242,_[a.wrapS]),e.texParameteri(r,10243,_[a.wrapT]),(32879===r||35866===r)&&e.texParameteri(r,32882,_[a.wrapR]),e.texParameteri(r,10240,b[a.magFilter]),e.texParameteri(r,10241,b[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),(32879===r||35866===r)&&e.texParameteri(r,32882,33071),(a.wrapS!==eg||a.wrapT!==eg)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,10240,filterFallback(a.magFilter)),e.texParameteri(r,10241,filterFallback(a.minFilter)),a.minFilter!==ey&&a.minFilter!==eS&&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")){let s=t.get("EXT_texture_filter_anisotropic");a.magFilter!==ey&&(a.minFilter===eb||a.minFilter===eA)&&(a.type!==eB||!1!==t.has("OES_texture_float_linear"))&&(!1!==l||a.type!==eV||!1!==t.has("OES_texture_half_float_linear"))&&(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function initTexture(t,r){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",onTextureDispose));let n=r.source,a=g.get(n);void 0===a&&(a={},g.set(n,a));let o=function(e){let t=[];
5return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),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()}(r);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;let n=a[t.__cacheKey];void 0!==n&&(a[t.__cacheKey].usedTimes--,0===n.usedTimes&&deleteTexture(r)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function uploadTexture(t,n,s){let o=3553;(n.isDataArrayTexture||n.isCompressedArrayTexture)&&(o=35866),n.isData3DTexture&&(o=32879);let u=initTexture(t,n),h=n.source;r.bindTexture(o,t.__webglTexture,33984+s);let d=i.get(h);if(h.version!==d.__version||!0===u){let t;r.activeTexture(33984+s),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let i=!l&&(n.wrapS!==eg||n.wrapT!==eg||n.minFilter!==ey&&n.minFilter!==eS)&&!1===isPowerOfTwo$1(n.image),p=resizeImage(n.image,i,!1,c);p=verifyColorSpace(n,p);let f=isPowerOfTwo$1(p)||l,m=a.convert(n.format,n.encoding),g=a.convert(n.type),y=getInternalFormat(n.internalFormat,m,g,n.encoding,n.isVideoTexture);setTextureParameters(o,n,f);let x=n.mipmaps,_=l&&!0!==n.isVideoTexture,b=void 0===d.__version||!0===u,M=getMipLevels(n,p,f);if(n.isDepthTexture)y=6402,l?y=n.type===eB?36012:n.type===eD?33190:n.type===ez?35056:33189:n.type===eB&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),n.format===eW&&6402===y&&n.type!==eR&&n.type!==eD&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=eD,g=a.convert(n.type)),n.format===eH&&6402===y&&(y=34041,n.type!==ez&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=ez,g=a.convert(n.type))),b&&(_?r.texStorage2D(3553,1,y,p.width,p.height):r.texImage2D(3553,0,y,p.width,p.height,0,m,g,null));else if(n.isDataTexture){if(x.length>0&&f){_&&b&&r.texStorage2D(3553,M,y,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)t=x[e],_?r.texSubImage2D(3553,e,0,0,t.width,t.height,m,g,t.data):r.texImage2D(3553,e,y,t.width,t.height,0,m,g,t.data);n.generateMipmaps=!1}else _?(b&&r.texStorage2D(3553,M,y,p.width,p.height),r.texSubImage2D(3553,0,0,0,p.width,p.height,m,g,p.data)):r.texImage2D(3553,0,y,p.width,p.height,0,m,g,p.data)}else if(n.isCompressedTexture){if(n.isCompressedArrayTexture){_&&b&&r.texStorage3D(35866,M,y,x[0].width,x[0].height,p.depth);for(let e=0,i=x.length;e<i;e++)t=x[e],n.format!==eU?null!==m?_?r.compressedTexSubImage3D(35866,e,0,0,0,t.width,t.height,p.depth,m,t.data,0,0):r.compressedTexImage3D(35866,e,y,t.width,t.height,p.depth,0,t.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?r.texSubImage3D(35866,e,0,0,0,t.width,t.height,p.depth,m,g,t.data):r.texImage3D(35866,e,y,t.width,t.height,p.depth,0,m,g,t.data)}else{_&&b&&r.texStorage2D(3553,M,y,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)t=x[e],n.format!==eU?null!==m?_?r.compressedTexSubImage2D(3553,e,0,0,t.width,t.height,m,t.data):r.compressedTexImage2D(3553,e,y,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?r.texSubImage2D(3553,e,0,0,t.width,t.height,m,g,t.data):r.texImage2D(3553,e,y,t.width,t.height,0,m,g,t.data)}}else if(n.isDataArrayTexture)_?(b&&r.texStorage3D(35866,M,y,p.width,p.height,p.depth),r.texSubImage3D(35866,0,0,0,0,p.width,p.height,p.depth,m,g,p.data)):r.texImage3D(35866,0,y,p.width,p.height,p.depth,0,m,g,p.data);else if(n.isData3DTexture)_?(b&&r.texStorage3D(32879,M,y,p.width,p.height,p.depth),r.texSubImage3D(32879,0,0,0,0,p.width,p.height,p.depth,m,g,p.data)):r.texImage3D(32879,0,y,p.width,p.height,p.depth,0,m,g,p.data);else if(n.isFramebufferTexture){if(b){if(_)r.texStorage2D(3553,M,y,p.width,p.height);else{let e=p.width,t=p.height;for(let i=0;i<M;i++)r.texImage2D(3553,i,y,e,t,0,m,g,null),e>>=1,t>>=1}}}else if(x.length>0&&f){_&&b&&r.texStorage2D(3553,M,y,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)t=x[e],_?r.texSubImage2D(3553,e,0,0,m,g,t):r.texImage2D(3553,e,y,m,g,t);n.generateMipmaps=!1}else _?(b&&r.texStorage2D(3553,M,y,p.width,p.height),r.texSubImage2D(3553,0,0,0,m,g,p)):r.texImage2D(3553,0,y,m,g,p);textureNeedsGenerateMipmaps(n,f)&&generateMipmap(o),d.__version=h.version,n.onUp
5date&&n.onUpdate(n)}t.__version=n.version}function setupFrameBufferTexture(t,n,s,o,l){let u=a.convert(s.format,s.encoding),h=a.convert(s.type),c=getInternalFormat(s.internalFormat,u,h,s.encoding),d=i.get(n);d.__hasExternalTextures||(32879===l||35866===l?r.texImage3D(l,0,c,n.width,n.height,n.depth,0,u,h,null):r.texImage2D(l,0,c,n.width,n.height,0,u,h,null)),r.bindFramebuffer(36160,t),useMultisampledRTT(n)?p.framebufferTexture2DMultisampleEXT(36160,o,l,i.get(s).__webglTexture,0,getRenderTargetSamples(n)):(3553===l||l>=34069&&l<=34074)&&e.framebufferTexture2D(36160,o,l,i.get(s).__webglTexture,0),r.bindFramebuffer(36160,null)}function setupRenderBufferStorage(t,r,i){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){let n=33189;if(i||useMultisampledRTT(r)){let t=r.depthTexture;t&&t.isDepthTexture&&(t.type===eB?n=36012:t.type===eD&&(n=33190));let i=getRenderTargetSamples(r);useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,i,n,r.width,r.height):e.renderbufferStorageMultisample(36161,i,n,r.width,r.height)}else e.renderbufferStorage(36161,n,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){let n=getRenderTargetSamples(r);i&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(36161,n,35056,r.width,r.height):useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,n,35056,r.width,r.height):e.renderbufferStorage(36161,34041,r.width,r.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{let t=!0===r.isWebGLMultipleRenderTargets?r.texture:[r.texture];for(let n=0;n<t.length;n++){let s=t[n],o=a.convert(s.format,s.encoding),l=a.convert(s.type),u=getInternalFormat(s.internalFormat,o,l,s.encoding),h=getRenderTargetSamples(r);i&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(36161,h,u,r.width,r.height):useMultisampledRTT(r)?p.renderbufferStorageMultisampleEXT(36161,h,u,r.width,r.height):e.renderbufferStorage(36161,u,r.width,r.height)}}e.bindRenderbuffer(36161,null)}function setupDepthRenderbuffer(t){let n=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!n.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");!function(t,n){let a=n&&n.isWebGLCubeRenderTarget;if(a)throw Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(36160,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),setTexture2D(n.depthTexture,0);let s=i.get(n.depthTexture).__webglTexture,o=getRenderTargetSamples(n);if(n.depthTexture.format===eW)useMultisampledRTT(n)?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,o):e.framebufferTexture2D(36160,36096,3553,s,0);else if(n.depthTexture.format===eH)useMultisampledRTT(n)?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,o):e.framebufferTexture2D(36160,33306,3553,s,0);else throw Error("Unknown depthTexture format")}(n.__webglFramebuffer,t)}else if(a){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)r.bindFramebuffer(36160,n.__webglFramebuffer[i]),n.__webglDepthbuffer[i]=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer[i],t,!1)}else r.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(n.__webglDepthbuffer,t,!1);r.bindFramebuffer(36160,null)}function getRenderTargetSamples(e){return Math.min(d,e.samples)}function useMultisampledRTT(e){let r=i.get(e);return l&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function verifyColorSpace(e,r){let i=e.encoding,n=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===ri||i!==tP&&(i===tR?!1===l?!0===t.has("EXT_sRGB")&&n===eU?(e.format=ri,e.minFilter=eS,e.generateMipmaps=!1):r=ImageUtils.sRGBToLinear(r):(n!==eU||a!==eE)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),r}this.allocateTextureUnit=function(){let e=x;return e>=u&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+u),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function(e,t){let n=i.get(e);if(e.version>0&&n.__version!==e.version){uploadTexture(n,e,t);return}r.bindTexture(35866,n.__webglTexture,33984+t)},this.setTexture3D=function(e,t){let n=i.get(e);if(e.version>0&&n.__version!==e.version){uploadTexture(n,e,t);return}r.bindTexture(32879,n.__webglTexture,33984+t)},this.setTextureCube=function(t,n){let s=i.get(t);if(t.version>0&&s.__version!==t.version){(function(t,n,s){if(6!==n.image.length)return;let o=initTexture(t,n),u=n.source;r.bindTexture(34067,t.__webglTexture,33984+s);let c=i.get(u);if(u.version!==c.__version||!0===o){let t;r.activeTexture(33984+s),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment),e.pixelStorei(37443,0);let i=n.isCompressedTexture||n.image[0].isCompressedTexture,d=n.image[0]&&n.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)i||d?p[e]=d?n.image[e].image:n.image[e]:p[e]=resizeImage(n.image[e],!1,!0,h),p[e]=verifyColorSpace(n,p[e]);let f=p[0],m=isPowerOfTwo$1(f)||l,g=a.convert(n.format,n.encoding),y=a.convert(n.type),x=getInternalFormat(n.internalFormat,g,y,n.encoding),_=l&&!0!==n.isVideoTexture,b=void 0===c.__version||!0===o,M=getMipLevels(n,f,m);if(setTextureParameters(34067,n,m),i){_&&b&&r.texStorage2D(34067,M,x,f.width,f.height);for(let e=0;e<6;e++){t=p[e].mipmaps;for(let i=0;i<t.length;i++){let a=t[i];n.format!==eU?null!==g?_?r.compressedTexSubImage2D(34069+e,i,0,0,a.width,a.height,g,a.data):r.compressedTexImage2D(34069+e,i,x,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):_?r.texSubImage2D(34069+e,i,0,0,a.width,a.height,g,y,a.data):r.texImage2D(34069+e,i,x,a.width,a.height,0,g,y,a.data)}}}else{t=n.mipmaps,_&&b&&(t.length>0&&M++,r.texStorage2D(34067,M,x,p[0].width,p[0].height));for(let e=0;e<6;e++)if(d){_?r.texSubImage2D(34069+e,0,0,0,p[e].width,p[e].height,g,y,p[e].data):r.texImage2D(34069+e,0,x,p[e].width,p[e].height,0,g,y,p[e].data);for(let i=0;i<t.length;i++){let n=t[i],a=n.image[e].image;_?r.texSubImage2D(34069+e,i+1,0,0,a.width,a.height,g,y,a.data):r.texImage2D(34069+e,i+1,x,a.width,a.height,0,g,y,a.data)}}else{_?r.texSubImage2D(34069+e,0,0,0,g,y,p[e]):r.texImage2D(34069+e,0,x,g,y,p[e]);for(let i=0;i<t.length;i++){let n=t[i];_?r.texSubImage2D(34069+e,i+1,0,0,g,y,n.image[e]):r.texImage2D(34069+e,i+1,x,g,y,n.image[e])}}}textureNeedsGenerateMipmaps(n,m)&&generateMipmap(34067),c.__version=u.version,n.onUp
5date&&n.onUpdate(n)}t.__version=n.version})(s,t,n);return}r.bindTexture(34067,s.__webglTexture,33984+n)},this.rebindTextures=function(e,t,r){let n=i.get(e);void 0!==t&&setupFrameBufferTexture(n.__webglFramebuffer,e,e.texture,36064,3553),void 0!==r&&setupDepthRenderbuffer(e)},this.setupRenderTarget=function(t){let o=t.texture,u=i.get(t),h=i.get(o);t.addEventListener("dispose",onRenderTargetDispose),!0!==t.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=e.createTexture()),h.__version=o.version,s.memory.textures++);let c=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=isPowerOfTwo$1(t)||l;if(c){u.__webglFramebuffer=[];for(let t=0;t<6;t++)u.__webglFramebuffer[t]=e.createFramebuffer()}else{if(u.__webglFramebuffer=e.createFramebuffer(),d){if(n.drawBuffers){let r=t.texture;for(let t=0,n=r.length;t<n;t++){let n=i.get(r[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.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===useMultisampledRTT(t)){let i=d?o:[o];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],r.bindFramebuffer(36160,u.__webglMultisampledFramebuffer);for(let r=0;r<i.length;r++){let n=i[r];u.__webglColorRenderbuffer[r]=e.createRenderbuffer(),e.bindRenderbuffer(36161,u.__webglColorRenderbuffer[r]);let s=a.convert(n.format,n.encoding),o=a.convert(n.type),l=getInternalFormat(n.internalFormat,s,o,n.encoding,!0===t.isXRRenderTarget),h=getRenderTargetSamples(t);e.renderbufferStorageMultisample(36161,h,l,t.width,t.height),e.framebufferRenderbuffer(36160,36064+r,36161,u.__webglColorRenderbuffer[r])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(u.__webglDepthRenderbuffer=e.createRenderbuffer(),setupRenderBufferStorage(u.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(36160,null)}}if(c){r.bindTexture(34067,h.__webglTexture),setTextureParameters(34067,o,p);for(let e=0;e<6;e++)setupFrameBufferTexture(u.__webglFramebuffer[e],t,o,36064,34069+e);textureNeedsGenerateMipmaps(o,p)&&generateMipmap(34067),r.unbindTexture()}else if(d){let e=t.texture;for(let n=0,a=e.length;n<a;n++){let a=e[n],s=i.get(a);r.bindTexture(3553,s.__webglTexture),setTextureParameters(3553,a,p),setupFrameBufferTexture(u.__webglFramebuffer,t,a,36064+n,3553),textureNeedsGenerateMipmaps(a,p)&&generateMipmap(3553)}r.unbindTexture()}else{let e=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l?e=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),r.bindTexture(e,h.__webglTexture),setTextureParameters(e,o,p),setupFrameBufferTexture(u.__webglFramebuffer,t,o,36064,e),textureNeedsGenerateMipmaps(o,p)&&generateMipmap(e),r.unbindTexture()}t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(e){let t=isPowerOfTwo$1(e)||l,n=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let a=0,s=n.length;a<s;a++){let s=n[a];if(textureNeedsGenerateMipmaps(s,t)){let t=e.isWebGLCubeRenderTarget?34067:3553,n=i.get(s).__webglTexture;r.bindTexture(t,n),generateMipmap(t),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(l&&t.samples>0&&!1===useMultisampledRTT(t)){let n=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,s=t.height,o=16384,l=[],u=t.stencilBuffer?33306:36096,h=i.get(t),c=!0===t.isWebGLMultipleRenderTargets;if(c)for(let t=0;t<n.length;t++)r.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,3
56161,null),r.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,null,0);r.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),r.bindFramebuffer(36009,h.__webglFramebuffer);for(let r=0;r<n.length;r++){l.push(36064+r),t.depthBuffer&&l.push(u);let d=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===d&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),c&&e.framebufferRenderbuffer(36008,36064,36161,h.__webglColorRenderbuffer[r]),!0===d&&(e.invalidateFramebuffer(36008,[u]),e.invalidateFramebuffer(36009,[u])),c){let t=i.get(n[r]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,9728),f&&e.invalidateFramebuffer(36008,l)}if(r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,null),c)for(let t=0;t<n.length;t++){r.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,h.__webglColorRenderbuffer[t]);let a=i.get(n[t]).__webglTexture;r.bindFramebuffer(36160,h.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,a,0)}r.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(e,t,r){let i=r.isWebGL2;return{convert:function(r){let n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(r===eE)return 5121;if(r===eO)return 32819;if(r===eN)return 32820;if(r===eL)return 5120;if(r===eP)return 5122;if(r===eR)return 5123;if(r===eI)return 5124;if(r===eD)return 5125;if(r===eB)return 5126;if(r===eV)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(r===eG)return 6406;if(r===eU)return 6408;if(r===eF)return 6409;if(r===ek)return 6410;if(r===eW)return 6402;if(r===eH)return 34041;if(r===ri)return null!==(n=t.get("EXT_sRGB"))?n.SRGB_ALPHA_EXT:null;if(r===ej)return 6403;if(r===eq)return 36244;if(r===eX)return 33319;if(r===eY)return 33320;if(r===eZ)return 36249;if(r===eJ||r===eK||r===eQ||r===e$){if(a===tR){if(null===(n=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(r===eJ)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===eK)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===eQ)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===e$)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(r===eJ)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===eK)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===eQ)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===e$)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(r===e0||r===e1||r===e3||r===e2){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(r===e0)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===e1)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===e3)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===e2)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(r===e4)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===e5||r===e6){if(null===(n=t.get("WEBGL_compressed_texture_etc")))return null;if(r===e5)return a===tR?n.COMPRESSED_SRGB8_ETC2:n.COMPRESSED_RGB8_ETC2;if(r===e6)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:n.COMPRESSED_RGBA8_ETC2_EAC}if(r===e8||r===e7||r===e9||r===te||r===tt||r===tr||r===ti||r===tn||r===ta||r===ts||r===to||r===tl||r===tu||r===th){if(null===(n=t.get("WEBGL_compressed_texture_astc")))return null;if(r===e8)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:n.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===e7)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:n.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===e9)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:n.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===te)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:n.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===tt)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:n.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===tr)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:n.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===ti)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:n.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===tn)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:n.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===ta)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:n.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===ts)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:n.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===to)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:n.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===tl)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:n.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===tu)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:n.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===th)return a===tR?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:n.COMPRESSED_RGBA_ASTC_12x12_KHR}if(r===tc){if(null===(n=t.get("EXT_texture_compression_bptc")))return null;if(r===tc)return a===tR?n.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:n.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(r===td||r===tp||r===tf||r===tm){if(null===(n=t.get("EXT_texture_compression_rgtc")))return null;
5if(r===tc)return n.COMPRESSED_RED_RGTC1_EXT;if(r===tp)return n.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===tf)return n.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===tm)return n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return r===ez?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[r]?e[r]:null}}}let ArrayCamera=class ArrayCamera extends PerspectiveCamera{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};let Group=class Group extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}};let nu={type:"move"};let WebXRController=class WebXRController{getHandSpace(){return null===this._hand&&(this._hand=new Group,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(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}update(e,t,r){let i=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let i of(a=!0,e.hand.values())){let e=t.getJointPose(i,r),n=this._getHandJoint(l,i);null!==e&&(n.matrix.fromArray(e.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.jointRadius=e.radius),n.visible=null!==e}let i=l.joints["index-finger-tip"],n=l.joints["thumb-tip"],s=i.position.distanceTo(n.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(i=t.getPose(e.targetRaySpace,r))&&null!==n&&(i=n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(nu)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let r=new Group;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}};let DepthTexture=class DepthTexture extends Texture{constructor(e,t,r,i,n,a,s,o,l,u){if((u=void 0!==u?u:eW)!==eW&&u!==eH)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&u===eW&&(r=eD),void 0===r&&u===eH&&(r=ez),super(null,i,n,a,s,o,u,r,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:ey,this.minFilter=void 0!==o?o:ey,this.flipY=!1,this.generateMipmaps=!1}};
5let WebXRManager=class WebXRManager extends EventDispatcher{constructor(e,t){super();let r=this,i=null,n=1,a=null,s="local-floor",o=1,l=null,u=null,h=null,c=null,d=null,p=null,f=t.getContextAttributes(),m=null,g=null,y=[],x=[],_=new Set,b=new Map,M=new PerspectiveCamera;M.layers.enable(1),M.viewport=new Vector4;let S=new PerspectiveCamera;S.layers.enable(2),S.viewport=new Vector4;let w=[M,S],T=new ArrayCamera;T.layers.enable(1),T.layers.enable(2);let A=null,C=null;function onSessionEvent(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let r=y[t];void 0!==r&&r.dispatchEvent({type:e.type,data:e.inputSource})}function onSessionEnd(){i.removeEventListener("select",onSessionEvent),i.removeEventListener("selectstart",onSessionEvent),i.removeEventListener("selectend",onSessionEvent),i.removeEventListener("squeeze",onSessionEvent),i.removeEventListener("squeezestart",onSessionEvent),i.removeEventListener("squeezeend",onSessionEvent),i.removeEventListener("end",onSessionEnd),i.removeEventListener("inputsourceschange",onInputSourcesChange);for(let e=0;e<y.length;e++){let t=x[e];null!==t&&(x[e]=null,y[e].disconnect(t))}A=null,C=null,e.setRenderTarget(m),d=null,c=null,h=null,i=null,g=null,R.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(e){for(let t=0;t<e.removed.length;t++){let r=e.removed[t],i=x.indexOf(r);i>=0&&(x[i]=null,y[i].disconnect(r))}for(let t=0;t<e.added.length;t++){let r=e.added[t],i=x.indexOf(r);if(-1===i){for(let e=0;e<y.length;e++){if(e>=x.length){x.push(r),i=e;break}if(null===x[e]){x[e]=r,i=e;break}}if(-1===i)break}let n=y[i];n&&n.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new WebXRController,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){n=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==c?c:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(null!==(i=u)){if(m=e.getRenderTarget(),i.addEventListener("select",onSessionEvent),i.addEventListener("selectstart",onSessionEvent),i.addEventListener("selectend",onSessionEvent),i.addEventListener("squeeze",onSessionEvent),i.addEventListener("squeezestart",onSessionEvent),i.addEventListener("squeezeend",onSessionEvent),i.addEventListener("end",onSessionEnd),i.addEventListener("inputsourceschange",onInputSourcesChange),!0!==f.xrCompatible&&await t.makeXRCompatible(),void 0===i.renderState.layers||!1===e.capabilities.isWebGL2){let r={antialias:void 0!==i.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:n};d=new XRWebGLLayer(i,t,r),i.updateRenderState({baseLayer:d}),g=new WebGLRenderTarget(d.framebufferWidth,d.framebufferHeight,{format:eU,type:eE,encoding:e.outputEncoding,stencilBuffer:f.stencil})}else{let r=null,a=null,s=null;f.depth&&(s=f.stencil?35056:33190,r=f.stencil?eH:eW,a=f.stencil?ez:eD);let o={colorFormat:32856,depthFormat:s,scaleFactor:n};c=(h=new XRWebGLBinding(i,t)).createProjectionLayer(o),i.updateRenderState({layers:[c]}),g=new WebGLRenderTarget(c.textureWidth,c.textureHeight,{format:eU,type:eE,depthTexture:new DepthTexture(c.textureWidth,c.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,r),stencilBuffer:f.stencil,encoding:e.outputEncoding,samples:f.antialias?4:0});let l=e.properties.get(g);l.__ignoreDepthValues=c.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),R.setContext(i),R.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};let E=new Vector3,L=new Vector3;function updateCamera(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;T.near=S.near=M.near=e.near,T.far=S.far=M.far=e.far,(A!==T.near||C!==T.far)&&(i.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,C=T.far);let t=e.parent,r=T.cameras;updateCamera(T,t);for(let e=0;e<r.length;e++)updateCamera(r[e],t);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),e.matrix.copy(T.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);let n=e.children;for(let e=0,t=n.length;e<t;e++)n[e].updateMatrixWorld(!0);2===r.length?function(e,t,r){E.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(r.matrixWorld);let i=E.distanceTo(L),n=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],u=(n[9]-1)/n[5],h=(n[8]-1)/n[0],c=(a[8]+1)/a[0],d=i/(-h+c),p=-(d*h);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let f=s+d,m=o+d,g=s*h-p,y=s*c+(i-p),x=l*o/m*f,_=u*o/m*f;e.projectionMatrix.makePerspective(g,y,x,_,f,m)}(T,M,S):T.projectionMatrix.copy(M.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==c||null!==d)return o},this.setFoveation=function(e){o=e,null!==c&&(c.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.getPlanes=function(){return _};let P=null,R=new WebGLAnimation;R.setAnimationLoop(function(t,i){if(u=i.getViewerPose(l||a),p=i,null!==u){let t=u.views;null!==d&&(e.setRenderTargetFramebuffer(g,d.framebuffer),e.setRenderTarget(g));let r=!1;t.length!==T.cameras.length&&(T.cameras.length=0,r=!0);for(let i=0;i<t.length;i++){let n=t[i],a=null;if(null!==d)a=d.getViewport(n);else{let t=h.getViewSubImage(c,n);a=t.viewport,0===i&&(e.setRenderTargetTextures(g,t.colorTexture,c.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(g))}let s=w[i];void 0===s&&((s=new PerspectiveCamera).layers.enable(i),s.viewport=new Vector4,w[i]=s),s.matrix.fromArray(n.transform.matrix),s.projectionMatrix.fromArray(n.projectionMatrix),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&T.matrix.copy(s.matrix
5),!0===r&&T.cameras.push(s)}}for(let e=0;e<y.length;e++){let t=x[e],r=y[e];null!==t&&void 0!==r&&r.update(t,i,l||a)}if(P&&P(t,i),i.detectedPlanes){r.dispatchEvent({type:"planesdetected",data:i.detectedPlanes});let e=null;for(let t of _)i.detectedPlanes.has(t)||(null===e&&(e=[]),e.push(t));if(null!==e)for(let t of e)_.delete(t),b.delete(t),r.dispatchEvent({type:"planeremoved",data:t});for(let e of i.detectedPlanes)if(_.has(e)){let t=b.get(e);e.lastChangedTime>t&&(b.set(e,e.lastChangedTime),r.dispatchEvent({type:"planechanged",data:e}))}else _.add(e),b.set(e,i.lastChangedTime),r.dispatchEvent({type:"planeadded",data:e})}p=null}),this.setAnimationLoop=function(e){P=e},this.dispose=function(){}}};function WebGLMaterials(e,t){function refreshUniformsCommon(r,i){let n,a;r.opacity.value=i.opacity,i.color&&r.diffuse.value.copy(i.color),i.emissive&&r.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(r.map.value=i.map),i.alphaMap&&(r.alphaMap.value=i.alphaMap),i.bumpMap&&(r.bumpMap.value=i.bumpMap,r.bumpScale.value=i.bumpScale,i.side===b&&(r.bumpScale.value*=-1)),i.displacementMap&&(r.displacementMap.value=i.displacementMap,r.displacementScale.value=i.displacementScale,r.displacementBias.value=i.displacementBias),i.emissiveMap&&(r.emissiveMap.value=i.emissiveMap),i.normalMap&&(r.normalMap.value=i.normalMap,r.normalScale.value.copy(i.normalScale),i.side===b&&r.normalScale.value.negate()),i.specularMap&&(r.specularMap.value=i.specularMap),i.alphaTest>0&&(r.alphaTest.value=i.alphaTest);let s=t.get(i).envMap;if(s&&(r.envMap.value=s,r.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,r.reflectivity.value=i.reflectivity,r.ior.value=i.ior,r.refractionRatio.value=i.refractionRatio),i.lightMap){r.lightMap.value=i.lightMap;let t=!0===e.useLegacyLights?Math.PI:1;r.lightMapIntensity.value=i.lightMapIntensity*t}i.aoMap&&(r.aoMap.value=i.aoMap,r.aoMapIntensity.value=i.aoMapIntensity),i.map?n=i.map:i.specularMap?n=i.specularMap:i.displacementMap?n=i.displacementMap:i.normalMap?n=i.normalMap:i.bumpMap?n=i.bumpMap:i.roughnessMap?n=i.roughnessMap:i.metalnessMap?n=i.metalnessMap:i.alphaMap?n=i.alphaMap:i.emissiveMap?n=i.emissiveMap:i.clearcoatMap?n=i.clearcoatMap:i.clearcoatNormalMap?n=i.clearcoatNormalMap:i.clearcoatRoughnessMap?n=i.clearcoatRoughnessMap:i.iridescenceMap?n=i.iridescenceMap:i.iridescenceThicknessMap?n=i.iridescenceThicknessMap:i.specularIntensityMap?n=i.specularIntensityMap:i.specularColorMap?n=i.specularColorMap:i.transmissionMap?n=i.transmissionMap:i.thicknessMap?n=i.thicknessMap:i.sheenColorMap?n=i.sheenColorMap:i.sheenRoughnessMap&&(n=i.sheenRoughnessMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),r.uvTransform.value.copy(n.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),r.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(t,r){r.color.getRGB(t.fogColor.value,getUnlitUniformColorSpace(e)),r.isFog?(t.fogNear.value=r.near,t.fogFar.value=r.far):r.isFogExp2&&(t.fogDensity.value=r.density)},refreshMaterialUniforms:function(e,r,i,n,a){let s,o;r.isMeshBasicMaterial?refreshUniformsCommon(e,r):r.isMeshLambertMaterial?refreshUniformsCommon(e,r):r.isMeshToonMaterial?(refreshUniformsCommon(e,r),r.gradientMap&&(e.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?(refreshUniformsCommon(e,r),e.specular.value.copy(r.specular),e.shininess.value=Math.max(r.shininess,1e-4)):r.isMeshStandardMaterial?(refreshUniformsCommon(e,r),function(e,r){e.roughness.value=r.roughness,e.metalness.value=r.metalness,r.roughnessMap&&(e.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(e.metalnessMap.value=r.metalnessMap);let i=t.get(r).envMap;i&&(e.envMapIntensity.value=r.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&(e.ior.value=r.ior,r.sheen>0&&(e.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen),e.sheenRoughness.value=r.sheenRoughness,r.sheenColorMap&&(e.sheenColorMap.value=r.sheenColorMap),r.sheenRoughnessMap&&(e.sheenRoughnessMap.value=r.sheenRoughnessMap)),r.clearcoat>0&&(e.clearcoat.value=r.clearcoat,e.clearcoatRoughness.value=r.clearcoatRoughness,r.clearcoatMap&&(e.clearcoatMap.value=r.clearcoatMap),r.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=r.clearcoatRoughnessMap),r.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(r.clearcoatNormalScale),e.clearcoatNormalMap.value=r.clearcoatNormalMap,r.side===b&&e.clearcoatNormalScale.value.negate())),r.iridescence>
50&&(e.iridescence.value=r.iridescence,e.iridescenceIOR.value=r.iridescenceIOR,e.iridescenceThicknessMinimum.value=r.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=r.iridescenceThicknessRange[1],r.iridescenceMap&&(e.iridescenceMap.value=r.iridescenceMap),r.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=r.iridescenceThicknessMap)),r.transmission>0&&(e.transmission.value=r.transmission,e.transmissionSamplerMap.value=a.texture,e.transmissionSamplerSize.value.set(a.width,a.height),r.transmissionMap&&(e.transmissionMap.value=r.transmissionMap),e.thickness.value=r.thickness,r.thicknessMap&&(e.thicknessMap.value=r.thicknessMap),e.attenuationDistance.value=r.attenuationDistance,e.attenuationColor.value.copy(r.attenuationColor)),e.specularIntensity.value=r.specularIntensity,e.specularColor.value.copy(r.specularColor),r.specularIntensityMap&&(e.specularIntensityMap.value=r.specularIntensityMap),r.specularColorMap&&(e.specularColorMap.value=r.specularColorMap))):r.isMeshMatcapMaterial?(refreshUniformsCommon(e,r),r.matcap&&(e.matcap.value=r.matcap)):r.isMeshDepthMaterial?refreshUniformsCommon(e,r):r.isMeshDistanceMaterial?(refreshUniformsCommon(e,r),e.referencePosition.value.copy(r.referencePosition),e.nearDistance.value=r.nearDistance,e.farDistance.value=r.farDistance):r.isMeshNormalMaterial?refreshUniformsCommon(e,r):r.isLineBasicMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,r.isLineDashedMaterial&&(e.dashSize.value=r.dashSize,e.totalSize.value=r.dashSize+r.gapSize,e.scale.value=r.scale)):r.isPointsMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.size.value=r.size*i,e.scale.value=.5*n,r.map&&(e.map.value=r.map),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest),r.map?s=r.map:r.alphaMap&&(s=r.alphaMap),void 0!==s&&(!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uvTransform.value.copy(s.matrix))):r.isSpriteMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.rotation.value=r.rotation,r.map&&(e.map.value=r.map),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest),r.map?o=r.map:r.alphaMap&&(o=r.alphaMap),void 0!==o&&(!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uvTransform.value.copy(o.matrix))):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(e,t,r,i){let n={},a={},s=[],o=r.isWebGL2?e.getParameter(35375):0;function getUniformSize(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function onUniformsGroupsDispose(t){let r=t.target;r.removeEventListener("dispose",onUniformsGroupsDispose);let i=s.indexOf(r.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(n[r.id]),delete n[r.id],delete a[r.id]}return{bind:function(e,t){let r=t.program;i.uniformBlockBinding(e,r)},update:function(r,l){let u=n[r.id];void 0===u&&(function(e){let t=e.uniforms,r=0,i=0;for(let e=0,n=t.length;e<n;e++){let n=t[e],a={boundary:0,storage:0},s=Array.isArray(n.value)?n.value:[n.value];for(let e=0,t=s.length;e<t;e++){let t=s[e],r=getUniformSize(t);a.boundary+=r.boundary,a.storage+=r.storage}if(n.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),n.__offset=r,e>0){i=r%16;let e=16-i;0!==i&&e-a.boundary<0&&(r+=16-i,n.__offset=r)}r+=a.storage}(i=r%16)>0&&(r+=16-i),e.__size=r,e.__cache={}}(r),u=function(t){let r=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=r;let i=e.createBuffer(),n=t.__size,a=t.usage;return e.bindBuffer(35345,i),e.bufferData(35345,n,a),e.bindBuffer(35345,null),e.bindBufferBase(35345,r,i),i}(r),n[r.id]=u,r.addEventListener("dispose",onUniformsGroupsDispose));let h=l.program;i.updateUBOMapping(r,h);let c=t.render.frame;a[r.id]!==c&&(function(t){let r=n[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(35345,r);for(let t=0,r=i.length;t<r;t++){let r=i[t];if(!0===function(e,t,r){let i=e.value;if(void 0===r[t]){if("number"==typeof i)r[t]=i;else{let e=Array.isArray(i)?i:[i],n=[];for(let t=0;t<e.length;t++)n.push(e[t].clone());r[t]=n}return!0}if("number"==typeof i){if(r[t]!==i)return r[t]=i,!0}else{let e=Array.isArray(r[t])?r[t]:[r[t]],n=Array.isArray(i)?i:[i];for(let t=0;t<e.length;t++){let r=e[t];if(!1===r.equals(n[t]))return r.copy(n[t]),!0}}return!1}(r,t,a)){let t=r.__offset,i=Array.isArray(r.value)?r.value:[r.value],n=0;for(let a=0;a<i.length;a++){let s=i[a],o=getUniformSize(s);"number"==typeof s?(r.__data[0]=s,e.bufferSubData(35345,t+n,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=s.elements[0],r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=s.elements[0],r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=s.elements[0]):(s.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,t,r.__data)}}e.bindBuffer(35345,null)}(r),a[r.id]=c)},dispose:function(){for(let t in n)e.deleteBuffer(n[t]);s=[],n={},a={}}}}function WebGLRenderer(){let e,t,r,i,n,a,s,o,u,h,c,d,p,f,m,g,y,x,S,w,T,A,C,E,L,P=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};
5this.isWebGLRenderer=!0;let R=void 0!==P.canvas?P.canvas:function(){let e=createElementNS("canvas");return e.style.display="block",e}(),I=void 0!==P.context?P.context:null,D=void 0===P.depth||P.depth,B=void 0===P.stencil||P.stencil,V=void 0!==P.antialias&&P.antialias,O=void 0===P.premultipliedAlpha||P.premultipliedAlpha,N=void 0!==P.preserveDrawingBuffer&&P.preserveDrawingBuffer,z=void 0!==P.powerPreference?P.powerPreference:"default",G=void 0!==P.failIfMajorPerformanceCaveat&&P.failIfMajorPerformanceCaveat;e=null!==I?I.getContextAttributes().alpha:void 0!==P.alpha&&P.alpha;let U=null,F=null,k=[],W=[];this.domElement=R,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=tP,this.useLegacyLights=!0,this.toneMapping=ei,this.toneMappingExposure=1;let H=this,j=!1,q=0,X=0,Y=null,Z=-1,J=null,K=new Vector4,Q=new Vector4,$=null,ee=R.width,et=R.height,er=1,en=null,ea=null,es=new Vector4(0,0,ee,et),eo=new Vector4(0,0,ee,et),el=!1,eu=new Frustum,eh=!1,ec=!1,ed=null,ep=new Matrix4,ef=new Vector3,em={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function getTargetPixelRatio(){return null===Y?er:1}let eg=I;function getContext(e,t){for(let r=0;r<e.length;r++){let i=e[r],n=R.getContext(i,t);if(null!==n)return n}return null}try{if("setAttribute"in R&&R.setAttribute("data-engine","three.js r".concat(l)),R.addEventListener("webglcontextlost",onContextLost,!1),R.addEventListener("webglcontextrestored",onContextRestore,!1),R.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===eg){let e=["webgl2","webgl","experimental-webgl"];if(!0===H.isWebGL1Renderer&&e.shift(),eg=getContext(e,{alpha:!0,depth:D,stencil:B,antialias:V,premultipliedAlpha:O,preserveDrawingBuffer:N,powerPreference:z,failIfMajorPerformanceCaveat:G}),null===eg){if(getContext(e))throw Error("Error creating WebGL context with your selected attributes.");throw Error("Error creating WebGL context.")}}void 0===eg.getShaderPrecisionFormat&&(eg.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function initGLContext(){t=new WebGLExtensions(eg),r=new WebGLCapabilities(eg,t,P),t.init(r),C=new WebGLUtils(eg,t,r),i=new WebGLState(eg,t,r),n=new WebGLInfo,a=new WebGLProperties,s=new WebGLTextures(eg,t,i,a,r,C,n),o=new WebGLCubeMaps(H),u=new WebGLCubeUVMaps(H),h=new WebGLAttributes(eg,r),E=new WebGLBindingStates(eg,t,h,r),c=new WebGLGeometries(eg,h,n,E),d=new WebGLObjects(eg,c,h,n),w=new WebGLMorphtargets(eg,r,s),y=new WebGLClipping(a),p=new WebGLPrograms(H,o,u,t,r,E,y),f=new WebGLMaterials(H,a),m=new WebGLRenderLists,g=new WebGLRenderStates(t,r),S=new WebGLBackground(H,o,u,i,d,e,O),x=new WebGLShadowMap(H,d,r),L=new WebGLUniformsGroups(eg,n,r,i),T=new WebGLBufferRenderer(eg,t,n,r),A=new WebGLIndexedBufferRenderer(eg,t,n,r),n.programs=p.programs,H.capabilities=r,H.extensions=t,H.properties=a,H.renderLists=m,H.shadowMap=x,H.state=i,H.info=n}initGLContext();let ev=new WebXRManager(H,eg);function onContextLost(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),j=!0}function onContextRestore(){console.log("THREE.WebGLRenderer: Context Restored."),j=!1;let e=n.autoReset,t=x.enabled,r=x.autoUpdate,i=x.needsUpdate,a=x.type;initGLContext(),n.autoReset=e,x.enabled=t,x.autoUpdate=r,x.needsUpdate=i,x.type=a}function onContextCreationError(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function onMaterialDispose(e){let t=e.target;t.removeEventListener("dispose",onMaterialDispose),function(e){let t=a.get(e).programs;void 0!==t&&(t.forEach(function(e){p.releaseProgram(e)}),e.isShaderMaterial&&p.releaseShaderCache(e))}(t),a.remove(t)}this.xr=ev,this.getContext=function(){return eg},this.getContextAttributes=function(){return eg.getContextAttributes()},this.forceContextLoss=function(){let e=t.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=t.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return er},this.setPixelRatio=function(e){void 0!==e&&(er=e,this.setSize(ee,et,!1))}
5,this.getSize=function(e){return e.set(ee,et)},this.setSize=function(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(ev.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ee=e,et=t,R.width=Math.floor(e*er),R.height=Math.floor(t*er),!0===r&&(R.style.width=e+"px",R.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ee*er,et*er).floor()},this.setDrawingBufferSize=function(e,t,r){ee=e,et=t,er=r,R.width=Math.floor(e*r),R.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(K)},this.getViewport=function(e){return e.copy(es)},this.setViewport=function(e,t,r,n){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,r,n),i.viewport(K.copy(es).multiplyScalar(er).floor())},this.getScissor=function(e){return e.copy(eo)},this.setScissor=function(e,t,r,n){e.isVector4?eo.set(e.x,e.y,e.z,e.w):eo.set(e,t,r,n),i.scissor(Q.copy(eo).multiplyScalar(er).floor())},this.getScissorTest=function(){return el},this.setScissorTest=function(e){i.setScissorTest(el=e)},this.setOpaqueSort=function(e){en=e},this.setTransparentSort=function(e){ea=e},this.getClearColor=function(e){return e.copy(S.getClearColor())},this.setClearColor=function(){S.setClearColor.apply(S,arguments)},this.getClearAlpha=function(){return S.getClearAlpha()},this.setClearAlpha=function(){S.setClearAlpha.apply(S,arguments)},this.clear=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=0;e&&(i|=16384),t&&(i|=256),r&&(i|=1024),eg.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){R.removeEventListener("webglcontextlost",onContextLost,!1),R.removeEventListener("webglcontextrestored",onContextRestore,!1),R.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),m.dispose(),g.dispose(),a.dispose(),o.dispose(),u.dispose(),d.dispose(),E.dispose(),L.dispose(),p.dispose(),ev.dispose(),ev.removeEventListener("sessionstart",onXRSessionStart),ev.removeEventListener("sessionend",onXRSessionEnd),ed&&(ed.dispose(),ed=null),ex.stop()},this.renderBufferDirect=function(e,t,n,l,d,p){let m;null===t&&(t=em);let g=d.isMesh&&0>d.matrixWorld.determinant(),x=function(e,t,n,l,h){var c;!0!==t.isScene&&(t=em),s.resetTextureUnits();let d=t.fog,p=l.isMeshStandardMaterial?t.environment:null,m=null===Y?H.outputEncoding:!0===Y.isXRRenderTarget?Y.texture.encoding:tP,g=(l.isMeshStandardMaterial?u:o).get(l.envMap||p),x=!0===l.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,_=!!l.normalMap&&!!n.attributes.tangent,b=!!n.morphAttributes.position,M=!!n.morphAttributes.normal,S=!!n.morphAttributes.color,T=l.toneMapped?H.toneMapping:ei,A=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,C=void 0!==A?A.length:0,E=a.get(l),P=F.state.lights;if(!0===eh&&(!0===ec||e!==J)){let t=e===J&&l.id===Z;y.setState(l,e,t)}let R=!1;l.version===E.__version?E.needsLights&&E.lightsStateVersion!==P.state.version?R=!0:E.outputEncoding!==m?R=!0:h.isInstancedMesh&&!1===E.instancing?R=!0:h.isInstancedMesh||!0!==E.instancing?h.isSkinnedMesh&&
5!1===E.skinning?R=!0:h.isSkinnedMesh||!0!==E.skinning?E.envMap!==g?R=!0:!0===l.fog&&E.fog!==d?R=!0:void 0!==E.numClippingPlanes&&(E.numClippingPlanes!==y.numPlanes||E.numIntersection!==y.numIntersection)?R=!0:E.vertexAlphas!==x?R=!0:E.vertexTangents!==_?R=!0:E.morphTargets!==b?R=!0:E.morphNormals!==M?R=!0:E.morphColors!==S?R=!0:E.toneMapping!==T?R=!0:!0===r.isWebGL2&&E.morphTargetsCount!==C&&(R=!0):R=!0:R=!0:(R=!0,E.__version=l.version);let I=E.currentProgram;!0===R&&(I=getProgram(l,t,h));let D=!1,B=!1,V=!1,O=I.getUniforms(),N=E.uniforms;if(i.useProgram(I.program)&&(D=!0,B=!0,V=!0),l.id!==Z&&(Z=l.id,B=!0),D||J!==e){if(O.setValue(eg,"projectionMatrix",e.projectionMatrix),r.logarithmicDepthBuffer&&O.setValue(eg,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),J!==e&&(J=e,B=!0,V=!0),l.isShaderMaterial||l.isMeshPhongMaterial||l.isMeshToonMaterial||l.isMeshStandardMaterial||l.envMap){let t=O.map.cameraPosition;void 0!==t&&t.setValue(eg,ef.setFromMatrixPosition(e.matrixWorld))}(l.isMeshPhongMaterial||l.isMeshToonMaterial||l.isMeshLambertMaterial||l.isMeshBasicMaterial||l.isMeshStandardMaterial||l.isShaderMaterial)&&O.setValue(eg,"isOrthographic",!0===e.isOrthographicCamera),(l.isMeshPhongMaterial||l.isMeshToonMaterial||l.isMeshLambertMaterial||l.isMeshBasicMaterial||l.isMeshStandardMaterial||l.isShaderMaterial||l.isShadowMaterial||h.isSkinnedMesh)&&O.setValue(eg,"viewMatrix",e.matrixWorldInverse)}if(h.isSkinnedMesh){O.setOptional(eg,h,"bindMatrix"),O.setOptional(eg,h,"bindMatrixInverse");let e=h.skeleton;e&&(r.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eg,"boneTexture",e.boneTexture,s),O.setValue(eg,"boneTextureSize",e.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."))}let z=n.morphAttributes;if((void 0!==z.position||void 0!==z.normal||void 0!==z.color&&!0===r.isWebGL2)&&w.update(h,n,I),(B||E.receiveShadow!==h.receiveShadow)&&(E.receiveShadow=h.receiveShadow,O.setValue(eg,"receiveShadow",h.receiveShadow)),l.isMeshGouraudMaterial&&null!==l.envMap&&(N.envMap.value=g,N.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1),B&&(O.setValue(eg,"toneMappingExposure",H.toneMappingExposure),E.needsLights&&(c=V,N.ambientLightColor.needsUpdate=c,N.lightProbe.needsUpdate=c,N.directionalLights.needsUpdate=c,N.directionalLightShadows.needsUpdate=c,N.pointLights.needsUpdate=c,N.pointLightShadows.needsUpdate=c,N.spotLights.needsUpdate=c,N.spotLightShadows.needsUpdate=c,N.rectAreaLights.needsUpdate=c,N.hemisphereLights.needsUpdate=c),d&&!0===l.fog&&f.refreshFogUniforms(N,d),f.refreshMaterialUniforms(N,l,er,et,ed),WebGLUniforms.upload(eg,E.uniformsList,N,s)),l.isShaderMaterial&&!0===l.uniformsNeedUpdate&&(WebGLUniforms.upload(eg,E.uniformsList,N,s),l.uniformsNeedUpdate=!1),l.isSpriteMaterial&&O.setValue(eg,"center",h.center),O.setValue(eg,"modelViewMatrix",h.modelViewMatrix),O.setValue(eg,"normalMatrix",h.normalMatrix),O.setValue(eg,"modelMatrix",h.matrixWorld),l.isShaderMaterial||l.isRawShaderMaterial){let e=l.uniformsGroups;for(let t=0,i=e.length;t<i;t++)if(r.isWebGL2){let r=e[t];L.update(r,I),L.bind(r,I)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return I}(e,t,n,l,d);i.setMaterial(l,g);let _=n.index,b=1;!0===l.wireframe&&(_=c.getWireframeAttribute(n),b=2);let M=n.drawRange,S=n.attributes.position,C=M.start*b,P=(M.start+M.count)*b;null!==p&&(C=Math.max(C,p.start*b),P=Math.min(P,(p.start+p.count)*b)),null!==_?(C=Math.max(C,0),P=Math.min(P,_.count)):null!=S&&(C=Math.max(C,0),P=Math.min(P,S.count));let R=P-C;if(R<0||R===1/0)return;E.setup(d,l,x,n,_);let I=T;if(null!==_&&(m=h.get(_),(I=A).setIndex(m)),d.isMesh)!0===l.wireframe?(i.setLineWidth(l.wireframeLinewidth*getTargetPixelRatio()),I.setMode(1)):I.setMode(4);else if(d.isLine){let e=l.linewidth;void 0===e&&(e=1),i.setLineWidth(e*getTargetPixelRatio()),d.isLineSegments?I.setMode(1):d.isLineLoop?I.setMode(2):I.setMode(3)}else d.isPoints?I.setMode(0):d.isSprite&&I.setMode(4);if(d.isInstancedMesh)I.renderInstances(C,R,d.count);else if(n.isInstancedBufferGeometry){let e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);I.renderInstances(C,R,t)}else I.render(C,R)},this.compile=function(e,t){function prepare(e,t,r){!0===e.transparent&&e.side===M&&!1===e.forceSinglePass?(e.side=b,e.needsUpdate=!0,getProgram(e,t,r),e.side=_,e.needsUpdate=!0,getProgram(e,t,r),e.side=M):getProgram(e,t,r)}
5(F=g.get(e)).init(),W.push(F),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(F.pushLight(e),e.castShadow&&F.pushShadow(e))}),F.setupLights(H.useLegacyLights),e.traverse(function(t){let r=t.material;if(r){if(Array.isArray(r))for(let i=0;i<r.length;i++){let n=r[i];prepare(n,e,t)}else prepare(r,e,t)}}),W.pop(),F=null};let ey=null;function onXRSessionStart(){ex.stop()}function onXRSessionEnd(){ex.start()}let ex=new WebGLAnimation;function renderScene(e,n,a,o){let l=e.opaque,u=e.transmissive,h=e.transparent;F.setupLightsView(a),!0===eh&&y.setGlobalState(H.clippingPlanes,a),u.length>0&&function(e,i,n){let a=r.isWebGL2;null===ed&&(ed=new WebGLRenderTarget(1024,1024,{generateMipmaps:!0,type:t.has("EXT_color_buffer_half_float")?eV:eE,minFilter:eA,samples:a&&!0===V?4:0}));let o=H.getRenderTarget();H.setRenderTarget(ed),H.clear();let l=H.toneMapping;H.toneMapping=ei,renderObjects(e,i,n),H.toneMapping=l,s.updateMultisampleRenderTarget(ed),s.updateRenderTargetMipmap(ed),H.setRenderTarget(o)}(l,n,a),o&&i.viewport(K.copy(o)),l.length>0&&renderObjects(l,n,a),u.length>0&&renderObjects(u,n,a),h.length>0&&renderObjects(h,n,a),i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),i.setPolygonOffset(!1)}function renderObjects(e,t,r){let i=!0===t.isScene?t.overrideMaterial:null;for(let n=0,a=e.length;n<a;n++){let a=e[n],s=a.object,o=a.geometry,l=null===i?a.material:i,u=a.group;s.layers.test(r.layers)&&(s.onBeforeRender(H,t,r,o,l,u),s.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),l.onBeforeRender(H,t,r,o,s,u),!0===l.transparent&&l.side===M&&!1===l.forceSinglePass?(l.side=b,l.needsUpdate=!0,H.renderBufferDirect(r,t,o,l,s,u),l.side=_,l.needsUpdate=!0,H.renderBufferDirect(r,t,o,l,s,u),l.side=M):H.renderBufferDirect(r,t,o,l,s,u),s.onAfterRender(H,t,r,o,l,u))}}function getProgram(e,t,r){!0!==t.isScene&&(t=em);let i=a.get(e),n=F.state.lights,s=F.state.shadowsArray,l=n.state.version,h=p.getParameters(e,n.state,s,t,r),c=p.getProgramCacheKey(h),d=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?u:o).get(e.envMap||i.environment),void 0===d&&(e.addEventListener("dispose",onMaterialDispose),d=new Map,i.programs=d);let f=d.get(c);if(void 0!==f){if(i.currentProgram===f&&i.lightsStateVersion===l)return updateCommonMaterialProperties(e,h),f}else h.uniforms=p.getUniforms(e),e.onBuild(r,h,H),e.onBeforeCompile(h,H),f=p.acquireProgram(h,c),d.set(c,f),i.uniforms=h.uniforms;let m=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=y.uniform),updateCommonMaterialProperties(e,h),i.needsLights=e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights,i.lightsStateVersion=l,i.needsLights&&(m.ambientLightColor.value=n.state.ambient,m.lightProbe.value=n.state.probe,m.directionalLights.value=n.state.directional,m.directionalLightShadows.value=n.state.directionalShadow,m.spotLights.value=n.state.spot,m.spotLightShadows.value=n.state.spotShadow,m.rectAreaLights.value=n.state.rectArea,m.ltc_1.value=n.state.rectAreaLTC1,m.ltc_2.value=n.state.rectAreaLTC2,m.pointLights.value=n.state.point,m.pointLightShadows.value=n.state.pointShadow,m.hemisphereLights.value=n.state.hemi,m.directionalShadowMap.value=n.state.directionalShadowMap,m.directionalShadowMatrix.value=n.state.directionalShadowMatrix,m.spotShadowMap.value=n.state.spotShadowMap,m.spotLightMatrix.value=n.state.spotLightMatrix,m.spotLightMap.value=n.state.spotLightMap,m.pointShadowMap.value=n.state.pointShadowMap,m.pointShadowMatrix.value=n.state.pointShadowMatrix);let g=f.getUniforms(),x=WebGLUniforms.seqWithValue(g.seq,m);return i.currentProgram=f,i.uniformsList=x,f}function updateCommonMaterialProperties(e,t){let r=a.get(e);r.outputEncoding=t.outputEncoding,r.instancing=t.instancing,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}ex.setAnimationLoop(function(e){ey&&ey(e)}),"undefined"!=typeof self&&ex.setContext(self),this.setAnimationLoop=function(e){ey=e,ev.setAnimationLoop(e),null===e?ex.stop():ex.start()},ev.addEventListener("sessionstart",onXRSessionStart),ev.addEventListener("sessionend",onXRSessionEnd),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===j)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ev.enabled&&!0===ev.isPresenting&&(!0===ev.cameraAutoUpdate&&ev.updateCamera(t),t=ev.getCamera()),!0===e.isScene&&e.onBeforeRender(H,e,t,Y),(F=g.get(e,W.length)).init(),W.pu
5sh(F),ep.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eu.setFromProjectionMatrix(ep),ec=this.localClippingEnabled,eh=y.init(this.clippingPlanes,ec),(U=m.get(e,k.length)).init(),k.push(U),function projectObject(e,t,r,i){if(!1===e.visible)return;let a=e.layers.test(t.layers);if(a){if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)F.pushLight(e),e.castShadow&&F.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eu.intersectsSprite(e)){i&&ef.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ep);let t=d.update(e),n=e.material;n.visible&&U.push(e,t,n,r,ef.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==n.render.frame&&(e.skeleton.update(),e.skeleton.frame=n.render.frame),!e.frustumCulled||eu.intersectsObject(e))){i&&ef.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ep);let t=d.update(e),n=e.material;if(Array.isArray(n)){let i=t.groups;for(let a=0,s=i.length;a<s;a++){let s=i[a],o=n[s.materialIndex];o&&o.visible&&U.push(e,t,o,r,ef.z,s)}}else n.visible&&U.push(e,t,n,r,ef.z,null)}}let s=e.children;for(let e=0,n=s.length;e<n;e++)projectObject(s[e],t,r,i)}(e,t,0,H.sortObjects),U.finish(),!0===H.sortObjects&&U.sort(en,ea),!0===eh&&y.beginShadows();let r=F.state.shadowsArray;if(x.render(r,e,t),!0===eh&&y.endShadows(),!0===this.info.autoReset&&this.info.reset(),S.render(U,e),F.setupLights(H.useLegacyLights),t.isArrayCamera){let r=t.cameras;for(let t=0,i=r.length;t<i;t++){let i=r[t];
5renderScene(U,e,i,i.viewport)}}else renderScene(U,e,t);null!==Y&&(s.updateMultisampleRenderTarget(Y),s.updateRenderTargetMipmap(Y)),!0===e.isScene&&e.onAfterRender(H,e,t),E.resetDefaultState(),Z=-1,J=null,W.pop(),F=W.length>0?W[W.length-1]:null,k.pop(),U=k.length>0?k[k.length-1]:null},this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return Y},this.setRenderTargetTextures=function(e,r,i){a.get(e.texture).__webglTexture=r,a.get(e.depthTexture).__webglTexture=i;let n=a.get(e);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0!==t.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let r=a.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Y=e,q=t,X=n;let o=!0,l=null,u=!1,h=!1;if(e){let n=a.get(e);void 0!==n.__useDefaultFramebuffer?(i.bindFramebuffer(36160,null),o=!1):void 0===n.__webglFramebuffer?s.setupRenderTarget(e):n.__hasExternalTextures&&s.rebindTextures(e,a.get(e.texture).__webglTexture,a.get(e.depthTexture).__webglTexture);let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(h=!0);let d=a.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(l=d[t],u=!0):l=r.isWebGL2&&e.samples>0&&!1===s.useMultisampledRTT(e)?a.get(e).__webglMultisampledFramebuffer:d,K.copy(e.viewport),Q.copy(e.scissor),$=e.scissorTest}else K.copy(es).multiplyScalar(er).floor(),Q.copy(eo).multiplyScalar(er).floor(),$=el;let c=i.bindFramebuffer(36160,l);if(c&&r.drawBuffers&&o&&i.drawBuffers(e,l),i.viewport(K),i.scissor(Q),i.setScissorTest($),u){let r=a.get(e.texture);eg.framebufferTexture2D(36160,36064,34069+t,r.__webglTexture,n)}else if(h){let r=a.get(e.texture),i=t||0;eg.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}Z=-1},this.readRenderTargetPixels=function(e,n,s,o,l,u,h){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let c=a.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(c=c[h]),c){i.bindFramebuffer(36160,c);try{let i=e.texture,a=i.format,h=i.type;if(a!==eU&&C.convert(a)!==eg.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let c=h===eV&&(t.has("EXT_color_buffer_half_float")||r.isWebGL2&&t.has("EXT_color_buffer_float"));if(h!==eE&&C.convert(h)!==eg.getParameter(35738)&&!(h===eB&&(r.isWebGL2||t.has("OES_texture_float")||t.has("WEBGL_color_buffer_float")))&&!c){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}n>=0&&n<=e.width-o&&s>=0&&s<=e.height-l&&eg.readPixels(n,s,o,l,C.convert(a),C.convert(h),u)}finally{let e=null!==Y?a.get(Y).__webglFramebuffer:null;i.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=Math.pow(2,-r),a=Math.floor(t.image.width*n),o=Math.floor(t.image.height*n);s.setTexture2D(t,0),eg.copyTexSubImage2D(3553,r,0,0,e.x,e.y,a,o),i.unbindTexture()},this.copyTextureToTexture=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t.image.width,o=t.image.height,l=C.convert(r.format),u=C.convert(r.type);s.setTexture2D(r,0),eg.pixelStorei(37440,r.flipY),eg.pixelStorei(37441,r.premultiplyAlpha),eg.pixelStorei(3317,r.unpackAlignment),t.isDataTexture?eg.texSubImage2D(3553,n,e.x,e.y,a,o,l,u,t.image.data):t.isCompressedTexture?eg.compressedTexSubImage2D(3553,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,l,t.mipmaps[0].data):eg.texSubImage2D(3553,n,e.x,e.y,l,u,t.image),0===n&&r.generateMipmaps&&eg.generateMipmap(3553),i.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,n){let a,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(H.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let l=e.max.x-e.min.x+1,u=e.max.y-e.min.y+1,h=e.max.z-e.min.z+1,c=C.convert(n.format),d=C.convert(n.type);if(n.isData3DTexture)s.setTexture3D(n,0),a=32879;else if(n.isDataArrayTexture)s.setTexture2DArray(n,0),a=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}eg.pixelStorei(37440,n.flipY),eg.pixelStorei(37441,n.premultiplyAlpha),eg.pixelStorei(3317,n.unpackAlignment);let p=eg.getParameter(3314),f=eg.getParameter(32878),m=eg.getParameter(3316),g=eg.getParameter(3315),y=eg.getParameter(32877),x=r.isCompressedTexture?r.mipmaps[0]:r.image;eg.pixelStorei(3314,x.width),eg.pixelStorei(32878,x.height),eg.pixelStorei(3316,e.min.x),eg.pixelStorei(3315,e.min.y),eg.pixelStorei(32877,e.min.z),r.isDataTexture||r.isData3DTexture?eg.texSubImage3D(a,o,t.x,t.y,t.z,l,u,h,c,d,x.data):r.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),eg.compressedTexSubImage3D(a,o,t.x,t.y,t.z,l,u,h,c,x.data)):eg.texSubImage3D(a,o,t.x,t.y,t.z,l,u,h,c,d,x),eg.pixelStorei(3314,p),eg.pixelStorei(32878,f),eg.pixelStorei(3316,m),eg.pixelStorei(3315,g),eg.pixelStorei(32877,y),0===o&&n.generateMipmaps&&eg.generateMipmap(a),i.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?s.setTextureCube(e,0):e.isData3DTexture?s.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?s.setTexture2DArray(e,0):s.setTexture2D(e,0),i.unbindTexture()},this.resetState=function(){q=0,X=0,Y=null,i.reset(),E.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Object.defineProperties(WebGLRenderer.prototype,{physicallyCorrectLights:{get:function(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}});let WebGL1Renderer=class WebGL1Renderer extends WebGLRenderer{};WebGL1Renderer.prototype.isWebGL1Renderer=!0;let FogExp2=class FogExp2{clone(){return new FogExp2(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color(e),this.density=t}};let Fog=class Fog{clone(){return new Fog(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Color(e),this.near=t,this.far=r}};let Scene=class Scene extends Object3D{copy(e,t){return super.copy(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()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};let InterleavedBuffer=class InterleavedBuffer{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this}set(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=generateUUID()),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}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=t3,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=generateUUID()}};let nh=new Vector3;let InterleavedBufferAttribute=class InterleavedBufferAttribute{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)nh.fromBufferAttribute(this,t),nh.applyMatrix4(e),this.setXYZ(t,nh.x,nh.y,nh.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)nh.fromBufferAttribute(this,t),nh.applyNormalMatrix(e),this.setXYZ(t,nh.x,nh.y,nh.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)nh.fromBufferAttribute(this,t),nh.transformDirection(e),this.setXYZ(t,nh.x,nh.y,nh.z);return this}setX(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=normalize(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=denormalize(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=denormalize(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=denormalize(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=denormalize(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),i=normalize(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=normalize(t,this.array),r=normalize(r,this.array),i=normalize(i,this.array),n=normalize(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new InterleavedBufferAttribute(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return new BufferAttribute(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}constructor(e,t,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=i}};let SpriteMaterial=class SpriteMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}};
5let nc=new Vector3,nd=new Vector3,np=new Vector3,nf=new Vector2,nm=new Vector2,ng=new Matrix4,nv=new Vector3,ny=new Vector3,nx=new Vector3,n_=new Vector2,nb=new Vector2,nM=new Vector2;let Sprite=class Sprite extends Object3D{raycast(e,t){let r,i;null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),nd.setFromMatrixScale(this.matrixWorld),ng.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),np.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&nd.multiplyScalar(-np.z);let n=this.material.rotation;0!==n&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;transformVertex(nv.set(-.5,-.5,0),np,a,nd,r,i),transformVertex(ny.set(.5,-.5,0),np,a,nd,r,i),transformVertex(nx.set(.5,.5,0),np,a,nd,r,i),n_.set(0,0),nb.set(1,0),nM.set(1,1);let s=e.ray.intersectTriangle(nv,ny,nx,!1,nc);if(null===s&&(transformVertex(ny.set(-.5,.5,0),np,a,nd,r,i),nb.set(0,1),null===(s=e.ray.intersectTriangle(nv,nx,ny,!1,nc))))return;let o=e.ray.origin.distanceTo(nc);o<e.near||o>e.far||t.push({distance:o,point:nc.clone(),uv:Triangle.getUV(nc,nv,ny,nx,n_,nb,nM,new Vector2),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",void 0===n){n=new BufferGeometry;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new InterleavedBuffer(e,5);n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new InterleavedBufferAttribute(t,3,0,!1)),n.setAttribute("uv",new InterleavedBufferAttribute(t,2,3,!1))}this.geometry=n,this.material=void 0!==e?e:new SpriteMaterial,this.center=new Vector2(.5,.5)}};function transformVertex(e,t,r,i,n,a){nf.subVectors(e,r).addScalar(.5).multiply(i),void 0!==n?(nm.x=a*nf.x-n*nf.y,nm.y=n*nf.x+a*nf.y):nm.copy(nf),e.copy(t),e.x+=nm.x,e.y+=nm.y,e.applyMatrix4(ng)}let nS=new Vector3,nw=new Vector3;let LOD=class LOD extends Object3D{copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,r=t.length;e<r;e++){let r=t[e];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r=Math.abs(r);let n=this.levels;for(t=0;t<n.length&&!(r<n[t].distance);t++);return n.splice(t,0,{distance:r,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let r,i;for(r=1,i=t.length;r<i;r++){let i=t[r].distance;if(t[r].object.visible&&(i-=i*t[r].hysteresis),e<i)break}return t[r-1].object}return null}raycast(e,t){let r=this.levels;if(r.length>0){nS.setFromMatrixPosition(this.matrixWorld);let r=e.ray.origin.distanceTo(nS);this.getObjectForDistance(r).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let r,i;nS.setFromMatrixPosition(e.matrixWorld),nw.setFromMatrixPosition(this.matrixWorld);let n=nS.distanceTo(nw)/e.zoom;for(r=1,t[0].object.visible=!0,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];let r=this.levels;for(let e=0,i=r.length;e<i;e++){let i=r[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}};let nT=new Vector3,nA=new Vector4,nC=new Vector4,nE=new Vector3,nL=new Matrix4;let SkinnedMesh=class SkinnedMesh extends Mesh{copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(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()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Vector4,t=this.geometry.attributes.skinWeight;for(let r=0,i=t.count;r<i;r++){e.fromBufferAttribute(t,r);let i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(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)}boneTransform(e,t){let r=this.skeleton,i=this.geometry;nA.fromBufferAttribute(i.attributes.skinIndex,e),nC.fromBufferAttribute(i.attributes.skinWeight,e),nT.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let i=nC.getComponent(e);
5if(0!==i){let n=nA.getComponent(e);nL.multiplyMatrices(r.bones[n].matrixWorld,r.boneInverses[n]),t.addScaledVector(nE.copy(nT).applyMatrix4(nL),i)}}return t.applyMatrix4(this.bindMatrixInverse)}constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Matrix4,this.bindMatrixInverse=new Matrix4}};let Bone=class Bone extends Object3D{constructor(){super(),this.isBone=!0,this.type="Bone"}};let DataTexture=class DataTexture extends Texture{constructor(e=null,t=1,r=1,i,n,a,s,o,l=ey,u=ey,h,c){super(null,a,s,o,l,u,i,n,h,c),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};let nP=new Matrix4,nR=new Matrix4;let Skeleton=class Skeleton{init(){let 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(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new Matrix4)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new Matrix4;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let i=0,n=e.length;i<n;i++){let n=e[i]?e[i].matrixWorld:nR;nP.multiplyMatrices(n,t[i]),nP.toArray(r,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Skeleton(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=Math.max(e=ceilPowerOfTwo(e),4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let r=new DataTexture(t,e,e,eU,eB);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){let r=this.bones[t];if(r.name===e)return r}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){let i=e.bones[r],n=t[i];void 0===n&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),n=new Bone),this.bones.push(n),this.boneInverses.push(new Matrix4().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,r=this.boneInverses;for(let i=0,n=t.length;i<n;i++){let n=t[i];e.bones.push(n.uuid);let a=r[i];e.boneInverses.push(a.toArray())}return e}constructor(e=[],t=[]){this.uuid=generateUUID(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}};let InstancedBufferAttribute=class InstancedBufferAttribute extends BufferAttribute{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}constructor(e,t,r,i=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}};let nI=new Matrix4,nD=new Matrix4,nB=[],nV=new Matrix4,nO=new Mesh;let InstancedMesh=class InstancedMesh extends Mesh{copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){let r=this.matrixWorld,i=this.count;if(nO.geometry=this.geometry,nO.material=this.material,void 0!==nO.material)for(let n=0;n<i;n++){this.getMatrixAt(n,nI),nD.multiplyMatrices(r,nI),nO.matrixWorld=nD,nO.raycast(e,nB);for(let e=0,r=nB.length;e<r;e++){let r=nB[e];r.instanceId=n,r.object=this,t.push(r)}nB.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new InstancedBufferAttribute(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new InstancedBufferAttribute(new Float32Array(16*r),
516),this.instanceColor=null,this.count=r,this.frustumCulled=!1;for(let e=0;e<r;e++)this.setMatrixAt(e,nV)}};let LineBasicMaterial=class LineBasicMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}};let nN=new Vector3,nz=new Vector3,nG=new Matrix4,nU=new Ray,nF=new Sphere;let Line=class Line extends Object3D{copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,r=[0];for(let e=1,i=t.count;e<i;e++)nN.fromBufferAttribute(t,e-1),nz.fromBufferAttribute(t,e),r[e]=r[e-1],r[e]+=nN.distanceTo(nz);e.setAttribute("lineDistance",new Float32BufferAttribute(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let r=this.geometry,i=this.matrixWorld,n=e.params.Line.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),nF.copy(r.boundingSphere),nF.applyMatrix4(i),nF.radius+=n,!1===e.ray.intersectsSphere(nF))return;nG.copy(i).invert(),nU.copy(e.ray).applyMatrix4(nG);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new Vector3,u=new Vector3,h=new Vector3,c=new Vector3,d=this.isLineSegments?2:1,p=r.index,f=r.attributes,m=f.position;if(null!==p){let r=Math.max(0,a.start),i=Math.min(p.count,a.start+a.count);for(let n=r,a=i-1;n<a;n+=d){let r=p.getX(n),i=p.getX(n+1);l.fromBufferAttribute(m,r),u.fromBufferAttribute(m,i);let a=nU.distanceSqToSegment(l,u,c,h);if(a>o)continue;c.applyMatrix4(this.matrixWorld);let s=e.ray.origin.distanceTo(c);s<e.near||s>e.far||t.push({distance:s,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{let r=Math.max(0,a.start),i=Math.min(m.count,a.start+a.count);for(let n=r,a=i-1;n<a;n+=d){l.fromBufferAttribute(m,n),u.fromBufferAttribute(m,n+1);let r=nU.distanceSqToSegment(l,u,c,h);if(r>o)continue;c.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(c);i<e.near||i>e.far||t.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let e=t[r[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,r=e.length;t<r;t++){let r=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}}}constructor(e=new BufferGeometry,t=new LineBasicMaterial){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}};let nk=new Vector3,nW=new Vector3;let LineSegments=class LineSegments extends Line{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,r=[];for(let e=0,i=t.count;e<i;e+=2)nk.fromBufferAttribute(t,e),nW.fromBufferAttribute(t,e+1),r[e]=0===e?0:r[e-1],r[e+1]=r[e]+nk.distanceTo(nW);e.setAttribute("lineDistance",new Float32BufferAttribute(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}};let LineLoop=class LineLoop extends Line{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}};let PointsMaterial=class PointsMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Color(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}};let nH=new Matrix4,nj=new Ray,nq=new Sphere,nX=new Vector3;let Points=class Points extends Object3D{copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let r=this.geometry,i=this.matrixWorld,n=e.params.Points.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),nq.copy(r.boun
5dingSphere),nq.applyMatrix4(i),nq.radius+=n,!1===e.ray.intersectsSphere(nq))return;nH.copy(i).invert(),nj.copy(e.ray).applyMatrix4(nH);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=r.index,u=r.attributes,h=u.position;if(null!==l){let r=Math.max(0,a.start),n=Math.min(l.count,a.start+a.count);for(let a=r;a<n;a++){let r=l.getX(a);nX.fromBufferAttribute(h,r),testPoint(nX,r,o,i,e,t,this)}}else{let r=Math.max(0,a.start),n=Math.min(h.count,a.start+a.count);for(let a=r;a<n;a++)nX.fromBufferAttribute(h,a),testPoint(nX,a,o,i,e,t,this)}}updateMorphTargets(){let e=this.geometry,t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let e=t[r[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,r=e.length;t<r;t++){let r=e[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}}}constructor(e=new BufferGeometry,t=new PointsMaterial){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}};function testPoint(e,t,r,i,n,a,s){let o=nj.distanceSqToPoint(e);if(o<r){let r=new Vector3;nj.closestPointToPoint(e,r),r.applyMatrix4(i);let l=n.ray.origin.distanceTo(r);if(l<n.near||l>n.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:r,index:t,face:null,object:s})}}let VideoTexture=class VideoTexture extends Texture{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==a?a:eS,this.magFilter=void 0!==n?n:eS,this.generateMipmaps=!1;let u=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function updateVideo(){u.needsUpdate=!0,e.requestVideoFrameCallback(updateVideo)})}};let FramebufferTexture=class FramebufferTexture extends Texture{constructor(e,t,r){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=r,this.magFilter=ey,this.minFilter=ey,this.generateMipmaps=!1,this.needsUpdate=!0}};let CompressedTexture=class CompressedTexture extends Texture{constructor(e,t,r,i,n,a,s,o,l,u,h,c){super(null,a,s,o,l,u,i,n,h,c),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};let CompressedArrayTexture=class CompressedArrayTexture extends CompressedTexture{constructor(e,t,r,i,n,a){super(e,t,r,n,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=eg}};let CanvasTexture=class CanvasTexture extends Texture{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}};let Curve=class Curve{getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let 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;let t=[],r,i=this.getPoint(0),n=0;t.push(0);for(let a=1;a<=e;a++)t.push(n+=(r=this.getPoint(a/e)).distanceTo(i)),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r;let i=this.getLengths(),n=0,a=i.length;r=t||e*i[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=i[n=Math.floor(s+(o-s)/2)]-r)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(i[n=o]===r)return n/(a-1);let u=i[n],h=i[n+1],c=(n+(r-u)/(h-u))/(a-1);return c}getTangent(e,t){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);let n=this.getPoint(r),a=this.getPoint(i),s=t||(n.isVector2?new Vector2:new Vector3);return s.copy(a).sub(n).normalize(),s}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new Vector3,i=[],n=[],a=[],s=new Vector3,o=new Matrix4;for(let t=0;t<=e;t++){let r=t/e;i[t]=this.getTangentAt(r,new Vector3)}n[0]=new Vector3,a[0]=new Vector3;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),h=Math.abs(i[0].y),c=Math.abs(i[0].z);u<=l&&(l=u,r.set(1,0,0)),h<=l&&(l=h,r.set(0,1,0)),c<=l&&r.set(0,0,1),s.crossVectors(i[0],r).normalize(),n[0].crossVectors(i[0],s),a[0].crossVectors(i[0],n[0]);for(let t=1;t<=e;
5t++){if(n[t]=n[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(clamp(i[t-1].dot(i[t]),-1,1));n[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],n[t])}if(!0===t){let t=Math.acos(clamp(n[0].dot(n[e]),-1,1));t/=e,i[0].dot(s.crossVectors(n[0],n[e]))>0&&(t=-t);for(let r=1;r<=e;r++)n[r].applyMatrix4(o.makeRotationAxis(i[r],t*r)),a[r].crossVectors(i[r],n[r])}return{tangents:i,normals:n,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200}};let EllipseCurve=class EllipseCurve extends Curve{getPoint(e,t){let r=t||new Vector2,i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,a=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=a?0:i),!0!==this.aClockwise||a||(n===i?n=-i:n-=i);let s=this.aStartAngle+e*n,o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),r=o-this.aX,i=l-this.aY;o=r*e-i*t+this.aX,l=r*t+i*e+this.aY}return r.set(o,l)}copy(e){return super.copy(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}toJSON(){let e=super.toJSON();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}fromJSON(e){return super.fromJSON(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}constructor(e=0,t=0,r=1,i=1,n=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}};let ArcCurve=class ArcCurve extends EllipseCurve{constructor(e,t,r,i,n,a){super(e,t,r,r,i,n,a),this.isArcCurve=!0,this.type="ArcCurve"}};function CubicPoly(){let e=0,t=0,r=0,i=0;function init(n,a,s,o){e=n,t=s,r=-3*n+3*a-2*s-o,i=2*n-2*a+s+o}return{initCatmullRom:function(e,t,r,i,n){init(t,r,n*(r-e),n*(i-t))},initNonuniformCatmullRom:function(e,t,r,i,n,a,s){let o=(t-e)/n-(r-e)/(n+a)+(r-t)/a,l=(r-t)/a-(i-t)/(a+s)+(i-r)/s;init(t,r,o*=a,l*=a)},calc:function(n){let a=n*n;return e+t*n+r*a+i*(a*n)}}}let nY=new Vector3,nZ=new CubicPoly,nJ=new CubicPoly,nK=new CubicPoly;let CatmullRomCurve3=class CatmullRomCurve3 extends Curve{getPoint(e){let t,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3,n=this.points,a=n.length,s=(a-(this.closed?0:1))*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?t=n[(o-1)%a]:(nY.subVectors(n[0],n[1]).add(n[0]),t=nY);let u=n[o%a],h=n[(o+1)%a];if(this.closed||o+2<a?r=n[(o+2)%a]:(nY.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=nY),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,i=Math.pow(t.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(h),e),a=Math.pow(h.distanceToSquared(r),e);n<1e-4&&(n=1),i<1e-4&&(i=n),a<1e-4&&(a=n),nZ.initNonuniformCatmullRom(t.x,u.x,h.x,r.x,i,n,a),nJ.initNonuniformCatmullRom(t.y,u.y,h.y,r.y,i,n,a),nK.initNonuniformCatmullRom(t.z,u.z,h.z,r.z,i,n,a)}else"catmullrom"===this.curveType&&(nZ.initCatmullRom(t.x,u.x,h.x,r.x,this.tension),nJ.initCatmullRom(t.y,u.y,h.y,r.y,this.tension),nK.initCatmullRom(t.z,u.z,h.z,r.z,this.tension));return i.set(nZ.calc(l),nJ.calc(l),nK.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new Vector3().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}constructor(e=[],t=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}};function CatmullRom(e,t,r,i,n){let a=(i-t)*.5,s=(n-r)*.5,o=e*e;return(2*r-2*i+a+s)*(e*o)+(-3*r+3*i-2*a-s)*o+a*e+r}
5function QuadraticBezier(e,t,r,i){return function(e,t){let r=1-e;return r*r*t}(e,t)+2*(1-e)*e*r+e*e*i}function CubicBezier(e,t,r,i,n){return function(e,t){let r=1-e;return r*r*r*t}(e,t)+function(e,t){let r=1-e;return 3*r*r*e*t}(e,r)+3*(1-e)*e*e*i+e*e*e*n}let CubicBezierCurve=class CubicBezierCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(CubicBezier(e,r.x,i.x,n.x,a.x),CubicBezier(e,r.y,i.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new Vector2,t=new Vector2,r=new Vector2,i=new Vector2){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}};let CubicBezierCurve3=class CubicBezierCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3,r=this.v0,i=this.v1,n=this.v2,a=this.v3;
5return t.set(CubicBezier(e,r.x,i.x,n.x,a.x),CubicBezier(e,r.y,i.y,n.y,a.y),CubicBezier(e,r.z,i.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new Vector3,t=new Vector3,r=new Vector3,i=new Vector3){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}};let LineCurve=class LineCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector2,t=new Vector2){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}};let LineCurve3=class LineCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector3,t=new Vector3){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}};let QuadraticBezierCurve=class QuadraticBezierCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,r=this.v0,i=this.v1,n=this.v2;return t.set(QuadraticBezier(e,r.x,i.x,n.x),QuadraticBezier(e,r.y,i.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector2,t=new Vector2,r=new Vector2){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}};let QuadraticBezierCurve3=class QuadraticBezierCurve3 extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector3,r=this.v0,i=this.v1,n=this.v2;return t.set(QuadraticBezier(e,r.x,i.x,n.x),QuadraticBezier(e,r.y,i.y,n.y),QuadraticBezier(e,r.z,i.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new Vector3,t=new Vector3,r=new Vector3){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}};let SplineCurve=class SplineCurve extends Curve{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Vector2,r=this.points,i=(r.length-1)*e,n=Math.floor(i),a=i-n,s=r[0===n?n:n-1],o=r[n],l=r[n>r.length-2?r.length-1:n+1],u=r[n>r.length-3?r.length-1:n+2];return t.set(CatmullRom(a,s.x,o.x,l.x,u.x),CatmullRom(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new Vector2().fromArray(r))}return this}constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}};var nQ=Object.freeze({__proto__:null,ArcCurve:ArcCurve,CatmullRomCurve3:CatmullRomCurve3,CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:CubicBezierCurve3,EllipseCurve:EllipseCurve,LineCurve:LineCurve,LineCurve3:LineCurve3,QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,SplineCurve:SplineCurve});let CurvePath=class CurvePath extends Curve{add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new LineCurve(t,e))}getPoint(e,t){let r=e*this.getLength(),i=this.getCurveLengths(),n=0;for(;n<i.length;){if(i[n]>=r){let e=i[n]-r,a=this.curves[n],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let r=0,i=this.curves.length;r<i;r++)e.push(t+=this.curves[r].getLength());return this.cacheLengths=e,e}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,r=[];for(let i=0,n=this.curves;i<n.length;i++){let a=n[i],s=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isS
5plineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){let i=o[t];e&&e.equals(i)||(r.push(i),e=i)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(new nQ[r.type]().fromJSON(r))}return this}constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}};let Path=class Path extends CurvePath{setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new LineCurve(this.currentPoint.clone(),new Vector2(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){let n=new QuadraticBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(r,i));return this.curves.push(n),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,n,a){let s=new CubicBezierCurve(this.currentPoint.clone(),new Vector2(e,t),new Vector2(r,i),new Vector2(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new SplineCurve(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,n,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,r,i,n,a),this}absarc(e,t,r,i,n,a){return this.absellipse(e,t,r,r,i,n,a),this}ellipse(e,t,r,i,n,a,s,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,r,i,n,a,s,o),this}absellipse(e,t,r,i,n,a,s,o){let l=new EllipseCurve(e,t,r,i,n,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}constructor(e){super(),this.type="Path",this.currentPoint=new Vector2,e&&this.setFromPoints(e)}};let LatheGeometry=class LatheGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new LatheGeometry(e.points,e.segments,e.phiStart,e.phiLength)}constructor(e=[new Vector2(0,-.5),new Vector2(.5,0),new Vector2(0,.5)],t=12,r=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=clamp(i,0,2*Math.PI);let n=[],a=[],s=[],o=[],l=[],u=1/t,h=new Vector3,c=new Vector2,d=new Vector3,p=new Vector3,f=new Vector3,m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let n=0;n<=t;n++){let d=r+n*u*i,p=Math.sin(d),f=Math.cos(d);for(let r=0;r<=e.length-1;r++){h.x=e[r].x*p,h.y=e[r].y,h.z=e[r].x*f,a.push(h.x,h.y,h.z),c.x=n/t,c.y=r/(e.length-1),s.push(c.x,c.y);let i=o[3*r+0]*p,u=o[3*r+1],d=o[3*r+0]*f;l.push(i,u,d)}}for(let r=0;r<t;r++)for(let t=0;t<e.length-1;t++){let i=t+r*e.length,a=i+e.length,s=i+e.length+1,o=i+1;n.push(i,a,o),n.push(s,o,a)}this.setIndex(n),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("uv",new Float32BufferAttribute(s,2)),this.setAttribute("normal",new Float32BufferAttribute(l,3))}};let CapsuleGeometry=class CapsuleGeometry extends LatheGeometry{static fromJSON(e){return new CapsuleGeometry(e.radius,e.length,e.capSegments,e.radialSegments)}constructor(e=1,t=1,r=4,i=8){let n=new Path;n.absarc(0,-t/2,e,1.5*Math.PI,0),n.absarc(0,t/2,e,0,.5*Math.PI),super(n.getPoints(r),i),this.type="CapsuleGeometry",this.parameters={radiu
5s:e,height:t,capSegments:r,radialSegments:i}}};let CircleGeometry=class CircleGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CircleGeometry(e.radius,e.segments,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,r=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},t=Math.max(3,t);let n=[],a=[],s=[],o=[],l=new Vector3,u=new Vector2;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let n=0,h=3;n<=t;n++,h+=3){let c=r+n/t*i;l.x=e*Math.cos(c),l.y=e*Math.sin(c),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)n.push(e,e+1,0);this.setIndex(n),this.setAttribute("position",new Float32BufferAttribute(a,3)),this.setAttribute("normal",new Float32BufferAttribute(s,3)),this.setAttribute("uv",new Float32BufferAttribute(o,2))}};let CylinderGeometry=class CylinderGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,r=1,i=32,n=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:s,thetaLength:o};let l=this;i=Math.floor(i),n=Math.floor(n);let u=[],h=[],c=[],d=[],p=0,f=[],m=r/2,g=0;function generateCap(r){let n=p,a=new Vector2,f=new Vector3,y=0,x=!0===r?e:t,_=!0===r?1:-1;for(let e=1;e<=i;e++)h.push(0,m*_,0),c.push(0,_,0),d.push(.5,.5),p++;let b=p;for(let e=0;e<=i;e++){let t=e/i,r=t*o+s,n=Math.cos(r),l=Math.sin(r);f.x=x*l,f.y=m*_,f.z=x*n,h.push(f.x,f.y,f.z),c.push(0,_,0),a.x=.5*n+.5,a.y=.5*l*_+.5,d.push(a.x,a.y),p++}for(let e=0;e<i;e++){let t=n+e,i=b+e;!0===r?u.push(i,i+1,t):u.push(i+1,i,t),y+=3}l.addGroup(g,y,!0===r?1:2),g+=y}(function(){let a=new Vector3,y=new Vector3,x=0,_=(t-e)/r;for(let l=0;l<=n;l++){let u=[],g=l/n,x=g*(t-e)+e;for(let e=0;e<=i;e++){let t=e/i,n=t*o+s,l=Math.sin(n),f=Math.cos(n);y.x=x*l,y.y=-g*r+m,y.z=x*f,h.push(y.x,y.y,y.z),a.set(l,_,f).normalize(),c.push(a.x,a.y,a.z),d.push(t,1-g),u.push(p++)}f.push(u)}for(let e=0;e<i;e++)for(let t=0;t<n;t++){let r=f[t][e],i=f[t+1][e],n=f[t+1][e+1],a=f[t][e+1];u.push(r,i,a),u.push(i,n,a),x+=6}l.addGroup(g,x,0),g+=x})(),!1===a&&(e>0&&generateCap(!0),t>0&&generateCap(!1)),this.setIndex(u),this.setAttribute("position",new Float32BufferAttribute(h,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}};let ConeGeometry=class ConeGeometry extends CylinderGeometry{static fromJSON(e){return new ConeGeometry(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}constructor(e=1,t=1,r=32,i=1,n=!1,a=0,s=2*Math.PI){super(0,e,t,r,i,n,a,s),this.type="C
5oneGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:s}}};let PolyhedronGeometry=class PolyhedronGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new PolyhedronGeometry(e.vertices,e.indices,e.radius,e.details)}constructor(e=[],t=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i};let n=[],a=[];function pushVertex(e){n.push(e.x,e.y,e.z)}function getVertexByIndex(t,r){let i=3*t;r.x=e[i+0],r.y=e[i+1],r.z=e[i+2]}function correctUV(e,t,r,i){i<0&&1===e.x&&(a[t]=e.x-1),0===r.x&&0===r.z&&(a[t]=i/2/Math.PI+.5)}function azimuth(e){return Math.atan2(e.z,-e.x)}(function(e){let r=new Vector3,i=new Vector3,n=new Vector3;for(let a=0;a<t.length;a+=3)getVertexByIndex(t[a+0],r),getVertexByIndex(t[a+1],i),getVertexByIndex(t[a+2],n),function(e,t,r,i){let n=i+1,a=[];for(let i=0;i<=n;i++){a[i]=[];let s=e.clone().lerp(r,i/n),o=t.clone().lerp(r,i/n),l=n-i;for(let e=0;e<=l;e++)0===e&&i===n?a[i][e]=s:a[i][e]=s.clone().lerp(o,e/l)}for(let e=0;e<n;e++)for(let t=0;t<2*(n-e)-1;t++){let r=Math.floor(t/2);t%2==0?(pushVertex(a[e][r+1]),pushVertex(a[e+1][r]),pushVertex(a[e][r])):(pushVertex(a[e][r+1]),pushVertex(a[e+1][r+1]),pushVertex(a[e+1][r]))}}(r,i,n,e)})(i),function(e){let t=new Vector3;for(let r=0;r<n.length;r+=3)t.x=n[r+0],t.y=n[r+1],t.z=n[r+2],t.normalize().multiplyScalar(e),n[r+0]=t.x,n[r+1]=t.y,n[r+2]=t.z}(r),function(){let e=new Vector3;for(let t=0;t<n.length;t+=3){e.x=n[t+0],e.y=n[t+1],e.z=n[t+2];let r=azimuth(e)/2/Math.PI+.5,i=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;a.push(r,1-i)}(function(){let e=new Vector3,t=new Vector3,r=new Vector3,i=new Vector3,s=new Vector2,o=new Vector2,l=new Vector2;for(let u=0,h=0;u<n.length;u+=9,h+=6){e.set(n[u+0],n[u+1],n[u+2]),t.set(n[u+3],n[u+4],n[u+5]),r.set(n[u+6],n[u+7],n[u+8]),s.set(a[h+0],a[h+1]),o.set(a[h+2],a[h+3]),l.set(a[h+4],a[h+5]),i.copy(e).add(t).add(r).divideScalar(3);let c=azimuth(i);correctUV(s,h+0,e,c),correctUV(o,h+2,t,c),correctUV(l,h+4,r,c)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],r=a[e+2],i=a[e+4],n=Math.max(t,r,i),s=Math.min(t,r,i);n>.9&&s<.1&&(t<.2&&(a[e+0]+=1),r<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Float32BufferAttribute(n,3)),this.setAttribute("normal",new Float32BufferAttribute(n.slice(),3)),this.setAttribute("uv",new Float32BufferAttribute(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}};let DodecahedronGeometry=class DodecahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new DodecahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i];super(n,[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,
519,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}};let n$=new Vector3,n0=new Vector3,n1=new Vector3,n3=new Triangle;let EdgesGeometry=class EdgesGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){let r=Math.cos(rs*t),i=e.getIndex(),n=e.getAttribute("position"),a=i?i.count:n.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},h=[];for(let e=0;e<a;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:a,c}=n3;if(t.fromBufferAttribute(n,s[0]),a.fromBufferAttribute(n,s[1]),c.fromBufferAttribute(n,s[2]),n3.getNormal(n1),l[0]="".concat(Math.round(1e4*t.x),",").concat(Math.round(1e4*t.y),",").concat(Math.round(1e4*t.z)),l[1]="".concat(Math.round(1e4*a.x),",").concat(Math.round(1e4*a.y),",").concat(Math.round(1e4*a.z)),l[2]="".concat(Math.round(1e4*c.x),",").concat(Math.round(1e4*c.y),",").concat(Math.round(1e4*c.z)),l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,i=l[e],n=l[t],a=n3[o[e]],c=n3[o[t]],d="".concat(i,"_").concat(n),p="".concat(n,"_").concat(i);p in u&&u[p]?(n1.dot(u[p].normal)<=r&&(h.push(a.x,a.y,a.z),h.push(c.x,c.y,c.z)),u[p]=null):d in u||(u[d]={index0:s[e],index1:s[t],normal:n1.clone()})}}for(let e in u)if(u[e]){let{index0:t,index1:r}=u[e];n$.fromBufferAttribute(n,t),n0.fromBufferAttribute(n,r),h.push(n$.x,n$.y,n$.z),h.push(n0.x,n0.y,n0.z)}this.setAttribute("position",new Float32BufferAttribute(h,3))}}};let Shape=class Shape extends Path{getPointsHoles(e){let t=[];for(let r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(new Path().fromJSON(r))}return this}constructor(e){super(e),this.uuid=generateUUID(),this.type="Shape",this.holes=[]}};let n2={triangulate:function(e,t){let r,i,n,a,s,o,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,h=t&&t.length,c=h?t[0]*u:e.length,d=linkedList(e,0,c,u,!0),p=[];if(!d||d.next===d.prev)return p;if(h&&(d=function(e,t,r,i){let n,a,s,o,l;let u=[];for(n=0,a=t.length;n<a;n++)s=t[n]*i,o=n<a-1?t[n+1]*i:e.length,(l=linkedList(e,s,o,i,!1))===l.next&&(l.steiner=!0),u.push(function(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}(l));for(u.sort(compareX),n=0;n<u.length;n++)r=function(e,t){let r=function(e,t){let r=t,i=-1/0,n,a=e.x,s=e.y;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){let e=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y
5);if(e<=a&&e>i&&(i=e,n=r.x<r.next.x?r:r.next,e===a))return n}r=r.next}while(r!==t);if(!n)return null;let o=n,l=n.x,u=n.y,h=1/0,c;r=n;do{var d,p;a>=r.x&&r.x>=l&&a!==r.x&&pointInTriangle(s<u?a:i,s,l,u,s<u?i:a,s,r.x,r.y)&&(c=Math.abs(s-r.y)/(a-r.x),locallyInside(r,e)&&(c<h||c===h&&(r.x>n.x||r.x===n.x&&(d=n,p=r,0>area(d.prev,d,p.prev)&&0>area(p.next,d,d.next))))&&(n=r,h=c)),r=r.next}while(r!==o);return n}(e,t);if(!r)return t;let i=splitPolygon(r,e);return filterPoints(i,i.next),filterPoints(r,r.next)}(u[n],r);return r}(e,t,d,u)),e.length>80*u){r=n=e[0],i=a=e[1];for(let t=u;t<c;t+=u)s=e[t],o=e[t+1],s<r&&(r=s),o<i&&(i=o),s>n&&(n=s),o>a&&(a=o);l=0!==(l=Math.max(n-r,a-i))?32767/l:0}return function earcutLinked(e,t,r,i,n,a,s){if(!e)return;!s&&a&&function(e,t,r,i){let n=e;do 0===n.z&&(n.z=zOrder(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,r,i,n,a,s,o,l,u=1;do{for(r=e,e=null,a=null,s=0;r;){for(s++,i=r,o=0,t=0;t<u&&(o++,i=i.nextZ);t++);for(l=u;o>0||l>0&&i;)0!==o&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,o--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,u*=2}while(s>1)}(n)}(e,i,n,a);let o=e,l,u;for(;e.prev!==e.next;){if(l=e.prev,u=e.next,a?function(e,t,r,i){let n=e.prev,a=e.next;if(area(n,e,a)>=0)return!1;let s=n.x,o=e.x,l=a.x,u=n.y,h=e.y,c=a.y,d=s<o?s<l?s:l:o<l?o:l,p=u<h?u<c?u:c:h<c?h:c,f=s>o?s>l?s:l:o>l?o:l,m=u>h?u>c?u:c:h>c?h:c,g=zOrder(d,p,t,r,i),y=zOrder(f,m,t,r,i),x=e.prevZ,_=e.nextZ;for(;x&&x.z>=g&&_&&_.z<=y;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==n&&x!==a&&pointInTriangle(s,u,o,h,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0||(x=x.prevZ,_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==n&&_!==a&&pointInTriangle(s,u,o,h,l,c,_.x,_.y)&&area(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;x&&x.z>=g;){if(x.x>=d&&x.x<=f&&x.y>=p&&x.y<=m&&x!==n&&x!==a&&pointInTriangle(s,u,o,h,l,c,x.x,x.y)&&area(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=y;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==n&&_!==a&&pointInTriangle(s,u,o,h,l,c,_.x,_.y)&&area(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}(e,i,n,a):function(e){let t=e.prev,r=e.next;if(area(t,e,r)>=0)return!1;let i=t.x,n=e.x,a=r.x,s=t.y,o=e.y,l=r.y,u=i<n?i<a?i:a:n<a?n:a,h=s<o?s<l?s:l:o<l?o:l,c=i>n?i>a?i:a:n>a?n:a,d=s>o?s>l?s:l:o>l?o:l,p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=c&&p.y>=h&&p.y<=d&&pointInTriangle(i,s,n,o,a,l,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),removeNode(e),e=u.next,o=u.next;continue}if((e=u)===o){s?1===s?earcutLinked(e=function(e,t,r){let i=e;do{let n=i.prev,a=i.next.next;!equals(n,a)&&intersects(n,i,i.next,a)&&locallyInside(n,a)&&locallyInside(a,n)&&(t.push(n.i/r|0),t.push(i.i/r|0),t.push(a.i/r|0),removeNode(i),removeNode(i.next),i=e=a),i=i.next}while(i!==e);return filterPoints(i)}(filterPoints(e),t,r),t,r,i,n,a,2):2===s&&function(e,t,r,i,n,a){let s=e;do{let e=s.next.next;for(;e!==s.prev;){var o,l;if(s.i!==e.i&&(o=s,l=e,o.next.i!==l.i&&o.prev.i!==l.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&intersects(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(o,l)&&(locallyInside(o,l)&&locallyInside(l,o)&&function(e,t){let r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>
5a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}(o,l)&&(area(o.prev,o,l.prev)||area(o,l.prev,l))||equals(o,l)&&area(o.prev,o,o.next)>0&&area(l.prev,l,l.next)>0))){let o=splitPolygon(s,e);s=filterPoints(s,s.next),o=filterPoints(o,o.next),earcutLinked(s,t,r,i,n,a,0),earcutLinked(o,t,r,i,n,a,0);return}e=e.next}s=s.next}while(s!==e)}(e,t,r,i,n,a):earcutLinked(filterPoints(e),t,r,i,n,a,1);break}}}(d,p,u,r,i,l,0),p}};function linkedList(e,t,r,i,n){let a,s;if(n===function(e,t,r,i){let n=0;for(let a=t,s=r-i;a<r;a+=i)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,r,i)>0)for(a=t;a<r;a+=i)s=insertNode(a,e[a],e[a+1],s);else for(a=r-i;a>=t;a-=i)s=insertNode(a,e[a],e[a+1],s);return s&&equals(s,s.next)&&(removeNode(s),s=s.next),s}function filterPoints(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(equals(r,r.next)||0===area(r.prev,r,r.next))){if(removeNode(r),(r=t=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function compareX(e,t){return e.x-t.x}function zOrder(e,t,r,i,n){return(e=((e=((e=((e=((e=(e-r)*n|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-i)*n|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function pointInTriangle(e,t,r,i,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(r-s)*(t-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function area(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function equals(e,t){return e.x===t.x&&e.y===t.y}function intersects(e,t,r,i){let n=sign(area(e,t,r)),a=sign(area(e,t,i)),s=sign(area(r,i,e)),o=sign(area(r,i,t));return!!(n!==a&&s!==o||0===n&&onSegment(e,r,t)||0===a&&onSegment(e,i,t)||0===s&&onSegment(r,e,i)||0===o&&onSegment(r,t,i))}function onSegment(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function sign(e){return e>0?1:e<0?-1:0}function locallyInside(e,t){return 0>area(e.prev,e,e.next)?area(e,t,e.next)>=0&&area(e,e.prev,t)>=0:0>area(e,t,e.prev)||0>area(e,e.next,t)}function splitPolygon(e,t){let r=new Node(e.i,e.x,e.y),i=new Node(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function insertNode(e,t,r,i){let n=new Node(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function removeNode(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 Node(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}let ShapeUtils=class ShapeUtils{static area(e){let t=e.length,r=0;for(let i=t-1,n=0;n<t;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return .5*r}static isClockWise(e){return 0>ShapeUtils.area(e)}static triangulateShape(e,t){let r=[],i=[],n=[];removeDupEndPts(e),addContour(r,e);let a=e.length;t.forEach(removeDupEndPts);for(let e=0;e<t.length;e++)i.push(a),a+=t[e].length,addContour(r,t[e]);let s=n2.triangulate(r,i);for(let e=0;e<s.length;e+=3)n.push(s.slice(e,e+3));return n}};function removeDupEndPts(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function addContour(e,t){for(let r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}let ExtrudeGeometry=class ExtrudeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return function(e,t,r){if(r.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){let i=e[t];r.shapes.push(i.uuid)}else r.shapes.push(e.uuid);return r.options=Object.assign({},t),void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}(t,r,e)}static fromJSON(e,t){let r=[];for(let i=0,n=e.shapes.length;i<n;i++){let n=t[e.shapes[i]];r.push(n)}let i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=new nQ[i.type]().fromJSON(i)),new ExtrudeGeometry(r,e.options)}constructor(e=new Shape([new Vector2(.5,.5),new Vector2(-.5,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,i=[],n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];!function(e){let a,s,o,l;let u=[],h=void 0!==t.curveSegments?t.curveSegments:12,c=void 0!==t.steps?t.steps:1,d=void 0!==t.depth?t.depth:1,p=void 0===t.bevelEnabled||t.bevelEnabled,f=void 0!==t.bevelThickness?t.bevelThickness:.2,m=void 0!==t.bevelSize?t.bevelSize:f-.1,g=void 0!==t.bevelOffset?t.bevelOffset:0,y=void 0!==t.bevelSegments?t.bevelSegments:3,x=t.extrudePath,_=void 0!==t.UVGenerator?t.UVGenerator:n4,b,M=!1;x&&(b=x.getSpacedPoints(c),M=!0,p=!1,a=x.computeFrenetFrames(c,!1),s=new Vector3,o=new Vector3,l=new Vector3),p||(y=0,f=0,m=0,g=0);let S=e.extractPoints(h),w=S.shape,T=S.holes,A=!ShapeUtils.isClockWise(w);if(A){w=w.reverse();for(let e=0,t=T.length;e<t;e++){let t=T[e];ShapeUtils.isClockWise(t)&&(T[e]=t.reverse())}}let C=ShapeUtils.triangulateShape(w,T),E=w;for(let e=0,t=T.length;e<t;e++){let t=T[e];w=w.concat(t)}function scalePt2(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,r)}let L=w.length,P=C.length;function getBevelVec(e,t,r){let i,n,a;
5let s=e.x-t.x,o=e.y-t.y,l=r.x-e.x,u=r.y-e.y,h=s*s+o*o,c=s*u-o*l;if(Math.abs(c)>Number.EPSILON){let c=Math.sqrt(h),d=Math.sqrt(l*l+u*u),p=t.x-o/c,f=t.y+s/c,m=r.x-u/d,g=r.y+l/d,y=((m-p)*u-(g-f)*l)/(s*u-o*l);i=p+s*y-e.x,n=f+o*y-e.y;let x=i*i+n*n;if(x<=2)return new Vector2(i,n);a=Math.sqrt(x/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,n=s,a=Math.sqrt(h)):(i=s,n=o,a=Math.sqrt(h/2))}return new Vector2(i/a,n/a)}let R=[];for(let e=0,t=E.length,r=t-1,i=e+1;e<t;e++,r++,i++)r===t&&(r=0),i===t&&(i=0),R[e]=getBevelVec(E[e],E[r],E[i]);let I=[],D,B=R.concat();for(let e=0,t=T.length;e<t;e++){let t=T[e];D=[];for(let e=0,r=t.length,i=r-1,n=e+1;e<r;e++,i++,n++)i===r&&(i=0),n===r&&(n=0),D[e]=getBevelVec(t[e],t[i],t[n]);I.push(D),B=B.concat(D)}for(let e=0;e<y;e++){let t=e/y,r=f*Math.cos(t*Math.PI/2),i=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=E.length;e<t;e++){let t=scalePt2(E[e],R[e],i);v(t.x,t.y,-r)}for(let e=0,t=T.length;e<t;e++){let t=T[e];D=I[e];for(let e=0,n=t.length;e<n;e++){let n=scalePt2(t[e],D[e],i);v(n.x,n.y,-r)}}}let V=m+g;for(let e=0;e<L;e++){let t=p?scalePt2(w[e],B[e],V):w[e];M?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(b[0]).add(o).add(s),v(l.x,l.y,l.z)):v(t.x,t.y,0)}for(let e=1;e<=c;e++)for(let t=0;t<L;t++){let r=p?scalePt2(w[t],B[t],V):w[t];M?(o.copy(a.normals[e]).multiplyScalar(r.x),s.copy(a.binormals[e]).multiplyScalar(r.y),l.copy(b[e]).add(o).add(s),v(l.x,l.y,l.z)):v(r.x,r.y,d/c*e)}for(let e=y-1;e>=0;e--){let t=e/y,r=f*Math.cos(t*Math.PI/2),i=m*Math.sin(t*Math.PI/2)+g;for(let e=0,t=E.length;e<t;e++){let t=scalePt2(E[e],R[e],i);v(t.x,t.y,d+r)}for(let e=0,t=T.length;e<t;e++){let t=T[e];D=I[e];for(let e=0,n=t.length;e<n;e++){let n=scalePt2(t[e],D[e],i);M?v(n.x,n.y+b[c-1].y,b[c-1].x+r):v(n.x,n.y,d+r)}}}function sidewalls(e,t){let n=e.length;for(;--n>=0;){let a=n,s=n-1;s<0&&(s=e.length-1);for(let e=0,n=c+2*y;e<n;e++){let n=L*e,o=L*(e+1),l=t+a+n,u=t+s+n,h=t+s+o,c=t+a+o;!function(e,t,n,a){addVertex(e),addVertex(t),addVertex(a),addVertex(t),addVertex(n),addVertex(a);let s=i.length/3,o=_.generateSideWallUV(r,i,s-6,s-3,s-2,s-1);addUV(o[0]),addUV(o[1]),addUV(o[3]),addUV(o[1]),addUV(o[2]),addUV(o[3])}(l,u,h,c)}}}function v(e,t,r){u.push(e),u.push(t),u.push(r)}function f3(e,t,n){addVertex(e),addVertex(t),addVertex(n);let a=i.length/3,s=_.generateTopUV(r,i,a-3,a-2,a-1);addUV(s[0]),addUV(s[1]),addUV(s[2])}function addVertex(e){i.push(u[3*e+0]),i.push(u[3*e+1]),i.push(u[3*e+2])}function addUV(e){n.push(e.x),n.push(e.y)}(function(){let e=i.length/3;if(p){let e=0*L;for(let t=0;t<P;t++){let r=C[t];f3(r[2]+e,r[1]+e,r[0]+e)}e=L*(c+2*y);for(let t=0;t<P;t++){let r=C[t];f3(r[0]+e,r[1]+e,r[2]+e)}}else{for(let e=0;e<P;e++){let t=C[e];
5f3(t[2],t[1],t[0])}for(let e=0;e<P;e++){let t=C[e];f3(t[0]+L*c,t[1]+L*c,t[2]+L*c)}}r.addGroup(e,i.length/3-e,0)})(),function(){let e=i.length/3,t=0;sidewalls(E,0),t+=E.length;for(let e=0,r=T.length;e<r;e++){let r=T[e];sidewalls(r,t),t+=r.length}r.addGroup(e,i.length/3-e,1)}()}(s)}this.setAttribute("position",new Float32BufferAttribute(i,3)),this.setAttribute("uv",new Float32BufferAttribute(n,2)),this.computeVertexNormals()}};let n4={generateTopUV:function(e,t,r,i,n){let a=t[3*r],s=t[3*r+1],o=t[3*i],l=t[3*i+1],u=t[3*n],h=t[3*n+1];return[new Vector2(a,s),new Vector2(o,l),new Vector2(u,h)]},generateSideWallUV:function(e,t,r,i,n,a){let s=t[3*r],o=t[3*r+1],l=t[3*r+2],u=t[3*i],h=t[3*i+1],c=t[3*i+2],d=t[3*n],p=t[3*n+1],f=t[3*n+2],m=t[3*a],g=t[3*a+1],y=t[3*a+2];return Math.abs(o-h)<Math.abs(s-u)?[new Vector2(s,1-l),new Vector2(u,1-c),new Vector2(d,1-f),new Vector2(m,1-y)]:[new Vector2(o,1-l),new Vector2(h,1-c),new Vector2(p,1-f),new Vector2(g,1-y)]}};let IcosahedronGeometry=class IcosahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new IcosahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1];super(i,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}};let OctahedronGeometry=class OctahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new OctahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}};let RingGeometry=class RingGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new RingGeometry(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}constructor(e=.5,t=1,r=32,i=1,n=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:a},r=Math.max(3,r),i=Math.max(1,i);let s=[],o=[],l=[],u=[],h=e,c=(t-e)/i,d=new Vector3,p=new Vector2;for(let e=0;e<=i;e++){for(let e=0;e<=r;e++){let i=n+e/r*a;d.x=h*Math.cos(i),d.y=h*Math.sin(i),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}h+=c}for(let e=0;e<i;e++){let t=e*(r+1);for(let e=0;e<r;e++){let i=e+t,n=i+r+1,a=i+r+2,o=i+1;s.push(i,n,o),s.push(n,a,o)}}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}};let ShapeGeometry=class ShapeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return function(e,t){if(t.shapes=[],Array.isArray(e))for(let r=0,i=e.length;r<i;r++){let i=e[r];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(t,e)}static fromJSON(e,t){let r=[];for(let i=0,n=e.shapes.length;i<n;i++){let n=t[e.shapes[i]];r.push(n)}return new ShapeGeometry(r,e.curveSegments)}constructor(e=new Shape([new Vector2(0,.5),new Vector2(-.5,-.5),new Vector2(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],i=[],n=[],a=[],s=0,o=0;if(!1===Array.isArray(e))addShape(e);else for(let t=0;t<e.length;t++)addShape(e[t]),this.addGroup(s,o,t),s+=o,o=0;function addShape(e){let s=i.length/3,l=e.extractPoints(t),u=l.shape,h=l.holes;!1===ShapeUtils.isClockWise(u)&&(u=u.reverse());for(let e=0,t=h.length;e<t;e++){let t=h[e];!0===ShapeUtils.isClockWise(t)&&(h[e]=t.reverse())}let c=ShapeUtils.triangulateShape(u,h);for(let e=0,t=h.length;e<t;e++){let t=h[e];u=u.concat(t)}for(let e=0,t=u.length;e<t;e++){let t=u[e];i.push(t.x,t.y,0),n.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=c.length;e<t;e++){let t=c[e],i=t[0]+s,n=t[1]+s,a=t[2]+s;r.push(i,n,a),o+=3}}this.setIndex(r),this.setAttribute("position",new Float32BufferAttribute(i,3)),this.setAttribute("normal",new Float32BufferAttribute(n,3)),this.setAttribute("uv",new Float32BufferAttribute(a,2))}};let SphereGeometry=class SphereGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new SphereGeometry(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,r=16,i=0,n=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radiu
5s:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let o=Math.min(a+s,Math.PI),l=0,u=[],h=new Vector3,c=new Vector3,d=[],p=[],f=[],m=[];for(let d=0;d<=r;d++){let g=[],y=d/r,x=0;0==d&&0==a?x=.5/t:d==r&&o==Math.PI&&(x=-.5/t);for(let r=0;r<=t;r++){let o=r/t;h.x=-e*Math.cos(i+o*n)*Math.sin(a+y*s),h.y=e*Math.cos(a+y*s),h.z=e*Math.sin(i+o*n)*Math.sin(a+y*s),p.push(h.x,h.y,h.z),c.copy(h).normalize(),f.push(c.x,c.y,c.z),m.push(o+x,1-y),g.push(l++)}u.push(g)}for(let e=0;e<r;e++)for(let i=0;i<t;i++){let t=u[e][i+1],n=u[e][i],s=u[e+1][i],l=u[e+1][i+1];(0!==e||a>0)&&d.push(t,n,l),(e!==r-1||o<Math.PI)&&d.push(n,s,l)}this.setIndex(d),this.setAttribute("position",new Float32BufferAttribute(p,3)),this.setAttribute("normal",new Float32BufferAttribute(f,3)),this.setAttribute("uv",new Float32BufferAttribute(m,2))}};let TetrahedronGeometry=class TetrahedronGeometry extends PolyhedronGeometry{static fromJSON(e){return new TetrahedronGeometry(e.radius,e.detail)}constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}};let TorusGeometry=class TorusGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusGeometry(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}constructor(e=1,t=.4,r=12,i=48,n=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},r=Math.floor(r),i=Math.floor(i);let a=[],s=[],o=[],l=[],u=new Vector3,h=new Vector3,c=new Vector3;for(let a=0;a<=r;a++)for(let d=0;d<=i;d++){let p=d/i*n,f=a/r*Math.PI*2;h.x=(e+t*Math.cos(f))*Math.cos(p),h.y=(e+t*Math.cos(f))*Math.sin(p),h.z=t*Math.sin(f),s.push(h.x,h.y,h.z),u.x=e*Math.cos(p),u.y=e*Math.sin(p),c.subVectors(h,u).normalize(),o.push(c.x,c.y,c.z),l.push(d/i),l.push(a/r)}for(let e=1;e<=r;e++)for(let t=1;t<=i;t++){let r=(i+1)*e+t-1,n=(i+1)*(e-1)+t-1,s=(i+1)*(e-1)+t,o=(i+1)*e+t;a.push(r,n,o),a.push(n,s,o)}this.setIndex(a),this.setAttribute("position",new Float32BufferAttribute(s,3)),this.setAttribute("normal",new Float32BufferAttribute(o,3)),this.setAttribute("uv",new Float32BufferAttribute(l,2))}};let TorusKnotGeometry=class TorusKnotGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new TorusKnotGeometry(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}constructor(e=1,t=.4,r=64,i=8,n=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:i,p:n,q:a},r=Math.floor(r),i=Math.floor(i);let s=[],o=[],l=[],u=[],h=new Vector3,c=new Vector3,d=new Vector3,p=new Vector3,f=new Vector3,m=new Vector3,g=new Vector3;for(let s=0;s<=r;++s){let y=s/r*n*Math.PI*2;calculatePositionOnCurve(y,n,a,e,d),calculatePositionOnCurve(y+.01,n,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=i;++e){let n=e/i*Math.PI*2,a=-t*Math.cos(n),p=t*Math.sin(n);h.x=d.x+(a*g.x+p*f.x),h.y=d.y+(a*g.y+p*f.y),h.z=d.z+(a*g.z+p*f.z),o.push(h.x,h.y,h.z),c.subVectors(h,d).normalize(),l.push(c.x,c.y,c.z),u.push(s/r),u.push(e/i)}}for(let e=1;e<=r;e++)for(let t=1;t<=i;t++){let r=(i+1)*(e-1)+(t-1),n=(i+1)*e+(t-1),a=(i+1)*e+t,o=(i+1)*(e-1)+t;s.push(r,n,o),s.push(n,a,o)}function calculatePositionOnCurve(e,t,r,i,n){let a=r/t*e,s=Math.cos(a);n.x=i*(2+s)*.5*Math.cos(e),n.y=i*(2+s)*Math.sin(e)*.5,n.z=i*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new Float32BufferAttribute(o,3)),this.setAttribute("normal",new Float32BufferAttribute(l,3)),this.setAttribute("uv",new Float32BufferAttribute(u,2))}};let TubeGeometry=class TubeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new TubeGeometry(new nQ[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}constructor(e=new QuadraticBezierCurve3(new Vector3(-1,-1,0),new Vector3(-1,1,0),new Vector3(1,1,0)),t=64,r=1,i=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:i,closed:n};let a=e.computeFrenetFrames(t,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let s=new Vector3,o=new Vector3,l=new Vector2,u=new Vector3,h=[],c=[],d=[],p=[];function generateSegment(n){u=e.getPointAt(n/t,u);let l=a.normals[n],d=a.binormals[n];for(let e=0;e<=i;e++){let t=e/i*Math.PI*2,n=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+n*d.x,o.y=a*l.y+n*d.y,o.z=a*l.z+n*d.z,o.normalize(),c.push(o.x,o.y,o.z),s.x=u.x+r*o.x,s.y=u.y+r*o.y,s.z=u.z+r*o.z,h.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)generateSegment(e);generateSegment(!1===n?t:0),function(){for(let e=0;e<=t;e++)for(let r=0;r<=i;r++)l.x=e/t,l.y=r/i,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){let r=(i+1)*(e-1)+(t-1),n=(i+1)*e+(t-1),a=(i+1)*e+t,s=(i+1)*(e-1)+t;p.push(r,n,s),p.push(n,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new Float32BufferAttribute(h,3)),this.setAttribute("normal",new Float32BufferAttribute(c,3)),this.setAttribute("uv",new Float32BufferAttribute(d,2))}};let WireframeGeometry=class WireframeGeometry extends BufferGeometry{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e}
5,null!==e){let t=[],r=new Set,i=new Vector3,n=new Vector3;if(null!==e.index){let a=e.attributes.position,s=e.index,o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){let l=o[e],u=l.start,h=l.count;for(let e=u,o=u+h;e<o;e+=3)for(let o=0;o<3;o++){let l=s.getX(e+o),u=s.getX(e+(o+1)%3);i.fromBufferAttribute(a,l),n.fromBufferAttribute(a,u),!0===isUniqueEdge(i,n,r)&&(t.push(i.x,i.y,i.z),t.push(n.x,n.y,n.z))}}}else{let a=e.attributes.position;for(let e=0,s=a.count/3;e<s;e++)for(let s=0;s<3;s++){let o=3*e+s,l=3*e+(s+1)%3;i.fromBufferAttribute(a,o),n.fromBufferAttribute(a,l),!0===isUniqueEdge(i,n,r)&&(t.push(i.x,i.y,i.z),t.push(n.x,n.y,n.z))}}this.setAttribute("position",new Float32BufferAttribute(t,3))}}};function isUniqueEdge(e,t,r){let i="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),n="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==r.has(i)&&!0!==r.has(n)&&(r.add(i),r.add(n),!0)}var n5=Object.freeze({__proto__:null,BoxGeometry:BoxGeometry,CapsuleGeometry:CapsuleGeometry,CircleGeometry:CircleGeometry,ConeGeometry:ConeGeometry,CylinderGeometry:CylinderGeometry,DodecahedronGeometry:DodecahedronGeometry,EdgesGeometry:EdgesGeometry,ExtrudeGeometry:ExtrudeGeometry,IcosahedronGeometry:IcosahedronGeometry,LatheGeometry:LatheGeometry,OctahedronGeometry:OctahedronGeometry,PlaneGeometry:PlaneGeometry,PolyhedronGeometry:PolyhedronGeometry,RingGeometry:RingGeometry,ShapeGeometry:ShapeGeometry,SphereGeometry:SphereGeometry,TetrahedronGeometry:TetrahedronGeometry,TorusGeometry:TorusGeometry,TorusKnotGeometry:TorusKnotGeometry,TubeGeometry:TubeGeometry,WireframeGeometry:WireframeGeometry});let ShadowMaterial=class ShadowMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Color(0),this.transparent=!0,this.fog=!0,this.setValues(e)}};let RawShaderMaterial=class RawShaderMaterial extends ShaderMaterial{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};let MeshStandardMaterial=class MeshStandardMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Color(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshPhysicalMaterial=class MeshPhysicalMaterial extends MeshStandardMaterial{get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(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=[...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}constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vector2(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return clamp(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Color(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Color(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Color(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}};let MeshPhongMaterial=class MeshPhongMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Color(16777215),this.specular=new Color(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshToonMaterial=class MeshToonMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Color(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}};let MeshNormalMaterial=class MeshNormalMaterial extends Material{copy(e){return super.copy(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}constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}};let MeshLambertMaterial=class MeshLambertMaterial extends Material{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Color(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Color(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ee,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}};let MeshMatcapMaterial=class MeshMatcapMaterial extends Material{copy(e){return super.copy(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}
5constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Color(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tB,this.normalScale=new Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}};let LineDashedMaterial=class LineDashedMaterial extends LineBasicMaterial{copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}};function arraySlice(e,t,r){return isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)}function convertArray(e,t,r){return e&&(r||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function isTypedArray(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function getKeyframeOrder(e){let t=e.length,r=Array(t);for(let e=0;e!==t;++e)r[e]=e;return r.sort(function(t,r){return e[t]-e[r]}),r}function sortedArray(e,t,r){let i=e.length,n=new e.constructor(i);for(let a=0,s=0;s!==i;++a){let i=r[a]*t;for(let r=0;r!==t;++r)n[s++]=e[i+r]}return n}function flattenJSON(e,t,r,i){let n=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[n++];if(void 0===a)return;let s=a[i];if(void 0!==s){if(Array.isArray(s))do void 0!==(s=a[i])&&(t.push(a.time),r.push.apply(r,s)),a=e[n++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[i])&&(t.push(a.time),s.toArray(r,r.length)),a=e[n++];while(void 0!==a);else do void 0!==(s=a[i])&&(t.push(a.time),r.push(s)),a=e[n++];while(void 0!==a)}}let n6={arraySlice:arraySlice,convertArray:convertArray,isTypedArray:isTypedArray,getKeyframeOrder:getKeyframeOrder,sortedArray:sortedArray,flattenJSON:flattenJSON,subclip:function(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;let s=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],o=t.getValueSize(),l=[],u=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*n;if(!(a<r)&&!(a>=i)){l.push(t.times[e]);for(let r=0;r<o;++r)u.push(t.values[e*o+r])}}0!==l.length&&(t.times=convertArray(l,t.times.constructor),t.values=convertArray(u,t.values.constructor),s.push(t))}a.tracks=s;let o=1/0;for(let e=0;e<a.tracks.length;++e)o>a.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*o);return a.resetDuration(),a},makeClipAdditive:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;i<=0&&(i=30);let n=r.tracks.length,a=t/i;for(let t=0;t<n;++t){let i;let n=r.tracks[t],s=n.ValueTypeName;if("bool"===s||"string"===s)continue;let o=e.tracks.find(function(e){return e.name===n.name&&e.ValueTypeName===s});if(void 0===o)continue;let l=0,u=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let h=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);let d=n.times.length-1;if(a<=n.times[0]){let e=l,t=u-l;i=arraySlice(n.values,e,t)}else if(a>=n.times[d]){let e=d*u+l,t=e+u-l;i=arraySlice(n.values,e,t)}else{let e=n.createInterpolant(),t=l,r=u-l;e.evaluate(a),i=arraySlice(e.resultBuffer,t,r)}if("quaternion"===s){let e=new Quaternion().fromArray(i).normalize().conjugate();e.toArray(i)}let p=o.times.length;for(let e=0;e<p;++e){let t=e*c+h;if("quaternion"===s)Quaternion.multiplyQuaternionsFlat(o.values,t,i,0,o.values,t);else{let e=c-2*h;for(let r=0;r<e;++r)o.values[t+r]-=i[r]}}}return e.blendMode=tA,e}};let Interpolant=class Interpolant{evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{let a;r:{i:if(!(e<i)){for(let a=r+2;;){if(void 0===i){if(e<n)break i;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(n=i,e<(i=t[++r]))break t}a=t.length;break r}if(!(e>=n)){let s=t[1];e<s&&(r=2,n=s);for(let a=r-2;;){if(void 0===n)return this._cachedIndex=0,this.copySampleValue_(0);if(r===a)break;if(i=n,e>=(n=t[--r-1]))break t}a=r,r=0;break r}break e}for(;r<a;){let i=r+a>>>1;e<t[i]?a=i:r=i+1}if(i=t[r],void 0===(n=t[r-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i;for(let e=0;e!==i;++e)t[e]=r[n+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}
5constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}};let CubicInterpolant=class CubicInterpolant extends Interpolant{intervalChanged_(e,t,r){let i=this.parameterPositions,n=e-2,a=e+1,s=i[n],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case tS:n=e,s=2*t-r;break;case tw:n=i.length-2,s=t+i[n]-i[n+1];break;default:n=e,s=r}if(void 0===o)switch(this.getSettings_().endingEnd){case tS:a=e,o=2*r-t;break;case tw:a=1,o=r+i[1]-i[0];break;default:a=e-1,o=t}let l=(r-t)*.5,u=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-r),this._offsetPrev=n*u,this._offsetNext=a*u}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this._offsetPrev,h=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(r-t)/(i-t),f=p*p,m=f*p,g=-c*m+2*c*f-c*p,y=(1+c)*m+(-1.5-2*c)*f+(-.5+c)*p+1,x=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f;for(let e=0;e!==s;++e)n[e]=g*a[u+e]+y*a[l+e]+x*a[o+e]+_*a[h+e];return n}
5constructor(e,t,r,i){super(e,t,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:tM,endingEnd:tM}}};let LinearInterpolant=class LinearInterpolant extends Interpolant{interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=(r-t)/(i-t),h=1-u;for(let e=0;e!==s;++e)n[e]=a[l+e]*h+a[o+e]*u;return n}constructor(e,t,r,i){super(e,t,r,i)}};let DiscreteInterpolant=class DiscreteInterpolant extends Interpolant{interpolate_(e){return this.copySampleValue_(e-1)}constructor(e,t,r,i){super(e,t,r,i)}};let KeyframeTrack=class KeyframeTrack{static toJSON(e){let t;let r=e.constructor;if(r.toJSON!==this.toJSON)t=r.toJSON(e);else{t={name:e.name,times:convertArray(e.times,Array),values:convertArray(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new DiscreteInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new LinearInterpolant(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CubicInterpolant(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tx:t=this.InterpolantFactoryMethodDiscrete;break;case t_:t=this.InterpolantFactoryMethodLinear;break;case tb:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return tx;case this.InterpolantFactoryMethodLinear:return t_;case this.InterpolantFactoryMethodSmooth:return tb}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]*=e}return this}trim(e,t){let r=this.times,i=r.length,n=0,a=i-1;for(;n!==i&&r[n]<e;)++n;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==n||a!==i){n>=a&&(n=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=arraySlice(r,n,a),this.values=arraySlice(this.values,n*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,i=this.values,n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==n;t++){let i=r[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&isTypedArray(i))for(let t=0,r=i.length;t!==r;++t){let r=i[t];if(isNaN(r)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,r),e=!1;break}}return e}optimize(){let e=arraySlice(this.times),t=arraySlice(this.values),r=this.getValueSize(),i=this.getInterpolation()===tb,n=e.length-1,a=1;for(let s=1;s<n;++s){let n=!1,o=e[s],l=e[s+1];if(o!==l&&(1!==s||o!==e[0])){if(i)n=!0;else{let e=s*r,i=e-r,a=e+r;for(let s=0;s!==r;++s){let r=t[e+s];if(r!==t[i+s]||r!==t[a+s]){n=!0;break}}}}if(n){if(s!==a){e[a]=e[s];let i=s*r,n=a*r;for(let e=0;e!==r;++e)t[n+e]=t[i+e]}++a}}if(n>0){e[a]=e[n];for(let e=n*r,i=a*r,s=0;s!==r;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=arraySlice(e,0,a),this.values=arraySlice(t,0,a*r)):(this.times=e,this.values=t),this}clone(){let e=arraySlice(this.times,0),t=arraySlice(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}
5constructor(e,t,r,i){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=convertArray(t,this.TimeBufferType),this.values=convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}};KeyframeTrack.prototype.TimeBufferType=Float32Array,KeyframeTrack.prototype.ValueBufferType=Float32Array,KeyframeTrack.prototype.DefaultInterpolation=t_;let BooleanKeyframeTrack=class BooleanKeyframeTrack extends KeyframeTrack{};BooleanKeyframeTrack.prototype.ValueTypeName="bool",BooleanKeyframeTrack.prototype.ValueBufferType=Array,BooleanKeyframeTrack.prototype.DefaultInterpolation=tx,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let ColorKeyframeTrack=class ColorKeyframeTrack extends KeyframeTrack{};ColorKeyframeTrack.prototype.ValueTypeName="color";let NumberKeyframeTrack=class NumberKeyframeTrack extends KeyframeTrack{};NumberKeyframeTrack.prototype.ValueTypeName="number";let QuaternionLinearInterpolant=class QuaternionLinearInterpolant extends Interpolant{interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(r-t)/(i-t),l=e*s;for(let e=l+s;l!==e;l+=4)Quaternion.slerpFlat(n,0,a,l-s,a,l,o);return n}
5constructor(e,t,r,i){super(e,t,r,i)}};let QuaternionKeyframeTrack=class QuaternionKeyframeTrack extends KeyframeTrack{InterpolantFactoryMethodLinear(e){return new QuaternionLinearInterpolant(this.times,this.values,this.getValueSize(),e)}};QuaternionKeyframeTrack.prototype.ValueTypeName="quaternion",QuaternionKeyframeTrack.prototype.DefaultInterpolation=t_,QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let StringKeyframeTrack=class StringKeyframeTrack extends KeyframeTrack{};StringKeyframeTrack.prototype.ValueTypeName="string",StringKeyframeTrack.prototype.ValueBufferType=Array,StringKeyframeTrack.prototype.DefaultInterpolation=tx,StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear=void 0,StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth=void 0;let VectorKeyframeTrack=class VectorKeyframeTrack extends KeyframeTrack{};VectorKeyframeTrack.prototype.ValueTypeName="vector";let AnimationClip=class AnimationClip{static parse(e){let t=[],r=e.tracks,i=1/(e.fps||1);for(let e=0,n=r.length;e!==n;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return NumberKeyframeTrack;case"vector":case"vector2":case"vector3":case"vector4":return VectorKeyframeTrack;case"color":return ColorKeyframeTrack;case"quaternion":return QuaternionKeyframeTrack;case"bool":case"boolean":return BooleanKeyframeTrack;case"string":return StringKeyframeTrack}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],r=[];flattenJSON(e.keys,t,r,"value"),e.times=t,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(r[e]).scale(i));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n}static toJSON(e){let t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=r.length;e!==i;++e)t.push(KeyframeTrack.toJSON(r[e]));return i}static CreateFromMorphTargetSequence(e,t,r,i){let n=t.length,a=[];for(let e=0;e<n;e++){let s=[],o=[];s.push((e+n-1)%n,e,(e+1)%n),o.push(0,1,0);let l=getKeyframeOrder(s);s=sortedArray(s,1,l),o=sortedArray(o,1,l),i||0!==s[0]||(s.push(n),o.push(o[0])),a.push(new NumberKeyframeTrack(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/r))}return new this(e,-1,a)}static findByName(e,t){let r=e;Array.isArray(e)||(r=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<r.length;e++)if(r[e].name===t)return r[e];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let i={},n=/^([\w-]*?)([\d]+)$/;for(let t=0,r=e.length;t<r;t++){let r=e[t],a=r.name.match(n);if(a&&a.length>1){let e=a[1],t=i[e];t||(i[e]=t=[]),t.push(r)}}let a=[];for(let e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,r));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let addNonemptyTrack=function(e,t,r,i,n){if(0!==r.length){let a=[],s=[];flattenJSON(r,a,s,i),0!==a.length&&n.push(new e(t,a,s))}},r=[],i=e.name||"default",n=e.fps||30,a=e.blendMode,s=e.length||-1,o=e.hierarchy||[];for(let e=0;e<o.length;e++){let i=o[e].keys;if(i&&0!==i.length){if(i[0].morphTargets){let e;let t={};for(e=0;e<i.length;e++)if(i[e].morphTargets)for(let r=0;r<i[e].morphTargets.length;r++)t[i[e].morphTargets[r]]=-1;for(let n in t){let t=[],a=[];for(let r=0;r!==i[e].morphTargets.length;++r){let r=i[e];t.push(r.time),a.push(r.morphTarget===n?1:0)}r.push(new NumberKeyframeTrack(".morphTargetInfluence["+n+"]",t,a))}s=t.length*n}else{let n=".bones["+t[e].name+"]";addNonemptyTrack(VectorKeyframeTrack,n+".position",i,"pos",r),addNonemptyTrack(QuaternionKeyframeTrack,n+".quaternion",i,"rot",r),addNonemptyTrack(VectorKeyframeTrack,n+".scale",i,"scl",r)}}}if(0===r.length)return null;let l=new this(i,s,r,a);return l}resetDuration(){let e=this.tracks,t=0;for(let r=0,i=e.length;r!==i;++r){let e=this.tracks[r];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}constructor(e,t=-1,r,i=tT){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=generateUUID(),this.duration<0&&this.resetDuration()}};let n8={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={}}};let LoadingManager=class LoadingManager{constructor(e,t,r){let i;let n=this,a=!1,s=0,o=0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++,!1===a&&void 0!==n.onStart&&n.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,r=l.length;t<r;t+=2){let r=l[t],i=l[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}};let n7=new LoadingManager;let Loader=class Loader{load(){}loadAsync(e,t){let r=this;return new Promise(function(i,n){r.load(e,i,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}constructor(e){this.manager=void 0!==e?e:n7,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}};let n9={};
5let HttpError=class HttpError extends Error{constructor(e,t){super(e),this.response=t}};let FileLoader=class FileLoader extends Loader{load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=n8.get(e);if(void 0!==n)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(void 0!==n9[e]){n9[e].push({onLoad:t,onProgress:r,onError:i});return}n9[e]=[],n9[e].push({onLoad:t,onProgress:r,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(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;let r=n9[e],i=t.body.getReader(),n=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=n?parseInt(n):0,s=0!==a,o=0,l=new ReadableStream({start(e){(function readData(){i.read().then(t=>{let{done:i,value:n}=t;if(i)e.close();else{o+=n.byteLength;let t=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,i=r.length;e<i;e++){let i=r[e];i.onProgress&&i.onProgress(t)}e.enqueue(n),readData()}})})()}});return new Response(l)}throw new HttpError('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>{let t=new DOMParser;return t.parseFromString(e,s)});case"json":return e.json();default:if(void 0===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),r=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(r);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{n8.add(e,t);let r=n9[e];delete n9[e];for(let e=0,i=r.length;e<i;e++){let i=r[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{let r=n9[e];if(void 0===r)throw this.manager.itemError(e),t;delete n9[e];for(let e=0,i=r.length;e<i;e++){let i=r[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}constructor(e){super(e)}};let AnimationLoader=class AnimationLoader extends Loader{load(e,t,r,i){let n=this,a=new FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}parse(e){let t=[];for(let r=0;r<e.length;r++){let i=AnimationClip.parse(e[r]);t.push(i)}return t}constructor(e){super(e)}};let CompressedTextureLoader=class CompressedTextureLoader extends Loader{load(e,t,r,i){let n=this,a=[],s=new CompressedTexture,o=new FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(n.withCredentials);let l=0;if(Array.isArray(e))for(let u=0,h=e.length;u<h;++u)!function(u){o.load(e[u],function(e){let r=n.parse(e,!0);a[u]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(l+=1)&&(1===r.mipmapCount&&(s.minFilter=eS),s.image=a,s.format=r.format,s.needsUpdate=!0,t&&t(s))},r,i)}(u);else o.load(e,function(e){let r=n.parse(e,!0);if(r.isCubemap){let e=r.mipmaps.length/r.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<r.mipmapCount;e++)a[t].mipmaps.push(r.mipmaps[t*r.mipmapCount+e]),a[t].format=r.format,a[t].width=r.width,a[t].height=r.height}s.image=a}else s.image.width=r.width,s.image.height=r.height,s.mipmaps=r.mipmaps;1===r.mipmapCount&&(s.minFilter=eS),s.format=r.format,s.needsUpdate=!0,t&&t(s)},r,i);return s}constructor(e){super(e)}};let ImageLoader=class ImageLoader extends Loader{load(e,t,r,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=n8.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a;let s=createElementNS("img");function onImageLoad(){removeEventListeners(),n8.add(e,this),t&&t(this),n.manager.itemEnd(e)}function onImageError(t){removeEventListeners(),i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)}function removeEventListeners(){s.removeEventListener("load",onImageLoad,!1),s.removeEventListener("error",onImageError,!1)}return s.addEventListener("load",onImageLoad,!1),s.addEventListener("error",onImageError,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),n.manager.itemStart(e),s.src=e,s}constructor(e){super(e)}};let CubeTextureLoader=class CubeTextureLoader extends Loader{load(e,t,r,i){let n=new CubeTexture,a=new ImageLoader(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;for(let r=0;r<e.length;++r)!function(r){a.load(e[r],function(e){n.images[r]=e,6==++s&&(n.needsUpdate=!0,t&&t(n))},void 0,i)}(r);return n}constructor(e){super(e)}};let DataTextureLoader=class DataTextureLoader extends Loader{load(e,t,r,i){let n=this,a=new DataTexture,s=new FileLoader(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,function(e){let r=n.parse(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:eg,a.wrapT=void 0!==r.wrapT?r.wrapT:eg,a.magFilter=void 0!==r.magFilter?r.magFilter:eS,a.minFilter=void 0!==r.minFilter?r.minFilter:eS,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.encoding&&(a.encoding=r.encoding),void 0!==r.flipY&&(a.flipY=r.flipY),void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=eA),1===r.mipmapCount&&(a.minFilter=eS),void 0!==r.generateMipmaps&&(a.generateMipmaps=r.generateMipmaps),a.needsUpdate=!0,t&&t(a,r))},r,i),a}constructor(e){super(e)}};let TextureLoader=class TextureLoader extends Loader{load(e,t,r,i){let n=new Texture,a=new ImageLoader(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},r,i),n}constructor(e){super(e)}};let Light=class Light extends Object3D{dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(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}constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Color(e),this.intensity=t}};let HemisphereLight=class HemisphereLight extends Light{copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Color(t)}};let ae=new Matrix4,at=new Vector3,ar=new Vector3;let LightShadow=class LightShadow{getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;at.setFromMatrixPosition(e.matrixWorld),t.position.copy(at),ar.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ar),t.updateMatrixWorld(),ae.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ae),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(ae)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radiu
5s=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}constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vector2(512,512),this.map=null,this.mapPass=null,this.matrix=new Matrix4,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Frustum,this._frameExtents=new Vector2(1,1),this._viewportCount=1,this._viewports=[new Vector4(0,0,1,1)]}};let SpotLightShadow=class SpotLightShadow extends LightShadow{updateMatrices(e){let t=this.camera,r=2*ro*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(r!==t.fov||i!==t.aspect||n!==t.far)&&(t.fov=r,t.aspect=i,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}constructor(){super(new PerspectiveCamera(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}};let SpotLight=class SpotLight extends Light{get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(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}constructor(e,t,r=0,i=Math.PI/3,n=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.distance=r,this.angle=i,this.penumbra=n,this.decay=a,this.map=null,this.shadow=new SpotLightShadow}};let ai=new Matrix4,an=new Vector3,aa=new Vector3;let PointLightShadow=class PointLightShadow extends LightShadow{updateMatrices(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.camera,i=this.matrix,n=e.distance||r.far;n!==r.far&&(r.far=n,r.updateProjectionMatrix()),an.setFromMatrixPosition(e.matrixWorld),r.position.copy(an),aa.copy(r.position),aa.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(aa),r.updateMatrixWorld(),i.makeTranslation(-an.x,-an.y,-an.z),ai.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ai)}constructor(){super(new PerspectiveCamera(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Vector2(4,2),this._viewportCount=6,this._viewports=[new Vector4(2,1,1,1),new Vector4(0,1,1,1),new Vector4(3,1,1,1),new Vector4(1,1,1,1),new Vector4(3,0,1,1),new Vector4(1,0,1,1)],this._cubeDirections=[new Vector3(1,0,0),new Vector3(-1,0,0),new Vector3(0,0,1),new Vector3(0,0,-1),new Vector3(0,1,0),new Vector3(0,-1,0)],this._cubeUps=[new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,1,0),new Vector3(0,0,1),new Vector3(0,0,-1)]}};let PointLight=class PointLight extends Light{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new PointLightShadow}};let DirectionalLightShadow=class DirectionalLightShadow extends LightShadow{constructor(){super(new OrthographicCamera(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}};let DirectionalLight=class DirectionalLight extends Light{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Object3D.DEFAULT_UP),this.updateMatrix(),this.target=new Object3D,this.shadow=new DirectionalLightShadow}};let AmbientLight=class AmbientLight extends Light{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}};let RectAreaLight=class RectAreaLight extends Light{get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}constructor(e,t,r=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}};let SphericalHarmonics3=class SphericalHarmonics3{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],1.092548*(r*i)),t.addScaledVector(a[5],1.092548*(i*n)),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],1.092548*(r*n)),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){let r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*i),t.addScaledVector(a[5],.858086*i*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*r*n),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,t+3*i);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){let r=e.x,i=e.y,n=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*n,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*r*n,t[8]=.546274*(r*r-i*i)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Vector3)}};let LightProbe=class LightProbe extends Light{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new SphericalHarmonics3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}};let MaterialLoader=class MaterialLoader extends Loader{load(e,t,r,i){let n=this,a=new FileLoader(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}parse(e){let t=this.textures;function getTexture(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}let r=MaterialLoader.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=new Color().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(r.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=getTexture(i.value);break;case"c":r.uniforms[t].value=new Color().setHex(i.value);break;case"v2":r.uniforms[t].value=new Vector2().fromArray(i.value);break;case"v3":r.uniforms[t].value=new Vector3().fromArray(i.value);break;case"v4":r.uniforms[t].value=new Vector4().fromArray(i.value);break;case"m3":r.uniforms[t].value=new Matrix3().fromArray(i.value);break;
5case"m4":r.uniforms[t].value=new Matrix4().fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=getTexture(e.map)),void 0!==e.matcap&&(r.matcap=getTexture(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=getTexture(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=getTexture(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=getTexture(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=new Vector2().fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=getTexture(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=getTexture(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=getTexture(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=getTexture(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=getTexture(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=getTexture(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=getTexture(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=getTexture(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=getTexture(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=getTexture(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=getTexture(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=getTexture(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=new Vector2().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=getTexture(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=getTexture(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=getTexture(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=getTexture(e.thicknessMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=getTexture(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=getTexture(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){return new({ShadowMaterial,SpriteMaterial,RawShaderMaterial,ShaderMaterial,PointsMaterial,MeshPhysicalMaterial,MeshStandardMaterial,MeshPhongMaterial,MeshToonMaterial,MeshNormalMaterial,MeshLambertMaterial,MeshDepthMaterial,MeshDistanceMaterial,MeshBasicMaterial,MeshMatcapMaterial,LineDashedMaterial,LineBasicMaterial,Material})[e]}constructor(e){super(e),this.textures={}}};let LoaderUtils=class LoaderUtils{static decodeText(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r<i;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}};let InstancedBufferGeometry=class InstancedBufferGeometry extends BufferGeometry{copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}};let BufferGeometryLoader=class BufferGeometryLoader extends Loader{load(e,t,r,i){let n=this,a=new FileLoader(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}parse(e){let t={},r={};function getInterleavedBuffer(e,i){if(void 0!==t[i])return t[i];let n=e.interleavedBuffers,a=n[i],s=function(e,t){if(void 0!==r[t])return r[t];let i=e.arrayBuffers,n=i[t],a=new Uint32Array(n).buffer;return r[t]=a,a}(e,a.buffer),o=getTypedArray(a.type,s),l=new InterleavedBuffer(o,a.stride);return l.uuid=a.uuid,t[i]=l,l}let i=e.isInstancedBufferGeometry?new InstancedBufferGeometry:new BufferGeometry,n=e.data.index;if(void 0!==n){let e=getTypedArray(n.type,n.array);i.setIndex(new BufferAttribute(e,1))}let a=e.data.attributes;for(let t in a){let r;let n=a[t];if(n.isInterleavedBufferAttribute){let t=getInterleavedBuffer(e.data,n.data);r=new InterleavedBufferAttribute(t,n.itemSize,n.offset,n.normalized)}else{let e=getTypedArray(n.type,n.array),t=n.isInstancedBufferAttribute?InstancedBufferAttribute:BufferAttribute;r=new t(e,n.itemSize,n.normalized)}void 0!==n.name&&(r.name=n.name),void 0!==n.usage&&r.setUsage(n.usage),void 0!==n.updateRange&&(r.updateRange.offset=n.updateRange.offset,r.updateRange.count=n.updateRange.count),i.setAttribute(t,r)}let s=e.data.morphAttributes;if(s)for(let t in s){let r=s[t],n=[];for(let t=0,i=r.length;t<i;t++){let i;let a=r[t];if(a.isInterleavedBufferAttribute){let t=getInterleavedBuffer(e.data,a.data);i=new InterleavedBufferAttribute(t,a.itemSize,a.offset,a.normalized)}else{let e=getTypedArray(a.type,a.array);i=new BufferAttribute(e,a.itemSize,a.normalized)}void 0!==a.name&&(i.name=a.name),n.push(i)}i.morphAttributes[t]=n}let o=e.data.morphTargetsRelative;o&&(i.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){let t=l[e];i.addGroup(t.start,t.count,t.materialIndex)}let u=e.data.boundingSphere;if(void 0!==u){let e=new Vector3;void 0!==u.center&&e.fromArray(u.center),i.boundingSphere=new Sphere(e,u.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}constructor(e){super(e)}};let ObjectLoader=class ObjectLoader extends Loader{load(e,t,r,i){let n=this,a=""===this.path?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let s=new FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(r){let a=null;try{a=JSON.parse(r)}catch(t){void 0!==i&&i(t),console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message);return}let s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()){void 0!==i&&i(Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}n.parse(a,t)},r,i)}async loadAsync(e,t){let r=""===this.path?LoaderUtils.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;let i=new FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);let n=await i.loadAsync(e,t),a=JSON.parse(n),s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(a)}parse(e,t){let r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){void 0!==t&&t(l)}),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,n,o,s,r),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),void 0!==t){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){let t=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),n=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,n),s=this.parseMaterials(e.materials,a),o=this.parseObject(e.object,i,s,a,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),o}parseShapes(e){let t={};if(void 0!==e)for(let r=0,i=e.length;r<i;r++){let i=new Shape().fromJSON(e[r]);t[i.uuid]=i}return t}parseSkeletons(e,t){let r={},i={};if(t.traverse(function(e){e.isBone&&(i[e.uuid]=e)}),void 0!==e)for(let t=0,n=e.length;t<n;t++){let n=new Skeleton().fromJSON(e[t],i);r[n.uuid]=n}return r}parseGeometries(e,t){let r={};if(void 0!==e){let i=new BufferGeometryLoader;for(let n=0,a=e.length;n<a;n++){let a;let s=e[n];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(s);break;default:s.type in n5?a=n5[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.userData&&(a.userData=s.userData),r[s.uuid]=a}}return r}parseMaterials(e,t){let r={},i={};if(void 0!==e){let n=new MaterialLoader;n.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0===r[a.uuid]&&(r[a.uuid]=n.parse(a)),i[a.uuid]=r[a.uuid]}}return i}parseAnimations(e){let t={};if(void 0!==e)for(let r=0;r<e.length;r++){let i=e[r],n=AnimationClip.parse(i);t[n.uuid]=n}return t}parseImages(e,t){let r;let i=this,n={};function deserializeImage(e){if("string"==typeof e){let t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e;return i.manager.itemStart(t),r.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemError(t),i.manager.itemEnd(t)})}return e.data?{data:getTypedArray(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){let i=new LoadingManager(t);(r=new ImageLoader(i)).setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){let r=e[t],i=r.url;if(Array.isArray(i)){let e=[];for(let t=0,r=i.length;t<r;t++){let r=i[t],n=deserializeImage(r);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new DataTexture(n.data,n.width,n.height)))}n[r.uuid]=new Source(e)}else{let e=deserializeImage(r.url);n[r.uuid]=new Source(e)}}}return n}async parseImagesAsync(e){let t;let r=this,i={};async function deserializeImage(e){if("string"==typeof e){let i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:r.resourcePath+e;return await t.loadAsync(i)}return e.data?{data:getTypedArray(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(t=new ImageLoader(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){let r=e[t],n=r.url;if(Array.isArray(n)){let e=[];for(let t=0,r=n.length;t<r;t++){let r=n[t],i=await deserializeImage(r);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new DataTexture(i.data,i.width,i.height)))}i[r.uuid]=new Source(e)}else{let e=await deserializeImage(r.url);i[r.uuid]=new Source(e)}}}return i}parseTextures(e,t){function parseConstant(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}let r={};if(void 0!==e)for(let i=0,n=e.length;i<n;i++){let n;let a=e[i];void 0===a.image&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),void 0===t[a.image]&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let s=t[a.image],o=s.data;Array.isArray(o)?(n=new CubeTexture,6===o.length&&(n.needsUpdate=!0)):(n=o&&o.data?new DataTexture:new Texture,o&&(n.needsUpdate=!0)),n.source=s,n.uuid=a.uuid,void 0!==a.name&&(n.name=a.name),void 0!==a.mapping&&(n.mapping=parseConstant(a.mapping,as)),void 0!==a.offset&&n.offset.fromArray(a.offset),void 0!==a.repeat&&n.repeat.fromArray(a.repeat),void 0!==a.center&&n.center.fromArray(a.center),void 0!==a.rotation&&(n.rotation=a.rotation),void 0!==a.wrap&&(n.wrapS=parseConstant(a.wrap[0],ao),n.wrapT=parseConstant(a.wrap[1],ao)),void 0!==a.format&&(n.format=a.format),void 0!==a.internalFormat&&(n.internalFormat=a.internalFormat),void 0!==a.type&&(n.type=a.type),void 0!==a.encoding&&(n.encoding=a.encoding),void 0!==a.minFilter&&(n.minFilter=parseConstant(a.minFilter,al)),void 0!==a.magFilter&&(n.magFilter=parseConstant(a.magFilter,al)),void 0!==a.anisotropy&&(n.anisotropy=a.anisotropy),void 0!==a.flipY&&(n.flipY=a.flipY),void 0!==a.generateMipmaps&&(n.generateMipmaps=a.generateMipmaps),void 0!==a.premultiplyAlpha&&(n.premultiplyAlpha=a.premultiplyAlpha),void 0!==a.unpackAlignment&&(n.unpackAlignment=a.unpackAlignment),void 0!==a.userData&&(n.userData=a.userData),r[a.uuid]=n}return r}parseObject(e,t,r,i,n){let a,s,o;function getGeometry(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function getMaterial(e){if(void 0!==e){if(Array.isArray(e)){let t=[];for(let i=0,n=e.length;i<n;i++){let n=e[i];void 0===r[n]&&console.warn("THREE.ObjectLoader: Undefined material",n),t.push(r[n])}return t}return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]}}function getTexture(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":a=new Scene,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new Color(e.background):a.background=getTexture(e.background)),void 0!==e.environment&&(a.environment=getTexture(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new Fog(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new FogExp2(e.fog.color,e.fog.density))),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new PerspectiveCamera(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;
5case"OrthographicCamera":a=new OrthographicCamera(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 AmbientLight(e.color,e.intensity);break;case"DirectionalLight":a=new DirectionalLight(e.color,e.intensity);break;case"PointLight":a=new PointLight(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new RectAreaLight(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new HemisphereLight(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new LightProbe().fromJSON(e);break;case"SkinnedMesh":s=getGeometry(e.geometry),o=getMaterial(e.material),a=new SkinnedMesh(s,o),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":s=getGeometry(e.geometry),o=getMaterial(e.material),a=new Mesh(s,o);break;case"InstancedMesh":s=getGeometry(e.geometry),o=getMaterial(e.material);let l=e.count,u=e.instanceMatrix,h=e.instanceColor;(a=new InstancedMesh(s,o,l)).instanceMatrix=new InstancedBufferAttribute(new Float32Array(u.array),16),void 0!==h&&(a.instanceColor=new InstancedBufferAttribute(new Float32Array(h.array),h.itemSize));break;case"LOD":a=new LOD;break;case"Line":a=new Line(getGeometry(e.geometry),getMaterial(e.material));break;case"LineLoop":a=new LineLoop(getGeometry(e.geometry),getMaterial(e.material));break;case"LineSegments":a=new LineSegments(getGeometry(e.geometry),getMaterial(e.material));break;case"PointCloud":case"Points":a=new Points(getGeometry(e.geometry),getMaterial(e.material));break;case"Sprite":a=new Sprite(getMaterial(e.material));break;case"Group":a=new Group;break;case"Bone":a=new Bone;break;default:a=new Object3D}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){let s=e.children;for(let e=0;e<s.length;e++)a.add(this.parseObject(s[e],t,r,i,n))}if(void 0!==e.animations){let t=e.animations;for(let e=0;e<t.length;e++){let r=t[e];a.animations.push(n[r])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let r=t[e],i=a.getObjectByProperty("uuid",r.object);void 0!==i&&a.addLevel(i,r.distance,r.hysteresis)}}return a}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){let r=t[e.skeleton];void 0===r?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(r,e.bindMatrix)}})}constructor(e){super(e)}};let as={UVMapping:eu,CubeReflectionMapping:eh,CubeRefractionMapping:ec,EquirectangularReflectionMapping:ed,EquirectangularRefractionMapping:ep,CubeUVReflectionMapping:ef},ao={RepeatWrapping:em,ClampToEdgeWrapping:eg,MirroredRepeatWrapping:ev},al={NearestFilter:ey,NearestMipmapNearestFilter:ex,NearestMipmapLinearFilter:eb,LinearFilter:eS,LinearMipmapNearestFilter:ew,LinearMipmapLinearFilter:eA};let ImageBitmapLoader=class ImageBitmapLoader extends Loader{setOptions(e){return this.options=e,this}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=n8.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a;let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(r){n8.add(e,r),t&&t(r),n.manager.itemEnd(e)}).catch(function(t){i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)}),n.manager.itemStart(e)}constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}};let AudioContext=class AudioContext{static getContext(){return void 0===a&&(a=new(window.AudioContext||window.webkitAudioContext)),a}static setContext(e){a=e}};let AudioLoader=class AudioLoader extends Loader{load(e,t,r,i){let n=this,a=new FileLoader(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(r){try{let e=r.slice(0),i=AudioContext.getContext();i.decodeAudioData(e,function(e){t(e)})}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}},r,i)}constructor(e){super(e)}};let HemisphereLightProbe=class HemisphereLightProbe extends LightProbe{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;let i=new Color().set(e),n=new Color().set(t),a=new Vector3(i.r,i.g,i.b),s=new Vector3(n.r,n.g,n.b),o=Math.sqrt(Math.PI),l=o*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(s).multiplyScalar(o),this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(l)}};let AmbientLightProbe=class AmbientLightProbe extends LightProbe{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;let r=new Color().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};let au=new Matrix4,ah=new Matrix4,ac=new Matrix4;let StereoCamera=class StereoCamera{update(e){let t=this._cache,r=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;if(r){let r,i;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,ac.copy(e.projectionMatrix);let n=t.eyeSep/2,a=n*t.near/t.focus,s=t.near*Math.tan(rs*t.fov*.5)/t.zoom;ah.elements[12]=-n,au.elements[12]=n,r=-s*t.aspect+a,i=s*t.aspect+a,ac.elements[0]=2*t.near/(i-r),ac.elements[8]=(i+r)/(i-r),this.cameraL.projectionMatrix.copy(ac),r=-s*t.aspect-a,i=s*t.aspect-a,ac.elements[0]=2*t.near/(i-r),ac.elements[8]=(i+r)/(i-r),this.cameraR.projectionMatrix.copy(ac)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(ah),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(au)}constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new PerspectiveCamera,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}}};let Clock=class Clock{start(){this.startTime=now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}};function now(){return("undefined"==typeof performance?Date:performance).now()}let ad=new Vector3,ap=new Quaternion,af=new Vector3,am=new Vector3;let AudioListener=class AudioListener extends Object3D{getInput(){return this.gain}removeFilter(){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}getFilter(){return this.filter}setFilter(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}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ad,ap,af),am.set(0,0,-1).applyQuaternion(ap),t.positionX){let e=this.context.currentTime+this.timeDelta;
5t.positionX.linearRampToValueAtTime(ad.x,e),t.positionY.linearRampToValueAtTime(ad.y,e),t.positionZ.linearRampToValueAtTime(ad.z,e),t.forwardX.linearRampToValueAtTime(am.x,e),t.forwardY.linearRampToValueAtTime(am.y,e),t.forwardZ.linearRampToValueAtTime(am.z,e),t.upX.linearRampToValueAtTime(r.x,e),t.upY.linearRampToValueAtTime(r.y,e),t.upZ.linearRampToValueAtTime(r.z,e)}else t.setPosition(ad.x,ad.y,ad.z),t.setOrientation(am.x,am.y,am.z,r.x,r.y,r.z)}constructor(){super(),this.type="AudioListener",this.context=AudioContext.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Clock}};let Audio=class Audio extends Object3D{getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying){console.warn("THREE.Audio: Audio is already playing.");return}if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let 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()}pause(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}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}stop(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let 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}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let 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}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(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}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl
5=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}};let ag=new Vector3,av=new Quaternion,ay=new Vector3,ax=new Vector3;let PositionalAudio=class PositionalAudio extends Audio{disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(ag,av,ay),ax.set(0,0,1).applyQuaternion(av);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ag.x,e),t.positionY.linearRampToValueAtTime(ag.y,e),t.positionZ.linearRampToValueAtTime(ag.z,e),t.orientationX.linearRampToValueAtTime(ax.x,e),t.orientationY.linearRampToValueAtTime(ax.y,e),t.orientationZ.linearRampToValueAtTime(ax.z,e)}else t.setPosition(ag.x,ag.y,ag.z),t.setOrientation(ax.x,ax.y,ax.z)}constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}};let AudioAnalyser=class AudioAnalyser{getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}};let PropertyMixer=class PropertyMixer{accumulate(e,t){let r=this.buffer,i=this.valueSize,n=e*i+i,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==i;++e)r[n+e]=r[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(r,n,0,e,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,i=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(r,i,e,1-n,t)}a>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let e=t,n=t+t;e!==n;++e)if(r[e]!==r[e+t]){s.setValue(r,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let e=r;e!==i;++e)t[e]=t[i+e%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,i,n){if(i>=.5)for(let i=0;i!==n;++i)e[t+i]=e[r+i]}_slerp(e,t,r,i){Quaternion.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,n){let a=this._workIndex*n;Quaternion.multiplyQuaternionsFlat(e,a,e,t,e,r),Quaternion.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,r,i,n){let a=1-i;for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]*a+e[r+s]*i}}_lerpAdditive(e,t,r,i,n){for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]+e[r+a]*i}}constructor(e,t,r){let i,n,a;switch(this.binding=e,this.valueSize=r,t){case"quaternion":i=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*r);break;default:i=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}};let a_="\\[\\]\\.:\\/",ab=RegExp("["+a_+"]","g"),aM="[^"+a_+"]",aS="[^"+a_.replace("\\.","")+"]",aw=/((?:WC+[\/:])*)/.source.replace("WC",aM),aT=/(WCOD+)?/.source.replace("WCOD",aS),aA=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",aM),aC=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",aM),aE=RegExp("^"+aw+aT+aA+aC+"$"),aL=["material","materials","bones","map"];let PropertyBinding=class PropertyBinding{static create(e,t,r){return e&&e.isAnimationObjectGroup?new PropertyBinding.Composite(e,t,r):new PropertyBinding(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ab,"")}static parseTrackName(e){let t=aE.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){let e=r.nodeName.substring(i+1);-1!==aL.indexOf(e)&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=e)}if(null===r.propertyName||0===r.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){let searchNodeSubtree=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let n=searchNodeSubtree(i.children);if(n)return n}return null},r=searchNodeSubtree(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)e[t++]=r[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0}
5_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(e=PropertyBinding.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let i=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(void 0===e[r]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(void 0!==i){if(void 0===e[i]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[i]}}let a=e[i];if(void 0===a){let r=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+r+"."+i+" but it wasn't found.",e);return}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===i){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[n]&&(n=e.morphTargetDictionary[n])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}constructor(e,t,r){this.path=t,this.parsedPath=r||PropertyBinding.parseTrackName(t),this.node=PropertyBinding.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};PropertyBinding.Composite=class{getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}constructor(e,t,r){let i=r||PropertyBinding.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}},PropertyBinding.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},PropertyBinding.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},PropertyBinding.prototype.GetterByBindingType=[PropertyBinding.prototype._getValue_direct,PropertyBinding.prototype._getValue_array,PropertyBinding.prototype._getValue_arrayElement,PropertyBinding.prototype._getValue_toArray],PropertyBinding.prototype.SetterByBindingTypeAndVersioning=[[PropertyBinding.prototype._setValue_direct,PropertyBinding.prototype._setValue_direct_setNeedsUpdate,PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_array,PropertyBinding.prototype._setValue_array_setNeedsUpdate,PropertyBinding.prototype._setValue_array_setMatr
5ixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_arrayElement,PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[PropertyBinding.prototype._setValue_fromArray,PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];let AnimationObjectGroup=class AnimationObjectGroup{add(){let e=this._objects,t=this._indicesByUUID,r=this._paths,i=this._parsedPaths,n=this._bindings,a=n.length,s,o=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let h=arguments[u],c=h.uuid,d=t[c];if(void 0===d){d=o++,t[c]=d,e.push(h);for(let e=0;e!==a;++e)n[e].push(new PropertyBinding(h,r[e],i[e]))}else if(d<l){s=e[d];let o=--l,u=e[o];t[u.uuid]=d,e[d]=u,t[c]=o,e[o]=h;for(let e=0;e!==a;++e){let t=n[e],a=t[o],s=t[d];t[d]=a,void 0===s&&(s=new PropertyBinding(h,r[e],i[e])),t[o]=s}}else e[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){let s=arguments[a],o=s.uuid,l=t[o];if(void 0!==l&&l>=n){let a=n++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==i;++e){let t=r[e],i=t[a],n=t[l];t[l]=i,t[a]=n}}}this.nCachedObjects_=n}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u){if(delete t[l],u<n){let s=--n,o=e[s],l=--a,h=e[l];t[o.uuid]=u,e[u]=o,t[h.uuid]=s,e[s]=h,e.pop();for(let e=0;e!==i;++e){let t=r[e],i=t[s],n=t[l];t[u]=i,t[s]=n,t.pop()}}else{let n=--a,s=e[n];n>0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==i;++e){let t=r[e];t[u]=t[n],t.pop()}}}}this.nCachedObjects_=n}subscribe_(e,t){let r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,h=Array(l);i=n.length,r[e]=i,a.push(e),s.push(t),n.push(h);for(let r=u,i=o.length;r!==i;++r){let i=o[r];h[r]=new PropertyBinding(i,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){let i=this._paths,n=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s],l=e[s];t[l]=r,a[r]=o,a.pop(),n[r]=n[s],n.pop(),i[r]=i[s],i.pop()}}constructor(){this.isAnimationObjectGroup=!0,this.uuid=generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}};let AnimationAction=class AnimationAction{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){let r=this._clip.duration,i=e._clip.duration;e.warp(1,i/r,t),this.warp(r/i,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){let i=this._mixer,n=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+r,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}
5_update(e,t,r,i){if(!this.enabled){this._updateWeight(e);return}let n=this._startTime;if(null!==n){let i=(e-n)*r;i<0||0===r?t=0:(this._startTime=null,t=r*i)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(this.blendMode===tA)for(let r=0,i=e.length;r!==i;++r)e[r].evaluate(a),t[r].accumulateAdditive(s);else for(let r=0,n=e.length;r!==n;++r)e[r].evaluate(a),t[r].accumulate(i,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(null!==r){let i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;if(null!==r){let i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,i=this.time+e,n=this._loopCount,a=r===ty;if(0===e)return -1===n?i:a&&(1&n)==1?t-i:i;if(r===tg){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));n:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break n}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){let r=Math.floor(i/t);i-=t*r,n+=Math.abs(r);let s=this.repetitions-n;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})}}else this.time=i;if(a&&(1&n)==1)return t-i}return i}_setEndings(e,t,r){let i=this._interpolantSettings;r?(i.endingStart=tS,i.endingEnd=tS):(e?i.endingStart=this.zeroSlopeAtStart?tS:tM:i.endingStart=tw,t?i.endingEnd=this.zeroSlopeAtEnd?tS:tM:i.endingEnd=tw)}_scheduleFading(e,t,r){let i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=r,this}constructor(e,t,r=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;let n=t.tracks,a=n.length,s=Array(a),o={endingStart:tM,endingEnd:tM};for(let e=0;e!==a;++e){let t=n[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=tv,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}};let aP=new Float32Array(1);let AnimationMixer=class AnimationMixer extends EventDispatcher{_bindAction(e,t){let r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,a=e._propertyBindings,s=e._interpolants,o=r.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==n;++e){let n=i[e],l=n.name,h=u[l];if(void 0!==h)++h.referenceCount,a[e]=h;else{if(void 0!==(h=a[e])){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}let i=t&&t._propertyBindings[e].binding.parsedPath;h=new PropertyMixer(PropertyBinding.create(r,l,i),n.ValueTypeName,n.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),a[e]=h}s[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,r){let i=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;let n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,o[u]=l,o.pop(),e._byClipCacheIndex=null;let h=s.actionByRoot,c=(e._localRoot||this._root).uuid;delete h[c],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==--r.referenceCount&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_addInactiveBinding(e,t,r){let i=this._bindingsByRootAndName,n=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[r]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,a=this._bindingsByRootAndName,s=a[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[i]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new LinearInterpolant(new Float32Array(2),new Float32Array(2),1,aP)).__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n}clipAction(e,t,r){let i=t||this._root,n=i.uuid,a="string"==typeof e?AnimationClip.findByName(i,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===r&&(r=null!==a?a.blendMode:tT),void 0!==o){let e=o.actionByRoot[n];if(void 0!==e&&e.blendMode===r)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let u=new AnimationAction(this,a,t,r);return this._bindAction(u,l),this._addInactiveAction(u,s,n),u}existingAction(e,t){let r=t||this._root,i=r.uuid,n="string"==typeof e?AnimationClip.findByName(r,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==r;++s){let r=t[s];r._update(i,e,n,a)}let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,r=e.uuid,i=this._actionsByClip,n=i[r];if(void 0!==n){let e=n.knownActions;for(let r=0,i=e.length;r!==i;++r){let i=e[r];this._deactivateAction(i);let n=i._cacheIndex,a=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,a._cacheIndex=n,t[n]=a,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let e in r){let i=r[e].actionByRoot,n=i[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}let i=this._bindingsByRootAndName,n=i[t];if(void 0!==n)for(let e in n){let t=n[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}};let Uniform=class Uniform{clone(){return new Uniform(void 0===this.value.clone?this.value:this.value.clone())}constructor(e){this.value=e}};let aR=0;
5let UniformsGroup=class UniformsGroup extends EventDispatcher{add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,r=t.length;e<r;e++)this.uniforms.push(t[e].clone());return this}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:aR++}),this.name="",this.usage=t3,this.uniforms=[]}};let InstancedInterleavedBuffer=class InstancedInterleavedBuffer extends InterleavedBuffer{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}};let GLBufferAttribute=class GLBufferAttribute{set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}constructor(e,t,r,i,n){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=i,this.count=n,this.version=0}};let Raycaster=class Raycaster{set(e,t){this.ray.set(e,t)}setFromCamera(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)}intersectObject(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return intersectObject(e,this,r,t),r.sort(ascSort),r}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let i=0,n=e.length;i<n;i++)intersectObject(e[i],this,r,t);return r.sort(ascSort),r}constructor(e,t,r=0,i=1/0){this.ray=new Ray(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new Layers,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}};function ascSort(e,t){return e.distance-t.distance}function intersectObject(e,t,r,i){if(e.layers.test(t.layers)&&e.raycast(t,r),!0===i){let i=e.children;for(let e=0,n=i.length;e<n;e++)intersectObject(i[e],t,r,!0)}}let Spherical=class Spherical{set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(clamp(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}};let Cylindrical=class Cylindrical{set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,r=0){return this.radius=e,this.theta=t,this.y=r,this}};let aI=new Vector2;let Box2=class Box2{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=aI.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(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))}intersectsBox(e){return!(e.max.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,aI).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new Vector2(Infinity,Infinity),t=new Vector2(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}};let aD=new Vector3,aB=new Vector3;let Line3=class Line3{set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){aD.subVectors(e,this.start),aB.subVectors(this.end,this.start);let r=aB.dot(aB),i=aB.dot(aD),n=i/r;return t&&(n=clamp(n,0,1)),n}closestPointToPoint(e,t,r){let i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}
5applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}constructor(e=new Vector3,t=new Vector3){this.start=e,this.end=t}};let aV=new Vector3;let SpotLightHelper=class SpotLightHelper extends Object3D{dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),aV.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(aV),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let r=new BufferGeometry,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){let r=e/32*Math.PI*2,n=t/32*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(n),Math.sin(n),1)}r.setAttribute("position",new Float32BufferAttribute(i,3));let n=new LineBasicMaterial({fog:!1,toneMapped:!1});this.cone=new LineSegments(r,n),this.add(this.cone),this.update()}};let aO=new Vector3,aN=new Matrix4,az=new Matrix4;let SkeletonHelper=class SkeletonHelper extends LineSegments{updateMatrixWorld(e){let t=this.bones,r=this.geometry,i=r.getAttribute("position");az.copy(this.root.matrixWorld).invert();for(let e=0,r=0;e<t.length;e++){let n=t[e];n.parent&&n.parent.isBone&&(aN.multiplyMatrices(az,n.matrixWorld),aO.setFromMatrixPosition(aN),i.setXYZ(r,aO.x,aO.y,aO.z),aN.multiplyMatrices(az,n.parent.matrixWorld),aO.setFromMatrixPosition(aN),i.setXYZ(r+1,aO.x,aO.y,aO.z),r+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=function getBoneList(e){let t=[];!0===e.isBone&&t.push(e);for(let r=0;r<e.children.length;r++)t.push.apply(t,getBoneList(e.children[r]));return t}(e),r=new BufferGeometry,i=[],n=[],a=new Color(0,0,1),s=new Color(0,1,0);for(let e=0;e<t.length;e++){let r=t[e];r.parent&&r.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),n.push(a.r,a.g,a.b),n.push(s.r,s.g,s.b))}r.setAttribute("position",new Float32BufferAttribute(i,3)),r.setAttribute("color",new Float32BufferAttribute(n,3));let o=new LineBasicMaterial({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}};let PointLightHelper=class PointLightHelper extends Mesh{dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}constructor(e,t,r){let i=new SphereGeometry(t,4,2),n=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1});super(i,n),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}};let aG=new Vector3,aU=new Color,aF=new Color;let HemisphereLightHelper=class HemisphereLightHelper extends Object3D{dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");aU.copy(this.light.color),aF.copy(this.light.groundColor);for(let e=0,r=t.count;e<r;e++){let i=e<r/2?aU:aF;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(aG.setFromMatrixPosition(this.light.matrixWorld).negate())}constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";let i=new OctahedronGeometry(t);i.rotateY(.5*Math.PI),this.material=new MeshBasicMaterial({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);let n=i.getAttribute("position"),a=new Float32Array(3*n.count);i.setAttribute("color",new BufferAttribute(a,3)),this.add(new Mesh(i,this.material)),this.update()}};let GridHelper=class GridHelper extends LineSegments{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=10,r=4473924,i=8947848){r=new Color(r),i=new Color(i);let n=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,u=0,h=-s;e<=t;e++,h+=a){o.push(-s,0,h,s,0,h),o.push(h,0,-s,h,0,s);let t=e===n?r:i;t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3}let u=new BufferGeometry;u.setAttribute("position",new Float32BufferAttribute(o,3)),u.setAttribute("color",new Float32BufferAttribute(l,3));let h=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}};let PolarGridHelper=class PolarGridHelper extends LineSegments{dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=10,t=16,r=8,i=64,n=4473924,a=8947848){n=new Color(n),a=new Color(a);let s=[],o=[];if(t>1)for(let r=0;r<t;r++){let i=r/t*(2*Math.PI),l=Math.sin(i)*e,u=Math.cos(i)*e;s.push(0,0,0),s.push(l,0,u);let h=1&r?n:a;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let t=0;t<r;t++){let l=1&t?n:a,u=e-e/r*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),r=Math.sin(t)*u,n=Math.cos(t)*u;s.push(r,0,n),o.push(l.r,l.g,l.b),r=Math.sin(t=(e+1)/i*(2*Math.PI))*u,n=Math.cos(t)*u,s.push(r,0,n),o.push(l.r,l.g,l.b)}}let l=new BufferGeometry;l.setAttribute("position",new Float32BufferAttribute(s,3)),l.setAttribute("color",new Float32BufferAttribute(o,3));let u=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(l,u),this.type="PolarGridHelper"}};let ak=new Vector3,aW=new Vector3,aH=new Vector3;let DirectionalLightHelper=class DirectionalLightHelper extends Object3D{dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ak.setFromMatrixPosition(this.light.matrixWorld),aW.setFromMatrixPosition(this.light.target.matrixWorld),aH.subVectors(aW,ak),this.lightPlane.lookAt(aW),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(aW),this.targetLine.scale.z
5=aH.length()}constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new BufferGeometry;i.setAttribute("position",new Float32BufferAttribute([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let n=new LineBasicMaterial({fog:!1,toneMapped:!1});this.lightPlane=new Line(i,n),this.add(this.lightPlane),(i=new BufferGeometry).setAttribute("position",new Float32BufferAttribute([0,0,0,0,0,1],3)),this.targetLine=new Line(i,n),this.add(this.targetLine),this.update()}};let aj=new Vector3,aq=new Camera;let CameraHelper=class CameraHelper extends LineSegments{setColors(e,t,r,i,n){let a=this.geometry,s=a.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,r.r,r.g,r.b),s.setXYZ(33,r.r,r.g,r.b),s.setXYZ(34,r.r,r.g,r.b),s.setXYZ(35,r.r,r.g,r.b),s.setXYZ(36,r.r,r.g,r.b),s.setXYZ(37,r.r,r.g,r.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,n.r,n.g,n.b),s.setXYZ(41,n.r,n.g,n.b),s.setXYZ(42,n.r,n.g,n.b),s.setXYZ(43,n.r,n.g,n.b),s.setXYZ(44,n.r,n.g,n.b),s.setXYZ(45,n.r,n.g,n.b),s.setXYZ(46,n.r,n.g,n.b),s.setXYZ(47,n.r,n.g,n.b),s.setXYZ(48,n.r,n.g,n.b),s.setXYZ(49,n.r,n.g,n.b),s.needsUpdate=!0}update(){let e=this.geometry,t=this.pointMap;aq.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),setPoint("c",t,e,aq,0,0,-1),setPoint("t",t,e,aq,0,0,1),setPoint("n1",t,e,aq,-1,-1,-1),setPoint("n2",t,e,aq,1,-1,-1),setPoint("n3",t,e,aq,-1,1,-1),setPoint("n4",t,e,aq,1,1,-1),setPoint("f1",t,e,aq,-1,-1,1),setPoint("f2",t,e,aq,1,-1,1),setPoint("f3",t,e,aq,-1,1,1),setPoint("f4",t,e,aq,1,1,1),setPoint("u1",t,e,aq,.7,1.1,-1),setPoint("u2",t,e,aq,-.7,1.1,-1),setPoint("u3",t,e,aq,0,2,-1),setPoint("cf1",t,e,aq,-1,0,1),setPoint("cf2",t,e,aq,1,0,1),setPoint("cf3",t,e,aq,0,-1,1),setPoint("cf4",t,e,aq,0,1,1),setPoint("cn1",t,e,aq,-1,0,-1),setPoint("cn2",t,e,aq,1,0,-1),setPoint("cn3",t,e,aq,0,-1,-1),setPoint("cn4",t,e,aq,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e){let t=new BufferGeometry,r=new LineBasicMaterial({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],n=[],a={};function addLine(e,t){addPoint(e),addPoint(t)}function addPoint(e){i.push(0,0,0),n.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}addLine("n1","n2"),addLine("n2","n4"),addLine("n4","n3"),addLine("n3","n1"),addLine("f1","f2"),addLine("f2","f4"),addLine("f4","f3"),addLine("f3","f1"),addLine("n1","f1"),addLine("n2","f2"),addLine("n3","f3"),addLine("n4","f4"),addLine("p","n1"),addLine("p","n2"),addLine("p","n3"),addLine("p","n4"),addLine("u1","u2"),addLine("u2","u3"),addLine("u3","u1"),addLine("c","t"),addLine("p","c"),addLine("cn1","cn2"),addLine("cn3","cn4"),addLine("cf1","cf2"),addLine("cf3","cf4"),t.setAttribute("position",new Float32BufferAttribute(i,3)),t.setAttribute("color",new Float32BufferAttribute(n,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();let s=new Color(16755200),o=new Color(16711680),l=new Color(43775),u=new Color(16777215),h=new Color(3355443);this.setColors(s,o,l,u,h)}};function setPoint(e,t,r,i,n,a,s){aj.set(n,a,s).unproject(i);let o=t[e];if(void 0!==o){let e=r.getAttribute("position");for(let t=0,r=o.length;t<r;t++)e.setXYZ(o[t],aj.x,aj.y,aj.z)}}let aX=new Box3;let BoxHelper=class BoxHelper extends LineSegments{update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update(
5) has no longer arguments."),void 0!==this.object&&aX.setFromObject(this.object),aX.isEmpty())return;let t=aX.min,r=aX.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=t.x,n[4]=r.y,n[5]=r.z,n[6]=t.x,n[7]=t.y,n[8]=r.z,n[9]=r.x,n[10]=t.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=t.z,n[15]=t.x,n[16]=r.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=r.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),n=new BufferGeometry;n.setIndex(new BufferAttribute(r,1)),n.setAttribute("position",new BufferAttribute(i,3)),super(n,new LineBasicMaterial({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}};let Box3Helper=class Box3Helper extends LineSegments{updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new BufferGeometry;i.setIndex(new BufferAttribute(r,1)),i.setAttribute("position",new Float32BufferAttribute([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)),super(i,new LineBasicMaterial({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}};let PlaneHelper=class PlaneHelper extends Line{updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}constructor(e,t=1,r=16776960){let i=new BufferGeometry;i.setAttribute("position",new Float32BufferAttribute([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new LineBasicMaterial({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;let n=new BufferGeometry;n.setAttribute("position",new Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),n.computeBoundingSphere(),this.add(new Mesh(n,new MeshBasicMaterial({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}};let aY=new Vector3;let ArrowHelper=class ArrowHelper extends Object3D{setDirection(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{aY.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(aY,t)}}setLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,r=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(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}constructor(e=new Vector3(0,0,1),t=new Vector3(0,0,0),r=1,i=16776960,n=.2*r,a=.2*n){super(),this.type="ArrowHelper",void 0===s&&((s=new BufferGeometry).setAttribute("position",new Float32BufferAttribute([0,0,0,0,1,0],3)),(o=new CylinderGeometry(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Line(s,new LineBasicMaterial({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Mesh(o,new MeshBasicMaterial({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,n,a)}};let AxesHelper=class AxesHelper extends LineSegments{setColors(e,t,r){let i=new Color,n=this.geometry.attributes.color.array;return i.set(e),i.toArray(n,0),i.toArray(n,3),i.set(t),i.toArray(n,6),i.toArray(n,9),i.set(r),i.toArray(n,12),i.toArray(n,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new BufferGeometry;r.setAttribute("position",new Float32BufferAttribute(t,3)),r.setAttribute("color",new Float32BufferAttribute([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));let i=new LineBasicMaterial({vertexColors:!0,toneMapped:!1});super(r,i),this.type="AxesHelper"}};let ShapePath=class ShapePath{moveTo(e,t){return this.currentPath=new Path,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,n,a){return this.currentPath.bezierCurveTo(e,t,r,i,n,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,r,i,n,a;let s=ShapeUtils.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];
5if(1===o.length)return r=o[0],(i=new Shape).curves=r.curves,l.push(i),l;let u=!s(o[0].getPoints());u=e?!u:u;let h=[],c=[],d=[],p=0;c[0]=void 0,d[p]=[];for(let i=0,a=o.length;i<a;i++)t=s(n=(r=o[i]).getPoints()),(t=e?!t:t)?(!u&&c[p]&&p++,c[p]={s:new Shape,p:n},c[p].s.curves=r.curves,u&&p++,d[p]=[]):d[p].push({h:r,p:n[0]});if(!c[0])return function(e){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r],n=new Shape;n.curves=i.curves,t.push(n)}return t}(o);if(c.length>1){let e=!1,t=0;for(let e=0,t=c.length;e<t;e++)h[e]=[];for(let r=0,i=c.length;r<i;r++){let i=d[r];for(let n=0;n<i.length;n++){let a=i[n],s=!0;for(let i=0;i<c.length;i++)(function(e,t){let r=t.length,i=!1;for(let n=r-1,a=0;a<r;n=a++){let r=t[n],s=t[a],o=s.x-r.x,l=s.y-r.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(r=t[a],o=-o,s=t[n],l=-l),e.y<r.y||e.y>s.y)continue;if(e.y===r.y){if(e.x===r.x)return!0}else{let t=l*(e.x-r.x)-o*(e.y-r.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==r.y)continue;if(s.x<=e.x&&e.x<=r.x||r.x<=e.x&&e.x<=s.x)return!0}}return i})(a.p,c[i].p)&&(r!==i&&t++,s?(s=!1,h[i].push(a)):e=!0);s&&h[r].push(a)}}t>0&&!1===e&&(d=h)}for(let e=0,t=c.length;e<t;e++){i=c[e].s,l.push(i),a=d[e];for(let e=0,t=a.length;e<t;e++)i.holes.push(a[e].h)}return l}constructor(){this.type="ShapePath",this.color=new Color,this.subPaths=[],this.currentPath=null}};let aZ=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),r=new Uint32Array(e),i=new Uint32Array(512),n=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,n[e]=24,n[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,n[e]=-t-1,n[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,n[e]=13,n[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,n[e]=24,n[256|e]=24):(i[e]=31744,i[256|e]=64512,n[e]=13,n[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,r=0;for(;(8388608&t)==0;)t<<=1,r-=8388608;t&=-8388609,r+=947912704,a[e]=t|r}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:r,baseTable:i,shiftTable:n,mantissaTable:a,exponentTable:s,offsetTable:o}}(),aJ={toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=clamp(e,-65504,65504),aZ.floatView[0]=e;let t=aZ.uint32View[0],r=t>>23&511;return aZ.baseTable[r]+((8388607&t)>>aZ.shiftTable[r])},fromHalfFloat:function(e){let t=e>>10;return aZ.uint32View[0]=aZ.mantissaTable[aZ.offsetTable[t]+(1023&e)]+aZ.exponentTable[t],aZ.floatView[0]}};let BoxBufferGeometry=class BoxBufferGeometry extends BoxGeometry{constructor(e,t,r,i,n,a){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,r,i,n,a)}};let CapsuleBufferGeometry=class CapsuleBufferGeometry extends CapsuleGeometry{constructor(e,t,r,i
5){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,r,i)}};let CircleBufferGeometry=class CircleBufferGeometry extends CircleGeometry{constructor(e,t,r,i){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,r,i)}};let ConeBufferGeometry=class ConeBufferGeometry extends ConeGeometry{constructor(e,t,r,i,n,a,s){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,r,i,n,a,s)}};let CylinderBufferGeometry=class CylinderBufferGeometry extends CylinderGeometry{constructor(e,t,r,i,n,a,s,o){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,r,i,n,a,s,o)}};let DodecahedronBufferGeometry=class DodecahedronBufferGeometry extends DodecahedronGeometry{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}};let ExtrudeBufferGeometry=class ExtrudeBufferGeometry extends ExtrudeGeometry{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}};let IcosahedronBufferGeometry=class IcosahedronBufferGeometry extends IcosahedronGeometry{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}};let LatheBufferGeometry=class LatheBufferGeometry extends LatheGeometry{constructor(e,t,r,i
5){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,r,i)}};let OctahedronBufferGeometry=class OctahedronBufferGeometry extends OctahedronGeometry{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}};let PlaneBufferGeometry=class PlaneBufferGeometry extends PlaneGeometry{constructor(e,t,r,i){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,r,i)}};let PolyhedronBufferGeometry=class PolyhedronBufferGeometry extends PolyhedronGeometry{constructor(e,t,r,i){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,r,i)}};let RingBufferGeometry=class RingBufferGeometry extends RingGeometry{constructor(e,t,r,i,n,a){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,r,i,n,a)}};let ShapeBufferGeometry=class ShapeBufferGeometry extends ShapeGeometry{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}};let SphereBufferGeometry=class SphereBufferGeometry extends SphereGeometry{constructor(e,t,r,i,n,a,s){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,r,i,n,a,s)}};let TetrahedronBufferGeometry=class TetrahedronBufferGeometry extends TetrahedronGeometry{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}};let TorusBufferGeometry=class TorusBufferGeometry extends TorusGeometry{constructor(e,t,r,i,n){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,r,i,n)}};let TorusKnotBufferGeometry=class TorusKnotBufferGeometry extends TorusKnotGeometry{constructor(e,t,r,i,n,a){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,r,i,n,a)}};let TubeBufferGeometry=class TubeBufferGeometry extends TubeGeometry{constructor(e,t,r,i,n){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,r,i,n)}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:l}})),window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=l}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.