-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvendors~main.js
More file actions
6 lines (6 loc) · 622 KB
/
vendors~main.js
File metadata and controls
6 lines (6 loc) · 622 KB
1
2
3
4
5
6
(window.webpackJsonp=window.webpackJsonp||[]).push([[1],[function(t,e,n){"use strict";n.r(e),n.d(e,"ACESFilmicToneMapping",(function(){return ct})),n.d(e,"AddEquation",(function(){return P})),n.d(e,"AddOperation",(function(){return nt})),n.d(e,"AdditiveBlending",(function(){return T})),n.d(e,"AlphaFormat",(function(){return Vt})),n.d(e,"AlwaysDepth",(function(){return X})),n.d(e,"AlwaysStencilFunc",(function(){return on})),n.d(e,"AmbientLight",(function(){return $u})),n.d(e,"AmbientLightProbe",(function(){return _h})),n.d(e,"AnimationClip",(function(){return ou})),n.d(e,"AnimationLoader",(function(){return fu})),n.d(e,"AnimationMixer",(function(){return Qh})),n.d(e,"AnimationObjectGroup",(function(){return Jh})),n.d(e,"AnimationUtils",(function(){return Xl})),n.d(e,"ArcCurve",(function(){return _u})),n.d(e,"ArrayCamera",(function(){return ms})),n.d(e,"ArrowHelper",(function(){return Qd})),n.d(e,"Audio",(function(){return Oh})),n.d(e,"AudioAnalyser",(function(){return Fh})),n.d(e,"AudioContext",(function(){return gh})),n.d(e,"AudioListener",(function(){return Ch})),n.d(e,"AudioLoader",(function(){return yh})),n.d(e,"AxesHelper",(function(){return $d})),n.d(e,"AxisHelper",(function(){return Ep})),n.d(e,"BackSide",(function(){return g})),n.d(e,"BasicDepthPacking",(function(){return Ge})),n.d(e,"BasicShadowMap",(function(){return d})),n.d(e,"BinaryTextureLoader",(function(){return Pp})),n.d(e,"Bone",(function(){return Zs})),n.d(e,"BooleanKeyframeTrack",(function(){return $l})),n.d(e,"BoundingBoxHelper",(function(){return Tp})),n.d(e,"Box2",(function(){return sd})),n.d(e,"Box3",(function(){return br})),n.d(e,"Box3Helper",(function(){return Xd})),n.d(e,"BoxBufferGeometry",(function(){return Ji})),n.d(e,"BoxGeometry",(function(){return Zi})),n.d(e,"BoxHelper",(function(){return qd})),n.d(e,"BufferAttribute",(function(){return ii})),n.d(e,"BufferGeometry",(function(){return Mi})),n.d(e,"BufferGeometryLoader",(function(){return ah})),n.d(e,"ByteType",(function(){return Ct})),n.d(e,"Cache",(function(){return cu})),n.d(e,"Camera",(function(){return ra})),n.d(e,"CameraHelper",(function(){return kd})),n.d(e,"CanvasRenderer",(function(){return Op})),n.d(e,"CanvasTexture",(function(){return wc})),n.d(e,"CatmullRomCurve3",(function(){return Lu})),n.d(e,"CineonToneMapping",(function(){return st})),n.d(e,"CircleBufferGeometry",(function(){return Il})),n.d(e,"CircleGeometry",(function(){return Dl})),n.d(e,"ClampToEdgeWrapping",(function(){return yt})),n.d(e,"Clock",(function(){return Th})),n.d(e,"ClosedSplineCurve3",(function(){return _p})),n.d(e,"Color",(function(){return Jr})),n.d(e,"ColorKeyframeTrack",(function(){return tu})),n.d(e,"CompressedTexture",(function(){return bc})),n.d(e,"CompressedTextureLoader",(function(){return mu})),n.d(e,"ConeBufferGeometry",(function(){return Ol})),n.d(e,"ConeGeometry",(function(){return Cl})),n.d(e,"CubeCamera",(function(){return sa})),n.d(e,"CubeGeometry",(function(){return Zi})),n.d(e,"CubeReflectionMapping",(function(){return ut})),n.d(e,"CubeRefractionMapping",(function(){return ht})),n.d(e,"CubeTexture",(function(){return Ca})),n.d(e,"CubeTextureLoader",(function(){return yu})),n.d(e,"CubeUVReflectionMapping",(function(){return mt})),n.d(e,"CubeUVRefractionMapping",(function(){return vt})),n.d(e,"CubicBezierCurve",(function(){return Ou})),n.d(e,"CubicBezierCurve3",(function(){return Du})),n.d(e,"CubicInterpolant",(function(){return Zl})),n.d(e,"CullFaceBack",(function(){return s})),n.d(e,"CullFaceFront",(function(){return c})),n.d(e,"CullFaceFrontBack",(function(){return l})),n.d(e,"CullFaceNone",(function(){return o})),n.d(e,"Curve",(function(){return bu})),n.d(e,"CurvePath",(function(){return Gu})),n.d(e,"CustomBlending",(function(){return R})),n.d(e,"CylinderBufferGeometry",(function(){return Pl})),n.d(e,"CylinderGeometry",(function(){return Rl})),n.d(e,"Cylindrical",(function(){return ad})),n.d(e,"DataTexture",(function(){return la})),n.d(e,"DataTexture2DArray",(function(){return Oa})),n.d(e,"DataTexture3D",(function(){return Da})),n.d(e,"DataTextureLoader",(function(){return vu})),n.d(e,"DecrementStencilOp",(function(){return Ye})),n.d(e,"DecrementWrapStencilOp",(function(){return Je})),n.d(e,"DefaultLoadingManager",(function(){return uu})),n.d(e,"DepthFormat",(function(){return Yt})),n.d(e,"DepthStencilFormat",(function(){return Zt})),n.d(e,"DepthTexture",(function(){return _c})),n.d(e,"DirectionalLight",(function(){return Qu})),n.d(e,"DirectionalLightHelper",(function(){return Gd})),n.d(e,"DirectionalLightShadow",(function(){return Ku})),n.d(e,"DiscreteInterpolant",(function(){return Kl})),n.d(e,"DodecahedronBufferGeometry",(function(){return Nc})),n.d(e,"DodecahedronGeometry",(function(){return Ic})),n.d(e,"DoubleSide",(function(){return y})),n.d(e,"DstAlphaFactor",(function(){return H})),n.d(e,"DstColorFactor",(function(){return k})),n.d(e,"DynamicBufferAttribute",(function(){return dp})),n.d(e,"DynamicCopyUsage",(function(){return fn})),n.d(e,"DynamicDrawUsage",(function(){return cn})),n.d(e,"DynamicReadUsage",(function(){return hn})),n.d(e,"EdgesGeometry",(function(){return Ll})),n.d(e,"EdgesHelper",(function(){return Ap})),n.d(e,"EllipseCurve",(function(){return wu})),n.d(e,"EqualDepth",(function(){return J})),n.d(e,"EqualStencilFunc",(function(){return tn})),n.d(e,"EquirectangularReflectionMapping",(function(){return dt})),n.d(e,"EquirectangularRefractionMapping",(function(){return pt})),n.d(e,"Euler",(function(){return jn})),n.d(e,"EventDispatcher",(function(){return vn})),n.d(e,"ExtrudeBufferGeometry",(function(){return fl})),n.d(e,"ExtrudeGeometry",(function(){return pl})),n.d(e,"Face3",(function(){return ti})),n.d(e,"Face4",(function(){return tp})),n.d(e,"FaceColors",(function(){return _})),n.d(e,"FaceNormalsHelper",(function(){return zd})),n.d(e,"FileLoader",(function(){return pu})),n.d(e,"FlatShading",(function(){return x})),n.d(e,"Float32Attribute",(function(){return bp})),n.d(e,"Float32BufferAttribute",(function(){return di})),n.d(e,"Float64Attribute",(function(){return wp})),n.d(e,"Float64BufferAttribute",(function(){return pi})),n.d(e,"FloatType",(function(){return zt})),n.d(e,"Fog",(function(){return Ss})),n.d(e,"FogExp2",(function(){return Ms})),n.d(e,"Font",(function(){return fh})),n.d(e,"FontLoader",(function(){return vh})),n.d(e,"FrontFaceDirectionCCW",(function(){return h})),n.d(e,"FrontFaceDirectionCW",(function(){return u})),n.d(e,"FrontSide",(function(){return v})),n.d(e,"Frustum",(function(){return da})),n.d(e,"GammaEncoding",(function(){return Ie})),n.d(e,"Geometry",(function(){return Yi})),n.d(e,"GeometryUtils",(function(){return Cp})),n.d(e,"GreaterDepth",(function(){return Q})),n.d(e,"GreaterEqualDepth",(function(){return K})),n.d(e,"GreaterEqualStencilFunc",(function(){return an})),n.d(e,"GreaterStencilFunc",(function(){return nn})),n.d(e,"GridHelper",(function(){return Pd})),n.d(e,"Group",(function(){return fs})),n.d(e,"HalfFloatType",(function(){return Bt})),n.d(e,"HemisphereLight",(function(){return ju})),n.d(e,"HemisphereLightHelper",(function(){return Ld})),n.d(e,"HemisphereLightProbe",(function(){return wh})),n.d(e,"IcosahedronBufferGeometry",(function(){return Dc})),n.d(e,"IcosahedronGeometry",(function(){return Oc})),n.d(e,"ImageBitmapLoader",(function(){return dh})),n.d(e,"ImageLoader",(function(){return gu})),n.d(e,"ImageUtils",(function(){return Ln})),n.d(e,"ImmediateRenderObject",(function(){return hd})),n.d(e,"IncrementStencilOp",(function(){return Xe})),n.d(e,"IncrementWrapStencilOp",(function(){return Ze})),n.d(e,"InstancedBufferAttribute",(function(){return ih})),n.d(e,"InstancedBufferGeometry",(function(){return rh})),n.d(e,"InstancedInterleavedBuffer",(function(){return td})),n.d(e,"InstancedMesh",(function(){return tc})),n.d(e,"Int16Attribute",(function(){return vp})),n.d(e,"Int16BufferAttribute",(function(){return ci})),n.d(e,"Int32Attribute",(function(){return yp})),n.d(e,"Int32BufferAttribute",(function(){return ui})),n.d(e,"Int8Attribute",(function(){return pp})),n.d(e,"Int8BufferAttribute",(function(){return ai})),n.d(e,"IntType",(function(){return It})),n.d(e,"InterleavedBuffer",(function(){return Es})),n.d(e,"InterleavedBufferAttribute",(function(){return Ts})),n.d(e,"Interpolant",(function(){return Yl})),n.d(e,"InterpolateDiscrete",(function(){return Me})),n.d(e,"InterpolateLinear",(function(){return Se})),n.d(e,"InterpolateSmooth",(function(){return Ee})),n.d(e,"InvertStencilOp",(function(){return Ke})),n.d(e,"JSONLoader",(function(){return Dp})),n.d(e,"KeepStencilOp",(function(){return We})),n.d(e,"KeyframeTrack",(function(){return Ql})),n.d(e,"LOD",(function(){return js})),n.d(e,"LatheBufferGeometry",(function(){return Sl})),n.d(e,"LatheGeometry",(function(){return Ml})),n.d(e,"Layers",(function(){return Wn})),n.d(e,"LensFlare",(function(){return Np})),n.d(e,"LessDepth",(function(){return Y})),n.d(e,"LessEqualDepth",(function(){return Z})),n.d(e,"LessEqualStencilFunc",(function(){return en})),n.d(e,"LessStencilFunc",(function(){return $e})),n.d(e,"Light",(function(){return ku})),n.d(e,"LightProbe",(function(){return bh})),n.d(e,"LightProbeHelper",(function(){return Rd})),n.d(e,"LightShadow",(function(){return Wu})),n.d(e,"Line",(function(){return sc})),n.d(e,"Line3",(function(){return ud})),n.d(e,"LineBasicMaterial",(function(){return ec})),n.d(e,"LineCurve",(function(){return Iu})),n.d(e,"LineCurve3",(function(){return Nu})),n.d(e,"LineDashedMaterial",(function(){return Wl})),n.d(e,"LineLoop",(function(){return hc})),n.d(e,"LinePieces",(function(){return np})),n.d(e,"LineSegments",(function(){return uc})),n.d(e,"LineStrip",(function(){return ep})),n.d(e,"LinearEncoding",(function(){return Oe})),n.d(e,"LinearFilter",(function(){return Et})),n.d(e,"LinearInterpolant",(function(){return Jl})),n.d(e,"LinearMipMapLinearFilter",(function(){return Rt})),n.d(e,"LinearMipMapNearestFilter",(function(){return At})),n.d(e,"LinearMipmapLinearFilter",(function(){return Lt})),n.d(e,"LinearMipmapNearestFilter",(function(){return Tt})),n.d(e,"LinearToneMapping",(function(){return it})),n.d(e,"Loader",(function(){return hu})),n.d(e,"LoaderUtils",(function(){return nh})),n.d(e,"LoadingManager",(function(){return lu})),n.d(e,"LogLuvEncoding",(function(){return ze})),n.d(e,"LoopOnce",(function(){return be})),n.d(e,"LoopPingPong",(function(){return _e})),n.d(e,"LoopRepeat",(function(){return we})),n.d(e,"LuminanceAlphaFormat",(function(){return qt})),n.d(e,"LuminanceFormat",(function(){return Wt})),n.d(e,"MOUSE",(function(){return i})),n.d(e,"Material",(function(){return ni})),n.d(e,"MaterialLoader",(function(){return eh})),n.d(e,"Math",(function(){return xn})),n.d(e,"Matrix3",(function(){return An})),n.d(e,"Matrix4",(function(){return Hn})),n.d(e,"MaxEquation",(function(){return I})),n.d(e,"Mesh",(function(){return Hi})),n.d(e,"MeshBasicMaterial",(function(){return ri})),n.d(e,"MeshDepthMaterial",(function(){return is})),n.d(e,"MeshDistanceMaterial",(function(){return as})),n.d(e,"MeshFaceMaterial",(function(){return rp})),n.d(e,"MeshLambertMaterial",(function(){return kl})),n.d(e,"MeshMatcapMaterial",(function(){return jl})),n.d(e,"MeshNormalMaterial",(function(){return Vl})),n.d(e,"MeshPhongMaterial",(function(){return Gl})),n.d(e,"MeshPhysicalMaterial",(function(){return Ul})),n.d(e,"MeshStandardMaterial",(function(){return Fl})),n.d(e,"MeshToonMaterial",(function(){return Hl})),n.d(e,"MinEquation",(function(){return D})),n.d(e,"MirroredRepeatWrapping",(function(){return xt})),n.d(e,"MixOperation",(function(){return et})),n.d(e,"MultiMaterial",(function(){return ip})),n.d(e,"MultiplyBlending",(function(){return L})),n.d(e,"MultiplyOperation",(function(){return tt})),n.d(e,"NearestFilter",(function(){return bt})),n.d(e,"NearestMipMapLinearFilter",(function(){return St})),n.d(e,"NearestMipMapNearestFilter",(function(){return _t})),n.d(e,"NearestMipmapLinearFilter",(function(){return Mt})),n.d(e,"NearestMipmapNearestFilter",(function(){return wt})),n.d(e,"NeverDepth",(function(){return q})),n.d(e,"NeverStencilFunc",(function(){return Qe})),n.d(e,"NoBlending",(function(){return S})),n.d(e,"NoColors",(function(){return w})),n.d(e,"NoToneMapping",(function(){return rt})),n.d(e,"NormalBlending",(function(){return E})),n.d(e,"NotEqualDepth",(function(){return $})),n.d(e,"NotEqualStencilFunc",(function(){return rn})),n.d(e,"NumberKeyframeTrack",(function(){return eu})),n.d(e,"Object3D",(function(){return ar})),n.d(e,"ObjectLoader",(function(){return sh})),n.d(e,"ObjectSpaceNormalMap",(function(){return ke})),n.d(e,"OctahedronBufferGeometry",(function(){return Cc})),n.d(e,"OctahedronGeometry",(function(){return Pc})),n.d(e,"OneFactor",(function(){return z})),n.d(e,"OneMinusDstAlphaFactor",(function(){return V})),n.d(e,"OneMinusDstColorFactor",(function(){return j})),n.d(e,"OneMinusSrcAlphaFactor",(function(){return G})),n.d(e,"OneMinusSrcColorFactor",(function(){return F})),n.d(e,"OrthographicCamera",(function(){return Ju})),n.d(e,"PCFShadowMap",(function(){return p})),n.d(e,"PCFSoftShadowMap",(function(){return f})),n.d(e,"ParametricBufferGeometry",(function(){return Ec})),n.d(e,"ParametricGeometry",(function(){return Sc})),n.d(e,"Particle",(function(){return op})),n.d(e,"ParticleBasicMaterial",(function(){return lp})),n.d(e,"ParticleSystem",(function(){return sp})),n.d(e,"ParticleSystemMaterial",(function(){return up})),n.d(e,"Path",(function(){return Hu})),n.d(e,"PerspectiveCamera",(function(){return ia})),n.d(e,"Plane",(function(){return Nr})),n.d(e,"PlaneBufferGeometry",(function(){return xa})),n.d(e,"PlaneGeometry",(function(){return ya})),n.d(e,"PlaneHelper",(function(){return Yd})),n.d(e,"PointCloud",(function(){return ap})),n.d(e,"PointCloudMaterial",(function(){return cp})),n.d(e,"PointLight",(function(){return Zu})),n.d(e,"PointLightHelper",(function(){return Md})),n.d(e,"Points",(function(){return gc})),n.d(e,"PointsMaterial",(function(){return dc})),n.d(e,"PolarGridHelper",(function(){return Cd})),n.d(e,"PolyhedronBufferGeometry",(function(){return Ac})),n.d(e,"PolyhedronGeometry",(function(){return Tc})),n.d(e,"PositionalAudio",(function(){return Bh})),n.d(e,"PositionalAudioHelper",(function(){return Od})),n.d(e,"PropertyBinding",(function(){return Zh})),n.d(e,"PropertyMixer",(function(){return Uh})),n.d(e,"QuadraticBezierCurve",(function(){return zu})),n.d(e,"QuadraticBezierCurve3",(function(){return Bu})),n.d(e,"Quaternion",(function(){return wn})),n.d(e,"QuaternionKeyframeTrack",(function(){return ru})),n.d(e,"QuaternionLinearInterpolant",(function(){return nu})),n.d(e,"REVISION",(function(){return r})),n.d(e,"RGBADepthPacking",(function(){return He})),n.d(e,"RGBAFormat",(function(){return jt})),n.d(e,"RGBA_ASTC_10x10_Format",(function(){return ge})),n.d(e,"RGBA_ASTC_10x5_Format",(function(){return fe})),n.d(e,"RGBA_ASTC_10x6_Format",(function(){return me})),n.d(e,"RGBA_ASTC_10x8_Format",(function(){return ve})),n.d(e,"RGBA_ASTC_12x10_Format",(function(){return ye})),n.d(e,"RGBA_ASTC_12x12_Format",(function(){return xe})),n.d(e,"RGBA_ASTC_4x4_Format",(function(){return oe})),n.d(e,"RGBA_ASTC_5x4_Format",(function(){return se})),n.d(e,"RGBA_ASTC_5x5_Format",(function(){return ce})),n.d(e,"RGBA_ASTC_6x5_Format",(function(){return le})),n.d(e,"RGBA_ASTC_6x6_Format",(function(){return ue})),n.d(e,"RGBA_ASTC_8x5_Format",(function(){return he})),n.d(e,"RGBA_ASTC_8x6_Format",(function(){return de})),n.d(e,"RGBA_ASTC_8x8_Format",(function(){return pe})),n.d(e,"RGBA_PVRTC_2BPPV1_Format",(function(){return ie})),n.d(e,"RGBA_PVRTC_4BPPV1_Format",(function(){return re})),n.d(e,"RGBA_S3TC_DXT1_Format",(function(){return Qt})),n.d(e,"RGBA_S3TC_DXT3_Format",(function(){return $t})),n.d(e,"RGBA_S3TC_DXT5_Format",(function(){return te})),n.d(e,"RGBDEncoding",(function(){return Ue})),n.d(e,"RGBEEncoding",(function(){return Ne})),n.d(e,"RGBEFormat",(function(){return Xt})),n.d(e,"RGBFormat",(function(){return kt})),n.d(e,"RGBM16Encoding",(function(){return Fe})),n.d(e,"RGBM7Encoding",(function(){return Be})),n.d(e,"RGB_ETC1_Format",(function(){return ae})),n.d(e,"RGB_PVRTC_2BPPV1_Format",(function(){return ne})),n.d(e,"RGB_PVRTC_4BPPV1_Format",(function(){return ee})),n.d(e,"RGB_S3TC_DXT1_Format",(function(){return Kt})),n.d(e,"RawShaderMaterial",(function(){return Bl})),n.d(e,"Ray",(function(){return Cr})),n.d(e,"Raycaster",(function(){return ed})),n.d(e,"RectAreaLight",(function(){return th})),n.d(e,"RectAreaLightHelper",(function(){return Sd})),n.d(e,"RedFormat",(function(){return Jt})),n.d(e,"ReinhardToneMapping",(function(){return at})),n.d(e,"RepeatWrapping",(function(){return gt})),n.d(e,"ReplaceStencilOp",(function(){return qe})),n.d(e,"ReverseSubtractEquation",(function(){return O})),n.d(e,"RingBufferGeometry",(function(){return _l})),n.d(e,"RingGeometry",(function(){return wl})),n.d(e,"Scene",(function(){return or})),n.d(e,"SceneUtils",(function(){return Ip})),n.d(e,"ShaderChunk",(function(){return pa})),n.d(e,"ShaderLib",(function(){return ma})),n.d(e,"ShaderMaterial",(function(){return na})),n.d(e,"ShadowMaterial",(function(){return zl})),n.d(e,"Shape",(function(){return Vu})),n.d(e,"ShapeBufferGeometry",(function(){return Tl})),n.d(e,"ShapeGeometry",(function(){return El})),n.d(e,"ShapePath",(function(){return ph})),n.d(e,"ShapeUtils",(function(){return ul})),n.d(e,"ShortType",(function(){return Ot})),n.d(e,"Skeleton",(function(){return Ys})),n.d(e,"SkeletonHelper",(function(){return _d})),n.d(e,"SkinnedMesh",(function(){return Ws})),n.d(e,"SmoothShading",(function(){return b})),n.d(e,"Sphere",(function(){return Mr})),n.d(e,"SphereBufferGeometry",(function(){return bl})),n.d(e,"SphereGeometry",(function(){return xl})),n.d(e,"Spherical",(function(){return id})),n.d(e,"SphericalHarmonics3",(function(){return xh})),n.d(e,"SphericalReflectionMapping",(function(){return ft})),n.d(e,"Spline",(function(){return Sp})),n.d(e,"SplineCurve",(function(){return Fu})),n.d(e,"SplineCurve3",(function(){return Mp})),n.d(e,"SpotLight",(function(){return Xu})),n.d(e,"SpotLightHelper",(function(){return yd})),n.d(e,"SpotLightShadow",(function(){return qu})),n.d(e,"Sprite",(function(){return Gs})),n.d(e,"SpriteMaterial",(function(){return As})),n.d(e,"SrcAlphaFactor",(function(){return U})),n.d(e,"SrcAlphaSaturateFactor",(function(){return W})),n.d(e,"SrcColorFactor",(function(){return B})),n.d(e,"StaticCopyUsage",(function(){return pn})),n.d(e,"StaticDrawUsage",(function(){return sn})),n.d(e,"StaticReadUsage",(function(){return un})),n.d(e,"StereoCamera",(function(){return Eh})),n.d(e,"StreamCopyUsage",(function(){return mn})),n.d(e,"StreamDrawUsage",(function(){return ln})),n.d(e,"StreamReadUsage",(function(){return dn})),n.d(e,"StringKeyframeTrack",(function(){return iu})),n.d(e,"SubtractEquation",(function(){return C})),n.d(e,"SubtractiveBlending",(function(){return A})),n.d(e,"TOUCH",(function(){return a})),n.d(e,"TangentSpaceNormalMap",(function(){return Ve})),n.d(e,"TetrahedronBufferGeometry",(function(){return Rc})),n.d(e,"TetrahedronGeometry",(function(){return Lc})),n.d(e,"TextBufferGeometry",(function(){return yl})),n.d(e,"TextGeometry",(function(){return gl})),n.d(e,"Texture",(function(){return Pn})),n.d(e,"TextureLoader",(function(){return xu})),n.d(e,"TorusBufferGeometry",(function(){return Hc})),n.d(e,"TorusGeometry",(function(){return Gc})),n.d(e,"TorusKnotBufferGeometry",(function(){return Uc})),n.d(e,"TorusKnotGeometry",(function(){return Fc})),n.d(e,"Triangle",(function(){return qr})),n.d(e,"TriangleFanDrawMode",(function(){return Ce})),n.d(e,"TriangleStripDrawMode",(function(){return Pe})),n.d(e,"TrianglesDrawMode",(function(){return Re})),n.d(e,"TubeBufferGeometry",(function(){return Bc})),n.d(e,"TubeGeometry",(function(){return zc})),n.d(e,"UVMapping",(function(){return lt})),n.d(e,"Uint16Attribute",(function(){return gp})),n.d(e,"Uint16BufferAttribute",(function(){return li})),n.d(e,"Uint32Attribute",(function(){return xp})),n.d(e,"Uint32BufferAttribute",(function(){return hi})),n.d(e,"Uint8Attribute",(function(){return fp})),n.d(e,"Uint8BufferAttribute",(function(){return oi})),n.d(e,"Uint8ClampedAttribute",(function(){return mp})),n.d(e,"Uint8ClampedBufferAttribute",(function(){return si})),n.d(e,"Uncharted2ToneMapping",(function(){return ot})),n.d(e,"Uniform",(function(){return $h})),n.d(e,"UniformsLib",(function(){return fa})),n.d(e,"UniformsUtils",(function(){return $i})),n.d(e,"UnsignedByteType",(function(){return Pt})),n.d(e,"UnsignedInt248Type",(function(){return Ht})),n.d(e,"UnsignedIntType",(function(){return Nt})),n.d(e,"UnsignedShort4444Type",(function(){return Ft})),n.d(e,"UnsignedShort5551Type",(function(){return Ut})),n.d(e,"UnsignedShort565Type",(function(){return Gt})),n.d(e,"UnsignedShortType",(function(){return Dt})),n.d(e,"VSMShadowMap",(function(){return m})),n.d(e,"Vector2",(function(){return bn})),n.d(e,"Vector3",(function(){return Sn})),n.d(e,"Vector4",(function(){return Cn})),n.d(e,"VectorKeyframeTrack",(function(){return au})),n.d(e,"Vertex",(function(){return hp})),n.d(e,"VertexColors",(function(){return M})),n.d(e,"VertexNormalsHelper",(function(){return vd})),n.d(e,"VideoTexture",(function(){return xc})),n.d(e,"WebGLMultisampleRenderTarget",(function(){return Dn})),n.d(e,"WebGLRenderTarget",(function(){return On})),n.d(e,"WebGLRenderTargetCube",(function(){return ca})),n.d(e,"WebGLRenderer",(function(){return _s})),n.d(e,"WebGLUtils",(function(){return hs})),n.d(e,"WireframeGeometry",(function(){return Mc})),n.d(e,"WireframeHelper",(function(){return Lp})),n.d(e,"WrapAroundEnding",(function(){return Le})),n.d(e,"XHRLoader",(function(){return Rp})),n.d(e,"ZeroCurvatureEnding",(function(){return Te})),n.d(e,"ZeroFactor",(function(){return N})),n.d(e,"ZeroSlopeEnding",(function(){return Ae})),n.d(e,"ZeroStencilOp",(function(){return je})),n.d(e,"sRGBEncoding",(function(){return De})),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e});var r="111",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,s=1,c=2,l=3,u=0,h=1,d=0,p=1,f=2,m=3,v=0,g=1,y=2,x=1,b=2,w=0,_=1,M=2,S=0,E=1,T=2,A=3,L=4,R=5,P=100,C=101,O=102,D=103,I=104,N=200,z=201,B=202,F=203,U=204,G=205,H=206,V=207,k=208,j=209,W=210,q=0,X=1,Y=2,Z=3,J=4,K=5,Q=6,$=7,tt=0,et=1,nt=2,rt=0,it=1,at=2,ot=3,st=4,ct=5,lt=300,ut=301,ht=302,dt=303,pt=304,ft=305,mt=306,vt=307,gt=1e3,yt=1001,xt=1002,bt=1003,wt=1004,_t=1004,Mt=1005,St=1005,Et=1006,Tt=1007,At=1007,Lt=1008,Rt=1008,Pt=1009,Ct=1010,Ot=1011,Dt=1012,It=1013,Nt=1014,zt=1015,Bt=1016,Ft=1017,Ut=1018,Gt=1019,Ht=1020,Vt=1021,kt=1022,jt=1023,Wt=1024,qt=1025,Xt=jt,Yt=1026,Zt=1027,Jt=1028,Kt=33776,Qt=33777,$t=33778,te=33779,ee=35840,ne=35841,re=35842,ie=35843,ae=36196,oe=37808,se=37809,ce=37810,le=37811,ue=37812,he=37813,de=37814,pe=37815,fe=37816,me=37817,ve=37818,ge=37819,ye=37820,xe=37821,be=2200,we=2201,_e=2202,Me=2300,Se=2301,Ee=2302,Te=2400,Ae=2401,Le=2402,Re=0,Pe=1,Ce=2,Oe=3e3,De=3001,Ie=3007,Ne=3002,ze=3003,Be=3004,Fe=3005,Ue=3006,Ge=3200,He=3201,Ve=0,ke=1,je=0,We=7680,qe=7681,Xe=7682,Ye=7683,Ze=34055,Je=34056,Ke=5386,Qe=512,$e=513,tn=514,en=515,nn=516,rn=517,an=518,on=519,sn=35044,cn=35048,ln=35040,un=35045,hn=35049,dn=35041,pn=35046,fn=35050,mn=35042;function vn(){}Object.assign(vn.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,t)}}}});for(var gn=[],yn=0;yn<256;yn++)gn[yn]=(yn<16?"0":"")+yn.toString(16);var xn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(gn[255&t]+gn[t>>8&255]+gn[t>>16&255]+gn[t>>24&255]+"-"+gn[255&e]+gn[e>>8&255]+"-"+gn[e>>16&15|64]+gn[e>>24&255]+"-"+gn[63&n|128]+gn[n>>8&255]+"-"+gn[n>>16&255]+gn[n>>24&255]+gn[255&r]+gn[r>>8&255]+gn[r>>16&255]+gn[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*xn.DEG2RAD},radToDeg:function(t){return t*xn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function bn(t,e){this.x=t||0,this.y=e||0}function wn(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}Object.defineProperties(bn.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(bn.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}}),Object.assign(wn,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-o,v=s*h+c*d+l*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*m+h*w,c=c*m+d*w,l=l*m+p*w,u=u*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=_,c*=_,l*=_,u*=_}}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=u}}),Object.defineProperties(wn.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(wn.prototype,{isQuaternion:!0,set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);return"XYZ"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"YXZ"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"ZXY"===a?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p):"ZYX"===a?(this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p):"YZX"===a?(this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p):"XZY"===a&&(this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=r+s+h;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-c)*e,this._y=(a-l)*e,this._z=(o-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(u-c)/e,this._x=.25*e,this._y=(i+o)/e,this._z=(a+l)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(a-l)/e,this._x=(i+o)/e,this._y=.25*e,this._z=(c+u)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(o-i)/e,this._x=(a+l)/e,this._y=(c+u)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(xn.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*n+e*this._x,this._y=c*r+e*this._y,this._z=c*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-e)*u)/l,d=Math.sin(e*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var _n=new Sn,Mn=new wn;function Sn(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}Object.assign(Sn.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Mn.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(Mn.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*r-o*n,l=s*n+o*e-i*r,u=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(t){return _n.copy(this).projectOnVector(t),this.sub(_n)},reflect:function(t){return this.sub(_n.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());0===e&&console.error("THREE.Vector3: angleTo() can't handle zero length vectors.");var n=this.dot(t)/e;return Math.acos(xn.clamp(n,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}});var En,Tn=new Sn;function An(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(An.prototype,{isMatrix3:!0,set:function(t,e,n,r,i,a,o,s,c){var l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e<n;e++)Tn.x=t.getX(e),Tn.y=t.getY(e),Tn.z=t.getZ(e),Tn.applyMatrix3(this),t.setXYZ(e,Tn.x,Tn.y,Tn.z);return t},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=a*f+o*g+s*b,i[3]=a*m+o*y+s*w,i[6]=a*v+o*x+s*_,i[1]=c*f+l*g+u*b,i[4]=c*m+l*y+u*w,i[7]=c*v+l*x+u*_,i[2]=h*f+d*g+p*b,i[5]=h*m+d*y+p*w,i[8]=h*v+d*x+p*_,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];return e*a*l-e*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=t.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],d=n[8],p=d*c-l*h,f=l*u-d*s,m=h*s-c*u,v=i*p+a*f+o*m;if(0===v){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return r[0]=p*y,r[1]=(o*h-d*a)*y,r[2]=(l*a-o*c)*y,r[3]=f*y,r[4]=(d*i-o*u)*y,r[5]=(o*s-l*i)*y,r[6]=m*y,r[7]=(a*u-h*i)*y,r[8]=(c*i-a*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+t,-r*c,r*s,-r*(-c*a+s*o)+o+e,0,0,1)},scale:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*c,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*c,r[7]=-n*o+e*l,this},translate:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}});var Ln={getDataURL:function(t){var e;if("undefined"==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===En&&(En=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),En.width=t.width,En.height=t.height;var n=En.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=En}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},Rn=0;function Pn(t,e,n,r,i,a,o,s,c,l){Object.defineProperty(this,"id",{value:Rn++}),this.uuid=xn.generateUUID(),this.name="",this.image=void 0!==t?t:Pn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Pn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:yt,this.wrapT=void 0!==r?r:yt,this.magFilter=void 0!==i?i:Et,this.minFilter=void 0!==a?a:Lt,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:jt,this.type=void 0!==s?s:Pt,this.offset=new bn(0,0),this.repeat=new bn(1,1),this.center=new bn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new An,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Oe,this.version=0,this.onUpdate=null}function Cn(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1}function On(t,e,n){this.width=t,this.height=e,this.scissor=new Cn(0,0,t,e),this.scissorTest=!1,this.viewport=new Cn(0,0,t,e),n=n||{},this.texture=new Pn(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Et,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function Dn(t,e,n){On.call(this,t,e,n),this.samples=4}Pn.DEFAULT_IMAGE=void 0,Pn.DEFAULT_MAPPING=lt,Pn.prototype=Object.assign(Object.create(vn.prototype),{constructor:Pn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var r=this.image;if(void 0===r.uuid&&(r.uuid=xn.generateUUID()),!e&&void 0===t.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(Ln.getDataURL(r[a]))}else i=Ln.getDataURL(r);t.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping!==lt)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case gt:t.x=t.x-Math.floor(t.x);break;case yt:t.x=t.x<0?0:1;break;case xt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case gt:t.y=t.y-Math.floor(t.y);break;case yt:t.y=t.y<0?0:1;break;case xt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Pn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.defineProperties(Cn.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(Cn.prototype,{isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,a=t.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+l)/4,x=(c+d)/4,b=(h+p)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=x/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(v)),i=b/r):g<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=b/i),this.set(n,r,i,e),this}var w=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(w)<.001&&(w=1),this.x=(p-h)/w,this.y=(c-d)/w,this.z=(l-s)/w,this.w=Math.acos((o+u+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),On.prototype=Object.assign(Object.create(vn.prototype),{constructor:On,isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.texture.image.width=t,this.texture.image.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Dn.prototype=Object.assign(Object.create(On.prototype),{constructor:Dn,isWebGLMultisampleRenderTarget:!0,copy:function(t){return On.prototype.copy.call(this,t),this.samples=t.samples,this}});var In=new Sn,Nn=new Hn,zn=new Sn(0,0,0),Bn=new Sn(1,1,1),Fn=new Sn,Un=new Sn,Gn=new Sn;function Hn(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Hn.prototype,{isMatrix4:!0,set:function(t,e,n,r,i,a,o,s,c,l,u,h,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Hn).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(t){var e=this.elements,n=t.elements,r=1/In.setFromMatrixColumn(t,0).length(),i=1/In.setFromMatrixColumn(t,1).length(),a=1/In.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){var h=a*l,d=a*u,p=o*l,f=o*u;e[0]=s*l,e[4]=-s*u,e[8]=c,e[1]=d+p*c,e[5]=h-f*c,e[9]=-o*s,e[2]=f-h*c,e[6]=p+d*c,e[10]=a*s}else if("YXZ"===t.order){var m=s*l,v=s*u,g=c*l,y=c*u;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*c,e[1]=a*u,e[5]=a*l,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){m=s*l,v=s*u,g=c*l,y=c*u;e[0]=m-y*o,e[4]=-a*u,e[8]=g+v*o,e[1]=v+g*o,e[5]=a*l,e[9]=y-m*o,e[2]=-a*c,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){h=a*l,d=a*u,p=o*l,f=o*u;e[0]=s*l,e[4]=p*c-d,e[8]=h*c+f,e[1]=s*u,e[5]=f*c+h,e[9]=d*c-p,e[2]=-c,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*l,e[4]=_-x*u,e[8]=w*u+b,e[1]=u,e[5]=a*l,e[9]=-o*l,e[2]=-c*l,e[6]=b*u+w,e[10]=x-_*u}else if("XZY"===t.order){x=a*s,b=a*c,w=o*s,_=o*c;e[0]=s*l,e[4]=-u,e[8]=c*l,e[1]=x*u+_,e[5]=a*l,e[9]=b*u-w,e[2]=w*u-b,e[6]=o*l,e[10]=_*u+x}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(zn,t,Bn)},lookAt:function(t,e,n){var r=this.elements;return Gn.subVectors(t,e),0===Gn.lengthSq()&&(Gn.z=1),Gn.normalize(),Fn.crossVectors(n,Gn),0===Fn.lengthSq()&&(1===Math.abs(n.z)?Gn.x+=1e-4:Gn.z+=1e-4,Gn.normalize(),Fn.crossVectors(n,Gn)),Fn.normalize(),Un.crossVectors(Gn,Fn),r[0]=Fn.x,r[4]=Un.x,r[8]=Gn.x,r[1]=Fn.y,r[5]=Un.y,r[9]=Gn.y,r[2]=Fn.z,r[6]=Un.z,r[10]=Gn.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],S=r[12],E=r[1],T=r[5],A=r[9],L=r[13],R=r[2],P=r[6],C=r[10],O=r[14],D=r[3],I=r[7],N=r[11],z=r[15];return i[0]=a*w+o*E+s*R+c*D,i[4]=a*_+o*T+s*P+c*I,i[8]=a*M+o*A+s*C+c*N,i[12]=a*S+o*L+s*O+c*z,i[1]=l*w+u*E+h*R+d*D,i[5]=l*_+u*T+h*P+d*I,i[9]=l*M+u*A+h*C+d*N,i[13]=l*S+u*L+h*O+d*z,i[2]=p*w+f*E+m*R+v*D,i[6]=p*_+f*T+m*P+v*I,i[10]=p*M+f*A+m*C+v*N,i[14]=p*S+f*L+m*O+v*z,i[3]=g*w+y*E+x*R+b*D,i[7]=g*_+y*T+x*P+b*I,i[11]=g*M+y*A+x*C+b*N,i[15]=g*S+y*L+x*O+b*z,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e<n;e++)In.x=t.getX(e),In.y=t.getY(e),In.z=t.getZ(e),In.applyMatrix4(this),t.setXYZ(e,In.x,In.y,In.z);return t},determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],c=t[13],l=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*d-n*s*d)+t[7]*(+e*s*d-e*c*h+i*a*h-r*a*d+r*c*l-i*s*l)+t[11]*(+e*c*u-e*o*d-i*a*u+n*a*d+i*o*l-n*c*l)+t[15]*(-r*o*l-e*s*u+e*o*h+r*a*u-n*a*h+n*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},getInverse:function(t,e){var n=this.elements,r=t.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=r[8],p=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],b=p*y*h-g*f*h+g*u*m-l*y*m-p*u*x+l*f*x,w=v*f*h-d*y*h-v*u*m+c*y*m+d*u*x-c*f*x,_=d*g*h-v*p*h+v*l*m-c*g*m-d*l*x+c*p*x,M=v*p*u-d*g*u-v*l*f+c*g*f+d*l*y-c*p*y,S=i*b+a*w+o*_+s*M;if(0===S){var E="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(E);return console.warn(E),this.identity()}var T=1/S;return n[0]=b*T,n[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*x-a*f*x)*T,n[2]=(l*y*s-g*u*s+g*o*h-a*y*h-l*o*x+a*u*x)*T,n[3]=(p*u*s-l*f*s-p*o*h+a*f*h+l*o*m-a*u*m)*T,n[4]=w*T,n[5]=(d*y*s-v*f*s+v*o*m-i*y*m-d*o*x+i*f*x)*T,n[6]=(v*u*s-c*y*s-v*o*h+i*y*h+c*o*x-i*u*x)*T,n[7]=(c*f*s-d*u*s+d*o*h-i*f*h-c*o*m+i*u*m)*T,n[8]=_*T,n[9]=(v*p*s-d*g*s-v*a*m+i*g*m+d*a*x-i*p*x)*T,n[10]=(c*g*s-v*l*s+v*a*h-i*g*h-c*a*x+i*l*x)*T,n[11]=(d*l*s-c*p*s-d*a*h+i*p*h+c*a*m-i*l*m)*T,n[12]=M*T,n[13]=(d*g*o-v*p*o+v*a*f-i*g*f-d*a*y+i*p*y)*T,n[14]=(v*l*o-c*g*o-v*a*u+i*g*u+c*a*y-i*l*y)*T,n[15]=(c*p*o-d*l*o+d*a*u-i*p*u-c*a*f+i*l*f)*T,this},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,c=i+i,l=a+a,u=o+o,h=i*c,d=i*l,p=i*u,f=a*l,m=a*u,v=o*u,g=s*c,y=s*l,x=s*u,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+v))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*w,r[5]=(1-(h+v))*w,r[6]=(m+g)*w,r[7]=0,r[8]=(p+y)*_,r[9]=(m-g)*_,r[10]=(1-(h+f))*_,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},decompose:function(t,e,n){var r=this.elements,i=In.set(r[0],r[1],r[2]).length(),a=In.set(r[4],r[5],r[6]).length(),o=In.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Nn.copy(this);var s=1/i,c=1/a,l=1/o;return Nn.elements[0]*=s,Nn.elements[1]*=s,Nn.elements[2]*=s,Nn.elements[4]*=c,Nn.elements[5]*=c,Nn.elements[6]*=c,Nn.elements[8]*=l,Nn.elements[9]*=l,Nn.elements[10]*=l,e.setFromRotationMatrix(Nn),n.x=i,n.y=a,n.z=o,this},makePerspective:function(t,e,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),c=2*i/(n-r),l=(e+t)/(e-t),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),c=1/(n-r),l=1/(a-i),u=(e+t)*s,h=(n+r)*c,d=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}});var Vn=new Hn,kn=new wn;function jn(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||jn.DefaultOrder}function Wn(){this.mask=1}jn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],jn.DefaultOrder="XYZ",Object.defineProperties(jn.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(jn.prototype,{isEuler:!0,set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var r=xn.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],p=i[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===e?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===e?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(t,e,n){return Vn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Vn,e,n)},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(t){return kn.setFromEuler(this),this.setFromQuaternion(kn,t)},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Sn(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(Wn.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}});var qn=0,Xn=new Sn,Yn=new wn,Zn=new Hn,Jn=new Sn,Kn=new Sn,Qn=new Sn,$n=new wn,tr=new Sn(1,0,0),er=new Sn(0,1,0),nr=new Sn(0,0,1),rr={type:"added"},ir={type:"removed"};function ar(){Object.defineProperty(this,"id",{value:qn++}),this.uuid=xn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ar.DefaultUp.clone();var t=new Sn,e=new jn,n=new wn,r=new Sn(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Hn},normalMatrix:{value:new An}}),this.matrix=new Hn,this.matrixWorld=new Hn,this.matrixAutoUpdate=ar.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Wn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function or(){ar.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ar.DefaultUp=new Sn(0,1,0),ar.DefaultMatrixAutoUpdate=!0,ar.prototype=Object.assign(Object.create(vn.prototype),{constructor:ar,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,e){return Yn.setFromAxisAngle(t,e),this.quaternion.multiply(Yn),this},rotateOnWorldAxis:function(t,e){return Yn.setFromAxisAngle(t,e),this.quaternion.premultiply(Yn),this},rotateX:function(t){return this.rotateOnAxis(tr,t)},rotateY:function(t){return this.rotateOnAxis(er,t)},rotateZ:function(t){return this.rotateOnAxis(nr,t)},translateOnAxis:function(t,e){return Xn.copy(t).applyQuaternion(this.quaternion),this.position.add(Xn.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(tr,t)},translateY:function(t){return this.translateOnAxis(er,t)},translateZ:function(t){return this.translateOnAxis(nr,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Zn.getInverse(this.matrixWorld))},lookAt:function(t,e,n){t.isVector3?Jn.copy(t):Jn.set(t,e,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Kn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Zn.lookAt(Kn,Jn,this.up):Zn.lookAt(Jn,Kn,this.up),this.quaternion.setFromRotationMatrix(Zn),r&&(Zn.extractRotation(r.matrixWorld),Yn.setFromRotationMatrix(Zn),this.quaternion.premultiply(Yn.inverse()))},add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(rr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(ir)),this},attach:function(t){return this.updateWorldMatrix(!0,!1),Zn.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Zn.multiply(t.parent.matrixWorld)),t.applyMatrix(Zn),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Sn),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new wn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Kn,t,Qn),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Sn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Kn,$n,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Sn),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){var n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(t){var e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==Re&&(r.drawMode=this.drawMode),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(t.shapes,l)}else i(t.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,c=this.material.length;s<c;s++)u.push(i(t.materials,this.material[s]));r.material=u}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(t).object)}if(e){var h=m(t.geometries),d=m(t.materials),p=m(t.textures),f=m(t.images);o=m(t.shapes);h.length>0&&(n.geometries=h),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=r,n;function m(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}}),or.prototype=Object.assign(Object.create(ar.prototype),{constructor:or,isScene:!0,copy:function(t,e){return ar.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=ar.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},dispose:function(){this.dispatchEvent({type:"dispose"})}});var sr=[new Sn,new Sn,new Sn,new Sn,new Sn,new Sn,new Sn,new Sn],cr=new Sn,lr=new br,ur=new Sn,hr=new Sn,dr=new Sn,pr=new Sn,fr=new Sn,mr=new Sn,vr=new Sn,gr=new Sn,yr=new Sn,xr=new Sn;function br(t,e){this.min=void 0!==t?t:new Sn(1/0,1/0,1/0),this.max=void 0!==e?e:new Sn(-1/0,-1/0,-1/0)}function wr(t,e,n,r,i){var a,o;for(a=0,o=t.length-3;a<=o;a+=3){xr.fromArray(t,a);var s=i.x*Math.abs(xr.x)+i.y*Math.abs(xr.y)+i.z*Math.abs(xr.z),c=e.dot(xr),l=n.dot(xr),u=r.dot(xr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}Object.assign(br.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.length;s<c;s+=3){var l=t[s],u=t[s+1],h=t[s+2];l<e&&(e=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=t.count;s<c;s++){var l=t.getX(s),u=t.getY(s),h=t.getZ(s);l<e&&(e=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var n=cr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Sn),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Sn),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){t.updateWorldMatrix(!1,!1);var e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),lr.copy(e.boundingBox),lr.applyMatrix4(t.matrixWorld),this.expandByPoint(lr.min),this.expandByPoint(lr.max));for(var n=t.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Sn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,cr),cr.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(vr),gr.subVectors(this.max,vr),ur.subVectors(t.a,vr),hr.subVectors(t.b,vr),dr.subVectors(t.c,vr),pr.subVectors(hr,ur),fr.subVectors(dr,hr),mr.subVectors(ur,dr);var e=[0,-pr.z,pr.y,0,-fr.z,fr.y,0,-mr.z,mr.y,pr.z,0,-pr.x,fr.z,0,-fr.x,mr.z,0,-mr.x,-pr.y,pr.x,0,-fr.y,fr.x,0,-mr.y,mr.x,0];return!!wr(e,ur,hr,dr,gr)&&(!!wr(e=[1,0,0,0,1,0,0,0,1],ur,hr,dr,gr)&&(yr.crossVectors(pr,fr),wr(e=[yr.x,yr.y,yr.z],ur,hr,dr,gr)))},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Sn),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return cr.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(cr).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()?this:(sr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),sr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),sr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),sr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),sr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),sr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),sr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),sr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(sr),this)},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var _r=new br;function Mr(t,e){this.center=void 0!==t?t:new Sn,this.radius=void 0!==e?e:0}Object.assign(Mr.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var n=this.center;void 0!==e?n.copy(e):_r.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;i<a;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Sn),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new br),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}});var Sr=new Sn,Er=new Sn,Tr=new Sn,Ar=new Sn,Lr=new Sn,Rr=new Sn,Pr=new Sn;function Cr(t,e){this.origin=void 0!==t?t:new Sn,this.direction=void 0!==e?e:new Sn(0,0,-1)}Object.assign(Cr.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Sn),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Sr)),this},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Sn),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=Sr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Sr.copy(this.direction).multiplyScalar(e).add(this.origin),Sr.distanceToSquared(t))},distanceSqToSegment:function(t,e,n,r){Er.copy(t).add(e).multiplyScalar(.5),Tr.copy(e).sub(t).normalize(),Ar.copy(this.origin).sub(Er);var i,a,o,s,c=.5*t.distanceTo(e),l=-this.direction.dot(Tr),u=Ar.dot(this.direction),h=-Ar.dot(Tr),d=Ar.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*u-h,s=c*p,(i=l*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+l*(a*=f)+2*u)+a*(l*i+a+2*h)+d}else a=c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;else a=-c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-l*c+u)))*i+(a=i>0?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+d):o=-(i=Math.max(0,-(l*c+u)))*i+(a=i>0?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d;else a=l>0?-c:c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Tr).multiplyScalar(a).add(Er),o},intersectSphere:function(t,e){Sr.subVectors(t.center,this.origin);var n=Sr.dot(this.direction),r=Sr.dot(Sr)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,r=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,r=(t.min.x-h.x)*c),l>=0?(i=(t.min.y-h.y)*l,a=(t.max.y-h.y)*l):(i=(t.max.y-h.y)*l,a=(t.min.y-h.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))},intersectsBox:function(t){return null!==this.intersectBox(t,Sr)},intersectTriangle:function(t,e,n,r,i){Lr.subVectors(e,t),Rr.subVectors(n,t),Pr.crossVectors(Lr,Rr);var a,o=this.direction.dot(Pr);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Ar.subVectors(this.origin,t);var s=a*this.direction.dot(Rr.crossVectors(Ar,Rr));if(s<0)return null;var c=a*this.direction.dot(Lr.cross(Ar));if(c<0)return null;if(s+c>o)return null;var l=-a*Ar.dot(Pr);return l<0?null:this.at(l/o,i)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}});var Or=new Sn,Dr=new Sn,Ir=new An;function Nr(t,e){this.normal=void 0!==t?t:new Sn(1,0,0),this.constant=void 0!==e?e:0}Object.assign(Nr.prototype,{isPlane:!0,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(t,e,n){var r=Or.subVectors(n,e).cross(Dr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Sn),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Sn);var n=t.delta(Or),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;var i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:e.copy(n).multiplyScalar(i).add(t.start)},intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Sn),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,e){var n=e||Ir.getNormalMatrix(t),r=this.coplanarPoint(Or).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}});var zr=new Sn,Br=new Sn,Fr=new Sn,Ur=new Sn,Gr=new Sn,Hr=new Sn,Vr=new Sn,kr=new Sn,jr=new Sn,Wr=new Sn;function qr(t,e,n){this.a=void 0!==t?t:new Sn,this.b=void 0!==e?e:new Sn,this.c=void 0!==n?n:new Sn}Object.assign(qr,{getNormal:function(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Sn),r.subVectors(n,e),zr.subVectors(t,e),r.cross(zr);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(t,e,n,r,i){zr.subVectors(r,e),Br.subVectors(n,e),Fr.subVectors(t,e);var a=zr.dot(zr),o=zr.dot(Br),s=zr.dot(Fr),c=Br.dot(Br),l=Br.dot(Fr),u=a*c-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Sn),0===u)return i.set(-2,-1,-1);var h=1/u,d=(c*s-o*l)*h,p=(a*l-o*s)*h;return i.set(1-d-p,p,d)},containsPoint:function(t,e,n,r){return qr.getBarycoord(t,e,n,r,Ur),Ur.x>=0&&Ur.y>=0&&Ur.x+Ur.y<=1},getUV:function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Ur),s.set(0,0),s.addScaledVector(i,Ur.x),s.addScaledVector(a,Ur.y),s.addScaledVector(o,Ur.z),s},isFrontFacing:function(t,e,n,r){return zr.subVectors(n,e),Br.subVectors(t,e),zr.cross(Br).dot(r)<0}}),Object.assign(qr.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return zr.subVectors(this.c,this.b),Br.subVectors(this.a,this.b),.5*zr.cross(Br).length()},getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Sn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return qr.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Nr),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return qr.getBarycoord(t,this.a,this.b,this.c,e)},getUV:function(t,e,n,r,i){return qr.getUV(t,this.a,this.b,this.c,e,n,r,i)},containsPoint:function(t){return qr.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return qr.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Sn);var n,r,i=this.a,a=this.b,o=this.c;Gr.subVectors(a,i),Hr.subVectors(o,i),kr.subVectors(t,i);var s=Gr.dot(kr),c=Hr.dot(kr);if(s<=0&&c<=0)return e.copy(i);jr.subVectors(t,a);var l=Gr.dot(jr),u=Hr.dot(jr);if(l>=0&&u<=l)return e.copy(a);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),e.copy(i).addScaledVector(Gr,n);Wr.subVectors(t,o);var d=Gr.dot(Wr),p=Hr.dot(Wr);if(p>=0&&d<=p)return e.copy(o);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return r=c/(c-p),e.copy(i).addScaledVector(Hr,r);var m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return Vr.subVectors(o,a),r=(u-l)/(u-l+(d-p)),e.copy(a).addScaledVector(Vr,r);var v=1/(m+f+h);return n=f*v,r=h*v,e.copy(i).addScaledVector(Gr,n).addScaledVector(Hr,r)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}});var Xr={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},Yr={h:0,s:0,l:0},Zr={h:0,s:0,l:0};function Jr(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function Kr(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Qr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $r(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function ti(t,e,n,r,i,a){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new Sn,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Jr,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}Object.assign(Jr.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){if(t=xn.euclideanModulo(t,1),e=xn.clamp(e,0,1),n=xn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=Kr(i,r,t+1/3),this.g=Kr(i,r,t),this.b=Kr(i,r,t-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},setColorName:function(t){var e=Xr[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=Qr(t.r),this.g=Qr(t.g),this.b=Qr(t.b),this},copyLinearToSRGB:function(t){return this.r=$r(t.r),this.g=$r(t.g),this.b=$r(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)e=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:e=(i-a)/l+(i<a?6:0);break;case i:e=(a-r)/l+2;break;case a:e=(r-i)/l+4}e/=6}return t.h=e,t.s=n,t.l=c,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){return this.getHSL(Yr),Yr.h+=t,Yr.s+=e,Yr.l+=n,this.setHSL(Yr.h,Yr.s,Yr.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},lerpHSL:function(t,e){this.getHSL(Yr),t.getHSL(Zr);var n=xn.lerp(Yr.h,Zr.h,e),r=xn.lerp(Yr.s,Zr.s,e),i=xn.lerp(Yr.l,Zr.l,e);return this.setHSL(n,r,i),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}}),Jr.NAMES=Xr,Object.assign(ti.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}});var ei=0;function ni(){Object.defineProperty(this,"id",{value:ei++}),this.uuid=xn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=E,this.side=v,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=w,this.opacity=1,this.transparent=!1,this.blendSrc=U,this.blendDst=G,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=on,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=We,this.stencilZFail=We,this.stencilZPass=We,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.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function ri(t){ni.call(this),this.type="MeshBasicMaterial",this.color=new Jr(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=tt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}function ii(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=sn,this.updateRange={offset:0,count:-1},this.version=0}function ai(t,e,n){ii.call(this,new Int8Array(t),e,n)}function oi(t,e,n){ii.call(this,new Uint8Array(t),e,n)}function si(t,e,n){ii.call(this,new Uint8ClampedArray(t),e,n)}function ci(t,e,n){ii.call(this,new Int16Array(t),e,n)}function li(t,e,n){ii.call(this,new Uint16Array(t),e,n)}function ui(t,e,n){ii.call(this,new Int32Array(t),e,n)}function hi(t,e,n){ii.call(this,new Uint32Array(t),e,n)}function di(t,e,n){ii.call(this,new Float32Array(t),e,n)}function pi(t,e,n){ii.call(this,new Float64Array(t),e,n)}function fi(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function mi(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}ni.prototype=Object.assign(Object.create(vn.prototype),{constructor:ni,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===x;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==E&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==v&&(n.side=this.side),this.vertexColors!==w&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),a=r(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(ni.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),ri.prototype=Object.create(ni.prototype),ri.prototype.constructor=ri,ri.prototype.isMeshBasicMaterial=!0,ri.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(ii.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ii.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Jr),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new bn),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new Sn),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Cn),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),ai.prototype=Object.create(ii.prototype),ai.prototype.constructor=ai,oi.prototype=Object.create(ii.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(ii.prototype),si.prototype.constructor=si,ci.prototype=Object.create(ii.prototype),ci.prototype.constructor=ci,li.prototype=Object.create(ii.prototype),li.prototype.constructor=li,ui.prototype=Object.create(ii.prototype),ui.prototype.constructor=ui,hi.prototype=Object.create(ii.prototype),hi.prototype.constructor=hi,di.prototype=Object.create(ii.prototype),di.prototype.constructor=di,pi.prototype=Object.create(ii.prototype),pi.prototype.constructor=pi,Object.assign(fi.prototype,{computeGroups:function(t){for(var e,n=[],r=void 0,i=t.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==e&&(e.count=3*a-e.start,n.push(e)),e={start:3*a,materialIndex:r})}void 0!==e&&(e.count=3*a-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,r=t.vertices,i=t.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=t.morphTargets,c=s.length;if(c>0){e=[];for(var l=0;l<c;l++)e[l]={name:s[l].name,data:[]};this.morphTargets.position=e}var u,h=t.morphNormals,d=h.length;if(d>0){u=[];for(l=0;l<d;l++)u[l]={name:h[l].name,data:[]};this.morphTargets.normal=u}var p=t.skinIndices,f=t.skinWeights,m=p.length===r.length,v=f.length===r.length;r.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var g=n[l];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=i[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new bn,new bn,new bn));if(!0===o)void 0!==(b=i[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new bn,new bn,new bn));for(var M=0;M<c;M++){var S=s[M].vertices;e[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<d;M++){var E=h[M].vertexNormals[l];u[M].data.push(E.a,E.b,E.c)}m&&this.skinIndices.push(p[g.a],p[g.b],p[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}});var vi=1,gi=new Hn,yi=new ar,xi=new Sn,bi=new br,wi=new br,_i=new Sn;function Mi(){Object.defineProperty(this,"id",{value:vi+=2}),this.uuid=xn.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={}}Mi.prototype=Object.assign(Object.create(vn.prototype),{constructor:Mi,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(mi(t)>65535?hi:li)(t,1):this.index=t},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new An).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0);var r=this.attributes.tangent;void 0!==r&&((new An).getNormalMatrix(t).applyToBufferAttribute(r),r.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return gi.makeRotationX(t),this.applyMatrix(gi),this},rotateY:function(t){return gi.makeRotationY(t),this.applyMatrix(gi),this},rotateZ:function(t){return gi.makeRotationZ(t),this.applyMatrix(gi),this},translate:function(t,e,n){return gi.makeTranslation(t,e,n),this.applyMatrix(gi),this},scale:function(t,e,n){return gi.makeScale(t,e,n),this.applyMatrix(gi),this},lookAt:function(t){return yi.lookAt(t),yi.updateMatrix(),this.applyMatrix(yi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(xi).negate(),this.translate(xi.x,xi.y,xi.z),this},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new di(3*e.vertices.length,3),r=new di(3*e.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(e.vertices)),this.setAttribute("color",r.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var i=new di(e.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new di(e,3)),this},updateFromObject:function(t){var e,n=t.geometry;if(t.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(e=this.attributes.position)&&(e.copyVector3sArray(n.vertices),e.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(e=this.attributes.normal)&&(e.copyVector3sArray(n.normals),e.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(e=this.attributes.color)&&(e.copyColorsArray(n.colors),e.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(e=this.attributes.uv)&&(e.copyVector2sArray(n.uvs),e.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(e=this.attributes.lineDistance)&&(e.copyArray(n.lineDistances),e.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(t.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new fi).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.setAttribute("position",new ii(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.setAttribute("normal",new ii(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var r=new Float32Array(3*t.colors.length);this.setAttribute("color",new ii(r,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var i=new Float32Array(2*t.uvs.length);this.setAttribute("uv",new ii(i,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.setAttribute("uv2",new ii(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],c=t.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],d=new di(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(t.skinIndices.length>0){var p=new di(4*t.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new di(4*t.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new br);var t=this.attributes.position,e=this.morphAttributes.position;if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var i=e[n];bi.setFromBufferAttribute(i),this.morphTargetsRelative?(_i.addVectors(this.boundingBox.min,bi.min),this.boundingBox.expandByPoint(_i),_i.addVectors(this.boundingBox.max,bi.max),this.boundingBox.expandByPoint(_i)):(this.boundingBox.expandByPoint(bi.min),this.boundingBox.expandByPoint(bi.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:function(){null===this.boundingSphere&&(this.boundingSphere=new Mr);var t=this.attributes.position,e=this.morphAttributes.position;if(t){var n=this.boundingSphere.center;if(bi.setFromBufferAttribute(t),e)for(var r=0,i=e.length;r<i;r++){var a=e[r];wi.setFromBufferAttribute(a),this.morphTargetsRelative?(_i.addVectors(bi.min,wi.min),bi.expandByPoint(_i),_i.addVectors(bi.max,wi.max),bi.expandByPoint(_i)):(bi.expandByPoint(wi.min),bi.expandByPoint(wi.max))}bi.getCenter(n);var o=0;for(r=0,i=t.count;r<i;r++)_i.fromBufferAttribute(t,r),o=Math.max(o,n.distanceToSquared(_i));if(e)for(r=0,i=e.length;r<i;r++){a=e[r];for(var s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)_i.fromBufferAttribute(a,c),s&&(xi.fromBufferAttribute(t,c),_i.add(xi)),o=Math.max(o,n.distanceToSquared(_i))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes;if(e.position){var n=e.position.array;if(void 0===e.normal)this.setAttribute("normal",new ii(new Float32Array(n.length),3));else for(var r=e.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,c,l=e.normal.array,u=new Sn,h=new Sn,d=new Sn,p=new Sn,f=new Sn;if(t){var m=t.array;for(i=0,a=t.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],c=3*m[i+2],u.fromArray(n,o),h.fromArray(n,s),d.fromArray(n,c),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[o]+=p.x,l[o+1]+=p.y,l[o+2]+=p.z,l[s]+=p.x,l[s+1]+=p.y,l[s+2]+=p.z,l[c]+=p.x,l[c+1]+=p.y,l[c+2]+=p.z}else for(i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),d.fromArray(n,i+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[i]=p.x,l[i+1]=p.y,l[i+2]=p.z,l[i+3]=p.x,l[i+4]=p.y,l[i+5]=p.z,l[i+6]=p.x,l[i+7]=p.y,l[i+8]=p.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==t.attributes[r])for(var i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)},normalizeNormals:function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)_i.x=t.getX(e),_i.y=t.getY(e),_i.z=t.getZ(e),_i.normalize(),t.setXYZ(e,_i.x,_i.y,_i.z)},toNonIndexed:function(){function t(t,e){for(var n=t.array,r=t.itemSize,i=new n.constructor(e.length*r),a=0,o=0,s=0,c=e.length;s<c;s++){a=e[s]*r;for(var l=0;l<r;l++)i[o++]=n[a++]}return new ii(i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var e=new Mi,n=this.index.array,r=this.attributes;for(var i in r){var a=t(r[i],n);e.setAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],c=o[i],l=0,u=c.length;l<u;l++){a=t(c[l],n);s.push(a)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,d=(l=0,h.length);l<d;l++){var p=h[l];e.addGroup(p.start,p.count,p.materialIndex)}return e},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=(d=i[n]).toJSON();""!==d.name&&(a.name=d.name),t.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u<h;u++){var d;a=(d=c[u]).toJSON();""!==d.name&&(a.name=d.name),l.push(a)}l.length>0&&(o[n]=l,s=!0)}s&&(t.data.morphAttributes=o,t.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new Mi).copy(this)},copy:function(t){var e,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var i=t.index;null!==i&&this.setIndex(i.clone());var a=t.attributes;for(e in a){var o=a[e];this.setAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var c=[],l=s[e];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[e]=c}this.morphTargetsRelative=t.morphTargetsRelative;var u=t.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Si=new Hn,Ei=new Cr,Ti=new Mr,Ai=new Sn,Li=new Sn,Ri=new Sn,Pi=new Sn,Ci=new Sn,Oi=new Sn,Di=new Sn,Ii=new Sn,Ni=new Sn,zi=new bn,Bi=new bn,Fi=new bn,Ui=new Sn,Gi=new Sn;function Hi(t,e){ar.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Mi,this.material=void 0!==e?e:new ri({color:16777215*Math.random()}),this.drawMode=Re,this.updateMorphTargets()}function Vi(t,e,n,r,i,a,o,s){if(null===(e.side===g?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,e.side!==y,s)))return null;Gi.copy(s),Gi.applyMatrix4(t.matrixWorld);var c=n.ray.origin.distanceTo(Gi);return c<n.near||c>n.far?null:{distance:c,point:Gi.clone(),object:t}}function ki(t,e,n,r,i,a,o,s,c,l,u,h){Ai.fromBufferAttribute(i,l),Li.fromBufferAttribute(i,u),Ri.fromBufferAttribute(i,h);var d=t.morphTargetInfluences;if(e.morphTargets&&a&&d){Di.set(0,0,0),Ii.set(0,0,0),Ni.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(Pi.fromBufferAttribute(v,l),Ci.fromBufferAttribute(v,u),Oi.fromBufferAttribute(v,h),o?(Di.addScaledVector(Pi,m),Ii.addScaledVector(Ci,m),Ni.addScaledVector(Oi,m)):(Di.addScaledVector(Pi.sub(Ai),m),Ii.addScaledVector(Ci.sub(Li),m),Ni.addScaledVector(Oi.sub(Ri),m)))}Ai.add(Di),Li.add(Ii),Ri.add(Ni)}var g=Vi(t,e,n,r,Ai,Li,Ri,Ui);if(g){s&&(zi.fromBufferAttribute(s,l),Bi.fromBufferAttribute(s,u),Fi.fromBufferAttribute(s,h),g.uv=qr.getUV(Ui,Ai,Li,Ri,zi,Bi,Fi,new bn)),c&&(zi.fromBufferAttribute(c,l),Bi.fromBufferAttribute(c,u),Fi.fromBufferAttribute(c,h),g.uv2=qr.getUV(Ui,Ai,Li,Ri,zi,Bi,Fi,new bn));var y=new ti(l,u,h);qr.getNormal(Ai,Li,Ri,y.normal),g.face=y}return g}Hi.prototype=Object.assign(Object.create(ar.prototype),{constructor:Hi,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ar.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)n=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),Ti.copy(r.boundingSphere),Ti.applyMatrix4(a),!1!==t.ray.intersectsSphere(Ti)&&(Si.getInverse(a),Ei.copy(t.ray).applyMatrix4(Si),null===r.boundingBox||!1!==Ei.intersectsBox(r.boundingBox))))if(this.drawMode===Re){if(r.isBufferGeometry){var o,s,c,l,u,h,d,p,f,m=r.index,v=r.attributes.position,g=r.morphAttributes.position,y=r.morphTargetsRelative,x=r.attributes.uv,b=r.attributes.uv2,w=r.groups,_=r.drawRange;if(null!==m)if(Array.isArray(i))for(l=0,h=w.length;l<h;l++)for(f=i[(p=w[l]).materialIndex],u=Math.max(p.start,_.start),d=Math.min(p.start+p.count,_.start+_.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),c=m.getX(u+2),(n=ki(this,f,t,Ei,v,g,y,x,b,o,s,c))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,e.push(n));else for(l=Math.max(0,_.start),h=Math.min(m.count,_.start+_.count);l<h;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(n=ki(this,i,t,Ei,v,g,y,x,b,o,s,c))&&(n.faceIndex=Math.floor(l/3),e.push(n));else if(void 0!==v)if(Array.isArray(i))for(l=0,h=w.length;l<h;l++)for(f=i[(p=w[l]).materialIndex],u=Math.max(p.start,_.start),d=Math.min(p.start+p.count,_.start+_.count);u<d;u+=3)(n=ki(this,f,t,Ei,v,g,y,x,b,o=u,s=u+1,c=u+2))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,e.push(n));else for(l=Math.max(0,_.start),h=Math.min(v.count,_.start+_.count);l<h;l+=3)(n=ki(this,i,t,Ei,v,g,y,x,b,o=l,s=l+1,c=l+2))&&(n.faceIndex=Math.floor(l/3),e.push(n))}else if(r.isGeometry){var M,S,E,T,A=Array.isArray(i),L=r.vertices,R=r.faces,P=r.faceVertexUvs[0];P.length>0&&(T=P);for(var C=0,O=R.length;C<O;C++){var D=R[C],I=A?i[D.materialIndex]:i;if(void 0!==I&&(M=L[D.a],S=L[D.b],E=L[D.c],n=Vi(this,I,t,Ei,M,S,E,Ui))){if(T&&T[C]){var N=T[C];zi.copy(N[0]),Bi.copy(N[1]),Fi.copy(N[2]),n.uv=qr.getUV(Ui,M,S,E,zi,Bi,Fi,new bn)}n.face=D,n.faceIndex=C,e.push(n)}}}}else console.warn("THREE.Mesh: TriangleStripDrawMode and TriangleFanDrawMode are not supported by .raycast().")},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var ji=0,Wi=new Hn,qi=new ar,Xi=new Sn;function Yi(){Object.defineProperty(this,"id",{value:ji+=2}),this.uuid=xn.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Yi.prototype=Object.assign(Object.create(vn.prototype),{constructor:Yi,isGeometry:!0,applyMatrix:function(t){for(var e=(new An).getNormalMatrix(t),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(t)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(e).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return Wi.makeRotationX(t),this.applyMatrix(Wi),this},rotateY:function(t){return Wi.makeRotationY(t),this.applyMatrix(Wi),this},rotateZ:function(t){return Wi.makeRotationZ(t),this.applyMatrix(Wi),this},translate:function(t,e,n){return Wi.makeTranslation(t,e,n),this.applyMatrix(Wi),this},scale:function(t,e,n){return Wi.makeScale(t,e,n),this.applyMatrix(Wi),this},lookAt:function(t){return qi.lookAt(t),qi.updateMatrix(),this.applyMatrix(qi.matrix),this},fromBufferGeometry:function(t){var e=this,n=null!==t.index?t.index.array:void 0,r=t.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=r.position.array,a=void 0!==r.normal?r.normal.array:void 0,o=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,c=void 0!==r.uv2?r.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)e.vertices.push((new Sn).fromArray(i,l)),void 0!==o&&e.colors.push((new Jr).fromArray(o,l));function u(t,n,r,i){var l=void 0===o?[]:[e.colors[t].clone(),e.colors[n].clone(),e.colors[r].clone()],u=new ti(t,n,r,void 0===a?[]:[(new Sn).fromArray(a,3*t),(new Sn).fromArray(a,3*n),(new Sn).fromArray(a,3*r)],l,i);e.faces.push(u),void 0!==s&&e.faceVertexUvs[0].push([(new bn).fromArray(s,2*t),(new bn).fromArray(s,2*n),(new bn).fromArray(s,2*r)]),void 0!==c&&e.faceVertexUvs[1].push([(new bn).fromArray(c,2*t),(new bn).fromArray(c,2*n),(new bn).fromArray(c,2*r)])}var h=t.groups;if(h.length>0)for(l=0;l<h.length;l++)for(var d=h[l],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==n?u(n[f],n[f+1],n[f+2],d.materialIndex):u(f,f+1,f+2,d.materialIndex);else if(void 0!==n)for(l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xi).negate(),this.translate(Xi.x,Xi.y,Xi.z),this},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,r=new Hn;return r.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var t=new Sn,e=new Sn,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];t.subVectors(s,o),e.subVectors(a,o),t.cross(e),t.normalize(),i.normal.copy(t)}},computeVertexNormals:function(t){var e,n,r,i,a,o;for(void 0===t&&(t=!0),o=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)o[e]=new Sn;if(t){var s,c,l,u=new Sn,h=new Sn;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(e=0,n=this.vertices.length;e<n;e++)o[e].normalize();for(r=0,i=this.faces.length;r<i;r++){var d=(a=this.faces[r]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){var r=(n=this.faces[t]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),t=0,e=i.vertexNormals.length;t<e;t++)i.__originalVertexNormals[t]?i.__originalVertexNormals[t].copy(i.vertexNormals[t]):i.__originalVertexNormals[t]=i.vertexNormals[t].clone();var a=new Yi;for(a.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var o=this.morphNormals[t].faceNormals,s=this.morphNormals[t].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)c=new Sn,l={a:new Sn,b:new Sn,c:new Sn},o.push(c),s.push(l)}var c,l,u=this.morphNormals[t];for(a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new br),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Mr),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(t&&t.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=t.vertices,s=this.faces,c=t.faces,l=this.colors,u=t.colors;void 0===n&&(n=0),void 0!==e&&(r=(new An).getNormalMatrix(e));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==e&&p.applyMatrix4(e),a.push(p)}for(h=0,d=u.length;h<d;h++)l.push(u[h].clone());for(h=0,d=c.length;h<d;h++){var f,m,v,g=c[h],y=g.vertexNormals,x=g.vertexColors;(f=new ti(g.a+i,g.b+i,g.c+i)).normal.copy(g.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==r&&m.applyMatrix3(r).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(b=0,w=x.length;b<w;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(h=0,d=t.faceVertexUvs.length;h<d;h++){var _=t.faceVertexUvs[h];void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],S=[],E=0,T=M.length;E<T;E++)S.push(M[E].clone());this.faceVertexUvs[h].push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t)},mergeMesh:function(t){t&&t.isMesh?(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t)},mergeVertices:function(){var t,e,n,r,i,a,o,s,c={},l=[],u=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)t=this.vertices[n],void 0===c[e=Math.round(t.x*h)+"_"+Math.round(t.y*h)+"_"+Math.round(t.z*h)]?(c[e]=n,l.push(this.vertices[n]),u[n]=l.length-1):u[n]=u[c[e]];var d=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(t){this.vertices=[];for(var e=0,n=t.length;e<n;e++){var r=t[e];this.vertices.push(new Sn(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,e=t.length,n=0;n<e;n++)t[n]._id=n;t.sort((function(t,e){return t.materialIndex-e.materialIndex}));var r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===e&&(r=[]),o&&o.length===e&&(i=[]);for(n=0;n<e;n++){var s=t[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],u={},h=[],d={};for(i=0;i<this.faces.length;i++){var p=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=p.normal.length()>0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,v),x=M(x,6,g),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][i];o.push(T(b[0]),T(b[1]),T(b[2]))}if(m&&o.push(S(p.normal)),v){var w=p.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(g&&o.push(E(p.color)),y){var _=p.vertexColors;o.push(E(_[0]),E(_[1]),E(_[2]))}}function M(t,e,n){return n?t|1<<e:t&~(1<<e)}function S(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==c[e]?c[e]:(c[e]=s.length/3,s.push(t.x,t.y,t.z),c[e])}function E(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==u[e]?u[e]:(u[e]=l.length,l.push(t.getHex()),u[e])}function T(t){var e=t.x.toString()+t.y.toString();return void 0!==d[e]?d[e]:(d[e]=h.length/2,h.push(t.x,t.y),d[e])}return t.data={},t.data.vertices=r,t.data.normals=s,l.length>0&&(t.data.colors=l),h.length>0&&(t.data.uvs=[h]),t.data.faces=o,t},clone:function(){return(new Yi).copy(this)},copy:function(t){var e,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e<n;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,n=c.length;e<n;e++)this.colors.push(c[e].clone());var l=t.faces;for(e=0,n=l.length;e<n;e++)this.faces.push(l[e].clone());for(e=0,n=t.faceVertexUvs.length;e<n;e++){var u=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),r=0,i=u.length;r<i;r++){var h=u[r],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[e].push(d)}}var f=t.morphTargets;for(e=0,n=f.length;e<n;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],r=0,i=f[e].vertices.length;r<i;r++)m.vertices.push(f[e].vertices[r].clone());if(void 0!==f[e].normals)for(m.normals=[],r=0,i=f[e].normals.length;r<i;r++)m.normals.push(f[e].normals[r].clone());this.morphTargets.push(m)}var v=t.morphNormals;for(e=0,n=v.length;e<n;e++){var g={};if(void 0!==v[e].vertexNormals)for(g.vertexNormals=[],r=0,i=v[e].vertexNormals.length;r<i;r++){var y=v[e].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[e].faceNormals)for(g.faceNormals=[],r=0,i=v[e].faceNormals.length;r<i;r++)g.faceNormals.push(v[e].faceNormals[r].clone());this.morphNormals.push(g)}var b=t.skinWeights;for(e=0,n=b.length;e<n;e++)this.skinWeights.push(b[e].clone());var w=t.skinIndices;for(e=0,n=w.length;e<n;e++)this.skinIndices.push(w[e].clone());var _=t.lineDistances;for(e=0,n=_.length;e<n;e++)this.lineDistances.push(_[e]);var M=t.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=t.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Zi extends Yi{constructor(t,e,n,r,i,a){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new Ji(t,e,n,r,i,a)),this.mergeVertices()}}class Ji extends Mi{constructor(t,e,n,r,i,a){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};var o=this;t=t||1,e=e||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var s=[],c=[],l=[],u=[],h=0,d=0;function p(t,e,n,r,i,a,p,f,m,v,g){var y,x,b=a/m,w=p/v,_=a/2,M=p/2,S=f/2,E=m+1,T=v+1,A=0,L=0,R=new Sn;for(x=0;x<T;x++){var P=x*w-M;for(y=0;y<E;y++){var C=y*b-_;R[t]=C*r,R[e]=P*i,R[n]=S,c.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=f>0?1:-1,l.push(R.x,R.y,R.z),u.push(y/m),u.push(1-x/v),A+=1}}for(x=0;x<v;x++)for(y=0;y<m;y++){var O=h+y+E*x,D=h+y+E*(x+1),I=h+(y+1)+E*(x+1),N=h+(y+1)+E*x;s.push(O,D,N),s.push(D,I,N),L+=6}o.addGroup(d,L,g),d+=L,h+=A}p("z","y","x",-1,-1,n,e,t,a,i,0),p("z","y","x",1,-1,n,e,-t,a,i,1),p("x","z","y",1,1,t,n,e,r,a,2),p("x","z","y",1,-1,t,n,-e,r,a,3),p("x","y","z",1,-1,t,e,n,r,i,4),p("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new di(c,3)),this.setAttribute("normal",new di(l,3)),this.setAttribute("uv",new di(u,2))}}function Ki(t){var e={};for(var n in t)for(var r in e[n]={},t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}return e}function Qi(t){for(var e={},n=0;n<t.length;n++){var r=Ki(t[n]);for(var i in r)e[i]=r[i]}return e}var $i={clone:Ki,merge:Qi},ta="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",ea="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function na(t){ni.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=ta,this.fragmentShader=ea,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function ra(){ar.call(this),this.type="Camera",this.matrixWorldInverse=new Hn,this.projectionMatrix=new Hn,this.projectionMatrixInverse=new Hn}function ia(t,e,n,r){ra.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}na.prototype=Object.create(ni.prototype),na.prototype.constructor=na,na.prototype.isShaderMaterial=!0,na.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ki(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},na.prototype.toJSON=function(t){var e=ni.prototype.toJSON.call(this,t);for(var n in e.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(e.extensions=i),e},ra.prototype=Object.assign(Object.create(ar.prototype),{constructor:ra,isCamera:!0,copy:function(t,e){return ar.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new Sn),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){ar.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),ia.prototype=Object.assign(Object.create(ra.prototype),{constructor:ia,isPerspectiveCamera:!0,copy:function(t,e){return ra.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*xn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*xn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*xn.RAD2DEG*Math.atan(Math.tan(.5*xn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*xn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,e-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(i+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=ar.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});var aa=90,oa=1;function sa(t,e,n,r){ar.call(this),this.type="CubeCamera";var i=new ia(aa,oa,t,e);i.up.set(0,-1,0),i.lookAt(new Sn(1,0,0)),this.add(i);var a=new ia(aa,oa,t,e);a.up.set(0,-1,0),a.lookAt(new Sn(-1,0,0)),this.add(a);var o=new ia(aa,oa,t,e);o.up.set(0,0,1),o.lookAt(new Sn(0,1,0)),this.add(o);var s=new ia(aa,oa,t,e);s.up.set(0,0,-1),s.lookAt(new Sn(0,-1,0)),this.add(s);var c=new ia(aa,oa,t,e);c.up.set(0,-1,0),c.lookAt(new Sn(0,0,1)),this.add(c);var l=new ia(aa,oa,t,e);l.up.set(0,-1,0),l.lookAt(new Sn(0,0,-1)),this.add(l),r=r||{format:kt,magFilter:Et,minFilter:Et},this.renderTarget=new ca(n,n,r),this.renderTarget.texture.name="CubeCamera",this.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=t.getRenderTarget(),r=this.renderTarget,u=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,t.setRenderTarget(r,0),t.render(e,i),t.setRenderTarget(r,1),t.render(e,a),t.setRenderTarget(r,2),t.render(e,o),t.setRenderTarget(r,3),t.render(e,s),t.setRenderTarget(r,4),t.render(e,c),r.texture.generateMipmaps=u,t.setRenderTarget(r,5),t.render(e,l),t.setRenderTarget(n)},this.clear=function(t,e,n,r){for(var i=t.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)t.setRenderTarget(a,o),t.clear(e,n,r);t.setRenderTarget(i)}}function ca(t,e,n){On.call(this,t,e,n)}function la(t,e,n,r,i,a,o,s,c,l,u,h){Pn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==c?c:bt,this.minFilter=void 0!==l?l:bt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}sa.prototype=Object.create(ar.prototype),sa.prototype.constructor=sa,ca.prototype=Object.create(On.prototype),ca.prototype.constructor=ca,ca.prototype.isWebGLRenderTargetCube=!0,ca.prototype.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=e.format,this.texture.encoding=e.encoding;var n=new or,r={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},i=new na({type:"CubemapFromEquirect",uniforms:Ki(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:g,blending:S});i.uniforms.tEquirect.value=e;var a=new Hi(new Ji(5,5,5),i);n.add(a);var o=new sa(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(t,n),a.geometry.dispose(),a.material.dispose(),this},la.prototype=Object.create(Pn.prototype),la.prototype.constructor=la,la.prototype.isDataTexture=!0;var ua=new Mr,ha=new Sn;function da(t,e,n,r,i,a){this.planes=[void 0!==t?t:new Nr,void 0!==e?e:new Nr,void 0!==n?n:new Nr,void 0!==r?r:new Nr,void 0!==i?i:new Nr,void 0!==a?a:new Nr]}Object.assign(da.prototype,{set:function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(o-r,u-s,f-h,y-m).normalize(),e[1].setComponents(o+r,u+s,f+h,y+m).normalize(),e[2].setComponents(o+i,u+c,f+d,y+v).normalize(),e[3].setComponents(o-i,u-c,f-d,y-v).normalize(),e[4].setComponents(o-a,u-l,f-p,y-g).normalize(),e[5].setComponents(o+a,u+l,f+p,y+g).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),ua.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(ua)},intersectsSprite:function(t){return ua.center.set(0,0,0),ua.radius=.7071067811865476,ua.applyMatrix4(t.matrixWorld),this.intersectsSphere(ua)},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:function(t){for(var e=this.planes,n=0;n<6;n++){var r=e[n];if(ha.x=r.normal.x>0?t.max.x:t.min.x,ha.y=r.normal.y>0?t.max.y:t.min.y,ha.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(ha)<0)return!1}return!0},containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}});var pa={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpack2HalfToRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpack2HalfToRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},fa={common:{diffuse:{value:new Jr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new An},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new bn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Jr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Jr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new An}},sprite:{diffuse:{value:new Jr(15658734)},opacity:{value:1},center:{value:new bn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new An}}},ma={basic:{uniforms:Qi([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.fog]),vertexShader:pa.meshbasic_vert,fragmentShader:pa.meshbasic_frag},lambert:{uniforms:Qi([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.fog,fa.lights,{emissive:{value:new Jr(0)}}]),vertexShader:pa.meshlambert_vert,fragmentShader:pa.meshlambert_frag},phong:{uniforms:Qi([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.gradientmap,fa.fog,fa.lights,{emissive:{value:new Jr(0)},specular:{value:new Jr(1118481)},shininess:{value:30}}]),vertexShader:pa.meshphong_vert,fragmentShader:pa.meshphong_frag},standard:{uniforms:Qi([fa.common,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.roughnessmap,fa.metalnessmap,fa.fog,fa.lights,{emissive:{value:new Jr(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag},matcap:{uniforms:Qi([fa.common,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.fog,{matcap:{value:null}}]),vertexShader:pa.meshmatcap_vert,fragmentShader:pa.meshmatcap_frag},points:{uniforms:Qi([fa.points,fa.fog]),vertexShader:pa.points_vert,fragmentShader:pa.points_frag},dashed:{uniforms:Qi([fa.common,fa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pa.linedashed_vert,fragmentShader:pa.linedashed_frag},depth:{uniforms:Qi([fa.common,fa.displacementmap]),vertexShader:pa.depth_vert,fragmentShader:pa.depth_frag},normal:{uniforms:Qi([fa.common,fa.bumpmap,fa.normalmap,fa.displacementmap,{opacity:{value:1}}]),vertexShader:pa.normal_vert,fragmentShader:pa.normal_frag},sprite:{uniforms:Qi([fa.sprite,fa.fog]),vertexShader:pa.sprite_vert,fragmentShader:pa.sprite_frag},background:{uniforms:{uvTransform:{value:new An},t2D:{value:null}},vertexShader:pa.background_vert,fragmentShader:pa.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pa.cube_vert,fragmentShader:pa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pa.equirect_vert,fragmentShader:pa.equirect_frag},distanceRGBA:{uniforms:Qi([fa.common,fa.displacementmap,{referencePosition:{value:new Sn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pa.distanceRGBA_vert,fragmentShader:pa.distanceRGBA_frag},shadow:{uniforms:Qi([fa.lights,fa.fog,{color:{value:new Jr(0)},opacity:{value:1}}]),vertexShader:pa.shadow_vert,fragmentShader:pa.shadow_frag}};function va(){var t=null,e=!1,n=null;function r(i,a){!1!==e&&(n(i,a),t.requestAnimationFrame(r))}return{start:function(){!0!==e&&null!==n&&(t.requestAnimationFrame(r),e=!0)},stop:function(){e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function ga(t){var e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var r=e.get(n);r&&(t.deleteBuffer(r.buffer),e.delete(n))},update:function(n,r){n.isInterleavedBufferAttribute&&(n=n.data);var i=e.get(n);void 0===i?e.set(n,function(e,n){var r=e.array,i=e.usage,a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,r,i),e.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(n,r)):i.version<n.version&&(!function(e,n,r){var i=n.array,a=n.updateRange;t.bindBuffer(r,e),-1===a.count?t.bufferSubData(r,0,i):(t.bufferSubData(r,a.offset*i.BYTES_PER_ELEMENT,i.subarray(a.offset,a.offset+a.count)),a.count=-1)}(i.buffer,n,r),i.version=n.version)}}}function ya(t,e,n,r){Yi.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new xa(t,e,n,r)),this.mergeVertices()}function xa(t,e,n,r){Mi.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};var i,a,o=(t=t||1)/2,s=(e=e||1)/2,c=Math.floor(n)||1,l=Math.floor(r)||1,u=c+1,h=l+1,d=t/c,p=e/l,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*p-s;for(i=0;i<u;i++){var x=i*d-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/c),g.push(1-a/l)}}for(a=0;a<l;a++)for(i=0;i<c;i++){var b=i+u*a,w=i+u*(a+1),_=i+1+u*(a+1),M=i+1+u*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new di(m,3)),this.setAttribute("normal",new di(v,3)),this.setAttribute("uv",new di(g,2))}function ba(t,e,n,r){var i,a,o=new Jr(0),s=0,c=null,l=0;function u(t,n){e.buffers.color.setClear(t.r,t.g,t.b,n,r)}return{getClearColor:function(){return o},setClearColor:function(t,e){o.set(t),u(o,s=void 0!==e?e:1)},getClearAlpha:function(){return s},setClearAlpha:function(t){u(o,s=t)},render:function(e,r,h,d){var p=r.background,f=t.vr,m=f.getSession&&f.getSession();if(m&&"additive"===m.environmentBlendMode&&(p=null),null===p?(u(o,s),c=null,l=0):p&&p.isColor&&(u(p,1),d=!0,c=null,l=0),(t.autoClear||d)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLRenderTargetCube)){void 0===a&&((a=new Hi(new Ji(1,1,1),new na({type:"BackgroundCubeMaterial",uniforms:Ki(ma.cube.uniforms),vertexShader:ma.cube.vertexShader,fragmentShader:ma.cube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.tCube.value}}),n.update(a));var y=p.isWebGLRenderTargetCube?p.texture:p;a.material.uniforms.tCube.value=y,a.material.uniforms.tFlip.value=p.isWebGLRenderTargetCube?1:-1,c===p&&l===y.version||(a.material.needsUpdate=!0,c=p,l=y.version),e.unshift(a,a.geometry,a.material,0,0,null)}else p&&p.isTexture&&(void 0===i&&((i=new Hi(new xa(2,2),new na({type:"BackgroundMaterial",uniforms:Ki(ma.background.uniforms),vertexShader:ma.background.vertexShader,fragmentShader:ma.background.fragmentShader,side:v,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(i)),i.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),i.material.uniforms.uvTransform.value.copy(p.matrix),c===p&&l===p.version||(i.material.needsUpdate=!0,c=p,l=p.version),e.unshift(i,i.geometry,i.material,0,0,null))}}}function wa(t,e,n,r){var i,a=r.isWebGL2;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i)},this.renderInstances=function(r,o,s,c){if(0!==c){var l,u;if(a)l=t,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,o,s,c),n.update(s,i,c)}}}function _a(t,e,n){var r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===n.logarithmicDepthBuffer,l=t.getParameter(34930),u=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=u>0,y=a||!!e.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=e.get("EXT_texture_filter_anisotropic");return r=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function Ma(){var t=this,e=null,n=0,r=!1,i=!1,a=new Nr,o=new An,s={value:null,needsUpdate:!1};function c(){s.value!==e&&(s.value=e,s.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function l(e,n,r,i){var c=null!==e?e.length:0,l=null;if(0!==c){if(l=s.value,!0!==i||null===l){var u=r+4*c,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===l||l.length<u)&&(l=new Float32Array(u));for(var d=0,p=r;d!==c;++d,p+=4)a.copy(e[d]).applyMatrix4(h,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return t.numPlanes=c,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(t,i,a){var o=0!==t.length||i||0!==n||r;return r=i,e=l(t,a,0),n=t.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(t,a,o,u,h,d){if(!r||null===t||0===t.length||i&&!o)i?l(null):c();else{var p=i?0:n,f=4*p,m=h.clippingState||null;s.value=m,m=l(t,u,f,d);for(var v=0;v!==f;++v)m[v]=e[v];h.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function Sa(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function Ea(t,e,n){var r=new WeakMap,i=new WeakMap;function a(t){var o=t.target,s=r.get(o);for(var c in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[c]);o.removeEventListener("dispose",a),r.delete(o);var l=i.get(s);l&&(e.remove(l),i.delete(s)),n.memory.geometries--}function o(t){var n=[],r=t.index,a=t.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],h=s[c+1],d=s[c+2];n.push(u,h,h,d,d,u)}}else{s=a.array;o=a.version;for(c=0,l=s.length/3-1;c<l;c+=3){u=c+0,h=c+1,d=c+2;n.push(u,h,h,d,d,u)}}var p=new(mi(n)>65535?hi:li)(n,1);p.version=o,e.update(p,34963);var f=i.get(t);f&&e.remove(f),i.set(t,p)}return{get:function(t,e){var i=r.get(e);return i||(e.addEventListener("dispose",a),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Mi).setFromObject(t)),i=e._bufferGeometry),r.set(e,i),n.memory.geometries++,i)},update:function(t){var n=t.index,r=t.attributes;for(var i in null!==n&&e.update(n,34963),r)e.update(r[i],34962);var a=t.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)e.update(o[s],34962)},getWireframeAttribute:function(t){var e=i.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return i.get(t)}}}function Ta(t,e,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(t){i=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,r){t.drawElements(i,r,a,e*o),n.update(r,i)},this.renderInstances=function(r,c,l,u){if(0!==u){var h,d;if(s)h=t,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(h=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](i,l,a,c*o,u),n.update(l,i,u)}}}function Aa(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(r=r||1,e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 5:case 6:e.triangles+=r*(t-2);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function La(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ra(t){var e={},n=new Float32Array(8);return{update:function(r,i,a,o){var s=r.morphTargetInfluences,c=s.length,l=e[i.id];if(void 0===l){l=[];for(var u=0;u<c;u++)l[u]=[u,0];e[i.id]=l}var h=a.morphTargets&&i.morphAttributes.position,d=a.morphNormals&&i.morphAttributes.normal;for(u=0;u<c;u++){0!==(f=l[u])[1]&&(h&&i.deleteAttribute("morphTarget"+u),d&&i.deleteAttribute("morphNormal"+u))}for(u=0;u<c;u++){(f=l[u])[0]=u,f[1]=s[u]}l.sort(La);var p=0;for(u=0;u<8;u++){var f;if(f=l[u]){var m=f[0],v=f[1];if(v){h&&i.setAttribute("morphTarget"+u,h[m]),d&&i.setAttribute("morphNormal"+u,d[m]),n[u]=v,p+=v;continue}}n[u]=0}var g=i.morphTargetsRelative?1:1-p;o.getUniforms().setValue(t,"morphTargetBaseInfluence",g),o.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function Pa(t,e,n,r){var i={};return{update:function(t){var a=r.render.frame,o=t.geometry,s=e.get(t,o);return i[s.id]!==a&&(o.isGeometry&&s.updateFromObject(t),e.update(s),i[s.id]=a),t.isInstancedMesh&&n.update(t.instanceMatrix,34962),s},dispose:function(){i={}}}}function Ca(t,e,n,r,i,a,o,s,c,l){t=void 0!==t?t:[],e=void 0!==e?e:ut,o=void 0!==o?o:kt,Pn.call(this,t,e,n,r,i,a,o,s,c,l),this.flipY=!1}function Oa(t,e,n,r){Pn.call(this,null),this.image={data:t||null,width:e||1,height:n||1,depth:r||1},this.magFilter=bt,this.minFilter=bt,this.wrapR=yt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Da(t,e,n,r){Pn.call(this,null),this.image={data:t||null,width:e||1,height:n||1,depth:r||1},this.magFilter=bt,this.minFilter=bt,this.wrapR=yt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}ma.physical={uniforms:Qi([ma.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new Jr(0)},clearcoatNormalScale:{value:new bn(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:pa.meshphysical_vert,fragmentShader:pa.meshphysical_frag},ya.prototype=Object.create(Yi.prototype),ya.prototype.constructor=ya,xa.prototype=Object.create(Mi.prototype),xa.prototype.constructor=xa,Ca.prototype=Object.create(Pn.prototype),Ca.prototype.constructor=Ca,Ca.prototype.isCubeTexture=!0,Object.defineProperty(Ca.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}}),Oa.prototype=Object.create(Pn.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isDataTexture2DArray=!0,Da.prototype=Object.create(Pn.prototype),Da.prototype.constructor=Da,Da.prototype.isDataTexture3D=!0;var Ia=new Pn,Na=new Oa,za=new Da,Ba=new Ca,Fa=[],Ua=[],Ga=new Float32Array(16),Ha=new Float32Array(9),Va=new Float32Array(4);function ka(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,a=Fa[i];if(void 0===a&&(a=new Float32Array(i),Fa[i]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function ja(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Wa(t,e){for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}function qa(t,e){var n=Ua[e];void 0===n&&(n=new Int32Array(e),Ua[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function Xa(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ya(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ja(n,e))return;t.uniform2fv(this.addr,e),Wa(n,e)}}function Za(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ja(n,e))return;t.uniform3fv(this.addr,e),Wa(n,e)}}function Ja(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ja(n,e))return;t.uniform4fv(this.addr,e),Wa(n,e)}}function Ka(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ja(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Wa(n,e)}else{if(ja(n,r))return;Va.set(r),t.uniformMatrix2fv(this.addr,!1,Va),Wa(n,r)}}function Qa(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ja(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Wa(n,e)}else{if(ja(n,r))return;Ha.set(r),t.uniformMatrix3fv(this.addr,!1,Ha),Wa(n,r)}}function $a(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(ja(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Wa(n,e)}else{if(ja(n,r))return;Ga.set(r),t.uniformMatrix4fv(this.addr,!1,Ga),Wa(n,r)}}function to(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||Ia,i)}function eo(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Na,i)}function no(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||za,i)}function ro(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||Ba,i)}function io(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function ao(t,e){var n=this.cache;ja(n,e)||(t.uniform2iv(this.addr,e),Wa(n,e))}function oo(t,e){var n=this.cache;ja(n,e)||(t.uniform3iv(this.addr,e),Wa(n,e))}function so(t,e){var n=this.cache;ja(n,e)||(t.uniform4iv(this.addr,e),Wa(n,e))}function co(t,e){t.uniform1fv(this.addr,e)}function lo(t,e){t.uniform1iv(this.addr,e)}function uo(t,e){t.uniform2iv(this.addr,e)}function ho(t,e){t.uniform3iv(this.addr,e)}function po(t,e){t.uniform4iv(this.addr,e)}function fo(t,e){var n=ka(e,this.size,2);t.uniform2fv(this.addr,n)}function mo(t,e){var n=ka(e,this.size,3);t.uniform3fv(this.addr,n)}function vo(t,e){var n=ka(e,this.size,4);t.uniform4fv(this.addr,n)}function go(t,e){var n=ka(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function yo(t,e){var n=ka(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function xo(t,e){var n=ka(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function bo(t,e,n){var r=e.length,i=qa(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(e[a]||Ia,i[a])}function wo(t,e,n){var r=e.length,i=qa(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(e[a]||Ba,i[a])}function _o(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Xa;case 35664:return Ya;case 35665:return Za;case 35666:return Ja;case 35674:return Ka;case 35675:return Qa;case 35676:return $a;case 35678:case 36198:return to;case 35679:return no;case 35680:return ro;case 36289:return eo;case 5124:case 35670:return io;case 35667:case 35671:return ao;case 35668:case 35672:return oo;case 35669:case 35673:return so}}(e.type)}function Mo(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return co;case 35664:return fo;case 35665:return mo;case 35666:return vo;case 35674:return go;case 35675:return yo;case 35676:return xo;case 35678:return bo;case 35680:return wo;case 5124:case 35670:return lo;case 35667:case 35671:return uo;case 35668:case 35672:return ho;case 35669:case 35673:return po}}(e.type)}function So(t){this.id=t,this.seq=[],this.map={}}Mo.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Wa(e,t)},So.prototype.setValue=function(t,e,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(t,e[o.id],n)}};var Eo=/([\w\d_]+)(\])?(\[|\.)?/g;function To(t,e){t.seq.push(e),t.map[e.id]=e}function Ao(t,e,n){var r=t.name,i=r.length;for(Eo.lastIndex=0;;){var a=Eo.exec(r),o=Eo.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===i){To(n,void 0===l?new _o(s,t,e):new Mo(s,t,e));break}var u=n.map[s];void 0===u&&To(n,u=new So(s)),n=u}}function Lo(t,e){this.seq=[],this.map={};for(var n=t.getProgramParameter(e,35718),r=0;r<n;++r){var i=t.getActiveUniform(e,r);Ao(i,t.getUniformLocation(e,i.name),this)}}function Ro(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}Lo.prototype.setValue=function(t,e,n,r){var i=this.map[e];void 0!==i&&i.setValue(t,n,r)},Lo.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},Lo.upload=function(t,e,n,r){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,r)}},Lo.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var a=t[r];a.id in e&&n.push(a)}return n};var Po=0;function Co(t){switch(t){case Oe:return["Linear","( value )"];case De:return["sRGB","( value )"];case Ne:return["RGBE","( value )"];case Be:return["RGBM","( value, 7.0 )"];case Fe:return["RGBM","( value, 16.0 )"];case Ue:return["RGBD","( value, 256.0 )"];case Ie:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case ze:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+t)}}function Oo(t,e,n){var r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}(t.getShaderSource(e))}function Do(t,e){var n=Co(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Io(t,e){var n;switch(e){case it:n="Linear";break;case at:n="Reinhard";break;case ot:n="Uncharted2";break;case st:n="OptimizedCineon";break;case ct:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function No(t){return""!==t}function zo(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Bo(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Fo=/^[ \t]*#include +<([\w\d./]+)>/gm;function Uo(t){return t.replace(Fo,Go)}function Go(t,e){var n=pa[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Uo(n)}var Ho=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function Vo(t){return t.replace(Ho,ko)}function ko(t,e,n,r){for(var i="",a=parseInt(e);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function jo(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Wo(t,e,n,r,i,a){var o,s,c,l,u,h=t.getContext(),d=r.defines,v=i.vertexShader,g=i.fragmentShader,y=function(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===p?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===f?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===m&&(e="SHADOWMAP_TYPE_VSM"),e}(a),x=function(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ut:case ht:e="ENVMAP_TYPE_CUBE";break;case mt:case vt:e="ENVMAP_TYPE_CUBE_UV";break;case dt:case pt:e="ENVMAP_TYPE_EQUIREC";break;case ft:e="ENVMAP_TYPE_SPHERE"}return e}(a),b=function(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case ht:case pt:e="ENVMAP_MODE_REFRACTION"}return e}(a),w=function(t){var e="ENVMAP_BLENDING_MULTIPLY";if(t.envMap)switch(t.combine){case tt:e="ENVMAP_BLENDING_MULTIPLY";break;case et:e="ENVMAP_BLENDING_MIX";break;case nt:e="ENVMAP_BLENDING_ADD"}return e}(a),_=t.gammaFactor>0?t.gammaFactor:1,M=a.isWebGL2?"":function(t,e,n){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(No).join("\n")}(r.extensions,a,e),S=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(d),E=h.createProgram(),T=a.numMultiviewViews;if(r.isRawShaderMaterial?((o=[S].filter(No).join("\n")).length>0&&(o+="\n"),(s=[M,S].filter(No).join("\n")).length>0&&(s+="\n")):(o=[jo(a),"#define SHADER_NAME "+i.name,S,a.instancing?"#define USE_INSTANCING":"",a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+_,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+b:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+y:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(No).join("\n"),s=[M,jo(a),"#define SHADER_NAME "+i.name,S,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+_,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+x:"",a.envMap?"#define "+b:"",a.envMap?"#define "+w:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.sheen?"#define USE_SHEEN":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+y:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(r.extensions&&r.extensions.shaderTextureLOD||a.envMap)&&(a.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",a.toneMapping!==rt?"#define TONE_MAPPING":"",a.toneMapping!==rt?pa.tonemapping_pars_fragment:"",a.toneMapping!==rt?Io("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?pa.encodings_pars_fragment:"",a.mapEncoding?Do("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Do("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Do("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Do("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(c="linearToOutputTexel",l=a.outputEncoding,u=Co(l),"vec4 "+c+"( vec4 value ) { return LinearTo"+u[0]+u[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(No).join("\n")),v=Bo(v=zo(v=Uo(v),a),a),g=Bo(g=zo(g=Uo(g),a),a),v=Vo(v),g=Vo(g),a.isWebGL2&&!r.isRawShaderMaterial){var A=!1,L=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==v.match(L)&&null!==g.match(L)&&(A=!0,v=v.replace(L,""),g=g.replace(L,"")),o=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#version 300 es\n","#define varying in",A?"":"out highp vec4 pc_fragColor;",A?"":"#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"+s,T>0&&(o=(o=o.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","layout(num_views = "+T+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+T+"];","uniform mat4 projectionMatrices["+T+"];","uniform mat4 viewMatrices["+T+"];","uniform mat3 normalMatrices["+T+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+T+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))}var R,P,C=s+g,O=Ro(h,35633,o+v),D=Ro(h,35632,C);if(h.attachShader(E,O),h.attachShader(E,D),void 0!==r.index0AttributeName?h.bindAttribLocation(E,0,r.index0AttributeName):!0===a.morphTargets&&h.bindAttribLocation(E,0,"position"),h.linkProgram(E),t.debug.checkShaderErrors){var I=h.getProgramInfoLog(E).trim(),N=h.getShaderInfoLog(O).trim(),z=h.getShaderInfoLog(D).trim(),B=!0,F=!0;if(!1===h.getProgramParameter(E,35714)){B=!1;var U=Oo(h,O,"vertex"),G=Oo(h,D,"fragment");console.error("THREE.WebGLProgram: shader error: ",h.getError(),"35715",h.getProgramParameter(E,35715),"gl.getProgramInfoLog",I,U,G)}else""!==I?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",I):""!==N&&""!==z||(F=!1);F&&(this.diagnostics={runnable:B,material:r,programLog:I,vertexShader:{log:N,prefix:o},fragmentShader:{log:z,prefix:s}})}return h.deleteShader(O),h.deleteShader(D),this.getUniforms=function(){return void 0===R&&(R=new Lo(h,E)),R},this.getAttributes=function(){return void 0===P&&(P=function(t,e){for(var n={},r=t.getProgramParameter(e,35721),i=0;i<r;i++){var a=t.getActiveAttrib(e,i).name;n[a]=t.getAttribLocation(e,a)}return n}(h,E)),P},this.destroy=function(){h.deleteProgram(E),this.program=void 0},this.name=i.name,this.id=Po++,this.cacheKey=n,this.usedTimes=1,this.program=E,this.vertexShader=O,this.fragmentShader=D,this.numMultiviewViews=T,this}function qo(t,e,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},h=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","numMultiviewViews","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function d(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=Oe,n===Oe&&e&&(n=Ie),n}this.getParameters=function(e,r,h,p,f,m,v){var x=u[e.type],b=v.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(o)return 1024;var n=c,r=Math.floor((n-20)/4),i=Math.min(r,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}(v):0;null!==e.precision&&(s=n.getMaxPrecision(e.precision))!==e.precision&&console.warn("THREE.WebGLProgram.getParameters:",e.precision,"not supported, using",s,"instead.");var w=t.getRenderTarget(),_=w&&w.isWebGLMultiviewRenderTarget?w.numViews:0;return{isWebGL2:i,shaderID:x,precision:s,instancing:!0===v.isInstancedMesh,supportsVertexTextures:l,numMultiviewViews:_,outputEncoding:d(w?w.texture:null,t.gammaOutput),map:!!e.map,mapEncoding:d(e.map,t.gammaInput),matcap:!!e.matcap,matcapEncoding:d(e.matcap,t.gammaInput),envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,envMapEncoding:d(e.envMap,t.gammaInput),envMapCubeUV:!!e.envMap&&(e.envMap.mapping===mt||e.envMap.mapping===vt),lightMap:!!e.lightMap,aoMap:!!e.aoMap,emissiveMap:!!e.emissiveMap,emissiveMapEncoding:d(e.emissiveMap,t.gammaInput),bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,objectSpaceNormalMap:e.normalMapType===ke,tangentSpaceNormalMap:e.normalMapType===Ve,clearcoatNormalMap:!!e.clearcoatNormalMap,displacementMap:!!e.displacementMap,roughnessMap:!!e.roughnessMap,metalnessMap:!!e.metalnessMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,gradientMap:!!e.gradientMap,sheen:!!e.sheen,combine:e.combine,vertexTangents:e.normalMap&&e.vertexTangents,vertexColors:e.vertexColors,vertexUvs:!!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap||e.displacementMap),uvsVertexOnly:!(e.map||e.bumpMap||e.normalMap||e.specularMap||e.alphaMap||e.emissiveMap||e.roughnessMap||e.metalnessMap||e.clearcoatNormalMap||!e.displacementMap),fog:!!p,useFog:e.fog,fogExp2:p&&p.isFogExp2,flatShading:e.flatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:a,skinning:e.skinning&&b>0,maxBones:b,useVertexTexture:o,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numDirLightShadows:r.directionalShadowMap.length,numPointLightShadows:r.pointShadowMap.length,numSpotLightShadows:r.spotShadowMap.length,numClippingPlanes:f,numClipIntersection:m,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:e.toneMapped?t.toneMapping:rt,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:e.side===y,flipSided:e.side===g,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCacheKey=function(e,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var a=0;a<h.length;a++)r.push(n[h[a]]);return r.push(e.onBeforeCompile.toString()),r.push(t.gammaOutput),r.push(t.gammaFactor),r.join()},this.acquireProgram=function(n,i,a,o){for(var s,c=0,l=r.length;c<l;c++){var u=r[c];if(u.cacheKey===o){++(s=u).usedTimes;break}}return void 0===s&&(s=new Wo(t,e,o,n,i,a),r.push(s)),s},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function Xo(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Yo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Zo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Jo(){var t=[],e=0,n=[],r=[],i={id:-1};function a(n,r,a,o,s,c){var l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},t[e]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),e++,l}return{opaque:n,transparent:r,init:function(){e=0,n.length=0,r.length=0},push:function(t,e,i,o,s,c){var l=a(t,e,i,o,s,c);(!0===i.transparent?r:n).push(l)},unshift:function(t,e,i,o,s,c){var l=a(t,e,i,o,s,c);(!0===i.transparent?r:n).unshift(l)},sort:function(){n.length>1&&n.sort(Yo),r.length>1&&r.sort(Zo)}}}function Ko(){var t=new WeakMap;function e(n){var r=n.target;r.removeEventListener("dispose",e),t.delete(r)}return{get:function(n,r){var i,a=t.get(n);return void 0===a?(i=new Jo,t.set(n,new WeakMap),t.get(n).set(r,i),n.addEventListener("dispose",e)):void 0===(i=a.get(r))&&(i=new Jo,a.set(r,i)),i},dispose:function(){t=new WeakMap}}}function Qo(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Sn,color:new Jr,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"SpotLight":n={position:new Sn,direction:new Sn,color:new Jr,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new bn};break;case"PointLight":n={position:new Sn,color:new Jr,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new bn,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new Sn,skyColor:new Jr,groundColor:new Jr};break;case"RectAreaLight":n={color:new Jr,position:new Sn,halfWidth:new Sn,halfHeight:new Sn}}return t[e.id]=n,n}}}var $o=0;function ts(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function es(){for(var t=new Qo,e={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},n=0;n<9;n++)e.probe.push(new Sn);var r=new Sn,i=new Hn,a=new Hn;return{setup:function(n,o,s){for(var c=0,l=0,u=0,h=0;h<9;h++)e.probe[h].set(0,0,0);var d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,b=s.matrixWorldInverse;n.sort(ts),h=0;for(var w=n.length;h<w;h++){var _=n[h],M=_.color,S=_.intensity,E=_.distance,T=_.shadow&&_.shadow.map?_.shadow.map.texture:null;if(_.isAmbientLight)c+=M.r*S,l+=M.g*S,u+=M.b*S;else if(_.isLightProbe)for(var A=0;A<9;A++)e.probe[A].addScaledVector(_.sh.coefficients[A],S);else if(_.isDirectionalLight){if((R=t.get(_)).color.copy(_.color).multiplyScalar(_.intensity),R.direction.setFromMatrixPosition(_.matrixWorld),r.setFromMatrixPosition(_.target.matrixWorld),R.direction.sub(r),R.direction.transformDirection(b),R.shadow=_.castShadow,_.castShadow){var L=_.shadow;R.shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,e.directionalShadowMap[d]=T,e.directionalShadowMatrix[d]=_.shadow.matrix,g++}e.directional[d]=R,d++}else if(_.isSpotLight){if((R=t.get(_)).position.setFromMatrixPosition(_.matrixWorld),R.position.applyMatrix4(b),R.color.copy(M).multiplyScalar(S),R.distance=E,R.direction.setFromMatrixPosition(_.matrixWorld),r.setFromMatrixPosition(_.target.matrixWorld),R.direction.sub(r),R.direction.transformDirection(b),R.coneCos=Math.cos(_.angle),R.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),R.decay=_.decay,R.shadow=_.castShadow,_.castShadow){L=_.shadow;R.shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,e.spotShadowMap[f]=T,e.spotShadowMatrix[f]=_.shadow.matrix,x++}e.spot[f]=R,f++}else if(_.isRectAreaLight){(R=t.get(_)).color.copy(M).multiplyScalar(S),R.position.setFromMatrixPosition(_.matrixWorld),R.position.applyMatrix4(b),a.identity(),i.copy(_.matrixWorld),i.premultiply(b),a.extractRotation(i),R.halfWidth.set(.5*_.width,0,0),R.halfHeight.set(0,.5*_.height,0),R.halfWidth.applyMatrix4(a),R.halfHeight.applyMatrix4(a),e.rectArea[m]=R,m++}else if(_.isPointLight){if((R=t.get(_)).position.setFromMatrixPosition(_.matrixWorld),R.position.applyMatrix4(b),R.color.copy(_.color).multiplyScalar(_.intensity),R.distance=_.distance,R.decay=_.decay,R.shadow=_.castShadow,_.castShadow){L=_.shadow;R.shadowBias=L.bias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,R.shadowCameraNear=L.camera.near,R.shadowCameraFar=L.camera.far,e.pointShadowMap[p]=T,e.pointShadowMatrix[p]=_.shadow.matrix,y++}e.point[p]=R,p++}else if(_.isHemisphereLight){var R;(R=t.get(_)).direction.setFromMatrixPosition(_.matrixWorld),R.direction.transformDirection(b),R.direction.normalize(),R.skyColor.copy(_.color).multiplyScalar(S),R.groundColor.copy(_.groundColor).multiplyScalar(S),e.hemi[v]=R,v++}}e.ambient[0]=c,e.ambient[1]=l,e.ambient[2]=u;var P=e.hash;P.directionalLength===d&&P.pointLength===p&&P.spotLength===f&&P.rectAreaLength===m&&P.hemiLength===v&&P.numDirectionalShadows===g&&P.numPointShadows===y&&P.numSpotShadows===x||(e.directional.length=d,e.spot.length=f,e.rectArea.length=m,e.point.length=p,e.hemi.length=v,e.directionalShadowMap.length=g,e.pointShadowMap.length=y,e.spotShadowMap.length=x,e.directionalShadowMatrix.length=g,e.pointShadowMatrix.length=y,e.spotShadowMatrix.length=x,P.directionalLength=d,P.pointLength=p,P.spotLength=f,P.rectAreaLength=m,P.hemiLength=v,P.numDirectionalShadows=g,P.numPointShadows=y,P.numSpotShadows=x,e.version=$o++)},state:e}}function ns(){var t=new es,e=[],n=[];return{init:function(){e.length=0,n.length=0},state:{lightsArray:e,shadowsArray:n,lights:t},setupLights:function(r){t.setup(e,n,r)},pushLight:function(t){e.push(t)},pushShadow:function(t){n.push(t)}}}function rs(){var t=new WeakMap;function e(n){var r=n.target;r.removeEventListener("dispose",e),t.delete(r)}return{get:function(n,r){var i;return!1===t.has(n)?(i=new ns,t.set(n,new WeakMap),t.get(n).set(r,i),n.addEventListener("dispose",e)):!1===t.get(n).has(r)?(i=new ns,t.get(n).set(r,i)):i=t.get(n).get(r),i},dispose:function(){t=new WeakMap}}}function is(t){ni.call(this),this.type="MeshDepthMaterial",this.depthPacking=Ge,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function as(t){ni.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Sn,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}is.prototype=Object.create(ni.prototype),is.prototype.constructor=is,is.prototype.isMeshDepthMaterial=!0,is.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},as.prototype=Object.create(ni.prototype),as.prototype.constructor=as,as.prototype.isMeshDistanceMaterial=!0,as.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this};var os="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpack2HalfToRGBA ( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 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, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ss="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function cs(t,e,n){var r=new da,i=new bn,a=new bn,o=new Cn,s=[],c=[],l={},u={0:g,1:v,2:y},h=new na({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new bn},radius:{value:4}},vertexShader:ss,fragmentShader:os}),d=h.clone();d.defines.HORIZONAL_PASS=1;var f=new Mi;f.setAttribute("position",new ii(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new Hi(f,h),b=this;function w(n,r){var i=e.update(x);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,h,x,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,d,x,null)}function _(t,e,n){var r=t<<0|e<<1|n<<2,i=s[r];return void 0===i&&(i=new is({depthPacking:He,morphTargets:t,skinning:e}),s[r]=i),i}function M(t,e,n){var r=t<<0|e<<1|n<<2,i=c[r];return void 0===i&&(i=new as({morphTargets:t,skinning:e}),c[r]=i),i}function E(e,n,r,i,a,o){var s=e.geometry,c=null,h=_,d=e.customDepthMaterial;if(!0===r.isPointLight&&(h=M,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===n.morphTargets&&(!0===s.isBufferGeometry?p=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:!0===s.isGeometry&&(p=s.morphTargets&&s.morphTargets.length>0));var f=!1;!0===e.isSkinnedMesh&&(!0===n.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),c=h(p,f,!0===e.isInstancedMesh)}else c=d;if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var v=c.uuid,g=n.uuid,y=l[v];void 0===y&&(y={},l[v]=y);var x=y[g];void 0===x&&(x=c.clone(),y[g]=x),c=x}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=o===m?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function T(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===m)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=e.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,h=0,d=u.length;h<d;h++){var p=u[h],f=l[p.materialIndex];if(f&&f.visible){var v=E(n,f,o,a.near,a.far,s);t.renderBufferDirect(a,null,c,v,n,p)}}else if(l.visible){v=E(n,l,o,a.near,a.far,s);t.renderBufferDirect(a,null,c,v,n,null)}}for(var g=n.children,y=0,x=g.length;y<x;y++)T(g[y],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p,this.render=function(e,s,c){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==e.length){var l=t.getRenderTarget(),u=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(S),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=e.length;p<f;p++){var v=e[p],g=v.shadow;if(void 0!==g){i.copy(g.mapSize);var y=g.getFrameExtents();if(i.multiply(y),a.copy(g.mapSize),(i.x>n||i.y>n)&&(console.warn("THREE.WebGLShadowMap:",v,"has shadow exceeding max texture size, reducing"),i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,g.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,g.mapSize.y=a.y)),null===g.map&&!g.isPointLightShadow&&this.type===m){var x={minFilter:Et,magFilter:Et,format:jt};g.map=new On(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.mapPass=new On(i.x,i.y,x),g.camera.updateProjectionMatrix()}if(null===g.map){x={minFilter:bt,magFilter:bt,format:jt};g.map=new On(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()}t.setRenderTarget(g.map),t.clear();for(var _=g.getViewportCount(),M=0;M<_;M++){var E=g.getViewport(M);o.set(a.x*E.x,a.y*E.y,a.x*E.z,a.y*E.w),d.viewport(o),g.updateMatrices(v,M),r=g.getFrustum(),T(s,c,g.camera,v,this.type)}g.isPointLightShadow||this.type!==m||w(g,c)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}b.needsUpdate=!1,t.setRenderTarget(l,u,h)}}}function ls(t,e,n){var r=n.isWebGL2;var i=new function(){var e=!1,n=new Cn,r=null,i=new Cn(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){var e=!1,n=null,r=null,i=null;return{setTest:function(t){t?xt(2929):bt(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case q:t.depthFunc(512);break;case X:t.depthFunc(519);break;case Y:t.depthFunc(513);break;case Z:t.depthFunc(515);break;case J:t.depthFunc(514);break;case K:t.depthFunc(518);break;case Q:t.depthFunc(516);break;case $:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},l=new function(){var e=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(t){e||(t?xt(2960):bt(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&s===n&&c===r||(t.stencilOp(e,n,r),o=e,s=n,c=r)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}},u=t.getParameter(34921),h=new Uint8Array(u),d=new Uint8Array(u),p=new Uint8Array(u),f={},m=null,v=null,x=null,b=null,w=null,_=null,M=null,tt=null,et=null,nt=!1,rt=null,it=null,at=null,ot=null,st=null,ct=t.getParameter(35661),lt=!1,ut=0,ht=t.getParameter(7938);-1!==ht.indexOf("WebGL")?(ut=parseFloat(/^WebGL\ ([0-9])/.exec(ht)[1]),lt=ut>=1):-1!==ht.indexOf("OpenGL ES")&&(ut=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(ht)[1]),lt=ut>=2);var dt=null,pt={},ft=new Cn,mt=new Cn;function vt(e,n,r){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var gt={};function yt(n,i){(h[n]=1,0===d[n]&&(t.enableVertexAttribArray(n),d[n]=1),p[n]!==i)&&((r?t:e.get("ANGLE_instanced_arrays"))[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),p[n]=i)}function xt(e){!0!==f[e]&&(t.enable(e),f[e]=!0)}function bt(e){!1!==f[e]&&(t.disable(e),f[e]=!1)}gt[3553]=vt(3553,3553,1),gt[34067]=vt(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),l.setClear(0),xt(2929),a.setFunc(Z),Et(!1),Tt(s),xt(2884),St(S);var wt={[P]:32774,[C]:32778,[O]:32779};if(r)wt[D]=32775,wt[I]=32776;else{var _t=e.get("EXT_blend_minmax");null!==_t&&(wt[D]=_t.MIN_EXT,wt[I]=_t.MAX_EXT)}var Mt={[N]:0,[z]:1,[B]:768,[U]:770,[W]:776,[k]:774,[H]:772,[F]:769,[G]:771,[j]:775,[V]:773};function St(e,n,r,i,a,o,s,c){if(e!==S){if(v||(xt(3042),v=!0),e===R)a=a||n,o=o||r,s=s||i,n===b&&a===M||(t.blendEquationSeparate(wt[n],wt[a]),b=n,M=a),r===w&&i===_&&o===tt&&s===et||(t.blendFuncSeparate(Mt[r],Mt[i],Mt[o],Mt[s]),w=r,_=i,tt=o,et=s),x=e,nt=null;else if(e!==x||c!==nt){if(b===P&&M===P||(t.blendEquation(32774),b=P,M=P),c)switch(e){case E:t.blendFuncSeparate(1,771,1,771);break;case T:t.blendFunc(1,1);break;case A:t.blendFuncSeparate(0,0,769,771);break;case L:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case E:t.blendFuncSeparate(770,771,1,771);break;case T:t.blendFunc(770,1);break;case A:t.blendFunc(0,769);break;case L:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}w=null,_=null,tt=null,et=null,x=e,nt=c}}else v&&(bt(3042),v=!1)}function Et(e){rt!==e&&(e?t.frontFace(2304):t.frontFace(2305),rt=e)}function Tt(e){e!==o?(xt(2884),e!==it&&(e===s?t.cullFace(1029):e===c?t.cullFace(1028):t.cullFace(1032))):bt(2884),it=e}function At(e,n,r){e?(xt(32823),ot===n&&st===r||(t.polygonOffset(n,r),ot=n,st=r)):bt(32823)}function Lt(e){void 0===e&&(e=33984+ct-1),dt!==e&&(t.activeTexture(e),dt=e)}return{buffers:{color:i,depth:a,stencil:l},initAttributes:function(){for(var t=0,e=h.length;t<e;t++)h[t]=0},enableAttribute:function(t){yt(t,0)},enableAttributeAndDivisor:yt,disableUnusedAttributes:function(){for(var e=0,n=d.length;e!==n;++e)d[e]!==h[e]&&(t.disableVertexAttribArray(e),d[e]=0)},enable:xt,disable:bt,useProgram:function(e){return m!==e&&(t.useProgram(e),m=e,!0)},setBlending:St,setMaterial:function(t,e){t.side===y?bt(2884):xt(2884);var n=t.side===g;e&&(n=!n),Et(n),t.blending===E&&!1===t.transparent?St(S):St(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),i.setMask(t.colorWrite);var r=t.stencilWrite;l.setTest(r),r&&(l.setMask(t.stencilWriteMask),l.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),l.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),At(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:Et,setCullFace:Tt,setLineWidth:function(e){e!==at&&(lt&&t.lineWidth(e),at=e)},setPolygonOffset:At,setScissorTest:function(t){t?xt(3089):bt(3089)},activeTexture:Lt,bindTexture:function(e,n){null===dt&&Lt();var r=pt[dt];void 0===r&&(r={type:void 0,texture:void 0},pt[dt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||gt[e]),r.type=e,r.texture=n)},unbindTexture:function(){var e=pt[dt];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===ft.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ft.copy(e))},viewport:function(e){!1===mt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),mt.copy(e))},reset:function(){for(var e=0;e<d.length;e++)1===d[e]&&(t.disableVertexAttribArray(e),d[e]=0);f={},dt=null,pt={},m=null,x=null,rt=null,it=null,i.reset(),a.reset(),l.reset()}}}function us(t,e,n,r,i,a,o){var s,c=i.isWebGL2,l=i.maxTextures,u=i.maxCubemapSize,h=i.maxTextureSize,d=i.maxSamples,p=new WeakMap,f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d");function m(t,e){return f?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(t,e,n,r){var i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?xn.floorPowerOfTwo:Math.floor,o=a(i*t.width),c=a(i*t.height);void 0===s&&(s=m(o,c));var l=n?m(o,c):s;return l.width=o,l.height=c,l.getContext("2d").drawImage(t,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+c+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function g(t){return xn.isPowerOfTwo(t.width)&&xn.isPowerOfTwo(t.height)}function y(t,e){return t.generateMipmaps&&e&&t.minFilter!==bt&&t.minFilter!==Et}function x(e,n,i,a){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function b(t,n){if(!1===c)return t;var r=t;return 6403===t&&(5126===n&&(r=33326),5131===n&&(r=33325),5121===n&&(r=33321)),6407===t&&(5126===n&&(r=34837),5131===n&&(r=34843),5121===n&&(r=32849)),6408===t&&(5126===n&&(r=34836),5131===n&&(r=34842),5121===n&&(r=32856)),33325===r||33326===r||34842===r||34836===r?e.get("EXT_color_buffer_float"):34843!==r&&34837!==r||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),r}function w(t){return t===bt||t===wt||t===Mt?9728:9729}function _(e){var n=e.target;n.removeEventListener("dispose",_),function(e){var n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(e){var n=e.target;n.removeEventListener("dispose",M),function(e){var n=r.get(e),i=r.get(e.texture);if(!e)return;void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[a]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);if(e.isWebGLMultiviewRenderTarget){t.deleteTexture(n.__webglColorTexture),t.deleteTexture(n.__webglDepthStencilTexture),o.memory.textures-=2;a=0;for(var s=n.__webglViewFramebuffers.length;a<s;a++)t.deleteFramebuffer(n.__webglViewFramebuffers[a])}r.remove(e.texture),r.remove(e)}(n),o.memory.textures--}var S=0;function E(t,e){var i=r.get(t);if(t.isVideoTexture&&function(t){var e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function T(e,i){if(6===e.image.length){var o=r.get(e);if(e.version>0&&o.__version!==e.version){C(o,e),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),t.pixelStorei(37440,e.flipY);for(var s=e&&e.isCompressedTexture,l=e.image[0]&&e.image[0].isDataTexture,h=[],d=0;d<6;d++)h[d]=s||l?l?e.image[d].image:e.image[d]:v(e.image[d],!1,!0,u);var p,f=h[0],m=g(f)||c,w=a.convert(e.format),_=a.convert(e.type),M=b(w,_);if(P(34067,e,m),s){for(d=0;d<6;d++){p=h[d].mipmaps;for(var S=0;S<p.length;S++){var E=p[S];e.format!==jt&&e.format!==kt?null!==w?n.compressedTexImage2D(34069+d,S,M,E.width,E.height,0,E.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+d,S,M,E.width,E.height,0,w,_,E.data)}}o.__maxMipLevel=p.length-1}else{p=e.mipmaps;for(d=0;d<6;d++)if(l){n.texImage2D(34069+d,0,M,h[d].width,h[d].height,0,w,_,h[d].data);for(S=0;S<p.length;S++){var T=(E=p[S]).image[d].image;n.texImage2D(34069+d,S+1,M,T.width,T.height,0,w,_,T.data)}}else{n.texImage2D(34069+d,0,M,w,_,h[d]);for(S=0;S<p.length;S++){E=p[S];n.texImage2D(34069+d,S+1,M,w,_,E.image[d])}}o.__maxMipLevel=p.length}y(e,m)&&x(34067,e,f.width,f.height),o.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function A(t,e){n.activeTexture(33984+e),n.bindTexture(34067,r.get(t).__webglTexture)}var L={[gt]:10497,[yt]:33071,[xt]:33648},R={[bt]:9728,[wt]:9984,[Mt]:9986,[Et]:9729,[Tt]:9985,[Lt]:9987};function P(n,a,o){o?(t.texParameteri(n,10242,L[a.wrapS]),t.texParameteri(n,10243,L[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,L[a.wrapR]),t.texParameteri(n,10240,R[a.magFilter]),t.texParameteri(n,10241,R[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===yt&&a.wrapT===yt||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,w(a.magFilter)),t.texParameteri(n,10241,w(a.minFilter)),a.minFilter!==bt&&a.minFilter!==Et&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=e.get("EXT_texture_filter_anisotropic");if(s){if(a.type===zt&&null===e.get("OES_texture_float_linear"))return;if(a.type===Bt&&null===(c||e.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",_),e.__webglTexture=t.createTexture(),o.memory.textures++)}function O(e,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment);var s=function(t){return!c&&(t.wrapS!==yt||t.wrapT!==yt||t.minFilter!==bt&&t.minFilter!==Et)}(r)&&!1===g(r.image),l=v(r.image,s,!1,h),u=g(l)||c,d=a.convert(r.format),p=a.convert(r.type),f=b(d,p);P(o,r,u);var m,w=r.mipmaps;if(r.isDepthTexture){if(f=6402,r.type===zt){if(!1===c)throw new Error("Float Depth Texture only supported in WebGL2.0");f=36012}else c&&(f=33189);r.format===Yt&&6402===f&&r.type!==Dt&&r.type!==Nt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Dt,p=a.convert(r.type)),r.format===Zt&&(f=34041,r.type!==Ht&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Ht,p=a.convert(r.type))),n.texImage2D(3553,0,f,l.width,l.height,0,d,p,null)}else if(r.isDataTexture)if(w.length>0&&u){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,d,p,m.data);r.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,l.width,l.height,0,d,p,l.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],r.format!==jt&&r.format!==kt?null!==d?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,d,p,m.data);e.__maxMipLevel=w.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,f,l.width,l.height,l.depth,0,d,p,l.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,f,l.width,l.height,l.depth,0,d,p,l.data),e.__maxMipLevel=0;else if(w.length>0&&u){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,d,p,m);r.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,d,p,l),e.__maxMipLevel=0;y(r,u)&&x(3553,r,l.width,l.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(e,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=b(c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(36160,null)}function I(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){if(r){var i=z(n);t.renderbufferStorageMultisample(36161,i,33189,n.width,n.height)}else t.renderbufferStorage(36161,33189,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){i=z(n);t.renderbufferStorageMultisample(36161,i,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{var o=b(a.convert(n.texture.format),a.convert(n.texture.type));if(r){i=z(n);t.renderbufferStorageMultisample(36161,i,o,n.width,n.height)}else t.renderbufferStorage(36161,o,n.width,n.height)}t.bindRenderbuffer(36161,null)}function N(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.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),E(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Yt)t.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)t.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=t.createRenderbuffer(),I(n.__webglDepthbuffer[a],e)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),I(n.__webglDepthbuffer,e);t.bindFramebuffer(36160,null)}function z(t){return c&&t.isWebGLMultisampleRenderTarget?Math.min(d,t.samples):0}var B=!1,F=!1;this.allocateTextureUnit=function(){var t=S;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?O(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?O(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=T,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(i){var s=r.get(i),l=r.get(i.texture);i.addEventListener("dispose",M),l.__webglTexture=t.createTexture(),o.memory.textures++;var u=!0===i.isWebGLRenderTargetCube,h=!0===i.isWebGLMultisampleRenderTarget,d=!0===i.isWebGLMultiviewRenderTarget,p=g(i)||c;if(u){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),h)if(c){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var m=b(a.convert(i.texture.format),a.convert(i.texture.type)),v=z(i);t.renderbufferStorageMultisample(36161,v,m,i.width,i.height),t.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),i.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),I(s.__webglDepthRenderbuffer,i,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");else if(d){var w=i.width,_=i.height,S=i.numViews;t.bindFramebuffer(36160,s.__webglFramebuffer);var E=e.get("OVR_multiview2");o.memory.textures+=2;var T=t.createTexture();t.bindTexture(35866,T),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,32856,w,_,S,0,6408,5121,null),E.framebufferTextureMultiviewOVR(36160,36064,T,0,0,S);var A=t.createTexture();t.bindTexture(35866,A),t.texParameteri(35866,10240,9728),t.texParameteri(35866,10241,9728),t.texImage3D(35866,0,35056,w,_,S,0,34041,34042,null),E.framebufferTextureMultiviewOVR(36160,33306,A,0,0,S);var L=new Array(S);for(f=0;f<S;++f)L[f]=t.createFramebuffer(),t.bindFramebuffer(36160,L[f]),t.framebufferTextureLayer(36160,36064,T,0,f);s.__webglColorTexture=T,s.__webglDepthStencilTexture=A,s.__webglViewFramebuffers=L,t.bindFramebuffer(36160,null),t.bindTexture(35866,null)}if(u){n.bindTexture(34067,l.__webglTexture),P(34067,i.texture,p);for(f=0;f<6;f++)D(s.__webglFramebuffer[f],i,36064,34069+f);y(i.texture,p)&&x(34067,i.texture,i.width,i.height),n.bindTexture(34067,null)}else d||(n.bindTexture(3553,l.__webglTexture),P(3553,i.texture,p),D(s.__webglFramebuffer,i,36064,3553),y(i.texture,p)&&x(3553,i.texture,i.width,i.height),n.bindTexture(3553,null));i.depthBuffer&&N(i)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(y(e,g(t)||c)){var i=t.isWebGLRenderTargetCube?34067:3553,a=r.get(e).__webglTexture;n.bindTexture(i,a),x(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(c){var n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);var i=e.width,a=e.height,o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),t=t.texture),E(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLRenderTargetCube&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?T(t,e):A(t,e)}}function hs(t,e,n){var r=n.isWebGL2;return{convert:function(t){var n;if(t===Pt)return 5121;if(t===Ft)return 32819;if(t===Ut)return 32820;if(t===Gt)return 33635;if(t===Ct)return 5120;if(t===Ot)return 5122;if(t===Dt)return 5123;if(t===It)return 5124;if(t===Nt)return 5125;if(t===zt)return 5126;if(t===Bt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===Vt)return 6406;if(t===kt)return 6407;if(t===jt)return 6408;if(t===Wt)return 6409;if(t===qt)return 6410;if(t===Yt)return 6402;if(t===Zt)return 34041;if(t===Jt)return 6403;if(t===Kt||t===Qt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Kt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Qt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===$t)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===te)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===ee||t===ne||t===re||t===ie){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===ee)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===ne)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===re)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ie)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}return t===ae?null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null:t===oe||t===se||t===ce||t===le||t===ue||t===he||t===de||t===pe||t===fe||t===me||t===ve||t===ge||t===ye||t===xe?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===Ht?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ds(t,e,n,r){On.call(this,t,e,r),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}function ps(t,e){var n,r,i,a,o,s,c,l=2,u=t.extensions,h=t.properties,d=0;function p(t){return t.isArrayCamera?t.cameras:(o[0]=t,o)}this.isAvailable=function(){if(void 0===c){var t=u.get("OVR_multiview2");if(c=null!==t&&!1===e.getContextAttributes().antialias){d=e.getParameter(t.MAX_VIEWS_OVR),n=new ds(0,0,l),s=new bn,a=[],i=[],o=[];for(var r=0;r<d;r++)a[r]=new Hn,i[r]=new An}}return c},this.attachCamera=function(e){!1!==function(t){if(void 0===t.isArrayCamera)return!0;var e=t.cameras;if(e.length>d)return!1;for(var n=1,r=e.length;n<r;n++)if(e[0].viewport.z!==e[n].viewport.z||e[0].viewport.w!==e[n].viewport.w)return!1;return!0}(e)&&(r=t.getRenderTarget(),function(e){if(r?s.set(r.width,r.height):t.getDrawingBufferSize(s),e.isArrayCamera){var i=e.cameras[0].viewport;n.setSize(i.z,i.w),n.setNumViews(e.cameras.length)}else n.setSize(s.x,s.y),n.setNumViews(l)}(e),t.setRenderTarget(n))},this.detachCamera=function(i){n===t.getRenderTarget()&&(t.setRenderTarget(r),function(t){var r=n,i=r.numViews,a=h.get(r).__webglViewFramebuffers,o=r.width,c=r.height;if(t.isArrayCamera)for(var l=0;l<i;l++){var u=t.cameras[l].viewport,d=u.x,p=u.y,f=d+u.z,m=p+u.w;e.bindFramebuffer(36008,a[l]),e.blitFramebuffer(0,0,o,c,d,p,f,m,16384,9728)}else e.bindFramebuffer(36008,a[0]),e.blitFramebuffer(0,0,o,c,0,0,s.x,s.y,16384,9728)}(i))},this.updateCameraProjectionMatricesUniform=function(t,n){for(var r=p(t),i=0;i<r.length;i++)a[i].copy(r[i].projectionMatrix);n.setValue(e,"projectionMatrices",a)},this.updateCameraViewMatricesUniform=function(t,n){for(var r=p(t),i=0;i<r.length;i++)a[i].copy(r[i].matrixWorldInverse);n.setValue(e,"viewMatrices",a)},this.updateObjectMatricesUniforms=function(t,n,r){for(var o=p(n),s=0;s<o.length;s++)a[s].multiplyMatrices(o[s].matrixWorldInverse,t.matrixWorld),i[s].getNormalMatrix(a[s]);r.setValue(e,"modelViewMatrices",a),r.setValue(e,"normalMatrices",i)}}function fs(){ar.call(this),this.type="Group"}function ms(t){ia.call(this),this.cameras=t||[]}ds.prototype=Object.assign(Object.create(On.prototype),{constructor:ds,isWebGLMultiviewRenderTarget:!0,copy:function(t){return On.prototype.copy.call(this,t),this.numViews=t.numViews,this},setNumViews:function(t){return this.numViews!==t&&(this.numViews=t,this.dispose()),this}}),fs.prototype=Object.assign(Object.create(ar.prototype),{constructor:fs,isGroup:!0}),ms.prototype=Object.assign(Object.create(ia.prototype),{constructor:ms,isArrayCamera:!0});var vs,gs=new Sn,ys=new Sn;function xs(t,e,n){gs.setFromMatrixPosition(e.matrixWorld),ys.setFromMatrixPosition(n.matrixWorld);var r=gs.distanceTo(ys),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var v=o+f,g=s+f,y=d-m,x=p+(r-m),b=c*s/g*v,w=l*s/g*v;t.projectionMatrix.makePerspective(y,x,b,w,v,g)}function bs(t){var e,n,r=this,i=null,a=null,o=[],s=new Hn,c=new Hn,l=1,u="local-floor";"undefined"!=typeof window&&"VRFrameData"in window&&(a=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",w,!1));var h=new Hn,d=new wn,p=new Sn,f=new ia,m=new ia;m.viewport=new Cn,m.layers.enable(1);var v=new ia;v.viewport=new Cn,v.layers.enable(2);var g=new ms([m,v]);function y(){return null!==i&&!0===i.isPresenting}g.layers.enable(1),g.layers.enable(2);var x,b=new bn;function w(){if(y()){var a=i.getEyeParameters("left");e=2*a.renderWidth*l,n=a.renderHeight*l,x=t.getPixelRatio(),t.getSize(b),t.setDrawingBufferSize(e,n,1),m.viewport.set(0,0,e/2,n),v.viewport.set(e/2,0,e/2,n),T.start(),r.dispatchEvent({type:"sessionstart"})}else r.enabled&&t.setDrawingBufferSize(b.width,b.height,x),T.stop(),r.dispatchEvent({type:"sessionend"})}var _=[],M=[];function S(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),n=0,r=e.length;n<r;n++){var i=e[n];if(i&&("Daydream Controller"===i.id||"Gear VR Controller"===i.id||"Oculus Go Controller"===i.id||"OpenVR Gamepad"===i.id||i.id.startsWith("Oculus Touch")||i.id.startsWith("HTC Vive Focus")||i.id.startsWith("Spatial Controller"))){var a=i.hand;if(0===t&&(""===a||"right"===a))return i;if(1===t&&"left"===a)return i}}}function E(t,r){null!==r&&4===r.length&&t.set(r[0]*e,r[1]*n,r[2]*e,r[3]*n)}this.enabled=!1,this.getController=function(t){var e=o[t];return void 0===e&&((e=new fs).matrixAutoUpdate=!1,e.visible=!1,o[t]=e),e},this.getDevice=function(){return i},this.setDevice=function(t){void 0!==t&&(i=t),T.setContext(t)},this.setFramebufferScaleFactor=function(t){l=t},this.setReferenceSpaceType=function(t){u=t},this.getCamera=function(t){var e="local-floor"===u?1.6:0;if(i.depthNear=t.near,i.depthFar=t.far,i.getFrameData(a),"local-floor"===u){var n=i.stageParameters;n?s.fromArray(n.sittingToStandingTransform):s.makeTranslation(0,e,0)}var r=a.pose;f.matrix.copy(s),f.matrix.decompose(f.position,f.quaternion,f.scale),null!==r.orientation&&(d.fromArray(r.orientation),f.quaternion.multiply(d)),null!==r.position&&(d.setFromRotationMatrix(s),p.fromArray(r.position),p.applyQuaternion(d),f.position.add(p)),f.updateMatrixWorld(),t.matrixWorld.copy(f.matrixWorld);for(var l=t.children,y=0,x=l.length;y<x;y++)l[y].updateMatrixWorld(!0);m.near=t.near,v.near=t.near,m.far=t.far,v.far=t.far,m.matrixWorldInverse.fromArray(a.leftViewMatrix),v.matrixWorldInverse.fromArray(a.rightViewMatrix),c.getInverse(s),"local-floor"===u&&(m.matrixWorldInverse.multiply(c),v.matrixWorldInverse.multiply(c));var b=t.parent;null!==b&&(h.getInverse(b.matrixWorld),m.matrixWorldInverse.multiply(h),v.matrixWorldInverse.multiply(h)),m.matrixWorld.getInverse(m.matrixWorldInverse),v.matrixWorld.getInverse(v.matrixWorldInverse),m.projectionMatrix.fromArray(a.leftProjectionMatrix),v.projectionMatrix.fromArray(a.rightProjectionMatrix),xs(g,m,v);var w=i.getLayers();if(w.length){var T=w[0];E(m.viewport,T.leftBounds),E(v.viewport,T.rightBounds)}return function(){for(var t=0;t<o.length;t++){var e=o[t],n=S(t);if(void 0!==n&&void 0!==n.pose){if(null===n.pose)return;var r=n.pose;!1===r.hasPosition&&e.position.set(.2,-.6,-.05),null!==r.position&&e.position.fromArray(r.position),null!==r.orientation&&e.quaternion.fromArray(r.orientation),e.matrix.compose(e.position,e.quaternion,e.scale),e.matrix.premultiply(s),e.matrix.decompose(e.position,e.quaternion,e.scale),e.matrixWorldNeedsUpdate=!0,e.visible=!0;var i="Daydream Controller"===n.id?0:1;void 0===_[t]&&(_[t]=!1),_[t]!==n.buttons[i].pressed&&(_[t]=n.buttons[i].pressed,!0===_[t]?e.dispatchEvent({type:"selectstart"}):(e.dispatchEvent({type:"selectend"}),e.dispatchEvent({type:"select"}))),i=2,void 0===M[t]&&(M[t]=!1),void 0!==n.buttons[i]&&M[t]!==n.buttons[i].pressed&&(M[t]=n.buttons[i].pressed,!0===M[t]?e.dispatchEvent({type:"squeezestart"}):(e.dispatchEvent({type:"squeezeend"}),e.dispatchEvent({type:"squeeze"})))}else e.visible=!1}}(),g},this.getStandingMatrix=function(){return s},this.isPresenting=y;var T=new va;this.setAnimationLoop=function(t){T.setAnimationLoop(t),y()&&T.start()},this.submitFrame=function(){y()&&i.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",w)},this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}function ws(t,e){var n=this,r=null,i=null,a="local-floor",o=null,s=[],c=[];var l=new ia;l.layers.enable(1),l.viewport=new Cn;var u=new ia;u.layers.enable(2),u.viewport=new Cn;var h=new ms([l,u]);function d(t){for(var e=0;e<s.length;e++)c[e]===t.inputSource&&s[e].dispatchEvent({type:t.type})}function p(){t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),x.stop(),n.dispatchEvent({type:"sessionend"})}function f(t){i=t,x.setContext(r),x.start(),n.dispatchEvent({type:"sessionstart"})}function m(){for(var t=0;t<s.length;t++)c[t]=v(t)}function v(t){for(var e=r.inputSources,n=0;n<e.length;n++){var i=e[n],a=i.handedness;if(0===t&&("none"===a||"right"===a))return i;if(1===t&&"left"===a)return i}}function g(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.getInverse(t.matrixWorld)}h.layers.enable(1),h.layers.enable(2),this.enabled=!1,this.getController=function(t){var e=s[t];return void 0===e&&((e=new fs).matrixAutoUpdate=!1,e.visible=!1,s[t]=e),e},this.setFramebufferScaleFactor=function(){},this.setReferenceSpaceType=function(t){a=t},this.getSession=function(){return r},this.setSession=function(t){null!==(r=t)&&(r.addEventListener("select",d),r.addEventListener("selectstart",d),r.addEventListener("selectend",d),r.addEventListener("squeeze",d),r.addEventListener("squeezestart",d),r.addEventListener("squeezeend",d),r.addEventListener("end",p),r.updateRenderState({baseLayer:new XRWebGLLayer(r,e)}),r.requestReferenceSpace(a).then(f),r.addEventListener("inputsourceschange",m),m())},this.getCamera=function(t){var e=t.parent,n=h.cameras;g(h,e);for(var r=0;r<n.length;r++)g(n[r],e);t.matrixWorld.copy(h.matrixWorld);for(var i=t.children,a=(r=0,i.length);r<a;r++)i[r].updateMatrixWorld(!0);return xs(h,l,u),h},this.isPresenting=function(){return null!==r&&null!==i};var y=null;var x=new va;x.setAnimationLoop((function(e,n){if(null!==(o=n.getViewerPose(i))){var a=o.views,l=r.renderState.baseLayer;t.setFramebuffer(l.framebuffer);for(var u=0;u<a.length;u++){var d=a[u],p=l.getViewport(d),f=d.transform.inverse.matrix,m=h.cameras[u];m.matrix.fromArray(f).getInverse(m.matrix),m.projectionMatrix.fromArray(d.projectionMatrix),m.viewport.set(p.x,p.y,p.width,p.height),0===u&&h.matrix.copy(m.matrix)}}for(u=0;u<s.length;u++){var v=s[u],g=c[u];if(g){var x=n.getPose(g.targetRaySpace,i);if(null!==x){v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.visible=!0;continue}}v.visible=!1}y&&y(e)})),this.setAnimationLoop=function(t){y=t},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new Hn},this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")},this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")},this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")},this.submitFrame=function(){}}function _s(t){var e=void 0!==(t=t||{}).canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat,h=null,d=null;this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=it,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p,f,m,v,y,x,b,w,_,M,S,E,T,A,L,R,P,C,O=this,D=!1,I=null,N=0,z=0,B=null,F=null,U=-1,G={geometry:null,program:null,wireframe:!1},H=null,V=null,k=new Cn,j=new Cn,W=null,q=e.width,X=e.height,Y=1,Z=new Cn(0,0,q,X),J=new Cn(0,0,q,X),K=!1,Q=new da,$=new Ma,tt=!1,et=!1,nt=new Hn,rt=new Sn;function at(){return null===B?Y:1}try{var ot={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u,xrCompatible:!0};if(e.addEventListener("webglcontextlost",ht,!1),e.addEventListener("webglcontextrestored",dt,!1),null===(p=n||e.getContext("webgl",ot)||e.getContext("experimental-webgl",ot)))throw null!==e.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===p.getShaderPrecisionFormat&&(p.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function st(){f=new Sa(p),!1===(m=new _a(p,f,t)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),C=new hs(p,f,m),(v=new ls(p,f,m)).scissor(j.copy(J).multiplyScalar(Y).floor()),v.viewport(k.copy(Z).multiplyScalar(Y).floor()),y=new Aa(p),x=new Xo,b=new us(p,f,v,x,m,C,y),w=new ga(p),_=new Ea(p,w,y),M=new Pa(p,_,w,y),L=new Ra(p),S=new qo(O,f,m),E=new Ko,T=new rs,A=new ba(O,v,M,s),R=new wa(p,f,y,m),P=new Ta(p,f,y,m),y.programs=S.programs,O.capabilities=m,O.extensions=f,O.properties=x,O.renderLists=E,O.state=v,O.info=y}st();var ct="undefined"!=typeof navigator&&"xr"in navigator?new ws(O,p):new bs(O);this.vr=ct;var lt=new ps(O,p),ut=new cs(O,M,m.maxTextureSize);function ht(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function dt(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1,st()}function pt(t){var e=t.target;e.removeEventListener("dispose",pt),function(t){ft(t),x.remove(t)}(e)}function ft(t){var e=x.get(t).program;t.program=void 0,void 0!==e&&S.releaseProgram(e)}this.shadowMap=ut,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var t=f.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=f.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(t){void 0!==t&&(Y=t,this.setSize(q,X,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new bn),t.set(q,X)},this.setSize=function(t,n,r){ct.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=t,X=n,e.width=Math.floor(t*Y),e.height=Math.floor(n*Y),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),t=new bn),t.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(t,n,r){q=t,X=n,Y=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),t=new Cn),t.copy(k)},this.getViewport=function(t){return t.copy(Z)},this.setViewport=function(t,e,n,r){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,n,r),v.viewport(k.copy(Z).multiplyScalar(Y).floor())},this.getScissor=function(t){return t.copy(J)},this.setScissor=function(t,e,n,r){t.isVector4?J.set(t.x,t.y,t.z,t.w):J.set(t,e,n,r),v.scissor(j.copy(J).multiplyScalar(Y).floor())},this.getScissorTest=function(){return K},this.setScissorTest=function(t){v.setScissorTest(K=t)},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),p.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ht,!1),e.removeEventListener("webglcontextrestored",dt,!1),E.dispose(),T.dispose(),x.dispose(),M.dispose(),ct.dispose(),vt.stop()},this.renderBufferImmediate=function(t,e){v.initAttributes();var n=x.get(t);t.hasPositions&&!n.position&&(n.position=p.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=p.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=p.createBuffer()),t.hasColors&&!n.color&&(n.color=p.createBuffer());var r=e.getAttributes();t.hasPositions&&(p.bindBuffer(34962,n.position),p.bufferData(34962,t.positionArray,35048),v.enableAttribute(r.position),p.vertexAttribPointer(r.position,3,5126,!1,0,0)),t.hasNormals&&(p.bindBuffer(34962,n.normal),p.bufferData(34962,t.normalArray,35048),v.enableAttribute(r.normal),p.vertexAttribPointer(r.normal,3,5126,!1,0,0)),t.hasUvs&&(p.bindBuffer(34962,n.uv),p.bufferData(34962,t.uvArray,35048),v.enableAttribute(r.uv),p.vertexAttribPointer(r.uv,2,5126,!1,0,0)),t.hasColors&&(p.bindBuffer(34962,n.color),p.bufferData(34962,t.colorArray,35048),v.enableAttribute(r.color),p.vertexAttribPointer(r.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),p.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,a){var o=i.isMesh&&i.matrixWorld.determinant()<0;v.setMaterial(r,o);var s=wt(t,e,r,i),c=!1;G.geometry===n.id&&G.program===s.id&&G.wireframe===(!0===r.wireframe)||(G.geometry=n.id,G.program=s.id,G.wireframe=!0===r.wireframe,c=!0),i.morphTargetInfluences&&(L.update(i,n,r,s),c=!0);var l=n.index,u=n.attributes.position;if((null===l||0!==l.count)&&void 0!==u&&0!==u.count){var h,d=1;!0===r.wireframe&&(l=_.getWireframeAttribute(n),d=2);var g=R;null!==l&&(h=w.get(l),(g=P).setIndex(h)),c&&(!function(t,e,n,r){if(!1===m.isWebGL2&&(t.isInstancedMesh||e.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;v.initAttributes();var i=e.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(void 0!==l){var u=l.normalized,h=l.itemSize;if(void 0===(M=w.get(l)))continue;var d=M.buffer,g=M.type,y=M.bytesPerElement;if(l.isInterleavedBufferAttribute){var x=l.data,b=x.stride,_=l.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(c,x.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=x.meshPerAttribute*x.count)):v.enableAttribute(c),p.bindBuffer(34962,d),p.vertexAttribPointer(c,h,g,u,b*y,_*y)}else l.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===e.maxInstancedCount&&(e.maxInstancedCount=l.meshPerAttribute*l.count)):v.enableAttribute(c),p.bindBuffer(34962,d),p.vertexAttribPointer(c,h,g,u,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=w.get(t.instanceMatrix)))continue;d=M.buffer,g=M.type;v.enableAttributeAndDivisor(c+0,1),v.enableAttributeAndDivisor(c+1,1),v.enableAttributeAndDivisor(c+2,1),v.enableAttributeAndDivisor(c+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(c+0,4,g,!1,64,0),p.vertexAttribPointer(c+1,4,g,!1,64,16),p.vertexAttribPointer(c+2,4,g,!1,64,32),p.vertexAttribPointer(c+3,4,g,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:p.vertexAttrib2fv(c,S);break;case 3:p.vertexAttrib3fv(c,S);break;case 4:p.vertexAttrib4fv(c,S);break;default:p.vertexAttrib1fv(c,S)}}}}v.disableUnusedAttributes()}(i,n,r,s),null!==l&&p.bindBuffer(34963,h.buffer));var y=1/0;null!==l?y=l.count:void 0!==u&&(y=u.count);var x=n.drawRange.start*d,b=n.drawRange.count*d,M=null!==a?a.start*d:0,S=null!==a?a.count*d:1/0,E=Math.max(x,M),T=Math.min(y,x+b,M+S)-1,A=Math.max(0,T-E+1);if(0!==A){if(i.isMesh)if(!0===r.wireframe)v.setLineWidth(r.wireframeLinewidth*at()),g.setMode(1);else switch(i.drawMode){case Re:g.setMode(4);break;case Pe:g.setMode(5);break;case Ce:g.setMode(6)}else if(i.isLine){var C=r.linewidth;void 0===C&&(C=1),v.setLineWidth(C*at()),i.isLineSegments?g.setMode(1):i.isLineLoop?g.setMode(2):g.setMode(3)}else i.isPoints?g.setMode(0):i.isSprite&&g.setMode(4);i.isInstancedMesh?g.renderInstances(n,E,A,i.count):n.isInstancedBufferGeometry?g.renderInstances(n,E,A,n.maxInstancedCount):g.render(E,A)}}},this.compile=function(t,e){(d=T.get(t,e)).init(),t.traverse((function(t){t.isLight&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(e),t.traverse((function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)bt(e.material[n],t.fog,e);else bt(e.material,t.fog,e)}))};var mt=null;var vt=new va;function gt(t,e,n,r){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){r&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);var i=M.update(t);(a=t.material).visible&&h.push(t,i,a,n,rt.z,null)}}else if(t.isImmediateRenderObject)r&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt),h.push(t,null,t.material,n,rt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==y.render.frame&&(t.skeleton.update(),t.skeleton.frame=y.render.frame),!t.frustumCulled||Q.intersectsObject(t))){r&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);i=M.update(t);var a=t.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&h.push(t,i,u,n,rt.z,l)}else a.visible&&h.push(t,i,a,n,rt.z,null)}var p=t.children;for(s=0,c=p.length;s<c;s++)gt(p[s],e,n,r)}}function yt(t,e,n,r){for(var i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,c=o.geometry,l=void 0===r?o.material:r,u=o.group;if(n.isArrayCamera)if(V=n,ct.enabled&<.isAvailable())xt(s,e,n,c,l,u);else for(var h=n.cameras,p=0,f=h.length;p<f;p++){var m=h[p];s.layers.test(m.layers)&&(v.viewport(k.copy(m.viewport)),d.setupLights(m),xt(s,e,m,c,l,u))}else V=null,xt(s,e,n,c,l,u)}}function xt(t,e,n,r,i,a){if(t.onBeforeRender(O,e,n,r,i,a),d=T.get(e,V||n),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){v.setMaterial(i);var o=wt(n,e.fog,i,t);G.geometry=null,G.program=null,G.wireframe=!1,function(t,e){t.render((function(t){O.renderBufferImmediate(t,e)}))}(t,o)}else O.renderBufferDirect(n,e.fog,r,i,t,a);t.onAfterRender(O,e,n,r,i,a),d=T.get(e,V||n)}function bt(t,e,n){var r=x.get(t),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=S.getParameters(t,i.state,a,e,$.numPlanes,$.numIntersection,n),c=S.getProgramCacheKey(t,s),l=r.program,u=!0;if(void 0===l)t.addEventListener("dispose",pt);else if(l.cacheKey!==c)ft(t);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else{if(void 0!==s.shaderID)return;u=!1}if(u){if(s.shaderID){var h=ma[s.shaderID];r.shader={name:t.type,uniforms:Ki(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else r.shader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.onBeforeCompile(r.shader,O),c=S.getProgramCacheKey(t,s),l=S.acquireProgram(t,r.shader,s,c),r.program=l,t.program=l}var p=l.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var f=0;f<O.maxMorphTargets;f++)p["morphTarget"+f]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(f=0;f<O.maxMorphNormals;f++)p["morphNormal"+f]>=0&&t.numSupportedMorphNormals++}var m=r.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=$.numPlanes,r.numIntersection=$.numIntersection,m.clippingPlanes=$.uniform),r.fog=e,r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=o,r.needsLights&&(m.ambientLightColor.value=i.state.ambient,m.lightProbe.value=i.state.probe,m.directionalLights.value=i.state.directional,m.spotLights.value=i.state.spot,m.rectAreaLights.value=i.state.rectArea,m.pointLights.value=i.state.point,m.hemisphereLights.value=i.state.hemi,m.directionalShadowMap.value=i.state.directionalShadowMap,m.directionalShadowMatrix.value=i.state.directionalShadowMatrix,m.spotShadowMap.value=i.state.spotShadowMap,m.spotShadowMatrix.value=i.state.spotShadowMatrix,m.pointShadowMap.value=i.state.pointShadowMap,m.pointShadowMatrix.value=i.state.pointShadowMatrix);var v=r.program.getUniforms(),g=Lo.seqWithValue(v.seq,m);r.uniformsList=g}function wt(t,e,n,r){b.resetTextureUnits();var i=x.get(n),a=d.state.lights;if(tt&&(et||t!==H)){var o=t===H&&n.id===U;$.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}n.version===i.__version&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:i.needsLights&&i.lightsStateVersion!==a.state.version?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===$.numPlanes&&i.numIntersection===$.numIntersection||(n.needsUpdate=!0)),n.version!==i.__version&&(bt(n,e,r),i.__version=n.version);var s,c,l=!1,u=!1,h=!1,f=i.program,y=f.getUniforms(),w=i.shader.uniforms;if(v.useProgram(f.program)&&(l=!0,u=!0,h=!0),n.id!==U&&(U=n.id,u=!0),l||H!==t){if(f.numMultiviewViews>0?lt.updateCameraProjectionMatricesUniform(t,y):y.setValue(p,"projectionMatrix",t.projectionMatrix),m.logarithmicDepthBuffer&&y.setValue(p,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),H!==t&&(H=t,u=!0,h=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var _=y.map.cameraPosition;void 0!==_&&_.setValue(p,rt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&y.setValue(p,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&(f.numMultiviewViews>0?lt.updateCameraViewMatricesUniform(t,y):y.setValue(p,"viewMatrix",t.matrixWorldInverse))}if(n.skinning){y.setOptional(p,r,"bindMatrix"),y.setOptional(p,r,"bindMatrixInverse");var M=r.skeleton;if(M){var S=M.bones;if(m.floatVertexTextures){if(void 0===M.boneTexture){var E=Math.sqrt(4*S.length);E=xn.ceilPowerOfTwo(E),E=Math.max(E,4);var T=new Float32Array(E*E*4);T.set(M.boneMatrices);var A=new la(T,E,E,jt,zt);M.boneMatrices=T,M.boneTexture=A,M.boneTextureSize=E}y.setValue(p,"boneTexture",M.boneTexture,b),y.setValue(p,"boneTextureSize",M.boneTextureSize)}else y.setOptional(p,M,"boneMatrices")}}return(u||i.receiveShadow!==r.receiveShadow)&&(i.receiveShadow=r.receiveShadow,y.setValue(p,"receiveShadow",r.receiveShadow)),u&&(y.setValue(p,"toneMappingExposure",O.toneMappingExposure),y.setValue(p,"toneMappingWhitePoint",O.toneMappingWhitePoint),i.needsLights&&(c=h,(s=w).ambientLightColor.needsUpdate=c,s.lightProbe.needsUpdate=c,s.directionalLights.needsUpdate=c,s.pointLights.needsUpdate=c,s.spotLights.needsUpdate=c,s.rectAreaLights.needsUpdate=c,s.hemisphereLights.needsUpdate=c),e&&n.fog&&function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(w,e),n.isMeshBasicMaterial?_t(w,n):n.isMeshLambertMaterial?(_t(w,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(w,n)):n.isMeshPhongMaterial?(_t(w,n),n.isMeshToonMaterial?function(t,e){Mt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(w,n):Mt(w,n)):n.isMeshStandardMaterial?(_t(w,n),n.isMeshPhysicalMaterial?function(t,e){St(t,e),t.reflectivity.value=e.reflectivity,t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.sheen&&t.sheen.value.copy(e.sheen);e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===g&&t.clearcoatNormalScale.value.negate());t.transparency.value=e.transparency}(w,n):St(w,n)):n.isMeshMatcapMaterial?(_t(w,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===g&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===g&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,n)):n.isMeshDepthMaterial?(_t(w,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,n)):n.isMeshDistanceMaterial?(_t(w,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(w,n)):n.isMeshNormalMaterial?(_t(w,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===g&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===g&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(w,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(w,n)):n.isPointsMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*Y,t.scale.value=.5*X,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(w,n):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);var n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(w,n):n.isShadowMaterial&&(w.color.value.copy(n.color),w.opacity.value=n.opacity),void 0!==w.ltc_1&&(w.ltc_1.value=fa.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=fa.LTC_2),Lo.upload(p,i.uniformsList,w,b),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Lo.upload(p,i.uniformsList,w,b),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&y.setValue(p,"center",r.center),f.numMultiviewViews>0?lt.updateObjectMatricesUniforms(r,t,y):(y.setValue(p,"modelViewMatrix",r.modelViewMatrix),y.setValue(p,"normalMatrix",r.normalMatrix)),y.setValue(p,"modelMatrix",r.matrixWorld),f}function _t(t,e){var n;t.opacity.value=e.opacity,e.color&&t.diffuse.value.copy(e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=x.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}function Mt(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===g&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===g&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function St(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===g&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===g&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}vt.setAnimationLoop((function(t){ct.isPresenting()||mt&&mt(t)})),"undefined"!=typeof window&&vt.setContext(window),this.setAnimationLoop=function(t){mt=t,ct.setAnimationLoop(t),vt.start()},this.render=function(t,e){var n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),e&&e.isCamera){if(!D){G.geometry=null,G.program=null,G.wireframe=!1,U=-1,H=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),ct.enabled&&ct.isPresenting()&&(e=ct.getCamera(e)),(d=T.get(t,e)).init(),t.onBeforeRender(O,t,e,n||B),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromMatrix(nt),et=this.localClippingEnabled,tt=$.init(this.clippingPlanes,et,e),(h=E.get(t,e)).init(),gt(t,e,0,O.sortObjects),!0===O.sortObjects&&h.sort(),tt&&$.beginShadows();var i=d.state.shadowsArray;ut.render(i,t,e),d.setupLights(e),tt&&$.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ct.enabled&<.isAvailable()&<.attachCamera(e),A.render(h,t,e,r);var a=h.opaque,o=h.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&yt(a,t,e,s),o.length&&yt(o,t,e,s)}else a.length&&yt(a,t,e),o.length&&yt(o,t,e);t.onAfterRender(O,t,e),null!==B&&(b.updateRenderTargetMipmap(B),b.updateMultisampleRenderTarget(B)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),ct.enabled&&(lt.isAvailable()&<.detachCamera(e),ct.submitFrame()),h=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(t){I!==t&&null===B&&p.bindFramebuffer(36160,t),I=t},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return B},this.setRenderTarget=function(t,e,n){B=t,N=e,z=n,t&&void 0===x.get(t).__webglFramebuffer&&b.setupRenderTarget(t);var r=I,i=!1;if(t){var a=x.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(r=a[e||0],i=!0):r=t.isWebGLMultisampleRenderTarget?x.get(t).__webglMultisampledFramebuffer:a,k.copy(t.viewport),j.copy(t.scissor),W=t.scissorTest}else k.copy(Z).multiplyScalar(Y).floor(),j.copy(J).multiplyScalar(Y).floor(),W=K;if(F!==r&&(p.bindFramebuffer(36160,r),F=r),v.viewport(k),v.scissor(j),v.setScissorTest(W),i){var o=x.get(t.texture);p.framebufferTexture2D(36160,36064,34069+(e||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(t&&t.isWebGLRenderTarget){var s=x.get(t).__webglFramebuffer;if(t.isWebGLRenderTargetCube&&void 0!==o&&(s=s[o]),s){var c=!1;s!==F&&(p.bindFramebuffer(36160,s),c=!0);try{var l=t.texture,u=l.format,h=l.type;if(u!==jt&&C.convert(u)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Pt||C.convert(h)===p.getParameter(35738)||h===zt&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||h===Bt&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&p.readPixels(e,n,r,i,C.convert(u),C.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&p.bindFramebuffer(36160,F)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=C.convert(e.format);b.setTexture2D(e,0),p.copyTexImage2D(3553,n,o,t.x,t.y,i,a,0),v.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r){var i=e.image.width,a=e.image.height,o=C.convert(n.format),s=C.convert(n.type);b.setTexture2D(n,0),e.isDataTexture?p.texSubImage2D(3553,r||0,t.x,t.y,i,a,o,s,e.image.data):p.texSubImage2D(3553,r||0,t.x,t.y,o,s,e.image),v.unbindTexture()},this.initTexture=function(t){b.setTexture2D(t,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Ms(t,e){this.name="",this.color=new Jr(t),this.density=void 0!==e?e:25e-5}function Ss(t,e,n){this.name="",this.color=new Jr(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function Es(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=sn,this.updateRange={offset:0,count:-1},this.version=0}function Ts(t,e,n,r){this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function As(t){ni.call(this),this.type="SpriteMaterial",this.color=new Jr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}Object.assign(bs.prototype,vn.prototype),Object.assign(ws.prototype,vn.prototype),Object.assign(Ms.prototype,{isFogExp2:!0,clone:function(){return new Ms(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Ss.prototype,{isFog:!0,clone:function(){return new Ss(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Es.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Es.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Object.defineProperties(Ts.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ts.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this},setXYZW:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}}),As.prototype=Object.create(ni.prototype),As.prototype.constructor=As,As.prototype.isSpriteMaterial=!0,As.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};var Ls=new Sn,Rs=new Sn,Ps=new Sn,Cs=new bn,Os=new bn,Ds=new Hn,Is=new Sn,Ns=new Sn,zs=new Sn,Bs=new bn,Fs=new bn,Us=new bn;function Gs(t){if(ar.call(this),this.type="Sprite",void 0===vs){vs=new Mi;var e=new Es(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);vs.setIndex([0,1,2,0,2,3]),vs.setAttribute("position",new Ts(e,3,0,!1)),vs.setAttribute("uv",new Ts(e,2,3,!1))}this.geometry=vs,this.material=void 0!==t?t:new As,this.center=new bn(.5,.5)}function Hs(t,e,n,r,i,a){Cs.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Os.x=a*Cs.x-i*Cs.y,Os.y=i*Cs.x+a*Cs.y):Os.copy(Cs),t.copy(e),t.x+=Os.x,t.y+=Os.y,t.applyMatrix4(Ds)}Gs.prototype=Object.assign(Object.create(ar.prototype),{constructor:Gs,isSprite:!0,raycast:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Rs.setFromMatrixScale(this.matrixWorld),Ds.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ps.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Rs.multiplyScalar(-Ps.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Hs(Is.set(-.5,-.5,0),Ps,a,Rs,n,r),Hs(Ns.set(.5,-.5,0),Ps,a,Rs,n,r),Hs(zs.set(.5,.5,0),Ps,a,Rs,n,r),Bs.set(0,0),Fs.set(1,0),Us.set(1,1);var o=t.ray.intersectTriangle(Is,Ns,zs,!1,Ls);if(null!==o||(Hs(Ns.set(-.5,.5,0),Ps,a,Rs,n,r),Fs.set(0,1),null!==(o=t.ray.intersectTriangle(Is,zs,Ns,!1,Ls)))){var s=t.ray.origin.distanceTo(Ls);s<t.near||s>t.far||e.push({distance:s,point:Ls.clone(),uv:qr.getUV(Ls,Is,Ns,zs,Bs,Fs,Us,new bn),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return ar.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}});var Vs=new Sn,ks=new Sn;function js(){ar.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Ws(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Hi.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Hn,this.bindMatrixInverse=new Hn}js.prototype=Object.assign(Object.create(ar.prototype),{constructor:js,isLOD:!0,copy:function(t){ar.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n<r;n++){var i=e[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=t.autoUpdate,this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,r=0;r<n.length&&!(e<n[r].distance);r++);return n.splice(r,0,{distance:e,object:t}),this.add(t),this},getObjectForDistance:function(t){var e=this.levels;if(e.length>0){for(var n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null},raycast:function(t,e){if(this.levels.length>0){Vs.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Vs);this.getObjectForDistance(n).raycast(t,e)}},update:function(t){var e=this.levels;if(e.length>1){Vs.setFromMatrixPosition(t.matrixWorld),ks.setFromMatrixPosition(this.matrixWorld);var n=Vs.distanceTo(ks);e[0].object.visible=!0;for(var r=1,i=e.length;r<i&&n>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(;r<i;r++)e[r].object.visible=!1}},toJSON:function(t){var e=ar.prototype.toJSON.call(this,t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];e.object.levels.push({object:a.object.uuid,distance:a.distance})}return e}}),Ws.prototype=Object.assign(Object.create(Hi.prototype),{constructor:Ws,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var t=new Cn,e=this.geometry.attributes.skinWeight,n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);var i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){Hi.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var qs=new Hn,Xs=new Hn;function Ys(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Hn)}}function Zs(){ar.call(this),this.type="Bone"}Object.assign(Ys.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new Hn;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){var t,e,n;for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=t.length;i<a;i++){var o=t[i]?t[i].matrixWorld:Xs;qs.multiplyMatrices(o,e[i]),qs.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)},clone:function(){return new Ys(this.bones,this.boneInverses)},getBoneByName:function(t){for(var e=0,n=this.bones.length;e<n;e++){var r=this.bones[e];if(r.name===t)return r}}}),Zs.prototype=Object.assign(Object.create(ar.prototype),{constructor:Zs,isBone:!0});var Js=new Hn,Ks=new Hn,Qs=[],$s=new Hi;function tc(t,e,n){Hi.call(this,t,e),this.instanceMatrix=new ii(new Float32Array(16*n),16),this.count=n}function ec(t){ni.call(this),this.type="LineBasicMaterial",this.color=new Jr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}tc.prototype=Object.assign(Object.create(Hi.prototype),{constructor:tc,isInstancedMesh:!0,getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){var n=this.matrixWorld,r=this.count;if($s.geometry=this.geometry,$s.material=this.material,void 0!==$s.material)for(var i=0;i<r;i++)this.getMatrixAt(i,Js),Ks.multiplyMatrices(n,Js),$s.matrixWorld=Ks,$s.raycast(t,Qs),Qs.length>0&&(Qs[0].instanceId=i,Qs[0].object=this,e.push(Qs[0]),Qs.length=0)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){}}),ec.prototype=Object.create(ni.prototype),ec.prototype.constructor=ec,ec.prototype.isLineBasicMaterial=!0,ec.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this};var nc=new Sn,rc=new Sn,ic=new Hn,ac=new Cr,oc=new Mr;function sc(t,e,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),ar.call(this),this.type="Line",this.geometry=void 0!==t?t:new Mi,this.material=void 0!==e?e:new ec({color:16777215*Math.random()})}sc.prototype=Object.assign(Object.create(ar.prototype),{constructor:sc,isLine:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[0],r=1,i=e.count;r<i;r++)nc.fromBufferAttribute(e,r-1),rc.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=nc.distanceTo(rc);t.setAttribute("lineDistance",new di(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;(n=t.lineDistances)[0]=0;for(r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(t,e){var n=t.linePrecision,r=this.geometry,i=this.matrixWorld;if(null===r.boundingSphere&&r.computeBoundingSphere(),oc.copy(r.boundingSphere),oc.applyMatrix4(i),oc.radius+=n,!1!==t.ray.intersectsSphere(oc)){ic.getInverse(i),ac.copy(t.ray).applyMatrix4(ic);var a=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Sn,c=new Sn,l=new Sn,u=new Sn,h=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var d=r.index,p=r.attributes.position.array;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];if(s.fromArray(p,3*g),c.fromArray(p,3*y),!(ac.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(u))<t.near||w>t.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=p.length/3-1;m<v;m+=h){if(s.fromArray(p,3*m),c.fromArray(p,3*m+3),!(ac.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(u))<t.near||w>t.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(r.isGeometry){var x=r.vertices,b=x.length;for(m=0;m<b-1;m+=h){var w;if(!(ac.distanceSqToSegment(x[m],x[m+1],u,l)>o))u.applyMatrix4(this.matrixWorld),(w=t.ray.origin.distanceTo(u))<t.near||w>t.far||e.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var cc=new Sn,lc=new Sn;function uc(t,e){sc.call(this,t,e),this.type="LineSegments"}function hc(t,e){sc.call(this,t,e),this.type="LineLoop"}function dc(t){ni.call(this),this.type="PointsMaterial",this.color=new Jr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}uc.prototype=Object.assign(Object.create(sc.prototype),{constructor:uc,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;r<i;r+=2)cc.fromBufferAttribute(e,r),lc.fromBufferAttribute(e,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+cc.distanceTo(lc);t.setAttribute("lineDistance",new di(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(t.isGeometry){var a=t.vertices;for(n=t.lineDistances,r=0,i=a.length;r<i;r+=2)cc.copy(a[r]),lc.copy(a[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+cc.distanceTo(lc)}return this}}),hc.prototype=Object.assign(Object.create(sc.prototype),{constructor:hc,isLineLoop:!0}),dc.prototype=Object.create(ni.prototype),dc.prototype.constructor=dc,dc.prototype.isPointsMaterial=!0,dc.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this};var pc=new Hn,fc=new Cr,mc=new Mr,vc=new Sn;function gc(t,e){ar.call(this),this.type="Points",this.geometry=void 0!==t?t:new Mi,this.material=void 0!==e?e:new dc({color:16777215*Math.random()}),this.updateMorphTargets()}function yc(t,e,n,r,i,a,o){var s=fc.distanceSqToPoint(t);if(s<n){var c=new Sn;fc.closestPointToPoint(t,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:e,face:null,object:o})}}function xc(t,e,n,r,i,a,o,s,c){Pn.call(this,t,e,n,r,i,a,o,s,c),this.format=void 0!==o?o:kt,this.minFilter=void 0!==a?a:Et,this.magFilter=void 0!==i?i:Et,this.generateMipmaps=!1}function bc(t,e,n,r,i,a,o,s,c,l,u,h){Pn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function wc(t,e,n,r,i,a,o,s,c){Pn.call(this,t,e,n,r,i,a,o,s,c),this.needsUpdate=!0}function _c(t,e,n,r,i,a,o,s,c,l){if((l=void 0!==l?l:Yt)!==Yt&&l!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Yt&&(n=Dt),void 0===n&&l===Zt&&(n=Ht),Pn.call(this,null,r,i,a,o,s,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:bt,this.minFilter=void 0!==s?s:bt,this.flipY=!1,this.generateMipmaps=!1}function Mc(t){Mi.call(this),this.type="WireframeGeometry";var e,n,r,i,a,o,s,c,l,u,h=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,r=m.length;e<r;e++){var v=m[e];for(n=0;n<3;n++)s=v[f[n]],c=v[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)o=p[l],u=t.vertices[o.index1],h.push(u.x,u.y,u.z),u=t.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(t&&t.isBufferGeometry){var g,y,x,b,w,_,M;if(u=new Sn,null!==t.index){for(g=t.attributes.position,y=t.index,0===(x=t.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(e=w=(b=x[i]).start,r=w+b.count;e<r;e+=3)for(n=0;n<3;n++)s=y.getX(e+n),c=y.getX(e+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)o=p[l],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(e=0,r=(g=t.attributes.position).count/3;e<r;e++)for(n=0;n<3;n++)_=3*e+n,u.fromBufferAttribute(g,_),h.push(u.x,u.y,u.z),M=3*e+(n+1)%3,u.fromBufferAttribute(g,M),h.push(u.x,u.y,u.z)}this.setAttribute("position",new di(h,3))}function Sc(t,e,n){Yi.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new Ec(t,e,n)),this.mergeVertices()}function Ec(t,e,n){Mi.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,a=[],o=[],s=[],c=[],l=new Sn,u=new Sn,h=new Sn,d=new Sn,p=new Sn;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=e+1;for(r=0;r<=n;r++){var m=r/n;for(i=0;i<=e;i++){var v=i/e;t(v,m,u),o.push(u.x,u.y,u.z),v-1e-5>=0?(t(v-1e-5,m,h),d.subVectors(u,h)):(t(v+1e-5,m,h),d.subVectors(h,u)),m-1e-5>=0?(t(v,m-1e-5,h),p.subVectors(u,h)):(t(v,m+1e-5,h),p.subVectors(h,u)),l.crossVectors(d,p).normalize(),s.push(l.x,l.y,l.z),c.push(v,m)}}for(r=0;r<n;r++)for(i=0;i<e;i++){var g=r*f+i,y=r*f+i+1,x=(r+1)*f+i+1,b=(r+1)*f+i;a.push(g,y,b),a.push(y,x,b)}this.setIndex(a),this.setAttribute("position",new di(o,3)),this.setAttribute("normal",new di(s,3)),this.setAttribute("uv",new di(c,2))}function Tc(t,e,n,r){Yi.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},this.fromBufferGeometry(new Ac(t,e,n,r)),this.mergeVertices()}function Ac(t,e,n,r){Mi.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1;var i=[],a=[];function o(t,e,n,r){var i,a,o=Math.pow(2,r),c=[];for(i=0;i<=o;i++){c[i]=[];var l=t.clone().lerp(n,i/o),u=e.clone().lerp(n,i/o),h=o-i;for(a=0;a<=h;a++)c[i][a]=0===a&&i===o?l:l.clone().lerp(u,a/h)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var d=Math.floor(a/2);a%2==0?(s(c[i][d+1]),s(c[i+1][d]),s(c[i][d])):(s(c[i][d+1]),s(c[i+1][d+1]),s(c[i+1][d]))}}function s(t){i.push(t.x,t.y,t.z)}function c(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function l(t,e,n,r){r<0&&1===t.x&&(a[e]=t.x-1),0===n.x&&0===n.z&&(a[e]=r/2/Math.PI+.5)}function u(t){return Math.atan2(t.z,-t.x)}!function(t){for(var n=new Sn,r=new Sn,i=new Sn,a=0;a<e.length;a+=3)c(e[a+0],n),c(e[a+1],r),c(e[a+2],i),o(n,r,i,t)}(r=r||0),function(t){for(var e=new Sn,n=0;n<i.length;n+=3)e.x=i[n+0],e.y=i[n+1],e.z=i[n+2],e.normalize().multiplyScalar(t),i[n+0]=e.x,i[n+1]=e.y,i[n+2]=e.z}(n),function(){for(var t=new Sn,e=0;e<i.length;e+=3){t.x=i[e+0],t.y=i[e+1],t.z=i[e+2];var n=u(t)/2/Math.PI+.5,r=(o=t,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(n,1-r)}var o;(function(){for(var t=new Sn,e=new Sn,n=new Sn,r=new Sn,o=new bn,s=new bn,c=new bn,h=0,d=0;h<i.length;h+=9,d+=6){t.set(i[h+0],i[h+1],i[h+2]),e.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),r.copy(t).add(e).add(n).divideScalar(3);var p=u(r);l(o,d+0,t,p),l(s,d+2,e,p),l(c,d+4,n,p)}})(),function(){for(var t=0;t<a.length;t+=6){var e=a[t+0],n=a[t+2],r=a[t+4],i=Math.max(e,n,r),o=Math.min(e,n,r);i>.9&&o<.1&&(e<.2&&(a[t+0]+=1),n<.2&&(a[t+2]+=1),r<.2&&(a[t+4]+=1))}}()}(),this.setAttribute("position",new di(i,3)),this.setAttribute("normal",new di(i.slice(),3)),this.setAttribute("uv",new di(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Lc(t,e){Yi.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Rc(t,e)),this.mergeVertices()}function Rc(t,e){Ac.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Pc(t,e){Yi.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Cc(t,e)),this.mergeVertices()}function Cc(t,e){Ac.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Oc(t,e){Yi.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Dc(t,e)),this.mergeVertices()}function Dc(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Ac.call(this,r,[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],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ic(t,e){Yi.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Nc(t,e)),this.mergeVertices()}function Nc(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Ac.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function zc(t,e,n,r,i,a){Yi.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Bc(t,e,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Bc(t,e,n,r,i){Mi.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},e=e||64,n=n||1,r=r||8,i=i||!1;var a=t.computeFrenetFrames(e,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new Sn,l=new Sn,u=new bn,h=new Sn,d=[],p=[],f=[],m=[];function v(i){h=t.getPointAt(i/e,h);var o=a.normals[i],u=a.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);l.x=v*o.x+m*u.x,l.y=v*o.y+m*u.y,l.z=v*o.z+m*u.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(o=0;o<e;o++)v(o);v(!1===i?e:0),function(){for(o=0;o<=e;o++)for(s=0;s<=r;s++)u.x=o/e,u.y=s/r,f.push(u.x,u.y)}(),function(){for(s=1;s<=e;s++)for(o=1;o<=r;o++){var t=(r+1)*(s-1)+(o-1),n=(r+1)*s+(o-1),i=(r+1)*s+o,a=(r+1)*(s-1)+o;m.push(t,n,a),m.push(n,i,a)}}()}(),this.setIndex(m),this.setAttribute("position",new di(d,3)),this.setAttribute("normal",new di(p,3)),this.setAttribute("uv",new di(f,2))}function Fc(t,e,n,r,i,a,o){Yi.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Uc(t,e,n,r,i,a)),this.mergeVertices()}function Uc(t,e,n,r,i,a){Mi.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:a},t=t||1,e=e||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,c=[],l=[],u=[],h=[],d=new Sn,p=new Sn,f=new Sn,m=new Sn,v=new Sn,g=new Sn,y=new Sn;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(A(x,i,a,t,f),A(x+.01,i,a,t,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,w=-e*Math.cos(b),_=e*Math.sin(b);d.x=f.x+(w*y.x+_*v.x),d.y=f.y+(w*y.y+_*v.y),d.z=f.z+(w*y.z+_*v.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var M=(r+1)*(s-1)+(o-1),S=(r+1)*s+(o-1),E=(r+1)*s+o,T=(r+1)*(s-1)+o;c.push(M,S,T),c.push(S,E,T)}function A(t,e,n,r,i){var a=Math.cos(t),o=Math.sin(t),s=n/e*t,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new di(l,3)),this.setAttribute("normal",new di(u,3)),this.setAttribute("uv",new di(h,2))}function Gc(t,e,n,r,i){Yi.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Hc(t,e,n,r,i)),this.mergeVertices()}function Hc(t,e,n,r,i){Mi.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||1,e=e||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],c=[],l=[],u=[],h=new Sn,d=new Sn,p=new Sn;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,m=a/n*Math.PI*2;d.x=(t+e*Math.cos(m))*Math.cos(f),d.y=(t+e*Math.cos(m))*Math.sin(f),d.z=e*Math.sin(m),c.push(d.x,d.y,d.z),h.x=t*Math.cos(f),h.y=t*Math.sin(f),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),u.push(o/r),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var v=(r+1)*a+o-1,g=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute("position",new di(c,3)),this.setAttribute("normal",new di(l,3)),this.setAttribute("uv",new di(u,2))}gc.prototype=Object.assign(Object.create(ar.prototype),{constructor:gc,isPoints:!0,raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),mc.copy(n.boundingSphere),mc.applyMatrix4(r),mc.radius+=i,!1!==t.ray.intersectsSphere(mc)){pc.getInverse(r),fc.copy(t.ray).applyMatrix4(pc);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(null!==s)for(var l=s.array,u=0,h=l.length;u<h;u++){var d=l[u];vc.fromArray(c,3*d),yc(vc,d,o,r,t,e,this)}else{u=0;for(var p=c.length/3;u<p;u++)vc.fromArray(c,3*u),yc(vc,u,o,r,t,e,this)}}else{var f=n.vertices;for(u=0,p=f.length;u<p;u++)yc(f[u],u,o,r,t,e,this)}}},updateMorphTargets:function(){var t,e,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;t<e;t++)n=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=t}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),xc.prototype=Object.assign(Object.create(Pn.prototype),{constructor:xc,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),bc.prototype=Object.create(Pn.prototype),bc.prototype.constructor=bc,bc.prototype.isCompressedTexture=!0,wc.prototype=Object.create(Pn.prototype),wc.prototype.constructor=wc,wc.prototype.isCanvasTexture=!0,_c.prototype=Object.create(Pn.prototype),_c.prototype.constructor=_c,_c.prototype.isDepthTexture=!0,Mc.prototype=Object.create(Mi.prototype),Mc.prototype.constructor=Mc,Sc.prototype=Object.create(Yi.prototype),Sc.prototype.constructor=Sc,Ec.prototype=Object.create(Mi.prototype),Ec.prototype.constructor=Ec,Tc.prototype=Object.create(Yi.prototype),Tc.prototype.constructor=Tc,Ac.prototype=Object.create(Mi.prototype),Ac.prototype.constructor=Ac,Lc.prototype=Object.create(Yi.prototype),Lc.prototype.constructor=Lc,Rc.prototype=Object.create(Ac.prototype),Rc.prototype.constructor=Rc,Pc.prototype=Object.create(Yi.prototype),Pc.prototype.constructor=Pc,Cc.prototype=Object.create(Ac.prototype),Cc.prototype.constructor=Cc,Oc.prototype=Object.create(Yi.prototype),Oc.prototype.constructor=Oc,Dc.prototype=Object.create(Ac.prototype),Dc.prototype.constructor=Dc,Ic.prototype=Object.create(Yi.prototype),Ic.prototype.constructor=Ic,Nc.prototype=Object.create(Ac.prototype),Nc.prototype.constructor=Nc,zc.prototype=Object.create(Yi.prototype),zc.prototype.constructor=zc,Bc.prototype=Object.create(Mi.prototype),Bc.prototype.constructor=Bc,Bc.prototype.toJSON=function(){var t=Mi.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Fc.prototype=Object.create(Yi.prototype),Fc.prototype.constructor=Fc,Uc.prototype=Object.create(Mi.prototype),Uc.prototype.constructor=Uc,Gc.prototype=Object.create(Yi.prototype),Gc.prototype.constructor=Gc,Hc.prototype=Object.create(Mi.prototype),Hc.prototype.constructor=Hc;var Vc=function(t,e,n){n=n||2;var r,i,a,o,s,c,l,u=e&&e.length,h=u?e[0]*n:t.length,d=kc(t,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(t,e,n,r){var i,a,o,s,c,l=[];for(i=0,a=e.length;i<a;i++)o=e[i]*r,s=i<a-1?e[i+1]*r:t.length,(c=kc(t,o,s,r,!1))===c.next&&(c.steiner=!0),l.push($c(c));for(l.sort(Jc),i=0;i<l.length;i++)Kc(l[i],n),n=jc(n,n.next);return n}(t,e,d,n)),t.length>80*n){r=a=t[0],i=o=t[1];for(var f=n;f<h;f+=n)(s=t[f])<r&&(r=s),(c=t[f+1])<i&&(i=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-r,o-i))?1/l:0}return Wc(d,p,n,r,i,l),p};function kc(t,e,n,r,i){var a,o;if(i===function(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,n,r)>0)for(a=e;a<n;a+=r)o=sl(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=sl(a,t[a],t[a+1],o);return o&&rl(o,o.next)&&(cl(o),o=o.next),o}function jc(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!rl(r,r.next)&&0!==nl(r.prev,r,r.next))r=r.next;else{if(cl(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Wc(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Qc(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,c,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ);e++);for(c=l;s>0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);for(var s,c,l=t;t.prev!==t.next;)if(s=t.prev,c=t.next,a?Xc(t,r,i,a):qc(t))e.push(s.i/n),e.push(t.i/n),e.push(c.i/n),cl(t),t=c.next,l=c.next;else if((t=c)===l){o?1===o?Wc(t=Yc(t,e,n),e,n,r,i,a,2):2===o&&Zc(t,e,n,r,i,a):Wc(jc(t),e,n,r,i,a,1);break}}}function qc(t){var e=t.prev,n=t,r=t.next;if(nl(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(tl(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&nl(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Xc(t,e,n,r){var i=t.prev,a=t,o=t.next;if(nl(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Qc(s,c,e,n,r),d=Qc(l,u,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&tl(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&nl(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&tl(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&nl(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&tl(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&nl(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&tl(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&nl(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Yc(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!rl(i,a)&&il(i,r,r.next,a)&&al(i,a)&&al(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),cl(r),cl(r.next),r=t=a),r=r.next}while(r!==t);return r}function Zc(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&el(o,s)){var c=ol(o,s);return o=jc(o,o.next),c=jc(c,c.next),Wc(o,e,n,r,i,a),void Wc(c,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function Jc(t,e){return t.x-e.x}function Kc(t,e){if(e=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===o)return n.prev;var c,l=n,u=n.x,h=n.y,d=1/0;r=n.next;for(;r!==l;)i>=r.x&&r.x>=u&&i!==r.x&&tl(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&((c=Math.abs(a-r.y)/(i-r.x))<d||c===d&&r.x>n.x)&&al(r,t)&&(n=r,d=c),r=r.next;return n}(t,e)){var n=ol(e,t);jc(n,n.next)}}function Qc(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function $c(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function tl(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function el(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&il(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&al(t,e)&&al(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}function nl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function rl(t,e){return t.x===e.x&&t.y===e.y}function il(t,e,n,r){return!!(rl(t,n)&&rl(e,r)||rl(t,r)&&rl(n,e))||nl(t,e,n)>0!=nl(t,e,r)>0&&nl(n,r,t)>0!=nl(n,r,e)>0}function al(t,e){return nl(t.prev,t,t.next)<0?nl(t,e,t.next)>=0&&nl(t,t.prev,e)>=0:nl(t,e,t.prev)<0||nl(t,t.next,e)<0}function ol(t,e){var n=new ll(t.i,t.x,t.y),r=new ll(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function sl(t,e,n,r){var i=new ll(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function cl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ll(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ul={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n},isClockWise:function(t){return ul.area(t)<0},triangulateShape:function(t,e){var n=[],r=[],i=[];hl(t),dl(n,t);var a=t.length;e.forEach(hl);for(var o=0;o<e.length;o++)r.push(a),a+=e[o].length,dl(n,e[o]);var s=Vc(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function hl(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function dl(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}function pl(t,e){Yi.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new fl(t,e)),this.mergeVertices()}function fl(t,e){Mi.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];for(var n=this,r=[],i=[],a=0,o=t.length;a<o;a++){s(t[a])}function s(t){var a=[],o=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1,c=void 0!==e.depth?e.depth:100,l=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:6,h=void 0!==e.bevelSize?e.bevelSize:u-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3,f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:ml;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.amount);var v,g,y,x,b,w,_,M,S=!1;f&&(v=f.getSpacedPoints(s),S=!0,l=!1,g=f.computeFrenetFrames(s,!1),y=new Sn,x=new Sn,b=new Sn),l||(p=0,u=0,h=0,d=0);var E=t.extractPoints(o),T=E.shape,A=E.holes;if(!ul.isClockWise(T))for(T=T.reverse(),_=0,M=A.length;_<M;_++)w=A[_],ul.isClockWise(w)&&(A[_]=w.reverse());var L=ul.triangulateShape(T,A),R=T;for(_=0,M=A.length;_<M;_++)w=A[_],T=T.concat(w);function P(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}var C,O,D,I,N,z,B=T.length,F=L.length;function U(t,e,n){var r,i,a,o=t.x-e.x,s=t.y-e.y,c=n.x-t.x,l=n.y-t.y,u=o*o+s*s,h=o*l-s*c;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+l*l),f=e.x-s/d,m=e.y+o/d,v=((n.x-l/p-f)*l-(n.y+c/p-m)*c)/(o*l-s*c),g=(r=f+o*v-t.x)*r+(i=m+s*v-t.y)*i;if(g<=2)return new bn(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new bn(r/a,i/a)}for(var G=[],H=0,V=R.length,k=V-1,j=H+1;H<V;H++,k++,j++)k===V&&(k=0),j===V&&(j=0),G[H]=U(R[H],R[k],R[j]);var W,q,X=[],Y=G.concat();for(_=0,M=A.length;_<M;_++){for(w=A[_],W=[],H=0,k=(V=w.length)-1,j=H+1;H<V;H++,k++,j++)k===V&&(k=0),j===V&&(j=0),W[H]=U(w[H],w[k],w[j]);X.push(W),Y=Y.concat(W)}for(C=0;C<p;C++){for(D=C/p,I=u*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+d,H=0,V=R.length;H<V;H++)J((N=P(R[H],G[H],O)).x,N.y,-I);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],H=0,V=w.length;H<V;H++)J((N=P(w[H],W[H],O)).x,N.y,-I)}for(O=h+d,H=0;H<B;H++)N=l?P(T[H],Y[H],O):T[H],S?(x.copy(g.normals[0]).multiplyScalar(N.x),y.copy(g.binormals[0]).multiplyScalar(N.y),b.copy(v[0]).add(x).add(y),J(b.x,b.y,b.z)):J(N.x,N.y,0);for(q=1;q<=s;q++)for(H=0;H<B;H++)N=l?P(T[H],Y[H],O):T[H],S?(x.copy(g.normals[q]).multiplyScalar(N.x),y.copy(g.binormals[q]).multiplyScalar(N.y),b.copy(v[q]).add(x).add(y),J(b.x,b.y,b.z)):J(N.x,N.y,c/s*q);for(C=p-1;C>=0;C--){for(D=C/p,I=u*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+d,H=0,V=R.length;H<V;H++)J((N=P(R[H],G[H],O)).x,N.y,c+I);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],H=0,V=w.length;H<V;H++)N=P(w[H],W[H],O),S?J(N.x,N.y+v[s-1].y,v[s-1].x+I):J(N.x,N.y,c+I)}function Z(t,e){var n,r;for(H=t.length;--H>=0;){n=H,(r=H-1)<0&&(r=t.length-1);var i=0,a=s+2*p;for(i=0;i<a;i++){var o=B*i,c=B*(i+1);Q(e+n+o,e+r+o,e+r+c,e+n+c)}}}function J(t,e,n){a.push(t),a.push(e),a.push(n)}function K(t,e,i){$(t),$(e),$(i);var a=r.length/3,o=m.generateTopUV(n,r,a-3,a-2,a-1);tt(o[0]),tt(o[1]),tt(o[2])}function Q(t,e,i,a){$(t),$(e),$(a),$(e),$(i),$(a);var o=r.length/3,s=m.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);tt(s[0]),tt(s[1]),tt(s[3]),tt(s[1]),tt(s[2]),tt(s[3])}function $(t){r.push(a[3*t+0]),r.push(a[3*t+1]),r.push(a[3*t+2])}function tt(t){i.push(t.x),i.push(t.y)}!function(){var t=r.length/3;if(l){var e=0,i=B*e;for(H=0;H<F;H++)K((z=L[H])[2]+i,z[1]+i,z[0]+i);for(i=B*(e=s+2*p),H=0;H<F;H++)K((z=L[H])[0]+i,z[1]+i,z[2]+i)}else{for(H=0;H<F;H++)K((z=L[H])[2],z[1],z[0]);for(H=0;H<F;H++)K((z=L[H])[0]+B*s,z[1]+B*s,z[2]+B*s)}n.addGroup(t,r.length/3-t,0)}(),function(){var t=r.length/3,e=0;for(Z(R,e),e+=R.length,_=0,M=A.length;_<M;_++)Z(w=A[_],e),e+=w.length;n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new di(r,3)),this.setAttribute("uv",new di(i,2)),this.computeVertexNormals()}pl.prototype=Object.create(Yi.prototype),pl.prototype.constructor=pl,pl.prototype.toJSON=function(){var t=Yi.prototype.toJSON.call(this);return vl(this.parameters.shapes,this.parameters.options,t)},fl.prototype=Object.create(Mi.prototype),fl.prototype.constructor=fl,fl.prototype.toJSON=function(){var t=Mi.prototype.toJSON.call(this);return vl(this.parameters.shapes,this.parameters.options,t)};var ml={generateTopUV:function(t,e,n,r,i){var a=e[3*n],o=e[3*n+1],s=e[3*r],c=e[3*r+1],l=e[3*i],u=e[3*i+1];return[new bn(a,o),new bn(s,c),new bn(l,u)]},generateSideWallUV:function(t,e,n,r,i,a){var o=e[3*n],s=e[3*n+1],c=e[3*n+2],l=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*a],v=e[3*a+1],g=e[3*a+2];return Math.abs(s-u)<.01?[new bn(o,1-c),new bn(l,1-h),new bn(d,1-f),new bn(m,1-g)]:[new bn(s,1-c),new bn(u,1-h),new bn(p,1-f),new bn(v,1-g)]}};function vl(t,e,n){if(n.shapes=[],Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var a=t[r];n.shapes.push(a.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}function gl(t,e){Yi.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new yl(t,e)),this.mergeVertices()}function yl(t,e){var n=(e=e||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Yi;var r=n.generateShapes(t,e.size);e.depth=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),fl.call(this,r,e),this.type="TextBufferGeometry"}function xl(t,e,n,r,i,a,o){Yi.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new bl(t,e,n,r,i,a,o)),this.mergeVertices()}function bl(t,e,n,r,i,a,o){Mi.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=t||1,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,l=Math.min(a+o,Math.PI),u=0,h=[],d=new Sn,p=new Sn,f=[],m=[],v=[],g=[];for(c=0;c<=n;c++){var y=[],x=c/n,b=0;for(0==c&&0==a?b=.5/e:c==n&&l==Math.PI&&(b=-.5/e),s=0;s<=e;s++){var w=s/e;d.x=-t*Math.cos(r+w*i)*Math.sin(a+x*o),d.y=t*Math.cos(a+x*o),d.z=t*Math.sin(r+w*i)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),v.push(p.x,p.y,p.z),g.push(w+b,1-x),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<e;s++){var _=h[c][s+1],M=h[c][s],S=h[c+1][s],E=h[c+1][s+1];(0!==c||a>0)&&f.push(_,M,E),(c!==n-1||l<Math.PI)&&f.push(M,S,E)}this.setIndex(f),this.setAttribute("position",new di(m,3)),this.setAttribute("normal",new di(v,3)),this.setAttribute("uv",new di(g,2))}function wl(t,e,n,r,i,a){Yi.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new _l(t,e,n,r,i,a)),this.mergeVertices()}function _l(t,e,n,r,i,a){Mi.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},t=t||.5,e=e||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],u=[],h=[],d=[],p=t,f=(e-t)/(r=void 0!==r?Math.max(1,r):1),m=new Sn,v=new bn;for(s=0;s<=r;s++){for(c=0;c<=n;c++)o=i+c/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/e+1)/2,v.y=(m.y/e+1)/2,d.push(v.x,v.y);p+=f}for(s=0;s<r;s++){var g=s*(n+1);for(c=0;c<n;c++){var y=o=c+g,x=o+n+1,b=o+n+2,w=o+1;l.push(y,x,w),l.push(x,b,w)}}this.setIndex(l),this.setAttribute("position",new di(u,3)),this.setAttribute("normal",new di(h,3)),this.setAttribute("uv",new di(d,2))}function Ml(t,e,n,r){Yi.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},this.fromBufferGeometry(new Sl(t,e,n,r)),this.mergeVertices()}function Sl(t,e,n,r){Mi.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e)||12,n=n||0,r=r||2*Math.PI,r=xn.clamp(r,0,2*Math.PI);var i,a,o,s=[],c=[],l=[],u=1/e,h=new Sn,d=new bn;for(a=0;a<=e;a++){var p=n+a*u*r,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=t.length-1;o++)h.x=t[o].x*f,h.y=t[o].y,h.z=t[o].x*m,c.push(h.x,h.y,h.z),d.x=a/e,d.y=o/(t.length-1),l.push(d.x,d.y)}for(a=0;a<e;a++)for(o=0;o<t.length-1;o++){var v=i=o+a*t.length,g=i+t.length,y=i+t.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute("position",new di(c,3)),this.setAttribute("uv",new di(l,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,w=new Sn,_=new Sn,M=new Sn;for(i=e*t.length*3,a=0,o=0;a<t.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[i+o+0],_.y=b[i+o+1],_.z=b[i+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[i+o+0]=M.x,b[o+1]=b[i+o+1]=M.y,b[o+2]=b[i+o+2]=M.z}}function El(t,e){Yi.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new Tl(t,e)),this.mergeVertices()}function Tl(t,e){Mi.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(t))l(t);else for(var c=0;c<t.length;c++)l(t[c]),this.addGroup(o,s,c),o+=s,s=0;function l(t){var o,c,l,u=r.length/3,h=t.extractPoints(e),d=h.shape,p=h.holes;for(!1===ul.isClockWise(d)&&(d=d.reverse()),o=0,c=p.length;o<c;o++)l=p[o],!0===ul.isClockWise(l)&&(p[o]=l.reverse());var f=ul.triangulateShape(d,p);for(o=0,c=p.length;o<c;o++)l=p[o],d=d.concat(l);for(o=0,c=d.length;o<c;o++){var m=d[o];r.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var v=f[o],g=v[0]+u,y=v[1]+u,x=v[2]+u;n.push(g,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new di(r,3)),this.setAttribute("normal",new di(i,3)),this.setAttribute("uv",new di(a,2))}function Al(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}function Ll(t,e){Mi.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var n,r,i,a,o=[],s=Math.cos(xn.DEG2RAD*e),c=[0,0],l={},u=["a","b","c"];t.isBufferGeometry?(a=new Yi).fromBufferGeometry(t):a=t.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],v=0;v<3;v++)n=m[u[v]],r=m[u[(v+1)%3]],c[0]=Math.min(n,r),c[1]=Math.max(n,r),void 0===l[i=c[0]+","+c[1]]?l[i]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[i].face2=p;for(i in l){var g=l[i];if(void 0===g.face2||d[g.face1].normal.dot(d[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new di(o,3))}function Rl(t,e,n,r,i,a,o,s){Yi.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Pl(t,e,n,r,i,a,o,s)),this.mergeVertices()}function Pl(t,e,n,r,i,a,o,s){Mi.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;t=void 0!==t?t:1,e=void 0!==e?e:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],u=[],h=[],d=[],p=0,f=[],m=n/2,v=0;function g(n){var i,a,f,g=new bn,y=new Sn,x=0,b=!0===n?t:e,w=!0===n?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,m*w,0),h.push(0,w,0),d.push(.5,.5),p++;for(f=p,i=0;i<=r;i++){var _=i/r*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,u.push(y.x,y.y,y.z),h.push(0,w,0),g.x=.5*M+.5,g.y=.5*S*w+.5,d.push(g.x,g.y),p++}for(i=0;i<r;i++){var E=a+i,T=f+i;!0===n?l.push(T,T+1,E):l.push(T+1,T,E),x+=3}c.addGroup(v,x,!0===n?1:2),v+=x}!function(){var a,g,y=new Sn,x=new Sn,b=0,w=(e-t)/n;for(g=0;g<=i;g++){var _=[],M=g/i,S=M*(e-t)+t;for(a=0;a<=r;a++){var E=a/r,T=E*s+o,A=Math.sin(T),L=Math.cos(T);x.x=S*A,x.y=-M*n+m,x.z=S*L,u.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),h.push(y.x,y.y,y.z),d.push(E,1-M),_.push(p++)}f.push(_)}for(a=0;a<r;a++)for(g=0;g<i;g++){var R=f[g][a],P=f[g+1][a],C=f[g+1][a+1],O=f[g][a+1];l.push(R,P,O),l.push(P,C,O),b+=6}c.addGroup(v,b,0),v+=b}(),!1===a&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new di(u,3)),this.setAttribute("normal",new di(h,3)),this.setAttribute("uv",new di(d,2))}function Cl(t,e,n,r,i,a,o){Rl.call(this,0,t,e,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function Ol(t,e,n,r,i,a,o){Pl.call(this,0,t,e,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function Dl(t,e,n,r){Yi.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new Il(t,e,n,r)),this.mergeVertices()}function Il(t,e,n,r){Mi.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||1,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],c=[],l=[],u=new Sn,h=new bn;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,i=3;a<=e;a++,i+=3){var d=n+a/e*r;u.x=t*Math.cos(d),u.y=t*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[i]/t+1)/2,h.y=(s[i+1]/t+1)/2,l.push(h.x,h.y)}for(i=1;i<=e;i++)o.push(i,i+1,0);this.setIndex(o),this.setAttribute("position",new di(s,3)),this.setAttribute("normal",new di(c,3)),this.setAttribute("uv",new di(l,2))}gl.prototype=Object.create(Yi.prototype),gl.prototype.constructor=gl,yl.prototype=Object.create(fl.prototype),yl.prototype.constructor=yl,xl.prototype=Object.create(Yi.prototype),xl.prototype.constructor=xl,bl.prototype=Object.create(Mi.prototype),bl.prototype.constructor=bl,wl.prototype=Object.create(Yi.prototype),wl.prototype.constructor=wl,_l.prototype=Object.create(Mi.prototype),_l.prototype.constructor=_l,Ml.prototype=Object.create(Yi.prototype),Ml.prototype.constructor=Ml,Sl.prototype=Object.create(Mi.prototype),Sl.prototype.constructor=Sl,El.prototype=Object.create(Yi.prototype),El.prototype.constructor=El,El.prototype.toJSON=function(){var t=Yi.prototype.toJSON.call(this);return Al(this.parameters.shapes,t)},Tl.prototype=Object.create(Mi.prototype),Tl.prototype.constructor=Tl,Tl.prototype.toJSON=function(){var t=Mi.prototype.toJSON.call(this);return Al(this.parameters.shapes,t)},Ll.prototype=Object.create(Mi.prototype),Ll.prototype.constructor=Ll,Rl.prototype=Object.create(Yi.prototype),Rl.prototype.constructor=Rl,Pl.prototype=Object.create(Mi.prototype),Pl.prototype.constructor=Pl,Cl.prototype=Object.create(Rl.prototype),Cl.prototype.constructor=Cl,Ol.prototype=Object.create(Pl.prototype),Ol.prototype.constructor=Ol,Dl.prototype=Object.create(Yi.prototype),Dl.prototype.constructor=Dl,Il.prototype=Object.create(Mi.prototype),Il.prototype.constructor=Il;var Nl=Object.freeze({__proto__:null,WireframeGeometry:Mc,ParametricGeometry:Sc,ParametricBufferGeometry:Ec,TetrahedronGeometry:Lc,TetrahedronBufferGeometry:Rc,OctahedronGeometry:Pc,OctahedronBufferGeometry:Cc,IcosahedronGeometry:Oc,IcosahedronBufferGeometry:Dc,DodecahedronGeometry:Ic,DodecahedronBufferGeometry:Nc,PolyhedronGeometry:Tc,PolyhedronBufferGeometry:Ac,TubeGeometry:zc,TubeBufferGeometry:Bc,TorusKnotGeometry:Fc,TorusKnotBufferGeometry:Uc,TorusGeometry:Gc,TorusBufferGeometry:Hc,TextGeometry:gl,TextBufferGeometry:yl,SphereGeometry:xl,SphereBufferGeometry:bl,RingGeometry:wl,RingBufferGeometry:_l,PlaneGeometry:ya,PlaneBufferGeometry:xa,LatheGeometry:Ml,LatheBufferGeometry:Sl,ShapeGeometry:El,ShapeBufferGeometry:Tl,ExtrudeGeometry:pl,ExtrudeBufferGeometry:fl,EdgesGeometry:Ll,ConeGeometry:Cl,ConeBufferGeometry:Ol,CylinderGeometry:Rl,CylinderBufferGeometry:Pl,CircleGeometry:Dl,CircleBufferGeometry:Il,BoxGeometry:Zi,BoxBufferGeometry:Ji});function zl(t){ni.call(this),this.type="ShadowMaterial",this.color=new Jr(0),this.transparent=!0,this.setValues(t)}function Bl(t){na.call(this,t),this.type="RawShaderMaterial"}function Fl(t){ni.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Jr(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ve,this.normalScale=new bn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ul(t){Fl.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new bn(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(t)}function Gl(t){ni.call(this),this.type="MeshPhongMaterial",this.color=new Jr(16777215),this.specular=new Jr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ve,this.normalScale=new bn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=tt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Hl(t){Gl.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Vl(t){ni.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ve,this.normalScale=new bn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function kl(t){ni.call(this),this.type="MeshLambertMaterial",this.color=new Jr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=tt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function jl(t){ni.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Jr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ve,this.normalScale=new bn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Wl(t){ec.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}zl.prototype=Object.create(ni.prototype),zl.prototype.constructor=zl,zl.prototype.isShadowMaterial=!0,zl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this},Bl.prototype=Object.create(na.prototype),Bl.prototype.constructor=Bl,Bl.prototype.isRawShaderMaterial=!0,Fl.prototype=Object.create(ni.prototype),Fl.prototype.constructor=Fl,Fl.prototype.isMeshStandardMaterial=!0,Fl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ul.prototype=Object.create(Fl.prototype),Ul.prototype.constructor=Ul,Ul.prototype.isMeshPhysicalMaterial=!0,Ul.prototype.copy=function(t){return Fl.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearcoat=t.clearcoat,this.clearcoatRoughness=t.clearcoatRoughness,t.sheen?this.sheen=(this.sheen||new Jr).copy(t.sheen):this.sheen=null,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.transparency=t.transparency,this},Gl.prototype=Object.create(ni.prototype),Gl.prototype.constructor=Gl,Gl.prototype.isMeshPhongMaterial=!0,Gl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Hl.prototype=Object.create(Gl.prototype),Hl.prototype.constructor=Hl,Hl.prototype.isMeshToonMaterial=!0,Hl.prototype.copy=function(t){return Gl.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Vl.prototype=Object.create(ni.prototype),Vl.prototype.constructor=Vl,Vl.prototype.isMeshNormalMaterial=!0,Vl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},kl.prototype=Object.create(ni.prototype),kl.prototype.constructor=kl,kl.prototype.isMeshLambertMaterial=!0,kl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},jl.prototype=Object.create(ni.prototype),jl.prototype.constructor=jl,jl.prototype.isMeshMatcapMaterial=!0,jl.prototype.copy=function(t){return ni.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Wl.prototype=Object.create(ec.prototype),Wl.prototype.constructor=Wl,Wl.prototype.isLineDashedMaterial=!0,Wl.prototype.copy=function(t){return ec.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var ql=Object.freeze({__proto__:null,ShadowMaterial:zl,SpriteMaterial:As,RawShaderMaterial:Bl,ShaderMaterial:na,PointsMaterial:dc,MeshPhysicalMaterial:Ul,MeshStandardMaterial:Fl,MeshPhongMaterial:Gl,MeshToonMaterial:Hl,MeshNormalMaterial:Vl,MeshLambertMaterial:kl,MeshDepthMaterial:is,MeshDistanceMaterial:as,MeshBasicMaterial:ri,MeshMatcapMaterial:jl,LineDashedMaterial:Wl,LineBasicMaterial:ec,Material:ni}),Xl={arraySlice:function(t,e,n){return Xl.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=new Array(e),r=0;r!==e;++r)n[r]=r;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*e,c=0;c!==e;++c)i[o++]=t[s+c];return i},flattenJSON:function(t,e,n,r){for(var i=1,a=t[0];void 0!==a&&void 0===a[r];)a=t[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(e.push(a.time),n.push.apply(n,o)),a=t[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(e.push(a.time),o.toArray(n,n.length)),a=t[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(e.push(a.time),n.push(o)),a=t[i++]}while(void 0!==a)}},subclip:function(t,e,n,r,i){i=i||30;var a=t.clone();a.name=e;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],d=0;d<c.times.length;++d){var p=c.times[d]*i;if(!(p<n||p>=r)){u.push(c.times[d]);for(var f=0;f<l;++f)h.push(c.values[d*l+f])}}0!==u.length&&(c.times=Xl.convertArray(u,c.times.constructor),c.values=Xl.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a}};function Yl(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Zl(t,e,n,r){Yl.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Jl(t,e,n,r){Yl.call(this,t,e,n,r)}function Kl(t,e,n,r){Yl.call(this,t,e,n,r)}function Ql(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Xl.convertArray(e,this.TimeBufferType),this.values=Xl.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function $l(t,e,n){Ql.call(this,t,e,n)}function tu(t,e,n,r){Ql.call(this,t,e,n,r)}function eu(t,e,n,r){Ql.call(this,t,e,n,r)}function nu(t,e,n,r){Yl.call(this,t,e,n,r)}function ru(t,e,n,r){Ql.call(this,t,e,n,r)}function iu(t,e,n,r){Ql.call(this,t,e,n,r)}function au(t,e,n,r){Ql.call(this,t,e,n,r)}function ou(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=xn.generateUUID(),this.duration<0&&this.resetDuration()}function su(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return eu;case"vector":case"vector2":case"vector3":case"vector4":return au;case"color":return tu;case"quaternion":return ru;case"bool":case"boolean":return $l;case"string":return iu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var n=[],r=[];Xl.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Yl.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var a;n:{r:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,t<(r=e[++n]))break e}a=e.length;break n}if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=i,t>=(i=e[--n-1]))break e}a=n,n=0}for(;n<a;){var c=n+a>>>1;t<e[c]?a=c:n=c+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,a=0;a!==r;++a)e[a]=n[i+a];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Yl.prototype,{beforeStart_:Yl.prototype.copySampleValue_,afterEnd_:Yl.prototype.copySampleValue_}),Zl.prototype=Object.assign(Object.create(Yl.prototype),{constructor:Zl,DefaultSettings_:{endingStart:Te,endingEnd:Te},intervalChanged_:function(t,e,n){var r=this.parameterPositions,i=t-2,a=t+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case Ae:i=t,o=2*e-n;break;case Le:o=e+r[i=r.length-2]-r[i+1];break;default:i=t,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Ae:a=t,s=2*n-e;break;case Le:a=1,s=n+r[1]-r[0];break;default:a=t-1,s=e}var c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)i[b]=v*a[l+b]+g*a[c+b]+y*a[s+b]+x*a[u+b];return i}}),Jl.prototype=Object.assign(Object.create(Yl.prototype),{constructor:Jl,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=s-o,l=(n-e)/(r-e),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}}),Kl.prototype=Object.assign(Object.create(Yl.prototype),{constructor:Kl,interpolate_:function(t){return this.copySampleValue_(t-1)}}),Object.assign(Ql,{toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Xl.convertArray(t.times,Array),values:Xl.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e}}),Object.assign(Ql.prototype,{constructor:Ql,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Se,InterpolantFactoryMethodDiscrete:function(t){return new Kl(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Jl(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Zl(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case Me:e=this.InterpolantFactoryMethodDiscrete;break;case Se:e=this.InterpolantFactoryMethodLinear;break;case Ee:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Me;case this.InterpolantFactoryMethodLinear:return Se;case this.InterpolantFactoryMethodSmooth:return Ee}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<t;)++i;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Xl.arraySlice(n,i,a),this.values=Xl.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&Xl.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),r=this.getInterpolation()===Ee,i=1,a=t.length-1,o=1;o<a;++o){var s=!1,c=t[o];if(c!==t[o+1]&&(1!==o||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=e[l+d];if(p!==e[u+d]||p!==e[h+d]){s=!0;break}}if(s){if(o!==i){t[i]=t[o];var f=o*n,m=i*n;for(d=0;d!==n;++d)e[m+d]=e[f+d]}++i}}if(a>0){t[i]=t[a];for(f=a*n,m=i*n,d=0;d!==n;++d)e[m+d]=e[f+d];++i}return i!==t.length&&(this.times=Xl.arraySlice(t,0,i),this.values=Xl.arraySlice(e,0,i*n)),this},clone:function(){var t=Xl.arraySlice(this.times,0),e=Xl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}),$l.prototype=Object.assign(Object.create(Ql.prototype),{constructor:$l,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Me,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),tu.prototype=Object.assign(Object.create(Ql.prototype),{constructor:tu,ValueTypeName:"color"}),eu.prototype=Object.assign(Object.create(Ql.prototype),{constructor:eu,ValueTypeName:"number"}),nu.prototype=Object.assign(Object.create(Yl.prototype),{constructor:nu,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,c=(n-e)/(r-e),l=s+o;s!==l;s+=4)wn.slerpFlat(i,0,a,s-o,a,s,c);return i}}),ru.prototype=Object.assign(Object.create(Ql.prototype),{constructor:ru,ValueTypeName:"quaternion",DefaultInterpolation:Se,InterpolantFactoryMethodLinear:function(t){return new nu(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),iu.prototype=Object.assign(Object.create(Ql.prototype),{constructor:iu,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Me,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),au.prototype=Object.assign(Object.create(Ql.prototype),{constructor:au,ValueTypeName:"vector"}),Object.assign(ou,{parse:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,a=n.length;i!==a;++i)e.push(su(n[i]).scale(r));return new ou(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},i=0,a=n.length;i!==a;++i)e.push(Ql.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(t,e,n,r){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=Xl.getKeyframeOrder(s);s=Xl.sortedArray(s,1,l),c=Xl.sortedArray(c,1,l),r||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new eu(".morphTargetInfluences["+e[o].name+"]",s,c).scale(1/n))}return new ou(t,-1,a)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],c=s.name.match(i);if(c&&c.length>1){var l=r[h=c[1]];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(ou.CreateFromMorphTargetSequence(h,r[h],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var a=[],o=[];Xl.flattenJSON(n,a,o,r),0!==a.length&&i.push(new t(e,a,o))}},r=[],i=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var u={},h=0;h<l.length;h++)if(l[h].morphTargets)for(var d=0;d<l[h].morphTargets.length;d++)u[l[h].morphTargets[d]]=-1;for(var p in u){var f=[],m=[];for(d=0;d!==l[h].morphTargets.length;++d){var v=l[h];f.push(v.time),m.push(v.morphTarget===p?1:0)}r.push(new eu(".morphTargetInfluence["+p+"]",f,m))}a=u.length*(o||1)}else{var g=".bones["+e[c].name+"]";n(au,g+".position",l,"pos",r),n(ru,g+".quaternion",l,"rot",r),n(au,g+".scale",l,"scl",r)}}return 0===r.length?null:new ou(i,a,r)}}),Object.assign(ou.prototype,{resetDuration:function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var r=this.tracks[e];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},validate:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this},clone:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new ou(this.name,this.duration,t)}});var cu={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function lu(t,e,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===i&&void 0!==r.onStart&&r.onStart(t,a,o),i=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){var e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(var e=0,n=c.length;e<n;e+=2){var r=c[e],i=c[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return i}return null}}var uu=new lu;function hu(t){this.manager=void 0!==t?t:uu,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}Object.assign(hu.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this}});var du={};function pu(t){hu.call(this,t)}function fu(t){hu.call(this,t)}function mu(t){hu.call(this,t)}function vu(t){hu.call(this,t)}function gu(t){hu.call(this,t)}function yu(t){hu.call(this,t)}function xu(t){hu.call(this,t)}function bu(){this.type="Curve",this.arcLengthDivisions=200}function wu(t,e,n,r,i,a,o,s){bu.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=e||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function _u(t,e,n,r,i,a){wu.call(this,t,e,n,n,r,i,a),this.type="ArcCurve"}function Mu(){var t=0,e=0,n=0,r=0;function i(i,a,o,s){t=i,e=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(t,e,n,r,a){i(e,n,a*(n-t),a*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,a,o,s){var c=(e-t)/a-(n-t)/(a+o)+(n-e)/o,l=(n-e)/o-(r-e)/(o+s)+(r-n)/s;i(e,n,c*=o,l*=o)},calc:function(i){var a=i*i;return t+e*i+n*a+r*(a*i)}}}pu.prototype=Object.assign(Object.create(hu.prototype),{constructor:pu,load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=cu.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;if(void 0===du[t]){var o=t.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(l,s);break;case"json":u=JSON.parse(l);break;default:u=l}setTimeout((function(){e&&e(u),i.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}),0)}}else{du[t]=[],du[t].push({onLoad:e,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var v in m.open("GET",t,!0),m.addEventListener("load",(function(e){var n=this.response,r=du[t];if(delete du[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),cu.add(t,n);for(var a=0,o=r.length;a<o;a++){(s=r[a]).onLoad&&s.onLoad(n)}i.manager.itemEnd(t)}else{for(a=0,o=r.length;a<o;a++){var s;(s=r[a]).onError&&s.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}}),!1),m.addEventListener("progress",(function(e){for(var n=du[t],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(e)}}),!1),m.addEventListener("error",(function(e){var n=du[t];delete du[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),m.addEventListener("abort",(function(e){var n=du[t];delete du[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(t),m}du[t].push({onLoad:e,onProgress:n,onError:r})},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),fu.prototype=Object.assign(Object.create(hu.prototype),{constructor:fu,load:function(t,e,n,r){var i=this,a=new pu(i.manager);a.setPath(i.path),a.load(t,(function(t){e(i.parse(JSON.parse(t)))}),n,r)},parse:function(t){for(var e=[],n=0;n<t.length;n++){var r=ou.parse(t[n]);e.push(r)}return e}}),mu.prototype=Object.assign(Object.create(hu.prototype),{constructor:mu,load:function(t,e,n,r){var i=this,a=[],o=new bc;o.image=a;var s=new pu(this.manager);function c(c){s.load(t[c],(function(t){var n=i.parse(t,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=Et),o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var l=0,u=0,h=t.length;u<h;++u)c(u);else s.load(t,(function(t){var n=i.parse(t,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Et),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,r);return o}}),vu.prototype=Object.assign(Object.create(hu.prototype),{constructor:vu,load:function(t,e,n,r){var i=this,a=new la,o=new pu(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(t,(function(t){var n=i.parse(t);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:yt,a.wrapT=void 0!==n.wrapT?n.wrapT:yt,a.magFilter=void 0!==n.magFilter?n.magFilter:Et,a.minFilter=void 0!==n.minFilter?n.minFilter:Et,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Lt),1===n.mipmapCount&&(a.minFilter=Et),a.needsUpdate=!0,e&&e(a,n))}),n,r),a}}),gu.prototype=Object.assign(Object.create(hu.prototype),{constructor:gu,load:function(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=cu.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),cu.add(t,this),e&&e(this),i.manager.itemEnd(t)}function c(e){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}),yu.prototype=Object.assign(Object.create(hu.prototype),{constructor:yu,load:function(t,e,n,r){var i=new Ca,a=new gu(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(t[n],(function(t){i.images[n]=t,6===++o&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(var c=0;c<t.length;++c)s(c);return i}}),xu.prototype=Object.assign(Object.create(hu.prototype),{constructor:xu,load:function(t,e,n,r){var i=new Pn,a=new gu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(n){i.image=n;var r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?kt:jt,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}),Object.assign(bu.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=t;n++)a+=(e=this.getPoint(n/t)).distanceTo(i),r.push(a),i=e;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e||t*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var r=this.getPoint(e);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,r,i,a=new Sn,o=[],s=[],c=[],l=new Sn,u=new Hn;for(n=0;n<=t;n++)r=n/t,o[n]=this.getTangentAt(r),o[n].normalize();s[0]=new Sn,c[0]=new Sn;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(o[n-1],o[n]),l.length()>Number.EPSILON&&(l.normalize(),i=Math.acos(xn.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,i))),c[n].crossVectors(o[n],s[n]);if(!0===e)for(i=Math.acos(xn.clamp(s[0].dot(s[t]),-1,1)),i/=t,o[0].dot(l.crossVectors(s[0],s[t]))>0&&(i=-i),n=1;n<=t;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],i*n)),c[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),wu.prototype=Object.create(bu.prototype),wu.prototype.constructor=wu,wu.prototype.isEllipseCurve=!0,wu.prototype.getPoint=function(t,e){for(var n=e||new bn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+t*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=c-this.aY;s=h*l-d*u+this.aX,c=h*u+d*l+this.aY}return n.set(s,c)},wu.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},wu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t},wu.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},_u.prototype=Object.create(wu.prototype),_u.prototype.constructor=_u,_u.prototype.isArcCurve=!0;var Su=new Sn,Eu=new Mu,Tu=new Mu,Au=new Mu;function Lu(t,e,n,r){bu.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=e||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Ru(t,e,n,r,i){var a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function Pu(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function Cu(t,e,n,r,i){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}function Ou(t,e,n,r){bu.call(this),this.type="CubicBezierCurve",this.v0=t||new bn,this.v1=e||new bn,this.v2=n||new bn,this.v3=r||new bn}function Du(t,e,n,r){bu.call(this),this.type="CubicBezierCurve3",this.v0=t||new Sn,this.v1=e||new Sn,this.v2=n||new Sn,this.v3=r||new Sn}function Iu(t,e){bu.call(this),this.type="LineCurve",this.v1=t||new bn,this.v2=e||new bn}function Nu(t,e){bu.call(this),this.type="LineCurve3",this.v1=t||new Sn,this.v2=e||new Sn}function zu(t,e,n){bu.call(this),this.type="QuadraticBezierCurve",this.v0=t||new bn,this.v1=e||new bn,this.v2=n||new bn}function Bu(t,e,n){bu.call(this),this.type="QuadraticBezierCurve3",this.v0=t||new Sn,this.v1=e||new Sn,this.v2=n||new Sn}function Fu(t){bu.call(this),this.type="SplineCurve",this.points=t||[]}Lu.prototype=Object.create(bu.prototype),Lu.prototype.constructor=Lu,Lu.prototype.isCatmullRomCurve3=!0,Lu.prototype.getPoint=function(t,e){var n,r,i,a,o=e||new Sn,s=this.points,c=s.length,l=(c-(this.closed?0:1))*t,u=Math.floor(l),h=l-u;if(this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Su.subVectors(s[0],s[1]).add(s[0]),n=Su),r=s[u%c],i=s[(u+1)%c],this.closed||u+2<c?a=s[(u+2)%c]:(Su.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Su),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(r),d),f=Math.pow(r.distanceToSquared(i),d),m=Math.pow(i.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Eu.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,p,f,m),Tu.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,p,f,m),Au.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(Eu.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),Tu.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),Au.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(Eu.calc(h),Tu.calc(h),Au.calc(h)),o},Lu.prototype.copy=function(t){bu.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push(r.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Lu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++){var r=this.points[e];t.points.push(r.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t},Lu.prototype.fromJSON=function(t){bu.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push((new Sn).fromArray(r))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},Ou.prototype=Object.create(bu.prototype),Ou.prototype.constructor=Ou,Ou.prototype.isCubicBezierCurve=!0,Ou.prototype.getPoint=function(t,e){var n=e||new bn,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Cu(t,r.x,i.x,a.x,o.x),Cu(t,r.y,i.y,a.y,o.y)),n},Ou.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Ou.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Ou.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Du.prototype=Object.create(bu.prototype),Du.prototype.constructor=Du,Du.prototype.isCubicBezierCurve3=!0,Du.prototype.getPoint=function(t,e){var n=e||new Sn,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Cu(t,r.x,i.x,a.x,o.x),Cu(t,r.y,i.y,a.y,o.y),Cu(t,r.z,i.z,a.z,o.z)),n},Du.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},Du.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t},Du.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this},Iu.prototype=Object.create(bu.prototype),Iu.prototype.constructor=Iu,Iu.prototype.isLineCurve=!0,Iu.prototype.getPoint=function(t,e){var n=e||new bn;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Iu.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Iu.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},Iu.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Iu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Iu.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Nu.prototype=Object.create(bu.prototype),Nu.prototype.constructor=Nu,Nu.prototype.isLineCurve3=!0,Nu.prototype.getPoint=function(t,e){var n=e||new Sn;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},Nu.prototype.getPointAt=function(t,e){return this.getPoint(t,e)},Nu.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Nu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Nu.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},zu.prototype=Object.create(bu.prototype),zu.prototype.constructor=zu,zu.prototype.isQuadraticBezierCurve=!0,zu.prototype.getPoint=function(t,e){var n=e||new bn,r=this.v0,i=this.v1,a=this.v2;return n.set(Pu(t,r.x,i.x,a.x),Pu(t,r.y,i.y,a.y)),n},zu.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},zu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},zu.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Bu.prototype=Object.create(bu.prototype),Bu.prototype.constructor=Bu,Bu.prototype.isQuadraticBezierCurve3=!0,Bu.prototype.getPoint=function(t,e){var n=e||new Sn,r=this.v0,i=this.v1,a=this.v2;return n.set(Pu(t,r.x,i.x,a.x),Pu(t,r.y,i.y,a.y),Pu(t,r.z,i.z,a.z)),n},Bu.prototype.copy=function(t){return bu.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},Bu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t},Bu.prototype.fromJSON=function(t){return bu.prototype.fromJSON.call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this},Fu.prototype=Object.create(bu.prototype),Fu.prototype.constructor=Fu,Fu.prototype.isSplineCurve=!0,Fu.prototype.getPoint=function(t,e){var n=e||new bn,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ru(o,s.x,c.x,l.x,u.x),Ru(o,s.y,c.y,l.y,u.y)),n},Fu.prototype.copy=function(t){bu.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push(r.clone())}return this},Fu.prototype.toJSON=function(){var t=bu.prototype.toJSON.call(this);t.points=[];for(var e=0,n=this.points.length;e<n;e++){var r=this.points[e];t.points.push(r.toArray())}return t},Fu.prototype.fromJSON=function(t){bu.prototype.fromJSON.call(this,t),this.points=[];for(var e=0,n=t.points.length;e<n;e++){var r=t.points[e];this.points.push((new bn).fromArray(r))}return this};var Uu=Object.freeze({__proto__:null,ArcCurve:_u,CatmullRomCurve3:Lu,CubicBezierCurve:Ou,CubicBezierCurve3:Du,EllipseCurve:wu,LineCurve:Iu,LineCurve3:Nu,QuadraticBezierCurve:zu,QuadraticBezierCurve3:Bu,SplineCurve:Fu});function Gu(){bu.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Hu(t){Gu.call(this),this.type="Path",this.currentPoint=new bn,t&&this.setFromPoints(t)}function Vu(t){Hu.call(this,t),this.uuid=xn.generateUUID(),this.type="Shape",this.holes=[]}function ku(t,e){ar.call(this),this.type="Light",this.color=new Jr(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function ju(t,e,n){ku.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ar.DefaultUp),this.updateMatrix(),this.groundColor=new Jr(e)}function Wu(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new bn(512,512),this.map=null,this.mapPass=null,this.matrix=new Hn,this._frustum=new da,this._frameExtents=new bn(1,1),this._viewportCount=1,this._viewports=[new Cn(0,0,1,1)]}function qu(){Wu.call(this,new ia(50,1,.5,500))}function Xu(t,e,n,r,i,a){ku.call(this,t,e),this.type="SpotLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new qu}function Yu(){Wu.call(this,new ia(90,1,.5,500)),this._frameExtents=new bn(4,2),this._viewportCount=6,this._viewports=[new Cn(2,1,1,1),new Cn(0,1,1,1),new Cn(3,1,1,1),new Cn(1,1,1,1),new Cn(3,0,1,1),new Cn(1,0,1,1)],this._cubeDirections=[new Sn(1,0,0),new Sn(-1,0,0),new Sn(0,0,1),new Sn(0,0,-1),new Sn(0,1,0),new Sn(0,-1,0)],this._cubeUps=[new Sn(0,1,0),new Sn(0,1,0),new Sn(0,1,0),new Sn(0,1,0),new Sn(0,0,1),new Sn(0,0,-1)]}function Zu(t,e,n,r){ku.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new Yu}function Ju(t,e,n,r,i,a){ra.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==e?e:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function Ku(){Wu.call(this,new Ju(-5,5,5,-5,.5,500))}function Qu(t,e){ku.call(this,t,e),this.type="DirectionalLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.shadow=new Ku}function $u(t,e){ku.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function th(t,e,n,r){ku.call(this,t,e),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function eh(t){hu.call(this,t),this.textures={}}Gu.prototype=Object.assign(Object.create(bu.prototype),{constructor:Gu,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Iu(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=e){var i=n[r]-e,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];e&&e.equals(l)||(n.push(l),e=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(t){bu.prototype.copy.call(this,t),this.curves=[];for(var e=0,n=t.curves.length;e<n;e++){var r=t.curves[e];this.curves.push(r.clone())}return this.autoClose=t.autoClose,this},toJSON:function(){var t=bu.prototype.toJSON.call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,n=this.curves.length;e<n;e++){var r=this.curves[e];t.curves.push(r.toJSON())}return t},fromJSON:function(t){bu.prototype.fromJSON.call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,n=t.curves.length;e<n;e++){var r=t.curves[e];this.curves.push((new Uu[r.type]).fromJSON(r))}return this}}),Hu.prototype=Object.assign(Object.create(Gu.prototype),{constructor:Hu,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this},moveTo:function(t,e){return this.currentPoint.set(t,e),this},lineTo:function(t,e){var n=new Iu(this.currentPoint.clone(),new bn(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this},quadraticCurveTo:function(t,e,n,r){var i=new zu(this.currentPoint.clone(),new bn(t,e),new bn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(t,e,n,r,i,a){var o=new Ou(this.currentPoint.clone(),new bn(t,e),new bn(n,r),new bn(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(t){var e=new Fu([this.currentPoint.clone()].concat(t));return this.curves.push(e),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,e,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this},absarc:function(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this},ellipse:function(t,e,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,r,i,a,o,s),this},absellipse:function(t,e,n,r,i,a,o,s){var c=new wu(t,e,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(t){return Gu.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Gu.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Gu.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Vu.prototype=Object.assign(Object.create(Hu.prototype),{constructor:Vu,getPointsHoles:function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){Hu.prototype.copy.call(this,t),this.holes=[];for(var e=0,n=t.holes.length;e<n;e++){var r=t.holes[e];this.holes.push(r.clone())}return this},toJSON:function(){var t=Hu.prototype.toJSON.call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,n=this.holes.length;e<n;e++){var r=this.holes[e];t.holes.push(r.toJSON())}return t},fromJSON:function(t){Hu.prototype.fromJSON.call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,n=t.holes.length;e<n;e++){var r=t.holes[e];this.holes.push((new Hu).fromJSON(r))}return this}}),ku.prototype=Object.assign(Object.create(ar.prototype),{constructor:ku,isLight:!0,copy:function(t){return ar.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ar.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),ju.prototype=Object.assign(Object.create(ku.prototype),{constructor:ju,isHemisphereLight:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Wu.prototype,{_projScreenMatrix:new Hn,_lightPositionWorld:new Sn,_lookTarget:new Sn,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(t){var e=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(t.matrixWorld),e.position.copy(a),i.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(i),e.updateMatrixWorld(),r.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)},getViewport:function(t){return this._viewports[t]},getFrameExtents:function(){return this._frameExtents},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),qu.prototype=Object.assign(Object.create(Wu.prototype),{constructor:qu,isSpotLightShadow:!0,updateMatrices:function(t){var e=this.camera,n=2*xn.RAD2DEG*t.angle,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),Wu.prototype.updateMatrices.call(this,t)}}),Xu.prototype=Object.assign(Object.create(ku.prototype),{constructor:Xu,isSpotLight:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Yu.prototype=Object.assign(Object.create(Wu.prototype),{constructor:Yu,isPointLightShadow:!0,updateMatrices:function(t,e){void 0===e&&(e=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(t.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromMatrix(o)}}),Zu.prototype=Object.assign(Object.create(ku.prototype),{constructor:Zu,isPointLight:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Ju.prototype=Object.assign(Object.create(ra.prototype),{constructor:Ju,isOrthographicCamera:!0,copy:function(t,e){return ra.prototype.copy.call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,a=n+t,o=r+e,s=r-e;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;a=(i+=u*(this.view.offsetX/c))+u*(this.view.width/c),s=(o-=h*(this.view.offsetY/l))-h*(this.view.height/l)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=ar.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}),Ku.prototype=Object.assign(Object.create(Wu.prototype),{constructor:Ku,isDirectionalLightShadow:!0,updateMatrices:function(t){Wu.prototype.updateMatrices.call(this,t)}}),Qu.prototype=Object.assign(Object.create(ku.prototype),{constructor:Qu,isDirectionalLight:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),$u.prototype=Object.assign(Object.create(ku.prototype),{constructor:$u,isAmbientLight:!0}),th.prototype=Object.assign(Object.create(ku.prototype),{constructor:th,isRectAreaLight:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=ku.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}}),eh.prototype=Object.assign(Object.create(hu.prototype),{constructor:eh,load:function(t,e,n,r){var i=this,a=new pu(i.manager);a.setPath(i.path),a.load(t,(function(t){e(i.parse(JSON.parse(t)))}),n,r)},parse:function(t){var e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}var r=new ql[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new Jr).setHex(t.sheen)),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.vertexColors&&(r.vertexColors=t.vertexColors),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(r.morphNormals=t.morphNormals),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.uniforms)for(var i in t.uniforms){var a=t.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new Jr).setHex(a.value);break;case"v2":r.uniforms[i].value=(new bn).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Sn).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Cn).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new An).fromArray(a.value);case"m4":r.uniforms[i].value=(new Hn).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)r.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap),r.transparent=!0),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new bn).fromArray(s)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new bn).fromArray(t.clearcoatNormalScale)),r},setTextures:function(t){return this.textures=t,this}});var nh={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}},extractUrlBase:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function rh(){Mi.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function ih(t,e,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),ii.call(this,t,e,n),this.meshPerAttribute=r||1}function ah(t){hu.call(this,t)}rh.prototype=Object.assign(Object.create(Mi.prototype),{constructor:rh,isInstancedBufferGeometry:!0,copy:function(t){return Mi.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t=Mi.prototype.toJSON.call(this);return t.maxInstancedCount=this.maxInstancedCount,t.isInstancedBufferGeometry=!0,t}}),ih.prototype=Object.assign(Object.create(ii.prototype),{constructor:ih,isInstancedBufferAttribute:!0,copy:function(t){return ii.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){var t=ii.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}),ah.prototype=Object.assign(Object.create(hu.prototype),{constructor:ah,load:function(t,e,n,r){var i=this,a=new pu(i.manager);a.setPath(i.path),a.load(t,(function(t){e(i.parse(JSON.parse(t)))}),n,r)},parse:function(t){var e=t.isInstancedBufferGeometry?new rh:new Mi,n=t.data.index;if(void 0!==n){var r=new oh[n.type](n.array);e.setIndex(new ii(r,1))}var i=t.data.attributes;for(var a in i){var o=i[a],s=(r=new oh[o.type](o.array),new(o.isInstancedBufferAttribute?ih:ii)(r,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),e.setAttribute(a,s)}var c=t.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],h=0,d=l.length;h<d;h++){o=l[h],s=new ii(r=new oh[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),u.push(s)}e.morphAttributes[a]=u}t.data.morphTargetsRelative&&(e.morphTargetsRelative=!0);var p=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==p){h=0;for(var f=p.length;h!==f;++h){var m=p[h];e.addGroup(m.start,m.count,m.materialIndex)}}var v=t.data.boundingSphere;if(void 0!==v){var g=new Sn;void 0!==v.center&&g.fromArray(v.center),e.boundingSphere=new Mr(g,v.radius)}return t.name&&(e.name=t.name),t.userData&&(e.userData=t.userData),e}});var oh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function sh(t){hu.call(this,t)}sh.prototype=Object.assign(Object.create(hu.prototype),{constructor:sh,load:function(t,e,n,r){var i=this,a=""===this.path?nh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;var o=new pu(i.manager);o.setPath(this.path),o.load(t,(function(n){var a=null;try{a=JSON.parse(n)}catch(e){return void 0!==r&&r(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,r)},parse:function(t,e){var n=this.parseShape(t.shapes),r=this.parseGeometries(t.geometries,n),i=this.parseImages(t.images,(function(){void 0!==e&&e(s)})),a=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,a),s=this.parseObject(t.object,r,o);return t.animations&&(s.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(s),s},parseShape:function(t){var e={};if(void 0!==t)for(var n=0,r=t.length;n<r;n++){var i=(new Vu).fromJSON(t[n]);e[i.uuid]=i}return e},parseGeometries:function(t,e){var n={};if(void 0!==t)for(var r=new ah,i=0,a=t.length;i<a;i++){var o,s=t[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Nl[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Nl[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Nl[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Nl[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Nl[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Nl[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Nl[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Nl[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Nl[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Nl[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Nl[s.type]((new Uu[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Nl[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Nl[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,u=s.shapes.length;l<u;l++){var h=e[s.shapes[l]];c.push(h)}o=new Nl[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,u=s.shapes.length;l<u;l++){h=e[s.shapes[l]];c.push(h)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new Uu[d.type]).fromJSON(d)),o=new Nl[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE)o=(new THREE.LegacyJSONLoader).parse(s,this.resourcePath).geometry;else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(t,e){var n={},r={};if(void 0!==t){var i=new eh;i.setTextures(e);for(var a=0,o=t.length;a<o;a++){var s=t[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n],i=ou.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),e.push(i)}return e},parseImages:function(t,e){var n=this,r={};function i(t){return n.manager.itemStart(t),a.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}if(void 0!==t&&t.length>0){var a=new gu(new lu(e));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o<s;o++){var c=t[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,h=l.length;u<h;u++){var d=l[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[c.uuid].push(i(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var r={};if(void 0!==t)for(var i=0,a=t.length;i<a;i++){var o,s=t[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(e[s.image])?new Ca(e[s.image]):new Pn(e[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,lh)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],uh),o.wrapT=n(s.wrap[1],uh)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,hh)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,hh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),r[s.uuid]=o}return r},parseObject:function(t,e,n){var r;function i(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function a(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],r=0,i=t.length;r<i;r++){var a=t[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),e.push(n[a])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":r=new or,void 0!==t.background&&Number.isInteger(t.background)&&(r.background=new Jr(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new Ss(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Ms(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":r=new ia(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new Ju(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new $u(t.color,t.intensity);break;case"DirectionalLight":r=new Qu(t.color,t.intensity);break;case"PointLight":r=new Zu(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new th(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new Xu(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new ju(t.color,t.groundColor,t.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=i(t.geometry),s=a(t.material);r=o.bones&&o.bones.length>0?new Ws(o,s):new Hi(o,s);break;case"InstancedMesh":o=i(t.geometry),s=a(t.material);var c=t.count,l=t.instanceMatrix;(r=new tc(o,s,c)).instanceMatrix=new ii(new Float32Array(l.array),16);break;case"LOD":r=new js;break;case"Line":r=new sc(i(t.geometry),a(t.material),t.mode);break;case"LineLoop":r=new hc(i(t.geometry),a(t.material));break;case"LineSegments":r=new uc(i(t.geometry),a(t.material));break;case"PointCloud":case"Points":r=new gc(i(t.geometry),a(t.material));break;case"Sprite":r=new Gs(a(t.material));break;case"Group":r=new fs;break;default:r=new ar}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.drawMode&&r.setDrawMode(t.drawMode),void 0!==t.children)for(var u=t.children,h=0;h<u.length;h++)r.add(this.parseObject(u[h],e,n));if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);for(var d=t.levels,p=0;p<d.length;p++){var f=d[p],m=r.getObjectByProperty("uuid",f.object);void 0!==m&&r.addLevel(m,f.distance)}}return r}});var ch,lh={UVMapping:lt,CubeReflectionMapping:ut,CubeRefractionMapping:ht,EquirectangularReflectionMapping:dt,EquirectangularRefractionMapping:pt,SphericalReflectionMapping:ft,CubeUVReflectionMapping:mt,CubeUVRefractionMapping:vt},uh={RepeatWrapping:gt,ClampToEdgeWrapping:yt,MirroredRepeatWrapping:xt},hh={NearestFilter:bt,NearestMipmapNearestFilter:wt,NearestMipmapLinearFilter:Mt,LinearFilter:Et,LinearMipmapNearestFilter:Tt,LinearMipmapLinearFilter:Lt};function dh(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),hu.call(this,t),this.options=void 0}function ph(){this.type="ShapePath",this.color=new Jr,this.subPaths=[],this.currentPath=null}function fh(t){this.type="Font",this.data=t}function mh(t,e,n,r,i){var a=i.glyphs[t]||i.glyphs["?"];if(a){var o,s,c,l,u,h,d,p,f=new ph;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*e+n,s=m[v++]*e+r,f.moveTo(o,s);break;case"l":o=m[v++]*e+n,s=m[v++]*e+r,f.lineTo(o,s);break;case"q":c=m[v++]*e+n,l=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[v++]*e+n,l=m[v++]*e+r,u=m[v++]*e+n,h=m[v++]*e+r,d=m[v++]*e+n,p=m[v++]*e+r,f.bezierCurveTo(u,h,d,p,c,l)}}return{offsetX:a.ha*e,path:f}}console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".")}function vh(t){hu.call(this,t)}dh.prototype=Object.assign(Object.create(hu.prototype),{constructor:dh,setOptions:function(t){return this.options=t,this},load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=cu.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;fetch(t).then((function(t){return t.blob()})).then((function(t){return void 0===i.options?createImageBitmap(t):createImageBitmap(t,i.options)})).then((function(n){cu.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}}),Object.assign(ph.prototype,{moveTo:function(t,e){return this.currentPath=new Hu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this},lineTo:function(t,e){return this.currentPath.lineTo(t,e),this},quadraticCurveTo:function(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this},bezierCurveTo:function(t,e,n,r,i,a){return this.currentPath.bezierCurveTo(t,e,n,r,i,a),this},splineThru:function(t){return this.currentPath.splineThru(t),this},toShapes:function(t,e){function n(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n],a=new Vu;a.curves=i.curves,e.push(a)}return e}function r(t,e){for(var n=e.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=e[i],s=e[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=e[a],c=-c,s=e[i],l=-l),t.y<o.y||t.y>s.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var u=l*(t.x-o.x)-c*(t.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return r}var i=ul.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new Vu).curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=t?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(h=(s=a[g]).getPoints()),(o=t?!o:o)?(!u&&f[v]&&v++,f[v]={s:new Vu,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S<M.length;S++){for(var E=M[S],T=!0,A=0;A<f.length;A++)r(E.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:S}),T?(T=!1,p[A].push(E)):x=!0);T&&p[w].push(E)}b.length>0&&(x||(m=p))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,l.push(c);for(var R=0,P=(d=m[g]).length;R<P;R++)c.holes.push(d[R].h)}return l}}),Object.assign(fh.prototype,{isFont:!0,generateShapes:function(t,e){void 0===e&&(e=100);for(var n=[],r=function(t,e,n){for(var r=Array.from?Array.from(t):String(t).split(""),i=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if("\n"===u)s=0,c-=a;else{var h=mh(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}(t,e,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),vh.prototype=Object.assign(Object.create(hu.prototype),{constructor:vh,load:function(t,e,n,r){var i=this,a=new pu(this.manager);a.setPath(this.path),a.load(t,(function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var r=i.parse(n);e&&e(r)}),n,r)},parse:function(t){return new fh(t)}});var gh={getContext:function(){return void 0===ch&&(ch=new(window.AudioContext||window.webkitAudioContext)),ch},setContext:function(t){ch=t}};function yh(t){hu.call(this,t)}function xh(){this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Sn)}function bh(t,e){ku.call(this,void 0,e),this.sh=void 0!==t?t:new xh}function wh(t,e,n){bh.call(this,void 0,n);var r=(new Jr).set(t),i=(new Jr).set(e),a=new Sn(r.r,r.g,r.b),o=new Sn(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function _h(t,e){bh.call(this,void 0,e);var n=(new Jr).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}yh.prototype=Object.assign(Object.create(hu.prototype),{constructor:yh,load:function(t,e,n,r){var i=new pu(this.manager);i.setResponseType("arraybuffer"),i.setPath(this.path),i.load(t,(function(t){var n=t.slice(0);gh.getContext().decodeAudioData(n,(function(t){e(t)}))}),n,r)}}),Object.assign(xh.prototype,{isSphericalHarmonics3:!0,set:function(t){for(var e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this},zero:function(){for(var t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this},getAt:function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScale(a[1],.488603*r),e.addScale(a[2],.488603*i),e.addScale(a[3],.488603*n),e.addScale(a[4],n*r*1.092548),e.addScale(a[5],r*i*1.092548),e.addScale(a[6],.315392*(3*i*i-1)),e.addScale(a[7],n*i*1.092548),e.addScale(a[8],.546274*(n*n-r*r)),e},getIrradianceAt:function(t,e){var n=t.x,r=t.y,i=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScale(a[1],1.023328*r),e.addScale(a[2],1.023328*i),e.addScale(a[3],1.023328*n),e.addScale(a[4],.858086*n*r),e.addScale(a[5],.858086*r*i),e.addScale(a[6],.743125*i*i-.247708),e.addScale(a[7],.858086*n*i),e.addScale(a[8],.429043*(n*n-r*r)),e},add:function(t){for(var e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this},scale:function(t){for(var e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this},lerp:function(t,e){for(var n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this},equals:function(t){for(var e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0},copy:function(t){return this.set(t.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(t,e){void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}}),Object.assign(xh,{getBasisAt:function(t,e){var n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)}}),bh.prototype=Object.assign(Object.create(ku.prototype),{constructor:bh,isLightProbe:!0,copy:function(t){return ku.prototype.copy.call(this,t),this.sh.copy(t.sh),this.intensity=t.intensity,this},toJSON:function(t){return ku.prototype.toJSON.call(this,t)}}),wh.prototype=Object.assign(Object.create(bh.prototype),{constructor:wh,isHemisphereLightProbe:!0,copy:function(t){return bh.prototype.copy.call(this,t),this},toJSON:function(t){return bh.prototype.toJSON.call(this,t)}}),_h.prototype=Object.assign(Object.create(bh.prototype),{constructor:_h,isAmbientLightProbe:!0,copy:function(t){return bh.prototype.copy.call(this,t),this},toJSON:function(t){return bh.prototype.toJSON.call(this,t)}});var Mh=new Hn,Sh=new Hn;function Eh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ia,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ia,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}}function Th(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Eh.prototype,{update:function(t){var e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep;var n,r,i=t.projectionMatrix.clone(),a=e.eyeSep/2,o=a*e.near/e.focus,s=e.near*Math.tan(xn.DEG2RAD*e.fov*.5)/e.zoom;Sh.elements[12]=-a,Mh.elements[12]=a,n=-s*e.aspect+o,r=s*e.aspect+o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*e.aspect-o,r=s*e.aspect-o,i.elements[0]=2*e.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Sh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Mh)}}),Object.assign(Th.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}});var Ah=new Sn,Lh=new wn,Rh=new Sn,Ph=new Sn;function Ch(){ar.call(this),this.type="AudioListener",this.context=gh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Th}function Oh(t){ar.call(this),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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=!0,this.sourceType="empty",this._startedAt=0,this._pausedAt=0,this.filters=[]}Ch.prototype=Object.assign(Object.create(ar.prototype),{constructor:Ch,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this},updateMatrixWorld:function(t){ar.prototype.updateMatrixWorld.call(this,t);var e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ah,Lh,Rh),Ph.set(0,0,-1).applyQuaternion(Lh),e.positionX){var r=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Ah.x,r),e.positionY.linearRampToValueAtTime(Ah.y,r),e.positionZ.linearRampToValueAtTime(Ah.z,r),e.forwardX.linearRampToValueAtTime(Ph.x,r),e.forwardY.linearRampToValueAtTime(Ph.y,r),e.forwardZ.linearRampToValueAtTime(Ph.z,r),e.upX.linearRampToValueAtTime(n.x,r),e.upY.linearRampToValueAtTime(n.y,r),e.upZ.linearRampToValueAtTime(n.z,r)}else e.setPosition(Ah.x,Ah.y,Ah.z),e.setOrientation(Ph.x,Ph.y,Ph.z,n.x,n.y,n.z)}}),Oh.prototype=Object.assign(Object.create(ar.prototype),{constructor:Oh,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setMediaElementSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this},setMediaStreamSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(t){if(void 0===t&&(t=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+t;var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._pausedAt+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._pausedAt=(this.context.currentTime-this._startedAt)*this.playbackRate,this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._pausedAt=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},setDetune:function(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(t){return this.loopStart=t,this},setLoopEnd:function(t){return this.loopEnd=t,this},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}});var Dh=new Sn,Ih=new wn,Nh=new Sn,zh=new Sn;function Bh(t){Oh.call(this,t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function Fh(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Uh(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Bh.prototype=Object.assign(Object.create(Oh.prototype),{constructor:Bh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){return this.panner.refDistance=t,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){return this.panner.rolloffFactor=t,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){return this.panner.distanceModel=t,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){return this.panner.maxDistance=t,this},setDirectionalCone:function(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(t){if(ar.prototype.updateMatrixWorld.call(this,t),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Dh,Ih,Nh),zh.set(0,0,1).applyQuaternion(Ih);var e=this.panner;if(e.positionX){var n=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Dh.x,n),e.positionY.linearRampToValueAtTime(Dh.y,n),e.positionZ.linearRampToValueAtTime(Dh.z,n),e.orientationX.linearRampToValueAtTime(zh.x,n),e.orientationY.linearRampToValueAtTime(zh.y,n),e.orientationZ.linearRampToValueAtTime(zh.z,n)}else e.setPosition(Dh.x,Dh.y,Dh.z),e.setOrientation(zh.x,zh.y,zh.z)}}}),Object.assign(Fh.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Object.assign(Uh.prototype,{accumulate:function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},apply:function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*e;this._mixBufferRegion(n,r,o,1-i,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){a.setValue(n,r);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=3*n;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]},_slerp:function(t,e,n,r){wn.slerpFlat(t,e,t,e,t,n,r)},_lerp:function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}}});var Gh=new RegExp("[\\[\\]\\.:\\/]","g"),Hh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Vh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),kh=/(WCOD+)?/.source.replace("WCOD",Hh),jh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Wh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),qh=new RegExp("^"+Vh+kh+jh+Wh+"$"),Xh=["material","materials","bones"];function Yh(t,e,n){var r=n||Zh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Zh(t,e,n){this.path=e,this.parsedPath=n||Zh.parseTrackName(e),this.node=Zh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Jh(){this.uuid=xn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Kh(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,a=new Array(i),o={endingStart:Te,endingEnd:Te},s=0;s!==i;++s){var c=r[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=we,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Qh(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function $h(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function td(t,e,n){Es.call(this,t,e),this.meshPerAttribute=n||1}function ed(t,e,n,r){this.ray=new Cr(t,e),this.near=n||0,this.far=r||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function nd(t,e){return t.distance-e.distance}function rd(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,a=0,o=i.length;a<o;a++)rd(i[a],e,n,!0)}function id(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function ad(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}Object.assign(Yh.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Zh,{Composite:Yh,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Zh.Composite(t,e,n):new Zh(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Gh,"")},parseTrackName:function(t){var e=qh.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Xh.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var r=function(t){for(var n=0;n<t.length;n++){var i=t[n];if(i.name===e||i.uuid===e)return i;var a=r(i.children);if(a)return a}return null},i=r(t.children);if(i)return i}return null}}),Object.assign(Zh.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.targetObject[this.propertyName]=t[e]},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,r=e.propertyName,i=e.propertyIndex;if(t||(t=Zh.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(n){var a=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var o=0;o<t.length;o++)if(t[o].name===a){a=o;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==a){if(void 0===t[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[a]}}var s=t[r];if(void 0!==s){var c=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(t.geometry.isBufferGeometry){if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(t.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!t.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(t.geometry.morphTargets[o].name===i){i=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var u=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+r+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),
//!\ DECLARE ALIAS AFTER assign prototype !
Object.assign(Zh.prototype,{_getValue_unbound:Zh.prototype.getValue,_setValue_unbound:Zh.prototype.setValue}),Object.assign(Jh.prototype,{isAnimationObjectGroup:!0,add:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=r[d];if(void 0===p){p=e++,r[d]=p,t.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new Zh(h,i[f],a[f]))}else if(p<n){c=t[p];var v=--n,g=t[v];r[g.uuid]=p,t[p]=g,r[d]=v,t[v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],b=y[p];y[p]=x,void 0===b&&(b=new Zh(h,i[f],a[f])),y[v]=b}}else t[p]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var t=this._objects,e=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&l>=e){var u=e++,h=t[u];n[h.uuid]=l,t[l]=h,n[c]=u,t[u]=s;for(var d=0,p=i;d!==p;++d){var f=r[d],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(void 0!==u)if(delete r[l],u<n){var h=--n,d=t[h],p=t[y=--e];r[d.uuid]=u,t[u]=d,r[p.uuid]=h,t[h]=p,t.pop();for(var f=0,m=a;f!==m;++f){var v=(x=i[f])[h],g=x[y];x[u]=v,x[h]=g,x.pop()}}else{var y;r[(p=t[y=--e]).uuid]=u,t[u]=p,t.pop();for(f=0,m=a;f!==m;++f){var x;(x=i[f])[u]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(u);for(var h=l,d=s.length;h!==d;++h){var p=s[h];u[h]=new Zh(p,t,e)}return u},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(Kh.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=t/o,c[1]=e/o,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===_e;if(0===t)return-1===i?e:a&&1==(1&i)?n-e:e;if(r===be){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=n||e<0){var o=Math.floor(e/n);e-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var c=t<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=e;if(a&&1==(1&i))return n-e}return e},_setEndings:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=Ae,r.endingEnd=Ae):(r.endingStart=t?this.zeroSlopeAtStart?Ae:Te:Le,r.endingEnd=e?this.zeroSlopeAtEnd?Ae:Te:Le)},_scheduleFading:function(t,e,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=n,this}}),Qh.prototype=Object.assign(Object.create(vn.prototype),{constructor:Qh,_bindAction:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=l[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(p=new Uh(Zh.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var r=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_addInactiveBinding:function(t,e,n){var r=this._bindingsByRootAndName,i=r[e],a=this._bindings;void 0===i&&(i={},r[e]=i),i[n]=t,t._cacheIndex=a.length,a.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new Jl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?ou.findByName(n,t):t,a=null!==i?i.uuid:t,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[r];if(void 0!==c)return c;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var l=new Kh(this,i,e);return this._bindAction(l,s),this._addInactiveAction(l,a,r),l},existingAction:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?ou.findByName(n,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==e;++i)t[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(r,t,i,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,e[l]=u,e.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),$h.prototype.clone=function(){return new $h(void 0===this.value.clone?this.value:this.value.clone())},td.prototype=Object.assign(Object.create(Es.prototype),{constructor:td,isInstancedInterleavedBuffer:!0,copy:function(t){return Es.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(ed.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e,n){var r=n||[];return rd(t,this,r,e),r.sort(nd),r},intersectObjects:function(t,e,n){var r=n||[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=t.length;i<a;i++)rd(t[i],this,r,e);return r.sort(nd),r}}),Object.assign(id.prototype,{set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(xn.clamp(e/this.radius,-1,1))),this}}),Object.assign(ad.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.setFromCartesianCoords(t.x,t.y,t.z)},setFromCartesianCoords:function(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}});var od=new bn;function sd(t,e){this.min=void 0!==t?t:new bn(1/0,1/0),this.max=void 0!==e?e:new bn(-1/0,-1/0)}Object.assign(sd.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(t,e){var n=od.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new bn),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new bn),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new bn),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new bn),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return od.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var cd=new Sn,ld=new Sn;function ud(t,e){this.start=void 0!==t?t:new Sn,this.end=void 0!==e?e:new Sn}function hd(t){ar.call(this),this.material=t,this.render=function(){}}Object.assign(ud.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Sn),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Sn),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Sn),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){cd.subVectors(t,this.start),ld.subVectors(this.end,this.start);var n=ld.dot(ld),r=ld.dot(cd)/n;return e&&(r=xn.clamp(r,0,1)),r},closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Sn),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),hd.prototype=Object.create(ar.prototype),hd.prototype.constructor=hd,hd.prototype.isImmediateRenderObject=!0;var dd=new Sn,pd=new Sn,fd=new An,md=["a","b","c"];function vd(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16711680,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new Mi,l=new di(2*o*3,3);c.setAttribute("position",l),uc.call(this,c,new ec({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}vd.prototype=Object.create(uc.prototype),vd.prototype.constructor=vd,vd.prototype.update=function(){this.object.updateMatrixWorld(!0),fd.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,e=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var r=n.vertices,i=n.faces,a=0,o=0,s=i.length;o<s;o++)for(var c=i[o],l=0,u=c.vertexNormals.length;l<u;l++){var h=r[c[md[l]]],d=c.vertexNormals[l];dd.copy(h).applyMatrix4(t),pd.copy(d).applyMatrix3(fd).normalize().multiplyScalar(this.size).add(dd),e.setXYZ(a,dd.x,dd.y,dd.z),a+=1,e.setXYZ(a,pd.x,pd.y,pd.z),a+=1}else if(n&&n.isBufferGeometry){var p=n.attributes.position,f=n.attributes.normal;for(a=0,l=0,u=p.count;l<u;l++)dd.set(p.getX(l),p.getY(l),p.getZ(l)).applyMatrix4(t),pd.set(f.getX(l),f.getY(l),f.getZ(l)),pd.applyMatrix3(fd).normalize().multiplyScalar(this.size).add(dd),e.setXYZ(a,dd.x,dd.y,dd.z),a+=1,e.setXYZ(a,pd.x,pd.y,pd.z),a+=1}e.needsUpdate=!0};var gd=new Sn;function yd(t,e){ar.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var n=new Mi,r=[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],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new di(r,3));var c=new ec({fog:!1});this.cone=new uc(n,c),this.add(this.cone),this.update()}yd.prototype=Object.create(ar.prototype),yd.prototype.constructor=yd,yd.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},yd.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),gd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(gd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var xd=new Sn,bd=new Hn,wd=new Hn;function _d(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var r=0;r<e.children.length;r++)n.push.apply(n,t(e.children[r]));return n}(t),n=new Mi,r=[],i=[],a=new Jr(0,0,1),o=new Jr(0,1,0),s=0;s<e.length;s++){var c=e[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new di(r,3)),n.setAttribute("color",new di(i,3));var l=new ec({vertexColors:M,depthTest:!1,depthWrite:!1,transparent:!0});uc.call(this,n,l),this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}function Md(t,e,n){this.light=t,this.light.updateMatrixWorld(),this.color=n;var r=new bl(e,4,2),i=new ri({wireframe:!0,fog:!1});Hi.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Sd(t,e){this.type="RectAreaLightHelper",this.light=t,this.color=e;var n=new Mi;n.setAttribute("position",new di([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),n.computeBoundingSphere();var r=new ec({fog:!1});sc.call(this,n,r);var i=new Mi;i.setAttribute("position",new di([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new Hi(i,new ri({side:g,fog:!1}))),this.update()}_d.prototype=Object.create(uc.prototype),_d.prototype.constructor=_d,_d.prototype.updateMatrixWorld=function(t){var e=this.bones,n=this.geometry,r=n.getAttribute("position");wd.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<e.length;i++){var o=e[i];o.parent&&o.parent.isBone&&(bd.multiplyMatrices(wd,o.matrixWorld),xd.setFromMatrixPosition(bd),r.setXYZ(a,xd.x,xd.y,xd.z),bd.multiplyMatrices(wd,o.parent.matrixWorld),xd.setFromMatrixPosition(bd),r.setXYZ(a+1,xd.x,xd.y,xd.z),a+=2)}n.getAttribute("position").needsUpdate=!0,ar.prototype.updateMatrixWorld.call(this,t)},Md.prototype=Object.create(Hi.prototype),Md.prototype.constructor=Md,Md.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Md.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},Sd.prototype=Object.create(sc.prototype),Sd.prototype.constructor=Sd,Sd.prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var t=this.material.color,e=Math.max(t.r,t.g,t.b);e>1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color)}},Sd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()};var Ed=new Sn,Td=new Jr,Ad=new Jr;function Ld(t,e,n){ar.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new Cc(e);r.rotateY(.5*Math.PI),this.material=new ri({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=M);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.setAttribute("color",new ii(a,3)),this.add(new Hi(r,this.material)),this.update()}function Rd(t,e){this.lightProbe=t,this.size=e;var n={GAMMA_OUTPUT:""},r=new na({defines:n,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","\t// matrix is assumed to be orthogonal","\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","vec3 linearToOutput( in vec3 a ) {","\t#ifdef GAMMA_OUTPUT","\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );","\t#else","\t\treturn a;","\t#endif","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","\t// normal is assumed to have unit length","\tfloat x = normal.x, y = normal.y, z = normal.z;","\t// band 0","\tvec3 result = shCoefficients[ 0 ] * 0.886227;","\t// band 1","\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","\t// band 2","\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","\treturn result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","\tvec3 normal = normalize( vNormal );","\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );","\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","\toutgoingLight = linearToOutput( outgoingLight );","\tgl_FragColor = vec4( outgoingLight, 1.0 );","}"].join("\n")}),i=new bl(1,32,16);Hi.call(this,i,r),this.onBeforeRender()}function Pd(t,e,n,r){t=t||10,e=e||10,n=new Jr(void 0!==n?n:4473924),r=new Jr(void 0!==r?r:8947848);for(var i=e/2,a=t/e,o=t/2,s=[],c=[],l=0,u=0,h=-o;l<=e;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=l===i?n:r;d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3}var p=new Mi;p.setAttribute("position",new di(s,3)),p.setAttribute("color",new di(c,3));var f=new ec({vertexColors:M});uc.call(this,p,f)}function Cd(t,e,n,r,i,a){t=t||10,e=e||16,n=n||8,r=r||64,i=new Jr(void 0!==i?i:4473924),a=new Jr(void 0!==a?a:8947848);var o,s,c,l,u,h,d,p=[],f=[];for(l=0;l<=e;l++)c=l/e*(2*Math.PI),o=Math.sin(c)*t,s=Math.cos(c)*t,p.push(0,0,0),p.push(o,0,s),d=1&l?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?i:a,h=t-t/n*l,u=0;u<r;u++)c=u/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(u+1)/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new Mi;m.setAttribute("position",new di(p,3)),m.setAttribute("color",new di(f,3));var v=new ec({vertexColors:M});uc.call(this,m,v)}function Od(t,e,n,r){this.audio=t,this.range=e||1,this.divisionsInnerAngle=n||16,this.divisionsOuterAngle=r||2;var i=new Mi,a=this.divisionsInnerAngle+2*this.divisionsOuterAngle,o=new Float32Array(3*(3*a+3));i.setAttribute("position",new ii(o,3));var s=new ec({color:65280}),c=new ec({color:16776960});sc.call(this,i,[c,s]),this.update()}Ld.prototype=Object.create(ar.prototype),Ld.prototype.constructor=Ld,Ld.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Ld.prototype.update=function(){var t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var e=t.geometry.getAttribute("color");Td.copy(this.light.color),Ad.copy(this.light.groundColor);for(var n=0,r=e.count;n<r;n++){var i=n<r/2?Td:Ad;e.setXYZ(n,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(Ed.setFromMatrixPosition(this.light.matrixWorld).negate())},Rd.prototype=Object.create(Hi.prototype),Rd.prototype.constructor=Rd,Rd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Rd.prototype.onBeforeRender=function(){this.position.copy(this.lightProbe.position),this.scale.set(1,1,1).multiplyScalar(this.size),this.material.uniforms.intensity.value=this.lightProbe.intensity},Pd.prototype=Object.assign(Object.create(uc.prototype),{constructor:Pd,copy:function(t){return uc.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),Cd.prototype=Object.create(uc.prototype),Cd.prototype.constructor=Cd,Od.prototype=Object.create(sc.prototype),Od.prototype.constructor=Od,Od.prototype.update=function(){var t,e,n=this.audio,r=this.range,i=this.divisionsInnerAngle,a=this.divisionsOuterAngle,o=xn.degToRad(n.panner.coneInnerAngle),s=xn.degToRad(n.panner.coneOuterAngle),c=o/2,l=s/2,u=0,h=0,d=this.geometry,p=d.attributes.position;function f(n,i,a,o){var s=(i-n)/a;for(p.setXYZ(u,0,0,0),h++,t=n;t<i;t+=s)e=u+h,p.setXYZ(e,Math.sin(t)*r,0,Math.cos(t)*r),p.setXYZ(e+1,Math.sin(Math.min(t+s,i))*r,0,Math.cos(Math.min(t+s,i))*r),p.setXYZ(e+2,0,0,0),h+=3;d.addGroup(u,h,o),u+=h,h=0}d.clearGroups(),f(-l,-c,a,0),f(-c,c,i,1),f(c,l,a,0),p.needsUpdate=!0,o===s&&(this.material[0].visible=!1)},Od.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()};var Dd=new Sn,Id=new Sn,Nd=new An;function zd(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16776960,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Mi,l=new di(2*o*3,3);c.setAttribute("position",l),uc.call(this,c,new ec({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}zd.prototype=Object.create(uc.prototype),zd.prototype.constructor=zd,zd.prototype.update=function(){this.object.updateMatrixWorld(!0),Nd.getNormalMatrix(this.object.matrixWorld);for(var t=this.object.matrixWorld,e=this.geometry.attributes.position,n=this.object.geometry,r=n.vertices,i=n.faces,a=0,o=0,s=i.length;o<s;o++){var c=i[o],l=c.normal;Dd.copy(r[c.a]).add(r[c.b]).add(r[c.c]).divideScalar(3).applyMatrix4(t),Id.copy(l).applyMatrix3(Nd).normalize().multiplyScalar(this.size).add(Dd),e.setXYZ(a,Dd.x,Dd.y,Dd.z),a+=1,e.setXYZ(a,Id.x,Id.y,Id.z),a+=1}e.needsUpdate=!0};var Bd=new Sn,Fd=new Sn,Ud=new Sn;function Gd(t,e,n){ar.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);var r=new Mi;r.setAttribute("position",new di([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new ec({fog:!1});this.lightPlane=new sc(r,i),this.add(this.lightPlane),(r=new Mi).setAttribute("position",new di([0,0,0,0,0,1],3)),this.targetLine=new sc(r,i),this.add(this.targetLine),this.update()}Gd.prototype=Object.create(ar.prototype),Gd.prototype.constructor=Gd,Gd.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Gd.prototype.update=function(){Bd.setFromMatrixPosition(this.light.matrixWorld),Fd.setFromMatrixPosition(this.light.target.matrixWorld),Ud.subVectors(Fd,Bd),this.lightPlane.lookAt(Fd),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(Fd),this.targetLine.scale.z=Ud.length()};var Hd=new Sn,Vd=new ra;function kd(t){var e=new Mi,n=new ec({color:16777215,vertexColors:_}),r=[],i=[],a={},o=new Jr(16755200),s=new Jr(16711680),c=new Jr(43775),l=new Jr(16777215),u=new Jr(3355443);function h(t,e,n){d(t,n),d(e,n)}function d(t,e){r.push(0,0,0),i.push(e.r,e.g,e.b),void 0===a[t]&&(a[t]=[]),a[t].push(r.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),e.setAttribute("position",new di(r,3)),e.setAttribute("color",new di(i,3)),uc.call(this,e,n),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function jd(t,e,n,r,i,a,o){Hd.set(i,a,o).unproject(r);var s=e[t];if(void 0!==s)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],Hd.x,Hd.y,Hd.z)}kd.prototype=Object.create(uc.prototype),kd.prototype.constructor=kd,kd.prototype.update=function(){var t=this.geometry,e=this.pointMap;Vd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),jd("c",e,t,Vd,0,0,-1),jd("t",e,t,Vd,0,0,1),jd("n1",e,t,Vd,-1,-1,-1),jd("n2",e,t,Vd,1,-1,-1),jd("n3",e,t,Vd,-1,1,-1),jd("n4",e,t,Vd,1,1,-1),jd("f1",e,t,Vd,-1,-1,1),jd("f2",e,t,Vd,1,-1,1),jd("f3",e,t,Vd,-1,1,1),jd("f4",e,t,Vd,1,1,1),jd("u1",e,t,Vd,.7,1.1,-1),jd("u2",e,t,Vd,-.7,1.1,-1),jd("u3",e,t,Vd,0,2,-1),jd("cf1",e,t,Vd,-1,0,1),jd("cf2",e,t,Vd,1,0,1),jd("cf3",e,t,Vd,0,-1,1),jd("cf4",e,t,Vd,0,1,1),jd("cn1",e,t,Vd,-1,0,-1),jd("cn2",e,t,Vd,1,0,-1),jd("cn3",e,t,Vd,0,-1,-1),jd("cn4",e,t,Vd,0,1,-1),t.getAttribute("position").needsUpdate=!0};var Wd=new br;function qd(t,e){this.object=t,void 0===e&&(e=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new Mi;i.setIndex(new ii(n,1)),i.setAttribute("position",new ii(r,3)),uc.call(this,i,new ec({color:e})),this.matrixAutoUpdate=!1,this.update()}function Xd(t,e){this.type="Box3Helper",this.box=t,e=e||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Mi;r.setIndex(new ii(n,1)),r.setAttribute("position",new di([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)),uc.call(this,r,new ec({color:e})),this.geometry.computeBoundingSphere()}function Yd(t,e,n){this.type="PlaneHelper",this.plane=t,this.size=void 0===e?1:e;var r=void 0!==n?n:16776960,i=new Mi;i.setAttribute("position",new di([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),sc.call(this,i,new ec({color:r}));var a=new Mi;a.setAttribute("position",new di([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Hi(a,new ri({color:r,opacity:.2,transparent:!0,depthWrite:!1})))}qd.prototype=Object.create(uc.prototype),qd.prototype.constructor=qd,qd.prototype.update=function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Wd.setFromObject(this.object),!Wd.isEmpty()){var e=Wd.min,n=Wd.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},qd.prototype.setFromObject=function(t){return this.object=t,this.update(),this},qd.prototype.copy=function(t){return uc.prototype.copy.call(this,t),this.object=t.object,this},qd.prototype.clone=function(){return(new this.constructor).copy(this)},Xd.prototype=Object.create(uc.prototype),Xd.prototype.constructor=Xd,Xd.prototype.updateMatrixWorld=function(t){var e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),ar.prototype.updateMatrixWorld.call(this,t))},Yd.prototype=Object.create(sc.prototype),Yd.prototype.constructor=Yd,Yd.prototype.updateMatrixWorld=function(t){var e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?g:v,this.lookAt(this.plane.normal),ar.prototype.updateMatrixWorld.call(this,t)};var Zd,Jd,Kd=new Sn;function Qd(t,e,n,r,i,a){ar.call(this),void 0===t&&(t=new Sn(0,0,1)),void 0===e&&(e=new Sn(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===Zd&&((Zd=new Mi).setAttribute("position",new di([0,0,0,0,1,0],3)),(Jd=new Pl(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new sc(Zd,new ec({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Hi(Jd,new ri({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,a)}function $d(t){var e=[0,0,0,t=t||1,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new Mi;n.setAttribute("position",new di(e,3)),n.setAttribute("color",new di([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new ec({vertexColors:M});uc.call(this,n,r)}function tp(t,e,n,r,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ti(t,e,n,i,a,o)}Qd.prototype=Object.create(ar.prototype),Qd.prototype.constructor=Qd,Qd.prototype.setDirection=function(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Kd.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Kd,e)}},Qd.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},Qd.prototype.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},Qd.prototype.copy=function(t){return ar.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},Qd.prototype.clone=function(){return(new this.constructor).copy(this)},$d.prototype=Object.create(uc.prototype),$d.prototype.constructor=$d;var ep=0,np=1;function rp(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function ip(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function ap(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new gc(t,e)}function op(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Gs(t)}function sp(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new gc(t,e)}function cp(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new dc(t)}function lp(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new dc(t)}function up(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new dc(t)}function hp(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Sn(t,e,n)}function dp(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new ii(t,e).setDynamic(!0)}function pp(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new ai(t,e)}function fp(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new oi(t,e)}function mp(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new si(t,e)}function vp(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new ci(t,e)}function gp(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new li(t,e)}function yp(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new ui(t,e)}function xp(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new hi(t,e)}function bp(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new di(t,e)}function wp(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new pi(t,e)}function _p(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Lu.call(this,t),this.type="catmullrom",this.closed=!0}function Mp(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Lu.call(this,t),this.type="catmullrom"}function Sp(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Lu.call(this,t),this.type="catmullrom"}function Ep(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new $d(t)}function Tp(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new qd(t,e)}function Ap(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new uc(new Ll(t.geometry),new ec({color:void 0!==e?e:16777215}))}function Lp(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new uc(new Mc(t.geometry),new ec({color:void 0!==e?e:16777215}))}function Rp(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pu(t)}function Pp(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vu(t)}bu.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(bu.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Gu.prototype,{createPointsGeometry:function(t){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var e=new Yi,n=0,r=t.length;n<r;n++){var i=t[n];e.vertices.push(new Sn(i.x,i.y,i.z||0))}return e}}),Object.assign(Hu.prototype,{fromPoints:function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)}}),_p.prototype=Object.create(Lu.prototype),Mp.prototype=Object.create(Lu.prototype),Sp.prototype=Object.create(Lu.prototype),Object.assign(Sp.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Pd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},_d.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(hu.prototype,{extractUrlBase:function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),nh.extractUrlBase(t)}}),hu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(sh.prototype,{setTexturePath:function(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}),Object.assign(sd.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(br.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),ud.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Object.assign(xn,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),xn.floorPowerOfTwo(t)},nextPowerOfTwo:function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),xn.ceilPowerOfTwo(t)}}),Object.assign(An.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Hn.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Sn).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,a)}}),Nr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},wn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(Cr.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(qr.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},midpoint:function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},normal:function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},plane:function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)}}),Object.assign(qr,{barycoordFromPoint:function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),qr.getBarycoord(t,e,n,r,i)},normal:function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),qr.getNormal(t,e,n,r)}}),Object.assign(Vu.prototype,{extractAllPoints:function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new pl(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new El(this,t)}}),Object.assign(bn.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Sn.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},distanceToManhattan:function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Cn.prototype,{fromAttribute:function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Yi.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}}),Object.assign(ar.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}}),Object.defineProperties(ar.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(js.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ys.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Ws.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(bu.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),ia.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(ku.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(ii.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===cn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(cn)}}}),Object.assign(ii.prototype,{setDynamic:function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?cn:sn),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Mi.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addAttribute:function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new ii(arguments[1],arguments[2])))},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)}}),Object.defineProperties(Mi.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Es.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===cn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),Object.assign(Es.prototype,{setDynamic:function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?cn:sn),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(fl.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties($h.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(ni.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Jr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===x}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(Gl.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(na.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(_s.prototype,{clearTarget:function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},animate:function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(_s.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}}}),Object.defineProperties(cs.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ca.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}}),Object.defineProperties(On.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(bs.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}}),Object.defineProperties(Oh.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new yh).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Fh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},sa.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)};var Cp={merge:function(t,e,n){var r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),r=e.matrix,e=e.geometry),t.merge(e,r,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}};function Op(){console.error("THREE.CanvasRenderer has been removed")}function Dp(){console.error("THREE.JSONLoader has been removed.")}Ln.crossOrigin=void 0,Ln.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new xu;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ln.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new yu;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ln.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ln.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Ip={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};function Np(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:r}}))},function(t,e,n){var r;!function(){function i(t,e,n){return t.call.apply(t.bind,arguments)}function a(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function o(t,e,n){return(o=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?i:a).apply(null,arguments)}var s=Date.now||function(){return+new Date};function c(t,e){this.a=t,this.o=e||t,this.c=this.o.document}var l=!!window.FontFace;function u(t,e,n,r){if(e=t.c.createElement(e),n)for(var i in n)n.hasOwnProperty(i)&&("style"==i?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r&&e.appendChild(t.c.createTextNode(r)),e}function h(t,e,n){(t=t.c.getElementsByTagName(e)[0])||(t=document.documentElement),t.insertBefore(n,t.lastChild)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function p(t,e,n){e=e||[],n=n||[];for(var r=t.className.split(/\s+/),i=0;i<e.length;i+=1){for(var a=!1,o=0;o<r.length;o+=1)if(e[i]===r[o]){a=!0;break}a||r.push(e[i])}for(e=[],i=0;i<r.length;i+=1){for(a=!1,o=0;o<n.length;o+=1)if(r[i]===n[o]){a=!0;break}a||e.push(r[i])}t.className=e.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function f(t,e){for(var n=t.className.split(/\s+/),r=0,i=n.length;r<i;r++)if(n[r]==e)return!0;return!1}function m(t,e,n){function r(){s&&i&&a&&(s(o),s=null)}e=u(t,"link",{rel:"stylesheet",href:e,media:"all"});var i=!1,a=!0,o=null,s=n||null;l?(e.onload=function(){i=!0,r()},e.onerror=function(){i=!0,o=Error("Stylesheet failed to load"),r()}):setTimeout((function(){i=!0,r()}),0),h(t,"head",e)}function v(t,e,n,r){var i=t.c.getElementsByTagName("head")[0];if(i){var a=u(t,"script",{src:e}),o=!1;return a.onload=a.onreadystatechange=function(){o||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(o=!0,n&&n(null),a.onload=a.onreadystatechange=null,"HEAD"==a.parentNode.tagName&&i.removeChild(a))},i.appendChild(a),setTimeout((function(){o||(o=!0,n&&n(Error("Script load timeout")))}),r||5e3),a}return null}function g(){this.a=0,this.c=null}function y(t){return t.a++,function(){t.a--,b(t)}}function x(t,e){t.c=e,b(t)}function b(t){0==t.a&&t.c&&(t.c(),t.c=null)}function w(t){this.a=t||"-"}function _(t,e){this.c=t,this.f=4,this.a="n";var n=(e||"n4").match(/^([nio])([1-9])$/i);n&&(this.a=n[1],this.f=parseInt(n[2],10))}function M(t){var e=[];t=t.split(/,\s*/);for(var n=0;n<t.length;n++){var r=t[n].replace(/['"]/g,"");-1!=r.indexOf(" ")||/^\d/.test(r)?e.push("'"+r+"'"):e.push(r)}return e.join(",")}function S(t){return t.a+t.f}function E(t){var e="normal";return"o"===t.a?e="oblique":"i"===t.a&&(e="italic"),e}function T(t){var e=4,n="n",r=null;return t&&((r=t.match(/(normal|oblique|italic)/i))&&r[1]&&(n=r[1].substr(0,1).toLowerCase()),(r=t.match(/([1-9]00|normal|bold)/i))&&r[1]&&(/bold/i.test(r[1])?e=7:/[1-9]00/.test(r[1])&&(e=parseInt(r[1].substr(0,1),10)))),n+e}function A(t,e){this.c=t,this.f=t.o.document.documentElement,this.h=e,this.a=new w("-"),this.j=!1!==e.events,this.g=!1!==e.classes}function L(t){if(t.g){var e=f(t.f,t.a.c("wf","active")),n=[],r=[t.a.c("wf","loading")];e||n.push(t.a.c("wf","inactive")),p(t.f,n,r)}R(t,"inactive")}function R(t,e,n){t.j&&t.h[e]&&(n?t.h[e](n.c,S(n)):t.h[e]())}function P(){this.c={}}function C(t,e){this.c=t,this.f=e,this.a=u(this.c,"span",{"aria-hidden":"true"},this.f)}function O(t){h(t.c,"body",t.a)}function D(t){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+M(t.c)+";font-style:"+E(t)+";font-weight:"+t.f+"00;"}function I(t,e,n,r,i,a){this.g=t,this.j=e,this.a=r,this.c=n,this.f=i||3e3,this.h=a||void 0}function N(t,e,n,r,i,a,o){this.v=t,this.B=e,this.c=n,this.a=r,this.s=o||"BESbswy",this.f={},this.w=i||3e3,this.u=a||null,this.m=this.j=this.h=this.g=null,this.g=new C(this.c,this.s),this.h=new C(this.c,this.s),this.j=new C(this.c,this.s),this.m=new C(this.c,this.s),t=D(t=new _(this.a.c+",serif",S(this.a))),this.g.a.style.cssText=t,t=D(t=new _(this.a.c+",sans-serif",S(this.a))),this.h.a.style.cssText=t,t=D(t=new _("serif",S(this.a))),this.j.a.style.cssText=t,t=D(t=new _("sans-serif",S(this.a))),this.m.a.style.cssText=t,O(this.g),O(this.h),O(this.j),O(this.m)}w.prototype.c=function(t){for(var e=[],n=0;n<arguments.length;n++)e.push(arguments[n].replace(/[\W_]+/g,"").toLowerCase());return e.join(this.a)},I.prototype.start=function(){var t=this.c.o.document,e=this,n=s(),r=new Promise((function(r,i){!function a(){s()-n>=e.f?i():t.fonts.load(function(t){return E(t)+" "+t.f+"00 300px "+M(t.c)}(e.a),e.h).then((function(t){1<=t.length?r():setTimeout(a,25)}),(function(){i()}))}()})),i=null,a=new Promise((function(t,n){i=setTimeout(n,e.f)}));Promise.race([a,r]).then((function(){i&&(clearTimeout(i),i=null),e.g(e.a)}),(function(){e.j(e.a)}))};var z={D:"serif",C:"sans-serif"},B=null;function F(){if(null===B){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);B=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))}return B}function U(t,e,n){for(var r in z)if(z.hasOwnProperty(r)&&e===t.f[z[r]]&&n===t.f[z[r]])return!0;return!1}function G(t){var e,n=t.g.a.offsetWidth,r=t.h.a.offsetWidth;(e=n===t.f.serif&&r===t.f["sans-serif"])||(e=F()&&U(t,n,r)),e?s()-t.A>=t.w?F()&&U(t,n,r)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?H(t,t.v):H(t,t.B):function(t){setTimeout(o((function(){G(this)}),t),50)}(t):H(t,t.v)}function H(t,e){setTimeout(o((function(){d(this.g.a),d(this.h.a),d(this.j.a),d(this.m.a),e(this.a)}),t),0)}function V(t,e,n){this.c=t,this.a=e,this.f=0,this.m=this.j=!1,this.s=n}N.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),G(this)};var k=null;function j(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&p(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),R(t,"active")):L(t.a))}function W(t){this.j=t,this.a=new P,this.h=0,this.f=this.g=!0}function q(t,e,n,r,i){var a=0==--t.h;(t.f||t.g)&&setTimeout((function(){var t=i||null,s=r||{};if(0===n.length&&a)L(e.a);else{e.f+=n.length,a&&(e.j=a);var c,l=[];for(c=0;c<n.length;c++){var u=n[c],h=s[u.c],d=e.a,f=u;if(d.g&&p(d.f,[d.a.c("wf",f.c,S(f).toString(),"loading")]),R(d,"fontloading",f),d=null,null===k)if(window.FontFace){f=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent);var m=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);k=f?42<parseInt(f[1],10):!m}else k=!1;d=k?new I(o(e.g,e),o(e.h,e),e.c,u,e.s,h):new N(o(e.g,e),o(e.h,e),e.c,u,e.s,t,h),l.push(d)}for(c=0;c<l.length;c++)l[c].start()}}),0)}function X(t,e){this.c=t,this.a=e}function Y(t,e){this.c=t,this.a=e}function Z(t,e){this.c=t||J,this.a=[],this.f=[],this.g=e||""}V.prototype.g=function(t){var e=this.a;e.g&&p(e.f,[e.a.c("wf",t.c,S(t).toString(),"active")],[e.a.c("wf",t.c,S(t).toString(),"loading"),e.a.c("wf",t.c,S(t).toString(),"inactive")]),R(e,"fontactive",t),this.m=!0,j(this)},V.prototype.h=function(t){var e=this.a;if(e.g){var n=f(e.f,e.a.c("wf",t.c,S(t).toString(),"active")),r=[],i=[e.a.c("wf",t.c,S(t).toString(),"loading")];n||r.push(e.a.c("wf",t.c,S(t).toString(),"inactive")),p(e.f,r,i)}R(e,"fontinactive",t),j(this)},W.prototype.load=function(t){this.c=new c(this.j,t.context||this.j),this.g=!1!==t.events,this.f=!1!==t.classes,function(t,e,n){var r=[],i=n.timeout;!function(t){t.g&&p(t.f,[t.a.c("wf","loading")]),R(t,"loading")}(e);r=function(t,e,n){var r,i=[];for(r in e)if(e.hasOwnProperty(r)){var a=t.c[r];a&&i.push(a(e[r],n))}return i}(t.a,n,t.c);var a=new V(t.c,e,i);for(t.h=r.length,e=0,n=r.length;e<n;e++)r[e].load((function(e,n,r){q(t,a,e,n,r)}))}(this,new A(this.c,t),t)},X.prototype.load=function(t){var e=this,n=e.a.projectId,r=e.a.version;if(n){var i=e.c.o;v(this.c,(e.a.api||"https://fast.fonts.net/jsapi")+"/"+n+".js"+(r?"?v="+r:""),(function(r){r?t([]):(i["__MonotypeConfiguration__"+n]=function(){return e.a},function e(){if(i["__mti_fntLst"+n]){var r,a=i["__mti_fntLst"+n](),o=[];if(a)for(var s=0;s<a.length;s++){var c=a[s].fontfamily;null!=a[s].fontStyle&&null!=a[s].fontWeight?(r=a[s].fontStyle+a[s].fontWeight,o.push(new _(c,r))):o.push(new _(c))}t(o)}else setTimeout((function(){e()}),50)}())})).id="__MonotypeAPIScript__"+n}else t([])},Y.prototype.load=function(t){var e,n,r=this.a.urls||[],i=this.a.families||[],a=this.a.testStrings||{},o=new g;for(e=0,n=r.length;e<n;e++)m(this.c,r[e],y(o));var s=[];for(e=0,n=i.length;e<n;e++)if((r=i[e].split(":"))[1])for(var c=r[1].split(","),l=0;l<c.length;l+=1)s.push(new _(r[0],c[l]));else s.push(new _(r[0]));x(o,(function(){t(s,a)}))};var J="https://fonts.googleapis.com/css";function K(t){this.f=t,this.a=[],this.c={}}var Q={latin:"BESbswy","latin-ext":"çöüğş",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},$={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},tt={i:"i",italic:"i",n:"n",normal:"n"},et=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;function nt(t,e){this.c=t,this.a=e}var rt={Arimo:!0,Cousine:!0,Tinos:!0};function it(t,e){this.c=t,this.a=e}function at(t,e){this.c=t,this.f=e,this.a=[]}nt.prototype.load=function(t){var e=new g,n=this.c,r=new Z(this.a.api,this.a.text),i=this.a.families;!function(t,e){for(var n=e.length,r=0;r<n;r++){var i=e[r].split(":");3==i.length&&t.f.push(i.pop());var a="";2==i.length&&""!=i[1]&&(a=":"),t.a.push(i.join(a))}}(r,i);var a=new K(i);!function(t){for(var e=t.f.length,n=0;n<e;n++){var r=t.f[n].split(":"),i=r[0].replace(/\+/g," "),a=["n4"];if(2<=r.length){var o;if(o=[],s=r[1])for(var s,c=(s=s.split(",")).length,l=0;l<c;l++){var u;if((u=s[l]).match(/^[\w-]+$/))if(null==(d=et.exec(u.toLowerCase())))u="";else{if(u=null==(u=d[2])||""==u?"n":tt[u],null==(d=d[1])||""==d)d="4";else var h=$[d],d=h||(isNaN(d)?"4":d.substr(0,1));u=[u,d].join("")}else u="";u&&o.push(u)}0<o.length&&(a=o),3==r.length&&(o=[],0<(r=(r=r[2])?r.split(","):o).length&&(r=Q[r[0]])&&(t.c[i]=r))}for(t.c[i]||(r=Q[i])&&(t.c[i]=r),r=0;r<a.length;r+=1)t.a.push(new _(i,a[r]))}}(a),m(n,function(t){if(0==t.a.length)throw Error("No fonts to load!");if(-1!=t.c.indexOf("kit="))return t.c;for(var e=t.a.length,n=[],r=0;r<e;r++)n.push(t.a[r].replace(/ /g,"+"));return e=t.c+"?family="+n.join("%7C"),0<t.f.length&&(e+="&subset="+t.f.join(",")),0<t.g.length&&(e+="&text="+encodeURIComponent(t.g)),e}(r),y(e)),x(e,(function(){t(a.a,a.c,rt)}))},it.prototype.load=function(t){var e=this.a.id,n=this.c.o;e?v(this.c,(this.a.api||"https://use.typekit.net")+"/"+e+".js",(function(e){if(e)t([]);else if(n.Typekit&&n.Typekit.config&&n.Typekit.config.fn){e=n.Typekit.config.fn;for(var r=[],i=0;i<e.length;i+=2)for(var a=e[i],o=e[i+1],s=0;s<o.length;s++)r.push(new _(a,o[s]));try{n.Typekit.load({events:!1,classes:!1,async:!0})}catch(t){}t(r)}}),2e3):t([])},at.prototype.load=function(t){var e=this.f.id,n=this.c.o,r=this;e?(n.__webfontfontdeckmodule__||(n.__webfontfontdeckmodule__={}),n.__webfontfontdeckmodule__[e]=function(e,n){for(var i=0,a=n.fonts.length;i<a;++i){var o=n.fonts[i];r.a.push(new _(o.name,T("font-weight:"+o.weight+";font-style:"+o.style)))}t(r.a)},v(this.c,(this.f.api||"https://f.fontdeck.com/s/css/js/")+function(t){return t.o.location.hostname||t.a.location.hostname}(this.c)+"/"+e+".js",(function(e){e&&t([])}))):t([])};var ot=new W(window);ot.a.c.custom=function(t,e){return new Y(e,t)},ot.a.c.fontdeck=function(t,e){return new at(e,t)},ot.a.c.monotype=function(t,e){return new X(e,t)},ot.a.c.typekit=function(t,e){return new it(e,t)},ot.a.c.google=function(t,e){return new nt(e,t)};var st={load:o(ot.load,ot)};void 0===(r=function(){return st}.call(e,n,e,t))||(t.exports=r)}()},function(t,e,n){var r,i;i="undefined"!=typeof self?self:this,void 0===(r=(()=>i.Kibo=function(){var t=function(t){this.element=t||window.document,this.initialize()};return t.KEY_NAMES_BY_CODE={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"caps_lock",27:"esc",32:"space",33:"page_up",34:"page_down",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"num_lock"},t.KEY_CODES_BY_NAME={},function(){for(var e in t.KEY_NAMES_BY_CODE)Object.prototype.hasOwnProperty.call(t.KEY_NAMES_BY_CODE,e)&&(t.KEY_CODES_BY_NAME[t.KEY_NAMES_BY_CODE[e]]=+e)}(),t.MODIFIERS=["shift","ctrl","alt"],t.WILDCARD_TYPES=["arrow","number","letter","f"],t.WILDCARDS={arrow:[37,38,39,40],number:[48,49,50,51,52,53,54,55,56,57],letter:[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90],f:[112,113,114,115,116,117,118,119,120,121,122,123]},t.registerEvent=document.addEventListener?function(t,e,n){t.addEventListener(e,n,!1)}:document.attachEvent?function(t,e,n){t.attachEvent("on"+e,n)}:void 0,t.unregisterEvent=document.removeEventListener?function(t,e,n){t.removeEventListener(e,n,!1)}:document.detachEvent?function(t,e,n){t.detachEvent("on"+e,n)}:void 0,t.stringContains=function(t,e){return-1!==t.indexOf(e)},t.neatString=function(t){return t.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ")},t.capitalize=function(t){return t.toLowerCase().replace(/^./,(function(t){return t.toUpperCase()}))},t.isString=function(e){return t.stringContains(Object.prototype.toString.call(e),"String")},t.arrayIncludes=Array.prototype.indexOf?function(t,e){return-1!==t.indexOf(e)}:function(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return!0;return!1},t.extractModifiers=function(e){var n,r;for(n=[],r=0;r<t.MODIFIERS.length;r++)t.stringContains(e,t.MODIFIERS[r])&&n.push(t.MODIFIERS[r]);return n},t.extractKey=function(e){var n,r;for(n=t.neatString(e).split(" "),r=0;r<n.length;r++)if(!t.arrayIncludes(t.MODIFIERS,n[r]))return n[r]},t.modifiersAndKey=function(e){var n,r;return t.stringContains(e,"any")?t.neatString(e).split(" ").slice(0,2).join(" "):(n=t.extractModifiers(e),(r=t.extractKey(e))&&!t.arrayIncludes(t.MODIFIERS,r)&&n.push(r),n.join(" "))},t.keyName=function(e){return t.KEY_NAMES_BY_CODE[e+""]},t.keyCode=function(e){return+t.KEY_CODES_BY_NAME[e]},t.prototype.initialize=function(){var e,n=this;for(this.lastKeyCode=-1,this.lastModifiers={},e=0;e<t.MODIFIERS.length;e++)this.lastModifiers[t.MODIFIERS[e]]=!1;for(this.keysDown={any:[]},this.keysUp={any:[]},e=0;e<t.WILDCARD_TYPES.length;e++)this.keysDown["any "+t.WILDCARD_TYPES[e]]=[],this.keysUp["any "+t.WILDCARD_TYPES[e]]=[];this.downHandler=this.handler("down"),this.upHandler=this.handler("up"),t.registerEvent(this.element,"keydown",this.downHandler),t.registerEvent(this.element,"keyup",this.upHandler),t.registerEvent(window,"unload",(function e(){t.unregisterEvent(n.element,"keydown",n.downHandler),t.unregisterEvent(n.element,"keyup",n.upHandler),t.unregisterEvent(window,"unload",e)}))},t.prototype.handler=function(e){var n=this;return function(r){var i,a,o,s;for(r=r||window.event,n.lastKeyCode=r.keyCode,i=0;i<t.MODIFIERS.length;i++)n.lastModifiers[t.MODIFIERS[i]]=r[t.MODIFIERS[i]+"Key"];for(t.arrayIncludes(t.MODIFIERS,t.keyName(n.lastKeyCode))&&(n.lastModifiers[t.keyName(n.lastKeyCode)]=!0),o=n["keys"+t.capitalize(e)],i=0;i<o.any.length;i++)!1===o.any[i](r)&&r.preventDefault&&r.preventDefault();for(i=0;i<t.WILDCARD_TYPES.length;i++)if(t.arrayIncludes(t.WILDCARDS[t.WILDCARD_TYPES[i]],n.lastKeyCode))for(a=0;a<o["any "+t.WILDCARD_TYPES[i]].length;a++)!1===o["any "+t.WILDCARD_TYPES[i]][a](r)&&r.preventDefault&&r.preventDefault();if(o[s=n.lastModifiersAndKey()])for(i=0;i<o[s].length;i++)!1===o[s][i](r)&&r.preventDefault&&r.preventDefault()}},t.prototype.registerKeys=function(e,n,r){var i,a,o=this["keys"+t.capitalize(e)];for(t.isString(n)&&(n=[n]),i=0;i<n.length;i++)a=n[i],o[a=t.modifiersAndKey(a+"")]?o[a].push(r):o[a]=[r];return this},t.prototype.unregisterKeys=function(e,n,r){var i,a,o,s=this["keys"+t.capitalize(e)];for(t.isString(n)&&(n=[n]),i=0;i<n.length;i++)if(o=n[i],o=t.modifiersAndKey(o+""),null===r)delete s[o];else if(s[o])for(a=0;a<s[o].length;a++)if(String(s[o][a])===String(r)){s[o].splice(a,1);break}return this},t.prototype.delegate=function(t,e,n){return null!==n?this.registerKeys(t,e,n):this.unregisterKeys(t,e,n)},t.prototype.down=function(t,e){return this.delegate("down",t,e)},t.prototype.up=function(t,e){return this.delegate("up",t,e)},t.prototype.lastKey=function(e){return e?this.lastModifiers[e]:t.keyName(this.lastKeyCode)},t.prototype.lastModifiersAndKey=function(){var e,n;for(e=[],n=0;n<t.MODIFIERS.length;n++)this.lastKey(t.MODIFIERS[n])&&e.push(t.MODIFIERS[n]);return t.arrayIncludes(e,this.lastKey())||e.push(this.lastKey()),e.join(" ")},t}()).call(e,n,e,t))||(t.exports=r)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r={createButton:function(t,e){function n(e){o.style.display="",o.style.cursor="pointer",o.style.left="calc(50% - 50px)",o.style.width="100px",o.textContent="ENTER_VR",o.onmouseenter=function(){o.style.opacity="1.0"},o.onmouseleave=function(){o.style.opacity="0.5"},o.onclick=function(){e.isPresenting?e.exitPresent():e.requestPresent([{source:t.domElement}])},t.vr.setDevice(e)}function r(){o.style.display="",o.style.cursor="auto",o.style.left="calc(50% - 75px)",o.style.width="150px",o.onmouseenter=null,o.onmouseleave=null,o.onclick=null}function i(){r(),o.textContent="VR NOT FOUND",t.vr.setDevice(null)}function a(t){t.style.position="absolute",t.style.bottom="20px",t.style.padding="12px 6px",t.style.border="1px solid #fff",t.style.borderRadius="4px",t.style.background="rgba(0,0,0,0.1)",t.style.color="#fff",t.style.font="normal 13px sans-serif",t.style.textAlign="center",t.style.opacity="0.5",t.style.outline="none",t.style.zIndex="999"}var o;if(e&&e.referenceSpaceType&&t.vr.setReferenceSpaceType(e.referenceSpaceType),"xr"in navigator)return(o=document.createElement("button")).style.display="none",a(o),navigator.xr.isSessionSupported("immersive-vr").then((function(e){e?function(){var e=null;function n(n){n.addEventListener("end",r),t.vr.setSession(n),o.textContent="EXIT VR",e=n}function r(){e.removeEventListener("end",r),t.vr.setSession(null),o.textContent="ENTER VR",e=null}o.style.display="",o.style.cursor="pointer",o.style.left="calc(50% - 50px)",o.style.width="100px",o.textContent="ENTER VR",o.onmouseenter=function(){o.style.opacity="1.0"},o.onmouseleave=function(){o.style.opacity="0.5"},o.onclick=function(){if(null===e){navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then(n)}else e.end()}}():(r(),o.textContent="VR NOT FOUND")})),o;if("getVRDisplays"in navigator)return(o=document.createElement("button")).style.display="none",a(o),window.addEventListener("vrdisplayconnect",(function(t){n(t.display)}),!1),window.addEventListener("vrdisplaydisconnect",(function(){i()}),!1),window.addEventListener("vrdisplaypresentchange",(function(t){o.textContent=t.display.isPresenting?"EXIT_VR":"ENTER_VR"}),!1),window.addEventListener("vrdisplayactivate",(function(e){e.display.requestPresent([{source:t.domElement}])}),!1),navigator.getVRDisplays().then((function(t){t.length>0?n(t[0]):i()})).catch(i),o;var s=document.createElement("a");return s.href="https://immersive-web.github.io/webxr/",s.innerHTML="WEBXR NOT SUPPORTED",s.style.left="calc(50% - 90px)",s.style.width="180px",s.style.textDecoration="none",a(s),s}}},function(t,e,n){"use strict";e.a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>'}]]);
//# sourceMappingURL=vendors~main.js.map