customMaterial.dd39ecee.js 783 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"dKqR":[function(require,module,exports) {
  2. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ArrayCamera=ch,exports.AxisHelper=lx,exports.BinaryTextureLoader=dx,exports.Bone=Yh,exports.BoundingBoxHelper=cx,exports.BufferAttribute=bi,exports.BufferGeometry=ki,exports.Camera=gs,exports.CanvasRenderer=fx,exports.CompressedTextureLoader=md,exports.CubicInterpolant=Xp,exports.Curve=yd,exports.DataTextureLoader=xd,exports.DiscreteInterpolant=Zp,exports.DynamicBufferAttribute=Kg,exports.EdgesHelper=hx,exports.EventDispatcher=In,exports.FileLoader=pd,exports.Float16BufferAttribute=Ri,exports.Float32Attribute=ox,exports.Float32BufferAttribute=Ci,exports.Float64Attribute=ax,exports.Float64BufferAttribute=Pi,exports.GLBufferAttribute=xf,exports.ImageBitmapLoader=Sm,exports.ImmediateRenderObject=Lf,exports.InstancedBufferAttribute=vm,exports.InstancedBufferGeometry=xm,exports.InstancedInterleavedBuffer=gf,exports.InstancedMesh=nu,exports.Int16Attribute=nx,exports.Int16BufferAttribute=Ti,exports.Int32Attribute=ix,exports.Int32BufferAttribute=Ai,exports.Int8Attribute=$g,exports.Int8BufferAttribute=wi,exports.InterleavedBuffer=_h,exports.InterleavedBufferAttribute=wh,exports.Interpolant=qp,exports.JSONLoader=gx,exports.LensFlare=vx,exports.Line=cu,exports.LineSegments=pu,exports.LinearInterpolant=Yp,exports.Loader=hd,exports.LoadingManager=ld,exports.Material=hi,exports.Mesh=os,exports.MeshFaceMaterial=Vg,exports.MeshPhysicalMaterial=Op,exports.MeshStandardMaterial=Fp,exports.MultiMaterial=Wg,exports.Object3D=Xr,exports.ParametricGeometry=exports.ParametricBufferGeometry=wp,exports.Particle=qg,exports.ParticleBasicMaterial=Zg,exports.ParticleSystem=Xg,exports.ParticleSystemMaterial=Jg,exports.PerspectiveCamera=xs,exports.PointCloud=jg,exports.PointCloudMaterial=Yg,exports.Points=yu,exports.PropertyBinding=uf,exports.QuaternionLinearInterpolant=td,exports.Raycaster=vf,exports.ShaderMaterial=fs,exports.SkinnedMesh=Xh,exports.TextureLoader=vd,exports.Uint16Attribute=rx,exports.Uint16BufferAttribute=Ei,exports.Uint32Attribute=sx,exports.Uint32BufferAttribute=Li,exports.Uint8Attribute=tx,exports.Uint8BufferAttribute=Mi,exports.Uint8ClampedAttribute=ex,exports.Uint8ClampedBufferAttribute=Si,exports.Vertex=Qg,exports.WebGLRenderTargetCube=mx,exports.WebGLRenderer=fh,exports.WebGLUtils=lh,exports.WireframeHelper=ux,exports.XHRLoader=px,exports.FloatType=exports.FlatShading=exports.FaceColors=exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=exports.Euler=exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=exports.EllipseCurve=exports.EdgesGeometry=exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=exports.DirectionalLightHelper=exports.DirectionalLight=exports.DepthTexture=exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=exports.DataUtils=exports.DataTexture3D=exports.DataTexture2DArray=exports.DataTexture=exports.Cylindrical=exports.CylinderGeometry=exports.CylinderBufferGeometry=exports.CustomToneMapping=exports.CustomBlending=exports.CurvePath=exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=exports.CubicBezierCurve3=exports.CubicBezierCurve=exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=exports.CubeTextureLoader=exports.CubeTexture=exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeCamera=exports.ConeGeometry=exports.ConeBufferGeometry=exports.CompressedTexture=exports.ColorKeyframeTrack=exports.Color=exports.Clock=exports.ClampToEdgeWrapping=exports.CircleGeometry=exports.CircleBufferGeometry=exports.CineonToneMapping=exports.CatmullRomCurve3=exports.CanvasTexture=exports.CameraHelper=exports.Cache=exports.ByteType=exports.BufferGeometryLoader=exports.BoxHelper=exports.BoxGeometry=exports.BoxBufferGeometry=exports.Box3Helper=exports.Box3=exports.Box2=exports.BooleanKeyframeTrack=exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=exports.AxesHelper=exports.AudioLoader=exports.AudioListener=exports.AudioContext=exports.AudioAnalyser=exports.Audio=exports.ArrowHelper=exports.ArcCurve=exports.AnimationUtils=exports.AnimationObjectGroup=exports.AnimationMixer=exports.AnimationLoader=exports.AnimationClip=exports.AmbientLightProbe=exports.AmbientLight=exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AdditiveAnimationBlendMode=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.ObjectLoader=exports.NumberKeyframeTrack=exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NormalAnimationBlendMode=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=exports.MeshToonMaterial=exports.MeshPhongMaterial=exports.MeshNormalMaterial=exports.MeshMatcapMaterial=exports.MeshLambertMaterial=exports.MeshDistanceMaterial=exports.MeshDepthMaterial=exports.MeshBasicMaterial=exports.MaxEquation=exports.Matrix4=exports.Matrix3=exports.MathUtils=exports.Math=exports.MaterialLoader=exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=exports.LoaderUtils=exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=exports.LinearMipMapLinearFilter=exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=exports.LinePieces=exports.LineLoop=exports.LineDashedMaterial=exports.LineCurve3=exports.LineCurve=exports.LineBasicMaterial=exports.Line3=exports.LightProbe=exports.Light=exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=exports.Layers=exports.LatheGeometry=exports.LatheBufferGeometry=exports.LOD=exports.KeyframeTrack=exports.KeepStencilOp=exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=exports.IntType=exports.IncrementWrapStencilOp=exports.IncrementStencilOp=exports.ImageUtils=exports.ImageLoader=exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=exports.HemisphereLightProbe=exports.HemisphereLightHelper=exports.HemisphereLight=exports.HalfFloatType=exports.Group=exports.GridHelper=exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GammaEncoding=exports.GLSL3=exports.GLSL1=exports.Frustum=exports.FrontSide=exports.FontLoader=exports.Font=exports.FogExp2=exports.Fog=void 0,exports.ShapeBufferGeometry=exports.Shape=exports.ShadowMaterial=exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=exports.Scene=exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=exports.RingGeometry=exports.RingBufferGeometry=exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=exports.RectAreaLight=exports.Ray=exports.RawShaderMaterial=exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=exports.QuaternionKeyframeTrack=exports.Quaternion=exports.QuadraticBezierCurve3=exports.QuadraticBezierCurve=exports.PropertyMixer=exports.PositionalAudio=exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=exports.PolarGridHelper=exports.PointsMaterial=exports.PointLightHelper=exports.PointLight=exports.PlaneHelper=exports.PlaneGeometry=exports.PlaneBufferGeometry=exports.Plane=exports.Path=exports.PMREMGenerator=exports.PCFSoftShadowMap=exports.PCFShadowMap=exports.OrthographicCamera=exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=exports.OctahedronGeometry=exports.OctahedronBufferGeometry=exports.ObjectSpaceNormalMap=void 0,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=exports.WrapAroundEnding=exports.WireframeGeometry=exports.WebGLRenderTarget=exports.WebGLMultisampleRenderTarget=exports.WebGLCubeRenderTarget=exports.WebGL1Renderer=exports.VideoTexture=exports.VertexColors=exports.VectorKeyframeTrack=exports.Vector4=exports.Vector3=exports.Vector2=exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=exports.Uniform=exports.UVMapping=exports.TubeGeometry=exports.TubeBufferGeometry=exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=exports.Triangle=exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=exports.TorusGeometry=exports.TorusBufferGeometry=exports.Texture=exports.TextGeometry=exports.TextBufferGeometry=exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=exports.StringKeyframeTrack=exports.StreamReadUsage=exports.StreamDrawUsage=exports.StreamCopyUsage=exports.StereoCamera=exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=exports.SpriteMaterial=exports.Sprite=exports.SpotLightHelper=exports.SpotLight=exports.SplineCurve=exports.SphericalHarmonics3=exports.Spherical=exports.SphereGeometry=exports.SphereBufferGeometry=exports.Sphere=exports.SmoothShading=exports.SkeletonHelper=exports.Skeleton=exports.ShortType=exports.ShapeUtils=exports.ShapePath=exports.ShapeGeometry=void 0;const t="126";exports.REVISION="126";const e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=e;const n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=n;const r=0;exports.CullFaceNone=r;const i=1;exports.CullFaceBack=i;const s=2;exports.CullFaceFront=s;const o=3;exports.CullFaceFrontBack=3;const a=0;exports.BasicShadowMap=0;const l=1;exports.PCFShadowMap=l;const c=2;exports.PCFSoftShadowMap=c;const h=3;exports.VSMShadowMap=h;const u=0;exports.FrontSide=u;const p=1;exports.BackSide=p;const d=2;exports.DoubleSide=d;const m=1;exports.FlatShading=1;const f=2;exports.SmoothShading=2;const g=0;exports.NoBlending=g;const x=1;exports.NormalBlending=x;const v=2;exports.AdditiveBlending=v;const y=3;exports.SubtractiveBlending=y;const _=4;exports.MultiplyBlending=_;const b=5;exports.CustomBlending=b;const w=100;exports.AddEquation=w;const M=101;exports.SubtractEquation=M;const S=102;exports.ReverseSubtractEquation=S;const T=103;exports.MinEquation=T;const E=104;exports.MaxEquation=E;const A=200;exports.ZeroFactor=A;const L=201;exports.OneFactor=L;const R=202;exports.SrcColorFactor=R;const C=203;exports.OneMinusSrcColorFactor=C;const P=204;exports.SrcAlphaFactor=P;const D=205;exports.OneMinusSrcAlphaFactor=D;const I=206;exports.DstAlphaFactor=I;const B=207;exports.OneMinusDstAlphaFactor=B;const N=208;exports.DstColorFactor=N;const F=209;exports.OneMinusDstColorFactor=F;const O=210;exports.SrcAlphaSaturateFactor=O;const z=0;exports.NeverDepth=z;const G=1;exports.AlwaysDepth=G;const H=2;exports.LessDepth=H;const U=3;exports.LessEqualDepth=U;const k=4;exports.EqualDepth=k;const V=5;exports.GreaterEqualDepth=V;const W=6;exports.GreaterDepth=W;const j=7;exports.NotEqualDepth=j;const q=0;exports.MultiplyOperation=q;const X=1;exports.MixOperation=X;const Y=2;exports.AddOperation=Y;const Z=0;exports.NoToneMapping=Z;const J=1;exports.LinearToneMapping=J;const Q=2;exports.ReinhardToneMapping=Q;const K=3;exports.CineonToneMapping=K;const $=4;exports.ACESFilmicToneMapping=$;const tt=5;exports.CustomToneMapping=tt;const et=300;exports.UVMapping=et;const nt=301;exports.CubeReflectionMapping=nt;const rt=302;exports.CubeRefractionMapping=rt;const it=303;exports.EquirectangularReflectionMapping=it;const st=304;exports.EquirectangularRefractionMapping=st;const ot=306;exports.CubeUVReflectionMapping=ot;const at=307;exports.CubeUVRefractionMapping=at;const lt=1e3;exports.RepeatWrapping=lt;const ct=1001;exports.ClampToEdgeWrapping=ct;const ht=1002;exports.MirroredRepeatWrapping=ht;const ut=1003;exports.NearestFilter=ut;const pt=1004;exports.NearestMipmapNearestFilter=pt;const dt=1004;exports.NearestMipMapNearestFilter=1004;const mt=1005;exports.NearestMipmapLinearFilter=mt;const ft=1005;exports.NearestMipMapLinearFilter=1005;const gt=1006;exports.LinearFilter=gt;const xt=1007;exports.LinearMipmapNearestFilter=xt;const vt=1007;exports.LinearMipMapNearestFilter=1007;const yt=1008;exports.LinearMipmapLinearFilter=yt;const _t=1008;exports.LinearMipMapLinearFilter=1008;const bt=1009;exports.UnsignedByteType=bt;const wt=1010;exports.ByteType=wt;const Mt=1011;exports.ShortType=Mt;const St=1012;exports.UnsignedShortType=St;const Tt=1013;exports.IntType=Tt;const Et=1014;exports.UnsignedIntType=Et;const At=1015;exports.FloatType=At;const Lt=1016;exports.HalfFloatType=Lt;const Rt=1017;exports.UnsignedShort4444Type=Rt;const Ct=1018;exports.UnsignedShort5551Type=Ct;const Pt=1019;exports.UnsignedShort565Type=Pt;const Dt=1020;exports.UnsignedInt248Type=Dt;const It=1021;exports.AlphaFormat=It;const Bt=1022;exports.RGBFormat=Bt;const Nt=1023;exports.RGBAFormat=Nt;const Ft=1024;exports.LuminanceFormat=Ft;const Ot=1025;exports.LuminanceAlphaFormat=Ot;const zt=Nt;exports.RGBEFormat=zt;const Gt=1026;exports.DepthFormat=Gt;const Ht=1027;exports.DepthStencilFormat=Ht;const Ut=1028;exports.RedFormat=Ut;const kt=1029;exports.RedIntegerFormat=kt;const Vt=1030;exports.RGFormat=Vt;const Wt=1031;exports.RGIntegerFormat=Wt;const jt=1032;exports.RGBIntegerFormat=jt;const qt=1033;exports.RGBAIntegerFormat=qt;const Xt=33776;exports.RGB_S3TC_DXT1_Format=Xt;const Yt=33777;exports.RGBA_S3TC_DXT1_Format=Yt;const Zt=33778;exports.RGBA_S3TC_DXT3_Format=Zt;const Jt=33779;exports.RGBA_S3TC_DXT5_Format=Jt;const Qt=35840;exports.RGB_PVRTC_4BPPV1_Format=Qt;const Kt=35841;exports.RGB_PVRTC_2BPPV1_Format=Kt;const $t=35842;exports.RGBA_PVRTC_4BPPV1_Format=$t;const te=35843;exports.RGBA_PVRTC_2BPPV1_Format=te;const ee=36196;exports.RGB_ETC1_Format=ee;const ne=37492;exports.RGB_ETC2_Format=ne;const re=37496;exports.RGBA_ETC2_EAC_Format=re;const ie=37808;exports.RGBA_ASTC_4x4_Format=ie;const se=37809;exports.RGBA_ASTC_5x4_Format=se;const oe=37810;exports.RGBA_ASTC_5x5_Format=oe;const ae=37811;exports.RGBA_ASTC_6x5_Format=ae;const le=37812;exports.RGBA_ASTC_6x6_Format=le;const ce=37813;exports.RGBA_ASTC_8x5_Format=ce;const he=37814;exports.RGBA_ASTC_8x6_Format=he;const ue=37815;exports.RGBA_ASTC_8x8_Format=ue;const pe=37816;exports.RGBA_ASTC_10x5_Format=pe;const de=37817;exports.RGBA_ASTC_10x6_Format=de;const me=37818;exports.RGBA_ASTC_10x8_Format=me;const fe=37819;exports.RGBA_ASTC_10x10_Format=fe;const ge=37820;exports.RGBA_ASTC_12x10_Format=ge;const xe=37821;exports.RGBA_ASTC_12x12_Format=xe;const ve=36492;exports.RGBA_BPTC_Format=ve;const ye=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=ye;const _e=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=_e;const be=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=be;const we=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=we;const Me=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Me;const Se=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=Se;const Te=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Te;const Ee=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Ee;const Ae=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ae;const Le=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Le;const Re=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Re;const Ce=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Ce;const Pe=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=Pe;const De=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=De;const Ie=2200;exports.LoopOnce=Ie;const Be=2201;exports.LoopRepeat=Be;const Ne=2202;exports.LoopPingPong=Ne;const Fe=2300;exports.InterpolateDiscrete=Fe;const Oe=2301;exports.InterpolateLinear=Oe;const ze=2302;exports.InterpolateSmooth=ze;const Ge=2400;exports.ZeroCurvatureEnding=Ge;const He=2401;exports.ZeroSlopeEnding=He;const Ue=2402;exports.WrapAroundEnding=Ue;const ke=2500;exports.NormalAnimationBlendMode=ke;const Ve=2501;exports.AdditiveAnimationBlendMode=Ve;const We=0;exports.TrianglesDrawMode=0;const je=1;exports.TriangleStripDrawMode=1;const qe=2;exports.TriangleFanDrawMode=2;const Xe=3e3;exports.LinearEncoding=Xe;const Ye=3001;exports.sRGBEncoding=Ye;const Ze=3007;exports.GammaEncoding=Ze;const Je=3002;exports.RGBEEncoding=Je;const Qe=3003;exports.LogLuvEncoding=Qe;const Ke=3004;exports.RGBM7Encoding=Ke;const $e=3005;exports.RGBM16Encoding=$e;const tn=3006;exports.RGBDEncoding=tn;const en=3200;exports.BasicDepthPacking=en;const nn=3201;exports.RGBADepthPacking=nn;const rn=0;exports.TangentSpaceNormalMap=rn;const sn=1;exports.ObjectSpaceNormalMap=sn;const on=0;exports.ZeroStencilOp=0;const an=7680;exports.KeepStencilOp=an;const ln=7681;exports.ReplaceStencilOp=7681;const cn=7682;exports.IncrementStencilOp=7682;const hn=7683;exports.DecrementStencilOp=7683;const un=34055;exports.IncrementWrapStencilOp=34055;const pn=34056;exports.DecrementWrapStencilOp=34056;const dn=5386;exports.InvertStencilOp=5386;const mn=512;exports.NeverStencilFunc=512;const fn=513;exports.LessStencilFunc=513;const gn=514;exports.EqualStencilFunc=514;const xn=515;exports.LessEqualStencilFunc=515;const vn=516;exports.GreaterStencilFunc=516;const yn=517;exports.NotEqualStencilFunc=517;const _n=518;exports.GreaterEqualStencilFunc=518;const bn=519;exports.AlwaysStencilFunc=bn;const wn=35044;exports.StaticDrawUsage=wn;const Mn=35048;exports.DynamicDrawUsage=Mn;const Sn=35040;exports.StreamDrawUsage=35040;const Tn=35045;exports.StaticReadUsage=35045;const En=35049;exports.DynamicReadUsage=35049;const An=35041;exports.StreamReadUsage=35041;const Ln=35046;exports.StaticCopyUsage=35046;const Rn=35050;exports.DynamicCopyUsage=35050;const Cn=35042;exports.StreamCopyUsage=35042;const Pn="100";exports.GLSL1="100";const Dn="300 es";function In(){}exports.GLSL3=Dn,Object.assign(In.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const 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;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t)}}});const Bn=[];for(let yx=0;yx<256;yx++)Bn[yx]=(yx<16?"0":"")+yx.toString(16);let Nn=1234567;const Fn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Bn[255&t]+Bn[t>>8&255]+Bn[t>>16&255]+Bn[t>>24&255]+"-"+Bn[255&e]+Bn[e>>8&255]+"-"+Bn[e>>16&15|64]+Bn[e>>24&255]+"-"+Bn[63&n|128]+Bn[n>>8&255]+"-"+Bn[n>>16&255]+Bn[n>>24&255]+Bn[255&r]+Bn[r>>8&255]+Bn[r>>16&255]+Bn[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},damp:function(t,e,n,r){return Fn.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(Fn.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(Nn=t%2147483647),((Nn=16807*Nn%2147483647)-1)/2147483646},degToRad:function(t){return t*Fn.DEG2RAD},radToDeg:function(t){return t*Fn.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))},setQuaternionFromProperEuler:function(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),h=o((e+r)/2),u=s((e-r)/2),p=o((e-r)/2),d=s((r-e)/2),m=o((r-e)/2);switch(i){case"XYX":t.set(a*h,l*u,l*p,a*c);break;case"YZY":t.set(l*p,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*p,a*h,a*c);break;case"XZX":t.set(a*h,l*m,l*d,a*c);break;case"YXY":t.set(l*d,a*h,l*m,a*c);break;case"ZYZ":t.set(l*m,l*d,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};exports.MathUtils=exports.Math=Fn;class On{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(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(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(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(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(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(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const 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(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(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(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(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(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(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}exports.Vector2=On,On.prototype.isVector2=!0;class zn{constructor(){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.")}set(t,e,n,r,i,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const 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}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const 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}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],m=r[0],f=r[3],g=r[6],x=r[1],v=r[4],y=r[7],_=r[2],b=r[5],w=r[8];return i[0]=s*m+o*x+a*_,i[3]=s*f+o*v+a*b,i[6]=s*g+o*y+a*w,i[1]=l*m+c*x+h*_,i[4]=l*f+c*v+h*b,i[7]=l*g+c*y+h*w,i[2]=u*m+p*x+d*_,i[5]=u*f+p*v+d*b,i[8]=u*g+p*y+d*w,this}multiplyScalar(t){const 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(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*i*c+n*o*a+r*i*l-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*i,p=l*i-s*a,d=e*h+n*u+r*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=h*m,t[1]=(r*l-c*n)*m,t[2]=(o*n-r*s)*m,t[3]=u*m,t[4]=(c*e-r*a)*m,t[5]=(r*i-o*e)*m,t[6]=p*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*i)*m,this}transpose(){let t;const 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(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const 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(t,e,n,r,i,s,o){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-r*l,r*a,-r*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],l=r[4],c=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*a,r[4]=-n*s+e*l,r[7]=-n*o+e*c,this}translate(t,e){const 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(t){const e=this.elements,n=t.elements;for(let r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const 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}clone(){return(new this.constructor).fromArray(this.elements)}}let Gn;exports.Matrix3=zn,zn.prototype.isMatrix3=!0;const Hn={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=t.width,Gn.height=t.height;const n=Gn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Gn}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}};exports.ImageUtils=Hn;let Un=0;class kn extends In{constructor(t=kn.DEFAULT_IMAGE,e=kn.DEFAULT_MAPPING,n=ct,r=ct,i=gt,s=yt,o=Nt,a=bt,l=1,c=Xe){super(),Object.defineProperty(this,"id",{value:Un++}),this.uuid=Fn.generateUUID(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new On(0,0),this.repeat=new On(1,1),this.center=new On(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(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.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const 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){const r=this.image;if(void 0===r.uuid&&(r.uuid=Fn.generateUUID()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Vn(r[t].image)):e.push(Vn(r[t]))}else e=Vn(r);t.images[r.uuid]={uuid:r.uuid,url:e}}n.image=r.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==et)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case lt:t.x=t.x-Math.floor(t.x);break;case ct:t.x=t.x<0?0:1;break;case ht: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 lt:t.y=t.y-Math.floor(t.y);break;case ct:t.y=t.y<0?0:1;break;case ht: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}set needsUpdate(t){!0===t&&this.version++}}function Vn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Hn.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}exports.Texture=kn,kn.DEFAULT_IMAGE=void 0,kn.DEFAULT_MAPPING=et,kn.prototype.isTexture=!0;class Wn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(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(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(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(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(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(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(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(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}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const 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(t){let e,n,r,i;const s=t.elements,o=s[0],a=s[4],l=s[8],c=s[1],h=s[5],u=s[9],p=s[2],d=s[6],m=s[10];if(Math.abs(a-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(a+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+m-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(o+1)/2,s=(h+1)/2,f=(m+1)/2,g=(a+c)/4,x=(l+p)/4,v=(u+d)/4;return t>s&&t>f?t<.01?(n=0,r=.707106781,i=.707106781):(r=g/(n=Math.sqrt(t)),i=x/n):s>f?s<.01?(n=.707106781,r=0,i=.707106781):(n=g/(r=Math.sqrt(s)),i=v/r):f<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(f)),r=v/i),this.set(n,r,i,e),this}let f=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-a)*(c-a));return Math.abs(f)<.001&&(f=1),this.x=(d-u)/f,this.y=(l-p)/f,this.z=(c-a)/f,this.w=Math.acos((o+h+m-1)/2),this}min(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(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(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(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(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}exports.Vector4=Wn,Wn.prototype.isVector4=!0;class jn extends In{constructor(t,e,n){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Wn(0,0,t,e),this.scissorTest=!1,this.viewport=new Wn(0,0,t,e),n=n||{},this.texture=new kn(void 0,n.mapping,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.image.depth=1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gt,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}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}exports.WebGLRenderTarget=jn,jn.prototype.isWebGLRenderTarget=!0;class qn extends jn{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}exports.WebGLMultisampleRenderTarget=qn,qn.prototype.isWebGLMultisampleRenderTarget=!0;class Xn{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return n.copy(t).slerp(e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],l=n[r+1],c=n[r+2],h=n[r+3];const u=i[s+0],p=i[s+1],d=i[s+2],m=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(h!==m||a!==u||l!==p||c!==d){let t=1-o;const e=a*u+l*p+c*d+h*m,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+u*i,l=l*t+p*i,c=c*t+d*i,h=h*t+m*i,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],l=n[r+2],c=n[r+3],h=i[s],u=i[s+1],p=i[s+2],d=i[s+3];return t[e]=o*d+c*h+a*p-l*u,t[e+1]=a*d+c*u+l*h-o*p,t[e+2]=l*d+c*p+o*u-a*h,t[e+3]=c*d-o*h-a*u-l*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(r/2),h=o(i/2),u=a(n/2),p=a(r/2),d=a(i/2);switch(s){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const 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(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(i-l)*t,this._z=(s-r)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(i-l)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-r)/t,this._x=(i+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let 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(t){return 2*Math.acos(Math.abs(Fn.clamp(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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(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(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+r*l-i*a,this._y=r*c+s*a+i*o-n*l,this._z=i*c+s*l+n*a-r*o,this._w=s*c-n*o-r*a-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*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=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=r*h+this._y*u,this._z=i*h+this._z*u,this._onChangeCallback(),this}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Quaternion=Xn,Xn.prototype.isQuaternion=!0;class Yn{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(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(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(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(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(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(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Jn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Jn.setFromAxisAngle(t,e))}applyMatrix3(t){const 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(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=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])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*r-o*n,c=a*n+o*e-i*r,h=a*r+i*n-s*e,u=-i*e-s*n-o*r;return this.x=l*a+u*-i+c*-o-h*-s,this.y=c*a+u*-s+h*-i-l*-o,this.z=h*a+u*-o+l*-s-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const 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(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(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(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(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(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(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(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(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Zn.copy(this).projectOnVector(t),this.sub(Zn)}reflect(t){return this.sub(Zn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(Fn.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const 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(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const 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(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}exports.Vector3=Yn,Yn.prototype.isVector3=!0;const Zn=new Yn,Jn=new Xn;class Qn{constructor(t=new Yn(1/0,1/0,1/0),e=new Yn(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],c=t[a+1],h=t[a+2];l<e&&(e=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),c=t.getY(a),h=t.getZ(a);l<e&&(e=l),c<n&&(n=c),h<r&&(r=h),l>i&&(i=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=$n.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){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(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new Yn),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new Yn),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),tr.copy(e.boundingBox),tr.applyMatrix4(t.matrixWorld),this.union(tr));const n=t.children;for(let r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this}containsPoint(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(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(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new Yn),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(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(t){return this.clampPoint(t.center,$n),$n.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let 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(t){if(this.isEmpty())return!1;this.getCenter(ar),lr.subVectors(this.max,ar),er.subVectors(t.a,ar),nr.subVectors(t.b,ar),rr.subVectors(t.c,ar),ir.subVectors(nr,er),sr.subVectors(rr,nr),or.subVectors(er,rr);let e=[0,-ir.z,ir.y,0,-sr.z,sr.y,0,-or.z,or.y,ir.z,0,-ir.x,sr.z,0,-sr.x,or.z,0,-or.x,-ir.y,ir.x,0,-sr.y,sr.x,0,-or.y,or.x,0];return!!ur(e,er,nr,rr,lr)&&(!!ur(e=[1,0,0,0,1,0,0,0,1],er,nr,rr,lr)&&(cr.crossVectors(ir,sr),ur(e=[cr.x,cr.y,cr.z],er,nr,rr,lr)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Yn),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $n.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize($n).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Kn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Kn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Kn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Kn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Kn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Kn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Kn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Kn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Kn),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box3=Qn,Qn.prototype.isBox3=!0;const Kn=[new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn,new Yn],$n=new Yn,tr=new Qn,er=new Yn,nr=new Yn,rr=new Yn,ir=new Yn,sr=new Yn,or=new Yn,ar=new Yn,lr=new Yn,cr=new Yn,hr=new Yn;function ur(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){hr.fromArray(t,s);const o=i.x*Math.abs(hr.x)+i.y*Math.abs(hr.y)+i.z*Math.abs(hr.z),a=e.dot(hr),l=n.dot(hr),c=r.dot(hr);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const pr=new Qn;class dr{constructor(t=new Yn,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):pr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;i<s;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return void 0===e&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),e=new Yn),e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Qn),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}exports.Sphere=dr;const mr=new Yn,fr=new Yn,gr=new Yn,xr=new Yn,vr=new Yn,yr=new Yn,_r=new Yn;class br{constructor(t=new Yn,e=new Yn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new Yn),e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mr)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Yn),e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mr.copy(this.direction).multiplyScalar(e).add(this.origin),mr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){fr.copy(t).add(e).multiplyScalar(.5),gr.copy(e).sub(t).normalize(),xr.copy(this.origin).sub(fr);const i=.5*t.distanceTo(e),s=-this.direction.dot(gr),o=xr.dot(this.direction),a=-xr.dot(gr),l=xr.lengthSq(),c=Math.abs(1-s*s);let h,u,p,d;if(c>0)if(u=s*o-a,d=i*c,(h=s*a-o)>=0)if(u>=-d)if(u<=d){const t=1/c;p=(h*=t)*(h+s*(u*=t)+2*o)+u*(s*h+u+2*a)+l}else u=i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u=-i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;else u<=-d?p=-(h=Math.max(0,-(-s*i+o)))*h+(u=h>0?-i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l:u<=d?(h=0,p=(u=Math.min(Math.max(-i,-a),i))*(u+2*a)+l):p=-(h=Math.max(0,-(s*i+o)))*h+(u=h>0?i:Math.min(Math.max(-i,-a),i))*(u+2*a)+l;else u=s>0?-i:i,p=-(h=Math.max(0,-(s*u+o)))*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(gr).multiplyScalar(u).add(fr),p}intersectSphere(t,e){mr.subVectors(t.center,this.origin);const n=mr.dot(this.direction),r=mr.dot(mr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,r=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,r=(t.min.x-u.x)*l),c>=0?(i=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(i=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||i>r?null:((i>n||n!=n)&&(n=i),(s<r||r!=r)&&(r=s),h>=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>r?null:((o>n||n!=n)&&(n=o),(a<r||r!=r)&&(r=a),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mr)}intersectTriangle(t,e,n,r,i){vr.subVectors(e,t),yr.subVectors(n,t),_r.crossVectors(vr,yr);let s,o=this.direction.dot(_r);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}xr.subVectors(this.origin,t);const a=s*this.direction.dot(yr.crossVectors(xr,yr));if(a<0)return null;const l=s*this.direction.dot(vr.cross(xr));if(l<0)return null;if(a+l>o)return null;const c=-s*xr.dot(_r);return c<0?null:this.at(c/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}exports.Ray=br;class wr{constructor(){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.")}set(t,e,n,r,i,s,o,a,l,c,h,u,p,d,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wr).fromArray(this.elements)}copy(t){const 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(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(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(t){const e=this.elements,n=t.elements,r=1/Mr.setFromMatrixColumn(t,0).length(),i=1/Mr.setFromMatrixColumn(t,1).length(),s=1/Mr.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]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-o*a,e[2]=i-t*l,e[6]=r+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,r=l*c,i=l*h;e[0]=t-i*o,e[4]=-s*h,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*c,e[9]=i-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,r=o*c,i=o*h;e[0]=a*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=a*h,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=i-t*h,e[8]=r*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+r,e[10]=t-i*h}else if("XZY"===t.order){const t=s*a,n=s*l,r=o*a,i=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+i,e[5]=s*c,e[9]=n*h-r,e[2]=r*h-n,e[6]=o*c,e[10]=i*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tr,t,Er)}lookAt(t,e,n){const r=this.elements;return Rr.subVectors(t,e),0===Rr.lengthSq()&&(Rr.z=1),Rr.normalize(),Ar.crossVectors(n,Rr),0===Ar.lengthSq()&&(1===Math.abs(n.z)?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),Ar.crossVectors(n,Rr)),Ar.normalize(),Lr.crossVectors(Rr,Ar),r[0]=Ar.x,r[4]=Lr.x,r[8]=Rr.x,r[1]=Ar.y,r[5]=Lr.y,r[9]=Rr.y,r[2]=Ar.z,r[6]=Lr.z,r[10]=Rr.z,this}multiply(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(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],m=n[6],f=n[10],g=n[14],x=n[3],v=n[7],y=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],B=r[7],N=r[11],F=r[15];return i[0]=s*b+o*T+a*R+l*I,i[4]=s*w+o*E+a*C+l*B,i[8]=s*M+o*A+a*P+l*N,i[12]=s*S+o*L+a*D+l*F,i[1]=c*b+h*T+u*R+p*I,i[5]=c*w+h*E+u*C+p*B,i[9]=c*M+h*A+u*P+p*N,i[13]=c*S+h*L+u*D+p*F,i[2]=d*b+m*T+f*R+g*I,i[6]=d*w+m*E+f*C+g*B,i[10]=d*M+m*A+f*P+g*N,i[14]=d*S+m*L+f*D+g*F,i[3]=x*b+v*T+y*R+_*I,i[7]=x*w+v*E+y*C+_*B,i[11]=x*M+v*A+y*P+_*N,i[15]=x*S+v*L+y*D+_*F,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],p=t[14];return t[3]*(+i*a*h-r*l*h-i*o*u+n*l*u+r*o*p-n*a*p)+t[7]*(+e*a*p-e*l*u+i*s*u-r*s*p+r*l*c-i*a*c)+t[11]*(+e*l*h-e*o*p-i*s*h+n*s*p+i*o*c-n*l*c)+t[15]*(-r*o*c-e*a*h+e*o*u+r*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const 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}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],p=t[11],d=t[12],m=t[13],f=t[14],g=t[15],x=h*f*l-m*u*l+m*a*p-o*f*p-h*a*g+o*u*g,v=d*u*l-c*f*l-d*a*p+s*f*p+c*a*g-s*u*g,y=c*m*l-d*h*l+d*o*p-s*m*p-c*o*g+s*h*g,_=d*h*a-c*m*a-d*o*u+s*m*u+c*o*f-s*h*f,b=e*x+n*v+r*y+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=x*w,t[1]=(m*u*i-h*f*i-m*r*p+n*f*p+h*r*g-n*u*g)*w,t[2]=(o*f*i-m*a*i+m*r*l-n*f*l-o*r*g+n*a*g)*w,t[3]=(h*a*i-o*u*i-h*r*l+n*u*l+o*r*p-n*a*p)*w,t[4]=v*w,t[5]=(c*f*i-d*u*i+d*r*p-e*f*p-c*r*g+e*u*g)*w,t[6]=(d*a*i-s*f*i-d*r*l+e*f*l+s*r*g-e*a*g)*w,t[7]=(s*u*i-c*a*i+c*r*l-e*u*l-s*r*p+e*a*p)*w,t[8]=y*w,t[9]=(d*h*i-c*m*i-d*n*p+e*m*p+c*n*g-e*h*g)*w,t[10]=(s*m*i-d*o*i+d*n*l-e*m*l-s*n*g+e*o*g)*w,t[11]=(c*o*i-s*h*i-c*n*l+e*h*l+s*n*p-e*o*p)*w,t[12]=_*w,t[13]=(c*m*r-d*h*r+d*n*u-e*m*u-c*n*f+e*h*f)*w,t[14]=(d*o*r-s*m*r-d*n*a+e*m*a+s*n*f-e*o*f)*w,t[15]=(s*h*r-c*o*r+c*n*a-e*h*a-s*n*u+e*o*u)*w,this}scale(t){const 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(){const 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(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const 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(t){const 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(t){const 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(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,l=i*s,c=i*o;return this.set(l*s+n,l*o-r*a,l*a+r*o,0,l*o+r*a,c*o+n,c*a-r*s,0,l*a-r*o,c*a+r*s,i*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,l=i+i,c=s+s,h=o+o,u=i*l,p=i*c,d=i*h,m=s*c,f=s*h,g=o*h,x=a*l,v=a*c,y=a*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(m+g))*_,r[1]=(p+y)*_,r[2]=(d-v)*_,r[3]=0,r[4]=(p-y)*b,r[5]=(1-(u+g))*b,r[6]=(f+x)*b,r[7]=0,r[8]=(d+v)*w,r[9]=(f-x)*w,r[10]=(1-(u+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Mr.set(r[0],r[1],r[2]).length();const s=Mr.set(r[4],r[5],r[6]).length(),o=Mr.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],Sr.copy(this);const a=1/i,l=1/s,c=1/o;return Sr.elements[0]*=a,Sr.elements[1]*=a,Sr.elements[2]*=a,Sr.elements[4]*=l,Sr.elements[5]*=l,Sr.elements[6]*=l,Sr.elements[8]*=c,Sr.elements[9]*=c,Sr.elements[10]*=c,e.setFromRotationMatrix(Sr),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),h=(n+r)/(n-r),u=-(s+i)/(s-i),p=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),l=1/(n-r),c=1/(s-i),h=(e+t)*a,u=(n+r)*l,p=(s+i)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const 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}}exports.Matrix4=wr,wr.prototype.isMatrix4=!0;const Mr=new Yn,Sr=new wr,Tr=new Yn(0,0,0),Er=new Yn(1,1,1),Ar=new Yn,Lr=new Yn,Rr=new Yn,Cr=new wr,Pr=new Xn;class Dr{constructor(t=0,e=0,n=0,r=Dr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const r=Fn.clamp,i=t.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],h=i[9],u=i[2],p=i[6],d=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cr,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return Pr.setFromEuler(this),this.setFromQuaternion(Pr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(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(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Yn(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}exports.Euler=Dr,Dr.prototype.isEuler=!0,Dr.DefaultOrder="XYZ",Dr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ir{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}exports.Layers=Ir;let Br=0;const Nr=new Yn,Fr=new Xn,Or=new wr,zr=new Yn,Gr=new Yn,Hr=new Yn,Ur=new Xn,kr=new Yn(1,0,0),Vr=new Yn(0,1,0),Wr=new Yn(0,0,1),jr={type:"added"},qr={type:"removed"};function Xr(){Object.defineProperty(this,"id",{value:Br++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Xr.DefaultUp.clone();const t=new Yn,e=new Dr,n=new Xn,r=new Yn(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 wr},normalMatrix:{value:new zn}}),this.matrix=new wr,this.matrixWorld=new wr,this.matrixAutoUpdate=Xr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ir,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}Xr.DefaultUp=new Yn(0,1,0),Xr.DefaultMatrixAutoUpdate=!0,Xr.prototype=Object.assign(Object.create(In.prototype),{constructor:Xr,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4: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 Fr.setFromAxisAngle(t,e),this.quaternion.multiply(Fr),this},rotateOnWorldAxis:function(t,e){return Fr.setFromAxisAngle(t,e),this.quaternion.premultiply(Fr),this},rotateX:function(t){return this.rotateOnAxis(kr,t)},rotateY:function(t){return this.rotateOnAxis(Vr,t)},rotateZ:function(t){return this.rotateOnAxis(Wr,t)},translateOnAxis:function(t,e){return Nr.copy(t).applyQuaternion(this.quaternion),this.position.add(Nr.multiplyScalar(e)),this},translateX:function(t){return this.translateOnAxis(kr,t)},translateY:function(t){return this.translateOnAxis(Vr,t)},translateZ:function(t){return this.translateOnAxis(Wr,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Or.copy(this.matrixWorld).invert())},lookAt:function(t,e,n){t.isVector3?zr.copy(t):zr.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Gr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Or.lookAt(Gr,zr,this.up):Or.lookAt(zr,Gr,this.up),this.quaternion.setFromRotationMatrix(Or),r&&(Or.extractRotation(r.matrixWorld),Fr.setFromRotationMatrix(Or),this.quaternion.premultiply(Fr.invert()))},add:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);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(jr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(qr)),this},clear:function(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(qr)}return this.children.length=0,this},attach:function(t){return this.updateWorldMatrix(!0,!1),Or.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Or.multiply(t.parent.matrixWorld)),t.applyMatrix4(Or),this.add(t),t.updateWorldMatrix(!1,!0),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(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new Xn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,t,Hr),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gr,Ur,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()},raycast:function(){},traverse:function(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)},traverseAncestors:function(t){const 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);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)},updateWorldMatrix:function(t,e){const 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){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}},toJSON:function(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const 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.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);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=s(t.geometries),r=s(t.materials),i=s(t.textures),o=s(t.images),a=s(t.shapes),l=s(t.skeletons),c=s(t.animations);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function s(t){const e=[];for(const n in t){const 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=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.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(let n=0;n<t.children.length;n++){const e=t.children[n];this.add(e.clone())}return this}});const Yr=new Yn,Zr=new Yn,Jr=new zn;class Qr{constructor(t=new Yn(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=Yr.subVectors(n,e).cross(Zr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return void 0===e&&(console.warn("THREE.Plane: .projectPoint() target is now required"),e=new Yn),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){void 0===e&&(console.warn("THREE.Plane: .intersectLine() target is now required"),e=new Yn);const n=t.delta(Yr),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):void 0;const 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(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new Yn),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Jr.getNormalMatrix(t),r=this.coplanarPoint(Yr).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}exports.Plane=Qr,Qr.prototype.isPlane=!0;const Kr=new Yn,$r=new Yn,ti=new Yn,ei=new Yn,ni=new Yn,ri=new Yn,ii=new Yn,si=new Yn,oi=new Yn,ai=new Yn;class li{constructor(t=new Yn,e=new Yn,n=new Yn){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new Yn),r.subVectors(n,e),Kr.subVectors(t,e),r.cross(Kr);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Kr.subVectors(r,e),$r.subVectors(n,e),ti.subVectors(t,e);const s=Kr.dot(Kr),o=Kr.dot($r),a=Kr.dot(ti),l=$r.dot($r),c=$r.dot(ti),h=s*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Yn),0===h)return i.set(-2,-1,-1);const u=1/h,p=(l*a-o*c)*u,d=(s*c-o*a)*u;return i.set(1-p-d,d,p)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ei),a.set(0,0),a.addScaledVector(i,ei.x),a.addScaledVector(s,ei.y),a.addScaledVector(o,ei.z),a}static isFrontFacing(t,e,n,r){return Kr.subVectors(n,e),$r.subVectors(t,e),Kr.cross($r).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Kr.subVectors(this.c,this.b),$r.subVectors(this.a,this.b),.5*Kr.cross($r).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Yn),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return li.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Qr),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return li.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return li.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return li.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return li.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new Yn);const n=this.a,r=this.b,i=this.c;let s,o;ni.subVectors(r,n),ri.subVectors(i,n),si.subVectors(t,n);const a=ni.dot(si),l=ri.dot(si);if(a<=0&&l<=0)return e.copy(n);oi.subVectors(t,r);const c=ni.dot(oi),h=ri.dot(oi);if(c>=0&&h<=c)return e.copy(r);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(ni,s);ai.subVectors(t,i);const p=ni.dot(ai),d=ri.dot(ai);if(d>=0&&p<=d)return e.copy(i);const m=p*l-a*d;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),e.copy(n).addScaledVector(ri,o);const f=c*d-p*h;if(f<=0&&h-c>=0&&p-d>=0)return ii.subVectors(i,r),o=(h-c)/(h-c+(p-d)),e.copy(r).addScaledVector(ii,o);const g=1/(f+m+u);return s=m*g,o=u*g,e.copy(n).addScaledVector(ni,s).addScaledVector(ri,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}exports.Triangle=li;let ci=0;function hi(){Object.defineProperty(this,"id",{value:ci++}),this.uuid=Fn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=x,this.side=u,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=P,this.blendDst=D,this.blendEquation=w,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=U,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,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}hi.prototype=Object.assign(Object.create(In.prototype),{constructor:hi,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const 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.")}},toJSON:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const 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.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.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!==x&&(n.blending=this.blending),this.side!==u&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.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),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}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.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;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.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(hi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const ui={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},pi={h:0,s:0,l:0},di={h:0,s:0,l:0};function mi(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 fi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function gi(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class xi{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(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(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=Fn.euclideanModulo(t,1),e=Fn.clamp(e,0,1),n=Fn.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=mi(i,r,t+1/3),this.g=mi(i,r,t),this.b=mi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=ui[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const 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(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=fi(t.r),this.g=fi(t.g),this.b=fi(t.b),this}copyLinearToSRGB(t){return this.r=gi(t.r),this.g=gi(t.g),this.b=gi(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const l=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=l<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(n<r?6:0);break;case n:o=(r-e)/t+2;break;case r:o=(e-n)/t+4}o/=6}return t.h=o,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(pi),pi.h+=t,pi.s+=e,pi.l+=n,this.setHSL(pi.h,pi.s,pi.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(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(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(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}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(pi),t.getHSL(di);const n=Fn.lerp(pi.h,di.h,e),r=Fn.lerp(pi.s,di.s,e),i=Fn.lerp(pi.l,di.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}exports.Color=xi,xi.NAMES=ui,xi.prototype.isColor=!0,xi.prototype.r=1,xi.prototype.g=1,xi.prototype.b=1;class vi extends hi{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new xi(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=q,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)}copy(t){return super.copy(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}}exports.MeshBasicMaterial=vi,vi.prototype.isMeshBasicMaterial=!0;const yi=new Yn,_i=new On;function bi(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=wn,this.updateRange={offset:0,count:-1},this.version=0}function wi(t,e,n){bi.call(this,new Int8Array(t),e,n)}function Mi(t,e,n){bi.call(this,new Uint8Array(t),e,n)}function Si(t,e,n){bi.call(this,new Uint8ClampedArray(t),e,n)}function Ti(t,e,n){bi.call(this,new Int16Array(t),e,n)}function Ei(t,e,n){bi.call(this,new Uint16Array(t),e,n)}function Ai(t,e,n){bi.call(this,new Int32Array(t),e,n)}function Li(t,e,n){bi.call(this,new Uint32Array(t),e,n)}function Ri(t,e,n){bi.call(this,new Uint16Array(t),e,n)}function Ci(t,e,n){bi.call(this,new Float32Array(t),e,n)}function Pi(t,e,n){bi.call(this,new Float64Array(t),e,n)}function Di(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}Object.defineProperty(bi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(bi.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(let 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){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new xi),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this},copyVector2sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new On),e[n++]=i.x,e[n++]=i.y}return this},copyVector3sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Yn),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this},copyVector4sArray:function(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new Wn),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this},applyMatrix3:function(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)_i.fromBufferAttribute(this,e),_i.applyMatrix3(t),this.setXY(e,_i.x,_i.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)yi.fromBufferAttribute(this,e),yi.applyMatrix3(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this},applyMatrix4:function(t){for(let e=0,n=this.count;e<n;e++)yi.x=this.getX(e),yi.y=this.getY(e),yi.z=this.getZ(e),yi.applyMatrix4(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this},applyNormalMatrix:function(t){for(let e=0,n=this.count;e<n;e++)yi.x=this.getX(e),yi.y=this.getY(e),yi.z=this.getZ(e),yi.applyNormalMatrix(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this},transformDirection:function(t){for(let e=0,n=this.count;e<n;e++)yi.x=this.getX(e),yi.y=this.getY(e),yi.z=this.getZ(e),yi.transformDirection(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this},set:function(t,e=0){return 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}}}),wi.prototype=Object.create(bi.prototype),wi.prototype.constructor=wi,Mi.prototype=Object.create(bi.prototype),Mi.prototype.constructor=Mi,Si.prototype=Object.create(bi.prototype),Si.prototype.constructor=Si,Ti.prototype=Object.create(bi.prototype),Ti.prototype.constructor=Ti,Ei.prototype=Object.create(bi.prototype),Ei.prototype.constructor=Ei,Ai.prototype=Object.create(bi.prototype),Ai.prototype.constructor=Ai,Li.prototype=Object.create(bi.prototype),Li.prototype.constructor=Li,Ri.prototype=Object.create(bi.prototype),Ri.prototype.constructor=Ri,Ri.prototype.isFloat16BufferAttribute=!0,Ci.prototype=Object.create(bi.prototype),Ci.prototype.constructor=Ci,Pi.prototype=Object.create(bi.prototype),Pi.prototype.constructor=Pi;const Ii={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Bi(t,e){return new Ii[t](e)}let Ni=0;const Fi=new wr,Oi=new Xr,zi=new Yn,Gi=new Qn,Hi=new Qn,Ui=new Yn;function ki(){Object.defineProperty(this,"id",{value:Ni++}),this.uuid=Fn.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={}}ki.prototype=Object.assign(Object.create(In.prototype),{constructor:ki,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){return Array.isArray(t)?this.index=new(Di(t)>65535?Li:Ei)(t,1):this.index=t,this},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},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new zn).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Fi.makeRotationX(t),this.applyMatrix4(Fi),this},rotateY:function(t){return Fi.makeRotationY(t),this.applyMatrix4(Fi),this},rotateZ:function(t){return Fi.makeRotationZ(t),this.applyMatrix4(Fi),this},translate:function(t,e,n){return Fi.makeTranslation(t,e,n),this.applyMatrix4(Fi),this},scale:function(t,e,n){return Fi.makeScale(t,e,n),this.applyMatrix4(Fi),this},lookAt:function(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromPoints:function(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ci(e,3)),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Qn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Yn(-1/0,-1/0,-1/0),new Yn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const t=e[n];Gi.setFromBufferAttribute(t),this.morphTargetsRelative?(Ui.addVectors(this.boundingBox.min,Gi.min),this.boundingBox.expandByPoint(Ui),Ui.addVectors(this.boundingBox.max,Gi.max),this.boundingBox.expandByPoint(Ui)):(this.boundingBox.expandByPoint(Gi.min),this.boundingBox.expandByPoint(Gi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new dr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Yn,1/0);if(t){const n=this.boundingSphere.center;if(Gi.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const n=e[t];Hi.setFromBufferAttribute(n),this.morphTargetsRelative?(Ui.addVectors(Gi.min,Hi.min),Gi.expandByPoint(Ui),Ui.addVectors(Gi.max,Hi.max),Gi.expandByPoint(Ui)):(Gi.expandByPoint(Hi.min),Gi.expandByPoint(Hi.max))}Gi.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)Ui.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(Ui));if(e)for(let i=0,s=e.length;i<s;i++){const s=e[i],o=this.morphTargetsRelative;for(let e=0,i=s.count;e<i;e++)Ui.fromBufferAttribute(s,e),o&&(zi.fromBufferAttribute(t,e),Ui.add(zi)),r=Math.max(r,n.distanceToSquared(Ui))}this.boundingSphere.radius=Math.sqrt(r),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(){},computeTangents:function(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,r=e.position.array,i=e.normal.array,s=e.uv.array,o=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new bi(new Float32Array(4*o),4));const a=e.tangent.array,l=[],c=[];for(let T=0;T<o;T++)l[T]=new Yn,c[T]=new Yn;const h=new Yn,u=new Yn,p=new Yn,d=new On,m=new On,f=new On,g=new Yn,x=new Yn;function v(t,e,n){h.fromArray(r,3*t),u.fromArray(r,3*e),p.fromArray(r,3*n),d.fromArray(s,2*t),m.fromArray(s,2*e),f.fromArray(s,2*n),u.sub(h),p.sub(h),m.sub(d),f.sub(d);const i=1/(m.x*f.y-f.x*m.y);isFinite(i)&&(g.copy(u).multiplyScalar(f.y).addScaledVector(p,-m.y).multiplyScalar(i),x.copy(p).multiplyScalar(m.x).addScaledVector(u,-f.x).multiplyScalar(i),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(x),c[e].add(x),c[n].add(x))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let T=0,E=y.length;T<E;++T){const t=y[T],e=t.start;for(let r=e,i=e+t.count;r<i;r+=3)v(n[r+0],n[r+1],n[r+2])}const _=new Yn,b=new Yn,w=new Yn,M=new Yn;function S(t){w.fromArray(i,3*t),M.copy(w);const e=l[t];_.copy(e),_.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(M,e);const n=b.dot(c[t])<0?-1:1;a[4*t]=_.x,a[4*t+1]=_.y,a[4*t+2]=_.z,a[4*t+3]=n}for(let T=0,E=y.length;T<E;++T){const t=y[T],e=t.start;for(let r=e,i=e+t.count;r<i;r+=3)S(n[r+0]),S(n[r+1]),S(n[r+2])}},computeVertexNormals:function(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new bi(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const r=new Yn,i=new Yn,s=new Yn,o=new Yn,a=new Yn,l=new Yn,c=new Yn,h=new Yn;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),m=t.getX(u+2);r.fromBufferAttribute(e,p),i.fromBufferAttribute(e,d),s.fromBufferAttribute(e,m),c.subVectors(s,i),h.subVectors(r,i),c.cross(h),o.fromBufferAttribute(n,p),a.fromBufferAttribute(n,d),l.fromBufferAttribute(n,m),o.add(c),a.add(c),l.add(c),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let t=0,u=e.count;t<u;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,i),h.subVectors(r,i),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}},merge:function(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,s=t.attributes[r],o=s.array,a=s.itemSize*e,l=Math.min(o.length,i.length-a);for(let t=0,e=a;t<l;t++,e++)i[e]=o[t]}return this},normalizeNormals:function(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Ui.fromBufferAttribute(t,e),Ui.normalize(),t.setXYZ(e,Ui.x,Ui.y,Ui.z)},toNonIndexed:function(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,s=new n.constructor(e.length*r);let o=0,a=0;for(let l=0,c=e.length;l<c;l++){o=e[l]*r;for(let t=0;t<r;t++)s[a++]=n[o++]}return new bi(s,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new ki,n=this.index.array,r=this.attributes;for(const o in r){const i=t(r[o],n);e.setAttribute(o,i)}const i=this.morphAttributes;for(const o in i){const r=[],s=i[o];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);r.push(i)}e.morphAttributes[o]=r}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,a=s.length;o<a;o++){const t=s[o];e.addGroup(t.start,t.count,t.materialIndex)}return e},toJSON:function(){const 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){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const a in n){const e=n[a],r=e.toJSON(t.data);""!==e.name&&(r.name=e.name),t.data.attributes[a]=r}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r],s=i.toJSON(t.data);""!==i.name&&(s.name=i.name),n.push(s)}n.length>0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t},clone:function(){return(new ki).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const l in r){const t=r[l];this.setAttribute(l,t.clone(e))}const i=t.morphAttributes;for(const l in i){const t=[],n=i[l];for(let r=0,i=n.length;r<i;r++)t.push(n[r].clone(e));this.morphAttributes[l]=t}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let l=0,c=s.length;l<c;l++){const t=s[l];this.addGroup(t.start,t.count,t.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});const Vi=new wr,Wi=new br,ji=new dr,qi=new Yn,Xi=new Yn,Yi=new Yn,Zi=new Yn,Ji=new Yn,Qi=new Yn,Ki=new Yn,$i=new Yn,ts=new Yn,es=new On,ns=new On,rs=new On,is=new Yn,ss=new Yn;function os(t=new ki,e=new vi){Xr.call(this),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}function as(t,e,n,r,i,s,o,a){let l;if(null===(l=e.side===p?r.intersectTriangle(o,s,i,!0,a):r.intersectTriangle(i,s,o,e.side!==d,a)))return null;ss.copy(a),ss.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(ss);return c<n.near||c>n.far?null:{distance:c,point:ss.clone(),object:t}}function ls(t,e,n,r,i,s,o,a,l,c,h,u){qi.fromBufferAttribute(i,c),Xi.fromBufferAttribute(i,h),Yi.fromBufferAttribute(i,u);const p=t.morphTargetInfluences;if(e.morphTargets&&s&&p){Ki.set(0,0,0),$i.set(0,0,0),ts.set(0,0,0);for(let t=0,e=s.length;t<e;t++){const e=p[t],n=s[t];0!==e&&(Zi.fromBufferAttribute(n,c),Ji.fromBufferAttribute(n,h),Qi.fromBufferAttribute(n,u),o?(Ki.addScaledVector(Zi,e),$i.addScaledVector(Ji,e),ts.addScaledVector(Qi,e)):(Ki.addScaledVector(Zi.sub(qi),e),$i.addScaledVector(Ji.sub(Xi),e),ts.addScaledVector(Qi.sub(Yi),e)))}qi.add(Ki),Xi.add($i),Yi.add(ts)}t.isSkinnedMesh&&e.skinning&&(t.boneTransform(c,qi),t.boneTransform(h,Xi),t.boneTransform(u,Yi));const d=as(t,e,n,r,qi,Xi,Yi,is);if(d){a&&(es.fromBufferAttribute(a,c),ns.fromBufferAttribute(a,h),rs.fromBufferAttribute(a,u),d.uv=li.getUV(is,qi,Xi,Yi,es,ns,rs,new On)),l&&(es.fromBufferAttribute(l,c),ns.fromBufferAttribute(l,h),rs.fromBufferAttribute(l,u),d.uv2=li.getUV(is,qi,Xi,Yi,es,ns,rs,new On));const t={a:c,b:c,c:u,normal:new Yn,materialIndex:0};li.getNormal(qi,Xi,Yi,t.normal),d.face=t}return d}os.prototype=Object.assign(Object.create(Xr.prototype),{constructor:os,isMesh:!0,copy:function(t){return Xr.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ji.copy(n.boundingSphere),ji.applyMatrix4(i),!1===t.ray.intersectsSphere(ji))return;if(Vi.copy(i).invert(),Wi.copy(t.ray).applyMatrix4(Vi),null!==n.boundingBox&&!1===Wi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,p=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,d=u.length;n<d;n++){const d=u[n],m=r[d.materialIndex];for(let n=Math.max(d.start,p.start),r=Math.min(d.start+d.count,p.start+p.count);n<r;n+=3){const r=i.getX(n),u=i.getX(n+1),p=i.getX(n+2);(s=ls(this,m,t,Wi,o,a,l,c,h,r,u,p))&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=d.materialIndex,e.push(s))}}else{for(let n=Math.max(0,p.start),u=Math.min(i.count,p.start+p.count);n<u;n+=3){const u=i.getX(n),p=i.getX(n+1),d=i.getX(n+2);(s=ls(this,r,t,Wi,o,a,l,c,h,u,p,d))&&(s.faceIndex=Math.floor(n/3),e.push(s))}}else if(void 0!==o)if(Array.isArray(r))for(let n=0,d=u.length;n<d;n++){const i=u[n],d=r[i.materialIndex];for(let n=Math.max(i.start,p.start),r=Math.min(i.start+i.count,p.start+p.count);n<r;n+=3){(s=ls(this,d,t,Wi,o,a,l,c,h,n,n+1,n+2))&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=i.materialIndex,e.push(s))}}else{for(let n=Math.max(0,p.start),i=Math.min(o.count,p.start+p.count);n<i;n+=3){(s=ls(this,r,t,Wi,o,a,l,c,h,n,n+1,n+2))&&(s.faceIndex=Math.floor(n/3),e.push(s))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}});class cs extends ki{constructor(t=1,e=1,n=1,r=1,i=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:s};const o=this;r=Math.floor(r),i=Math.floor(i),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,p=0;function d(t,e,n,r,i,s,d,m,f,g,x){const v=s/f,y=d/g,_=s/2,b=d/2,w=m/2,M=f+1,S=g+1;let T=0,E=0;const A=new Yn;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<M;a++){const u=a*v-_;A[t]=u*r,A[e]=s*i,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=m>0?1:-1,c.push(A.x,A.y,A.z),h.push(a/f),h.push(1-o/g),T+=1}}for(let o=0;o<g;o++)for(let t=0;t<f;t++){const e=u+t+M*o,n=u+t+M*(o+1),r=u+(t+1)+M*(o+1),i=u+(t+1)+M*o;a.push(e,n,i),a.push(n,r,i),E+=6}o.addGroup(p,E,x),p+=E,u+=T}d("z","y","x",-1,-1,n,e,t,s,i,0),d("z","y","x",1,-1,n,e,-t,s,i,1),d("x","z","y",1,1,t,n,e,r,s,2),d("x","z","y",1,-1,t,n,-e,r,s,3),d("x","y","z",1,-1,t,e,n,r,i,4),d("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(a),this.setAttribute("position",new Ci(l,3)),this.setAttribute("normal",new Ci(c,3)),this.setAttribute("uv",new Ci(h,2))}}function hs(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function us(t){const e={};for(let n=0;n<t.length;n++){const r=hs(t[n]);for(const t in r)e[t]=r[t]}return e}exports.BoxGeometry=exports.BoxBufferGeometry=cs;const ps={clone:hs,merge:us};exports.UniformsUtils=ps;var ds="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",ms="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";function fs(t){hi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=ds,this.fragmentShader=ms,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,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function gs(){Xr.call(this),this.type="Camera",this.matrixWorldInverse=new wr,this.projectionMatrix=new wr,this.projectionMatrixInverse=new wr}function xs(t=50,e=1,n=.1,r=2e3){gs.call(this),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}fs.prototype=Object.create(hi.prototype),fs.prototype.constructor=fs,fs.prototype.isShaderMaterial=!0,fs.prototype.copy=function(t){return hi.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=hs(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=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this},fs.prototype.toJSON=function(t){const e=hi.prototype.toJSON.call(this,t);e.glslVersion=this.glslVersion,e.uniforms={};for(const r in this.uniforms){const n=this.uniforms[r].value;n&&n.isTexture?e.uniforms[r]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[r]={type:"m4",value:n.toArray()}:e.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e},gs.prototype=Object.assign(Object.create(Xr.prototype),{constructor:gs,isCamera:!0,copy:function(t,e){return Xr.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 Yn),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Xr.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Xr.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),xs.prototype=Object.assign(Object.create(gs.prototype),{constructor:xs,isPerspectiveCamera:!0,copy:function(t,e){return gs.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){const e=.5*this.getFilmHeight()/t;this.fov=2*Fn.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*Fn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Fn.RAD2DEG*Math.atan(Math.tan(.5*Fn.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,s){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=s,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*Fn.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){const e=Xr.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}});const vs=90,ys=1;class _s extends Xr{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new xs(vs,ys,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Yn(1,0,0)),this.add(r);const i=new xs(vs,ys,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Yn(-1,0,0)),this.add(i);const s=new xs(vs,ys,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Yn(0,1,0)),this.add(s);const o=new xs(vs,ys,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Yn(0,-1,0)),this.add(o);const a=new xs(vs,ys,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new Yn(0,0,1)),this.add(a);const l=new xs(vs,ys,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Yn(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}exports.CubeCamera=_s;class bs extends kn{constructor(t,e,n,r,i,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:nt,n,r,i,s,o=void 0!==o?o:Bt,a,l,c),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}exports.CubeTexture=bs,bs.prototype.isCubeTexture=!0;class ws extends jn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new bs(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:gt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Nt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new cs(5,5,5),i=new fs({name:"CubemapFromEquirect",uniforms:hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:p,blending:g});i.uniforms.tEquirect.value=e;const s=new os(r,i),o=e.minFilter;return e.minFilter===yt&&(e.minFilter=gt),new _s(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}exports.WebGLCubeRenderTarget=ws,ws.prototype.isWebGLCubeRenderTarget=!0;class Ms extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:ut,this.minFilter=void 0!==c?c:ut,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}exports.DataTexture=Ms,Ms.prototype.isDataTexture=!0;const Ss=new dr,Ts=new Yn;class Es{constructor(t=new Qr,e=new Qr,n=new Qr,r=new Qr,i=new Qr,s=new Qr){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const 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(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],m=n[11],f=n[12],g=n[13],x=n[14],v=n[15];return e[0].setComponents(o-r,h-a,m-u,v-f).normalize(),e[1].setComponents(o+r,h+a,m+u,v+f).normalize(),e[2].setComponents(o+i,h+l,m+p,v+g).normalize(),e[3].setComponents(o-i,h-l,m-p,v-g).normalize(),e[4].setComponents(o-s,h-c,m-d,v-x).normalize(),e[5].setComponents(o+s,h+c,m+d,v+x).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(Ts.x=r.normal.x>0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const s=r.get(e);void 0===s?r.set(e,function(e,r){const i=e.array,s=e.usage,o=t.createBuffer();t.bindBuffer(r,o),t.bufferData(r,i,s),e.onUploadCallback();let a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:i instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):s.version<e.version&&(function(e,r,i){const s=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,s):(n?t.bufferSubData(i,o.offset*s.BYTES_PER_ELEMENT,s,o.offset,o.count):t.bufferSubData(i,o.offset*s.BYTES_PER_ELEMENT,s.subarray(o.offset,o.offset+o.count)),o.count=-1)}(s.buffer,e,i),s.version=e.version)}}}exports.Frustum=Es;class Rs extends ki{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,s=e/2,o=Math.floor(n),a=Math.floor(r),l=o+1,c=a+1,h=t/o,u=e/a,p=[],d=[],m=[],f=[];for(let g=0;g<c;g++){const t=g*u-s;for(let e=0;e<l;e++){const n=e*h-i;d.push(n,-t,0),m.push(0,0,1),f.push(e/o),f.push(1-g/a)}}for(let g=0;g<a;g++)for(let t=0;t<o;t++){const e=t+l*g,n=t+l*(g+1),r=t+1+l*(g+1),i=t+1+l*g;p.push(e,n,i),p.push(n,r,i)}this.setIndex(p),this.setAttribute("position",new Ci(d,3)),this.setAttribute("normal",new Ci(m,3)),this.setAttribute("uv",new Ci(f,2))}}exports.PlaneGeometry=exports.PlaneBufferGeometry=Rs;var Cs="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Ps="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Ds="#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",Is="#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",Bs="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Ns="vec3 transformed = vec3( position );",Fs="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Os="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",zs="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",Gs="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",Hs="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Us="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",ks="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Vs="#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",Ws="#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",js="#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",qs="#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",Xs="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",Ys="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",Zs="vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",Js="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",Qs="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",Ks="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",$s="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",to="gl_FragColor = linearToOutputTexel( gl_FragColor );",eo="\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",no="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",ro="#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",io="#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",so="#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",oo="#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",ao="#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",lo="#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",co="#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",ho="#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",uo="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",po="#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",mo="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",fo="vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",go="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",xo="#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",vo="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",yo="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",_o="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",bo="varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",wo="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\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 = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",Mo="struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\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}",So="\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",To="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",Eo="#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",Ao="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Lo="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Ro="#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",Co="#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",Po="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",Do="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Io="#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",Bo="#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",No="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Fo="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Oo="#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",zo="#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",Go="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",Ho="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",Uo="#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",ko="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",Vo="#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",Wo="#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",jo="#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",qo="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",Xo="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Yo="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",Zo="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Jo="#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",Qo="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",Ko="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",$o="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",ta="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",ea="#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",na="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",ra="#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",ia="#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",sa="#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",oa="#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",aa="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",la="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",ca="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",ha="#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",ua="#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",pa="#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",da="#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",ma="#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",fa="#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",ga="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",xa="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",va="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",ya="#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",_a="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}",ba="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}",wa="#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Ma="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}",Sa="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",Ta="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",Ea="#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}",Aa="#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}",La="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Ra="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",Ca="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Pa="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Da="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ia="#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}",Ba="uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Na="#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}",Fa="#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 <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Oa="#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 <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#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}",za="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ga="#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ha="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Ua="#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}",ka="#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\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 <transmissionmap_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_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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\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 <transmissionmap_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 TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\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}",Va="#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}",Wa="#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}",ja="#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}",qa="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Xa="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}",Ya="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",Za="#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ja="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}",Qa="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}";const Ka={alphamap_fragment:Cs,alphamap_pars_fragment:Ps,alphatest_fragment:Ds,aomap_fragment:Is,aomap_pars_fragment:Bs,begin_vertex:Ns,beginnormal_vertex:Fs,bsdfs:Os,bumpmap_pars_fragment:zs,clipping_planes_fragment:Gs,clipping_planes_pars_fragment:Hs,clipping_planes_pars_vertex:Us,clipping_planes_vertex:ks,color_fragment:Vs,color_pars_fragment:Ws,color_pars_vertex:js,color_vertex:qs,common:Xs,cube_uv_reflection_fragment:Ys,defaultnormal_vertex:Zs,displacementmap_pars_vertex:Js,displacementmap_vertex:Qs,emissivemap_fragment:Ks,emissivemap_pars_fragment:$s,encodings_fragment:to,encodings_pars_fragment:eo,envmap_fragment:no,envmap_common_pars_fragment:ro,envmap_pars_fragment:io,envmap_pars_vertex:so,envmap_physical_pars_fragment:xo,envmap_vertex:oo,fog_vertex:ao,fog_pars_vertex:lo,fog_fragment:co,fog_pars_fragment:ho,gradientmap_pars_fragment:uo,lightmap_fragment:po,lightmap_pars_fragment:mo,lights_lambert_vertex:fo,lights_pars_begin:go,lights_toon_fragment:vo,lights_toon_pars_fragment:yo,lights_phong_fragment:_o,lights_phong_pars_fragment:bo,lights_physical_fragment:wo,lights_physical_pars_fragment:Mo,lights_fragment_begin:So,lights_fragment_maps:To,lights_fragment_end:Eo,logdepthbuf_fragment:Ao,logdepthbuf_pars_fragment:Lo,logdepthbuf_pars_vertex:Ro,logdepthbuf_vertex:Co,map_fragment:Po,map_pars_fragment:Do,map_particle_fragment:Io,map_particle_pars_fragment:Bo,metalnessmap_fragment:No,metalnessmap_pars_fragment:Fo,morphnormal_vertex:Oo,morphtarget_pars_vertex:zo,morphtarget_vertex:Go,normal_fragment_begin:Ho,normal_fragment_maps:Uo,normalmap_pars_fragment:ko,clearcoat_normal_fragment_begin:Vo,clearcoat_normal_fragment_maps:Wo,clearcoat_pars_fragment:jo,packing:qo,premultiplied_alpha_fragment:Xo,project_vertex:Yo,dithering_fragment:Zo,dithering_pars_fragment:Jo,roughnessmap_fragment:Qo,roughnessmap_pars_fragment:Ko,shadowmap_pars_fragment:$o,shadowmap_pars_vertex:ta,shadowmap_vertex:ea,shadowmask_pars_fragment:na,skinbase_vertex:ra,skinning_pars_vertex:ia,skinning_vertex:sa,skinnormal_vertex:oa,specularmap_fragment:aa,specularmap_pars_fragment:la,tonemapping_fragment:ca,tonemapping_pars_fragment:ha,transmissionmap_fragment:ua,transmissionmap_pars_fragment:pa,uv_pars_fragment:da,uv_pars_vertex:ma,uv_vertex:fa,uv2_pars_fragment:ga,uv2_pars_vertex:xa,uv2_vertex:va,worldpos_vertex:ya,background_frag:_a,background_vert:ba,cube_frag:wa,cube_vert:Ma,depth_frag:Sa,depth_vert:Ta,distanceRGBA_frag:Ea,distanceRGBA_vert:Aa,equirect_frag:La,equirect_vert:Ra,linedashed_frag:Ca,linedashed_vert:Pa,meshbasic_frag:Da,meshbasic_vert:Ia,meshlambert_frag:Ba,meshlambert_vert:Na,meshmatcap_frag:Fa,meshmatcap_vert:Oa,meshtoon_frag:za,meshtoon_vert:Ga,meshphong_frag:Ha,meshphong_vert:Ua,meshphysical_frag:ka,meshphysical_vert:Va,normal_frag:Wa,normal_vert:ja,points_frag:qa,points_vert:Xa,shadow_frag:Ya,shadow_vert:Za,sprite_frag:Ja,sprite_vert:Qa};exports.ShaderChunk=Ka;const $a={common:{diffuse:{value:new xi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new zn},uv2Transform:{value:new zn},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 On(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new zn}},sprite:{diffuse:{value:new xi(15658734)},opacity:{value:1},center:{value:new On(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new zn}}};exports.UniformsLib=$a;const tl={basic:{uniforms:us([$a.common,$a.specularmap,$a.envmap,$a.aomap,$a.lightmap,$a.fog]),vertexShader:Ka.meshbasic_vert,fragmentShader:Ka.meshbasic_frag},lambert:{uniforms:us([$a.common,$a.specularmap,$a.envmap,$a.aomap,$a.lightmap,$a.emissivemap,$a.fog,$a.lights,{emissive:{value:new xi(0)}}]),vertexShader:Ka.meshlambert_vert,fragmentShader:Ka.meshlambert_frag},phong:{uniforms:us([$a.common,$a.specularmap,$a.envmap,$a.aomap,$a.lightmap,$a.emissivemap,$a.bumpmap,$a.normalmap,$a.displacementmap,$a.fog,$a.lights,{emissive:{value:new xi(0)},specular:{value:new xi(1118481)},shininess:{value:30}}]),vertexShader:Ka.meshphong_vert,fragmentShader:Ka.meshphong_frag},standard:{uniforms:us([$a.common,$a.envmap,$a.aomap,$a.lightmap,$a.emissivemap,$a.bumpmap,$a.normalmap,$a.displacementmap,$a.roughnessmap,$a.metalnessmap,$a.fog,$a.lights,{emissive:{value:new xi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ka.meshphysical_vert,fragmentShader:Ka.meshphysical_frag},toon:{uniforms:us([$a.common,$a.aomap,$a.lightmap,$a.emissivemap,$a.bumpmap,$a.normalmap,$a.displacementmap,$a.gradientmap,$a.fog,$a.lights,{emissive:{value:new xi(0)}}]),vertexShader:Ka.meshtoon_vert,fragmentShader:Ka.meshtoon_frag},matcap:{uniforms:us([$a.common,$a.bumpmap,$a.normalmap,$a.displacementmap,$a.fog,{matcap:{value:null}}]),vertexShader:Ka.meshmatcap_vert,fragmentShader:Ka.meshmatcap_frag},points:{uniforms:us([$a.points,$a.fog]),vertexShader:Ka.points_vert,fragmentShader:Ka.points_frag},dashed:{uniforms:us([$a.common,$a.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ka.linedashed_vert,fragmentShader:Ka.linedashed_frag},depth:{uniforms:us([$a.common,$a.displacementmap]),vertexShader:Ka.depth_vert,fragmentShader:Ka.depth_frag},normal:{uniforms:us([$a.common,$a.bumpmap,$a.normalmap,$a.displacementmap,{opacity:{value:1}}]),vertexShader:Ka.normal_vert,fragmentShader:Ka.normal_frag},sprite:{uniforms:us([$a.sprite,$a.fog]),vertexShader:Ka.sprite_vert,fragmentShader:Ka.sprite_frag},background:{uniforms:{uvTransform:{value:new zn},t2D:{value:null}},vertexShader:Ka.background_vert,fragmentShader:Ka.background_frag},cube:{uniforms:us([$a.envmap,{opacity:{value:1}}]),vertexShader:Ka.cube_vert,fragmentShader:Ka.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ka.equirect_vert,fragmentShader:Ka.equirect_frag},distanceRGBA:{uniforms:us([$a.common,$a.displacementmap,{referencePosition:{value:new Yn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ka.distanceRGBA_vert,fragmentShader:Ka.distanceRGBA_frag},shadow:{uniforms:us([$a.lights,$a.fog,{color:{value:new xi(0)},opacity:{value:1}}]),vertexShader:Ka.shadow_vert,fragmentShader:Ka.shadow_frag}};function el(t,e,n,r,i){const s=new xi(0);let o,a,l=0,c=null,h=0,d=null;function m(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),m(s,l=e)},getClearAlpha:function(){return l},setClearAlpha:function(t){m(s,l=t)},render:function(n,i,f,g){let x=!0===i.isScene?i.background:null;x&&x.isTexture&&(x=e.get(x));const v=t.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(x=null),null===x?m(s,l):x&&x.isColor&&(m(x,1),g=!0),(t.autoClear||g)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),x&&(x.isCubeTexture||x.isWebGLCubeRenderTarget||x.mapping===ot)?(void 0===a&&((a=new os(new cs(1,1,1),new fs({name:"BackgroundCubeMaterial",uniforms:hs(tl.cube.uniforms),vertexShader:tl.cube.vertexShader,fragmentShader:tl.cube.fragmentShader,side:p,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,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a)),x.isWebGLCubeRenderTarget&&(x=x.texture),a.material.uniforms.envMap.value=x,a.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x._needsFlipEnvMap?-1:1,c===x&&h===x.version&&d===t.toneMapping||(a.material.needsUpdate=!0,c=x,h=x.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):x&&x.isTexture&&(void 0===o&&((o=new os(new Rs(2,2),new fs({name:"BackgroundMaterial",uniforms:hs(tl.background.uniforms),vertexShader:tl.background.vertexShader,fragmentShader:tl.background.fragmentShader,side:u,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=x,!0===x.matrixAutoUpdate&&x.updateMatrix(),o.material.uniforms.uvTransform.value.copy(x.matrix),c===x&&h===x.version&&d===t.toneMapping||(o.material.needsUpdate=!0,c=x,h=x.version,d=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function nl(t,e,n,r){const i=t.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==s,a={},l=p(null);let c=l;function h(e){return r.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return r.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],r=[];for(let s=0;s<i;s++)e[s]=0,n[s]=0,r[s]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function d(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function m(t){f(t,0)}function f(n,i){const s=c.newAttributes,o=c.enabledAttributes,a=c.attributeDivisors;if(s[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),a[n]!==i){(r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),a[n]=i}}function g(){const e=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function x(e,n,i,s,o,a){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,s,o,a):t.vertexAttribIPointer(e,n,i,o,a)}function v(){y(),c!==l&&h((c=l).object)}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,u,v,y){let _=!1;if(o){const e=function(e,n,i){const o=!0===i.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let h=c[o];return void 0===h&&(h=p(r.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),c[o]=h),h}(v,u,l);c!==e&&h((c=e).object),(_=function(t,e){const n=c.attributes,r=t.attributes;let i=0;for(const s in r){const t=n[s],e=r[s];if(void 0===t)return!0;if(t.attribute!==e)return!0;if(t.data!==e.data)return!0;i++}return c.attributesNum!==i||c.index!==e}(v,y))&&function(t,e){const n={},r=t.attributes;let i=0;for(const s in r){const t=r[s],e={};e.attribute=t,t.data&&(e.data=t.data),n[s]=e,i++}c.attributes=n,c.attributesNum=i,c.index=e}(v,y)}else{const t=!0===l.wireframe;c.geometry===v.id&&c.program===u.id&&c.wireframe===t||(c.geometry=v.id,c.program=u.id,c.wireframe=t,_=!0)}!0===i.isInstancedMesh&&(_=!0),null!==y&&n.update(y,34963),_&&(function(i,s,o,a){if(!1===r.isWebGL2&&(i.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;d();const l=a.attributes,c=o.getAttributes(),h=s.defaultAttributeValues;for(const e in c){const r=c[e];if(r>=0){const s=l[e];if(void 0!==s){const e=s.normalized,i=s.itemSize,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(r,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(f(r,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):m(r),t.bindBuffer(34962,l),x(r,i,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(i.instanceMatrix);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r+0,1),f(r+1,1),f(r+2,1),f(r+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r+0,4,o,!1,64,0),t.vertexAttribPointer(r+1,4,o,!1,64,16),t.vertexAttribPointer(r+2,4,o,!1,64,32),t.vertexAttribPointer(r+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(i.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;f(r,1),t.bindBuffer(34962,s),t.vertexAttribPointer(r,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r,n);break;case 3:t.vertexAttrib3fv(r,n);break;case 4:t.vertexAttrib4fv(r,n);break;default:t.vertexAttrib1fv(r,n)}}}}g()}(i,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)u(t[e].object),delete t[e];delete e[n]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)u(r[t].object),delete r[t];delete n[t.id]}},initAttributes:d,enableAttribute:m,disableUnusedAttributes:g}}function rl(t,e,n,r){const i=r.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,r){t.drawArrays(s,e,r),n.update(r,s,1)},this.renderInstances=function(r,o,a){if(0===a)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(c="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[c](s,r,o,a),n.update(o,s,a)}}function il(t,e,n){let 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"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=i(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),d=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),x=h>0,v=s||e.has("OES_texture_float");return{isWebGL2:s,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:v,floatVertexTextures:x&&v,maxSamples:s?t.getParameter(36183):0}}function sl(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Qr,a=new zn,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==i||null===c){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length<e)&&(c=new Float32Array(e));for(let n=0,l=r;n!==s;++n,l+=4)o.copy(t[n]).applyMatrix4(i,a),o.normal.toArray(c,l),c[l+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,s){const o=0!==t.length||e||0!==r||i;return i=e,n=h(t,s,0),r=t.length,o},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1,c()},this.setState=function(e,o,a){const u=e.clippingPlanes,p=e.clipIntersection,d=e.clipShadows,m=t.get(e);if(!i||null===u||0===u.length||s&&!d)s?h(null):c();else{const t=s?0:r,e=4*t;let i=m.clippingState||null;l.value=i,i=h(u,o,e,a);for(let r=0;r!==e;++r)i[r]=n[r];m.clippingState=i,this.numIntersection=p?this.numPlanes:0,this.numPlanes+=t}}}function ol(t){let e=new WeakMap;function n(t,e){return e===it?t.mapping=nt:e===st&&(t.mapping=rt),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const s=i.mapping;if(s===it||s===st){if(e.has(i))return n(e.get(i).texture,i.mapping);{const s=i.image;if(s&&s.height>0){const o=t.getRenderTarget(),a=new ws(s.height/2);return a.fromEquirectangularTexture(t,i),e.set(i,a),t.setRenderTarget(o),i.addEventListener("dispose",r),n(a.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}function al(t){const e={};function n(n){if(void 0!==e[n])return e[n];let 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 e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function ll(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],s=t[e+2];n.push(r,i,i,s,s,r)}}else{const t=i.array;o=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const a=new(Di(n)>65535?Li:Ei)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===i[e.id]?e:(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++,e)},update:function(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n<r;n++)e.update(t[n],34962)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return s.get(t)}}}function cl(t,e,n,r){const i=r.isWebGL2;let s,o,a;this.setMode=function(t){s=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,r){t.drawElements(s,r,o,e*a),n.update(r,s,1)},this.renderInstances=function(r,l,c){if(0===c)return;let h,u;if(i)h=t,u="drawElementsInstanced";else if(u="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[u](s,l,o,r*a,c),n.update(l,s,c)}}function hl(t){const 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(e.calls++,n){case 4:e.triangles+=r*(t/3);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 ul(t,e){return t[0]-e[0]}function pl(t,e){return Math.abs(e[1])-Math.abs(t[1])}function dl(t){const e={},n=new Float32Array(8),r=[];for(let i=0;i<8;i++)r[i]=[i,0];return{update:function(i,s,o,a){const l=i.morphTargetInfluences,c=void 0===l?0:l.length;let h=e[s.id];if(void 0===h){h=[];for(let t=0;t<c;t++)h[t]=[t,0];e[s.id]=h}for(let t=0;t<c;t++){const e=h[t];e[0]=t,e[1]=l[t]}h.sort(pl);for(let t=0;t<8;t++)t<c&&h[t][1]?(r[t][0]=h[t][0],r[t][1]=h[t][1]):(r[t][0]=Number.MAX_SAFE_INTEGER,r[t][1]=0);r.sort(ul);const u=o.morphTargets&&s.morphAttributes.position,p=o.morphNormals&&s.morphAttributes.normal;let d=0;for(let t=0;t<8;t++){const e=r[t],i=e[0],o=e[1];i!==Number.MAX_SAFE_INTEGER&&o?(u&&s.getAttribute("morphTarget"+t)!==u[i]&&s.setAttribute("morphTarget"+t,u[i]),p&&s.getAttribute("morphNormal"+t)!==p[i]&&s.setAttribute("morphNormal"+t,p[i]),n[t]=o,d+=o):(u&&!0===s.hasAttribute("morphTarget"+t)&&s.deleteAttribute("morphTarget"+t),p&&!0===s.hasAttribute("morphNormal"+t)&&s.deleteAttribute("morphNormal"+t),n[t]=0)}const m=s.morphTargetsRelative?1:1-d;a.getUniforms().setValue(t,"morphTargetBaseInfluence",m),a.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function ml(t,e,n,r){let i=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const o=r.render.frame,a=t.geometry,l=e.get(t,a);return i.get(l)!==o&&(e.update(l),i.set(l,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}exports.ShaderLib=tl,tl.physical={uniforms:us([tl.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new On(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new xi(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Ka.meshphysical_vert,fragmentShader:Ka.meshphysical_frag};class fl extends kn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=ut,this.minFilter=ut,this.wrapR=ct,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}exports.DataTexture2DArray=fl,fl.prototype.isDataTexture2DArray=!0;class gl extends kn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=ut,this.minFilter=ut,this.wrapR=ct,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}}exports.DataTexture3D=gl,gl.prototype.isDataTexture3D=!0;const xl=new kn,vl=new fl,yl=new gl,_l=new bs,bl=[],wl=[],Ml=new Float32Array(16),Sl=new Float32Array(9),Tl=new Float32Array(4);function El(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=bl[i];if(void 0===s&&(s=new Float32Array(i),bl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function Al(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Ll(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function Rl(t,e){let n=wl[e];void 0===n&&(n=new Int32Array(e),wl[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function Cl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Pl(t,e){const 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(Al(n,e))return;t.uniform2fv(this.addr,e),Ll(n,e)}}function Dl(t,e){const 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(Al(n,e))return;t.uniform3fv(this.addr,e),Ll(n,e)}}function Il(t,e){const 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(Al(n,e))return;t.uniform4fv(this.addr,e),Ll(n,e)}}function Bl(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Al(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ll(n,e)}else{if(Al(n,r))return;Tl.set(r),t.uniformMatrix2fv(this.addr,!1,Tl),Ll(n,r)}}function Nl(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Al(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ll(n,e)}else{if(Al(n,r))return;Sl.set(r),t.uniformMatrix3fv(this.addr,!1,Sl),Ll(n,r)}}function Fl(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(Al(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ll(n,e)}else{if(Al(n,r))return;Ml.set(r),t.uniformMatrix4fv(this.addr,!1,Ml),Ll(n,r)}}function Ol(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||xl,i)}function zl(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||vl,i)}function Gl(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||yl,i)}function Hl(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||_l,i)}function Ul(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function kl(t,e){const n=this.cache;Al(n,e)||(t.uniform2iv(this.addr,e),Ll(n,e))}function Vl(t,e){const n=this.cache;Al(n,e)||(t.uniform3iv(this.addr,e),Ll(n,e))}function Wl(t,e){const n=this.cache;Al(n,e)||(t.uniform4iv(this.addr,e),Ll(n,e))}function jl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ql(t){switch(t){case 5126:return Cl;case 35664:return Pl;case 35665:return Dl;case 35666:return Il;case 35674:return Bl;case 35675:return Nl;case 35676:return Fl;case 5124:case 35670:return Ul;case 35667:case 35671:return kl;case 35668:case 35672:return Vl;case 35669:case 35673:return Wl;case 5125:return jl;case 35678:case 36198:case 36298:case 36306:case 35682:return Ol;case 35679:case 36299:case 36307:return Gl;case 35680:case 36300:case 36308:case 36293:return Hl;case 36289:case 36303:case 36311:case 36292:return zl}}function Xl(t,e){t.uniform1fv(this.addr,e)}function Yl(t,e){t.uniform1iv(this.addr,e)}function Zl(t,e){t.uniform2iv(this.addr,e)}function Jl(t,e){t.uniform3iv(this.addr,e)}function Ql(t,e){t.uniform4iv(this.addr,e)}function Kl(t,e){const n=El(e,this.size,2);t.uniform2fv(this.addr,n)}function $l(t,e){const n=El(e,this.size,3);t.uniform3fv(this.addr,n)}function tc(t,e){const n=El(e,this.size,4);t.uniform4fv(this.addr,n)}function ec(t,e){const n=El(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function nc(t,e){const n=El(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function rc(t,e){const n=El(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function ic(t,e,n){const r=e.length,i=Rl(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.safeSetTexture2D(e[s]||xl,i[s])}function sc(t,e,n){const r=e.length,i=Rl(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.safeSetTextureCube(e[s]||_l,i[s])}function oc(t){switch(t){case 5126:return Xl;case 35664:return Kl;case 35665:return $l;case 35666:return tc;case 35674:return ec;case 35675:return nc;case 35676:return rc;case 5124:case 35670:return Yl;case 35667:case 35671:return Zl;case 35668:case 35672:return Jl;case 35669:case 35673:return Ql;case 35678:case 36198:case 36298:case 36306:case 35682:return ic;case 35680:case 36300:case 36308:case 36293:return sc}}function ac(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=ql(e.type)}function lc(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=oc(e.type)}function cc(t){this.id=t,this.seq=[],this.map={}}lc.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ll(e,t)},cc.prototype.setValue=function(t,e,n){const r=this.seq;for(let i=0,s=r.length;i!==s;++i){const s=r[i];s.setValue(t,e[s.id],n)}};const hc=/(\w+)(\])?(\[|\.)?/g;function uc(t,e){t.seq.push(e),t.map[e.id]=e}function pc(t,e,n){const r=t.name,i=r.length;for(hc.lastIndex=0;;){const s=hc.exec(r),o=hc.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===i){uc(n,void 0===c?new ac(a,t,e):new lc(a,t,e));break}{let t=n.map[a];void 0===t&&uc(n,t=new cc(a)),n=t}}}function dc(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);pc(n,t.getUniformLocation(e,n.name),this)}}function mc(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}dc.prototype.setValue=function(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)},dc.prototype.setOptional=function(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)},dc.upload=function(t,e,n,r){for(let i=0,s=e.length;i!==s;++i){const s=e[i],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,r)}},dc.seqWithValue=function(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n};let fc=0;function gc(t){const e=t.split("\n");for(let n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function xc(t){switch(t){case Xe:return["Linear","( value )"];case Ye:return["sRGB","( value )"];case Je:return["RGBE","( value )"];case Ke:return["RGBM","( value, 7.0 )"];case $e:return["RGBM","( value, 16.0 )"];case tn:return["RGBD","( value, 256.0 )"];case Ze:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Qe:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function vc(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+gc(t.getShaderSource(e))}function yc(t,e){const n=xc(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function _c(t,e){const n=xc(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function bc(t,e){let n;switch(e){case J:n="Linear";break;case Q:n="Reinhard";break;case K:n="OptimizedCineon";break;case $:n="ACESFilmic";break;case tt:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function wc(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Tc).join("\n")}function Mc(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}function Sc(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i).name;n[r]=t.getAttribLocation(e,r)}return n}function Tc(t){return""!==t}function Ec(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 Ac(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Lc=/^[ \t]*#include +<([\w\d./]+)>/gm;function Rc(t){return t.replace(Lc,Cc)}function Cc(t,e){const n=Ka[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Rc(n)}const Pc=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Dc=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ic(t){return t.replace(Dc,Nc).replace(Pc,Bc)}function Bc(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Nc(t,e,n,r)}function Nc(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Fc(t){let 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 Oc(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===l?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===c?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===h&&(e="SHADOWMAP_TYPE_VSM"),e}function zc(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case nt:case rt:e="ENVMAP_TYPE_CUBE";break;case ot:case at:e="ENVMAP_TYPE_CUBE_UV"}return e}function Gc(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case rt:case at:e="ENVMAP_MODE_REFRACTION"}return e}function Hc(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case q:e="ENVMAP_BLENDING_MULTIPLY";break;case X:e="ENVMAP_BLENDING_MIX";break;case Y:e="ENVMAP_BLENDING_ADD"}return e}function Uc(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=Oc(n),c=zc(n),h=Gc(n),u=Hc(n),p=t.gammaFactor>0?t.gammaFactor:1,d=n.isWebGL2?"":wc(n),m=Mc(s),f=i.createProgram();let g,x,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((g=[m].filter(Tc).join("\n")).length>0&&(g+="\n"),(x=[d,m].filter(Tc).join("\n")).length>0&&(x+="\n")):(g=[Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+p,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#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(Tc).join("\n"),x=[d,Fc(n),"#define SHADER_NAME "+n.shaderName,m,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Z?"#define TONE_MAPPING":"",n.toneMapping!==Z?Ka.tonemapping_pars_fragment:"",n.toneMapping!==Z?bc("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Ka.encodings_pars_fragment,n.map?yc("mapTexelToLinear",n.mapEncoding):"",n.matcap?yc("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?yc("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?yc("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?yc("lightMapTexelToLinear",n.lightMapEncoding):"",_c("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Tc).join("\n")),o=Ac(o=Ec(o=Rc(o),n),n),a=Ac(a=Ec(a=Rc(a),n),n),o=Ic(o),a=Ic(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,x=["#define varying in",n.glslVersion===Dn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Dn?"":"#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"+x);const y=v+x+a,_=mc(i,35633,v+g+o),b=mc(i,35632,y);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(f).trim(),e=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const e=vc(i,_,"vertex"),n=vc(i,b,"fragment");console.error("THREE.WebGLProgram: shader error: ",i.getError(),"35715",i.getProgramParameter(f,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:x}})}let w,M;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new dc(i,f)),w},this.getAttributes=function(){return void 0===M&&(M=Sc(i,f)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=fc++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}function kc(t,e,n,r,i,s){const o=[],a=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,h=r.maxVertexUniforms,u=r.vertexTextures;let m=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","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","transmissionMap"];function x(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Xe,e}return{getParameters:function(i,o,g,v,y){const _=v.fog,b=i.isMeshStandardMaterial?v.environment:null,w=e.get(i.envMap||b),M=f[i.type],S=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+r+"."),0):r}}(y):0;let T,E;if(null!==i.precision&&(m=r.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",m,"instead."),M){const t=tl[M];T=t.vertexShader,E=t.fragmentShader}else T=i.vertexShader,E=i.fragmentShader;const A=t.getRenderTarget();return{isWebGL2:a,shaderID:M,shaderName:i.type,vertexShader:T,fragmentShader:E,defines:i.defines,isRawShaderMaterial:!0===i.isRawShaderMaterial,glslVersion:i.glslVersion,precision:m,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:u,outputEncoding:null!==A?x(A.texture):t.outputEncoding,map:!!i.map,mapEncoding:x(i.map),matcap:!!i.matcap,matcapEncoding:x(i.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:x(w),envMapCubeUV:!!w&&(w.mapping===ot||w.mapping===at),lightMap:!!i.lightMap,lightMapEncoding:x(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:x(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:i.normalMapType===sn,tangentSpaceNormalMap:i.normalMapType===rn,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,transmissionMap:!!i.transmissionMap,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap||i.transmissionMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||i.transmissionMap||!i.displacementMap),fog:!!_,useFog:i.fog,fogExp2:_&&_.isFogExp2,flatShading:!!i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:l,skinning:i.skinning&&S>0,maxBones:S,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:Z,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===d,flipSided:i.side===p,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<g.length;t++)n.push(e[g[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=tl[e];n=ps.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,i=o.length;t<i;t++){const e=o[t];if(e.cacheKey===n){++(r=e).usedTimes;break}}return void 0===r&&(r=new Uc(t,n,e,i),o.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function Vc(){let t=new WeakMap;return{get:function(e){let 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 Wc(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 jc(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 qc(t){const e=[];let n=0;const r=[],i=[],s={id:-1};function o(r,i,o,a,l,c){let h=e[n];const u=t.get(o);return void 0===h?(h={id:r.id,object:r,geometry:i,material:o,program:u.program||s,groupOrder:a,renderOrder:r.renderOrder,z:l,group:c},e[n]=h):(h.id=r.id,h.object=r,h.geometry=i,h.material=o,h.program=u.program||s,h.groupOrder=a,h.renderOrder=r.renderOrder,h.z=l,h.group=c),n++,h}return{opaque:r,transparent:i,init:function(){n=0,r.length=0,i.length=0},push:function(t,e,n,s,a,l){const c=o(t,e,n,s,a,l);(!0===n.transparent?i:r).push(c)},unshift:function(t,e,n,s,a,l){const c=o(t,e,n,s,a,l);(!0===n.transparent?i:r).unshift(c)},finish:function(){for(let t=n,r=e.length;t<r;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){r.length>1&&r.sort(t||Wc),i.length>1&&i.sort(e||jc)}}}function Xc(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new qc(t),e.set(n,[i])):r>=e.get(n).length?(i=new qc(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Yn,color:new xi};break;case"SpotLight":n={position:new Yn,direction:new Yn,color:new xi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yn,color:new xi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yn,skyColor:new xi,groundColor:new xi};break;case"RectAreaLight":n={color:new xi,position:new Yn,halfWidth:new Yn,halfHeight:new Yn}}return t[e.id]=n,n}}}function Zc(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new On,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}let Jc=0;function Qc(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Kc(t,e){const n=new Yc,r=Zc(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let l=0;l<9;l++)i.probe.push(new Yn);const s=new Yn,o=new wr,a=new wr;return{setup:function(s){let o=0,a=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let c=0,h=0,u=0,p=0,d=0,m=0,f=0,g=0;s.sort(Qc);for(let t=0,e=s.length;t<e;t++){const e=s[t],x=e.color,v=e.intensity,y=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=x.r*v,a+=x.g*v,l+=x.b*v;else if(e.isLightProbe)for(let t=0;t<9;t++)i.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[c]=n,i.directionalShadowMap[c]=_,i.directionalShadowMatrix[c]=e.shadow.matrix,m++}i.directional[c]=t,c++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(x).multiplyScalar(v),t.distance=y,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[u]=n,i.spotShadowMap[u]=_,i.spotShadowMatrix[u]=e.shadow.matrix,g++}i.spot[u]=t,u++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(x).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,i.pointShadow[h]=n,i.pointShadowMap[h]=_,i.pointShadowMatrix[h]=e.shadow.matrix,f++}i.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(v),t.groundColor.copy(e.groundColor).multiplyScalar(v),i.hemi[d]=t,d++}}p>0&&(e.isWebGL2?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$a.LTC_FLOAT_1,i.rectAreaLTC2=$a.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=$a.LTC_HALF_1,i.rectAreaLTC2=$a.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=o,i.ambient[1]=a,i.ambient[2]=l;const x=i.hash;x.directionalLength===c&&x.pointLength===h&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===d&&x.numDirectionalShadows===m&&x.numPointShadows===f&&x.numSpotShadows===g||(i.directional.length=c,i.spot.length=u,i.rectArea.length=p,i.point.length=h,i.hemi.length=d,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=f,i.spotShadowMatrix.length=g,x.directionalLength=c,x.pointLength=h,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=d,x.numDirectionalShadows=m,x.numPointShadows=f,x.numSpotShadows=g,i.version=Jc++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let p=0,d=t.length;p<d;p++){const e=t[p];if(e.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(u),n++}else if(e.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(u),l++}else if(e.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),a.identity(),o.copy(e.matrixWorld),o.premultiply(u),a.extractRotation(o),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(e.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(u),r++}else if(e.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(e.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),h++}}},state:i}}function $c(t,e){const n=new Kc(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(){n.setup(r)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function th(t,e){let n=new WeakMap;return{get:function(r,i=0){let s;return!1===n.has(r)?(s=new $c(t,e),n.set(r,[s])):i>=n.get(r).length?(s=new $c(t,e),n.get(r).push(s)):s=n.get(r)[i],s},dispose:function(){n=new WeakMap}}}class eh extends hi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=en,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)}copy(t){return super.copy(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}}exports.MeshDepthMaterial=eh,eh.prototype.isMeshDepthMaterial=!0;class nh extends hi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Yn,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)}copy(t){return super.copy(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}}exports.MeshDistanceMaterial=nh,nh.prototype.isMeshDistanceMaterial=!0;var rh="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",ih="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function sh(t,e,n){let r=new Es;const i=new On,s=new On,o=new Wn,a=[],c=[],m={},f={0:p,1:u,2:d},x=new fs({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new On},radius:{value:4}},vertexShader:ih,fragmentShader:rh}),v=x.clone();v.defines.HORIZONTAL_PASS=1;const y=new ki;y.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new os(y,x),b=this;function w(n,r){const i=e.update(_);x.uniforms.shadow_pass.value=n.map.texture,x.uniforms.resolution.value=n.mapSize,x.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,x,_,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,v,_,null)}function M(t,e,n){const r=t<<0|e<<1|n<<2;let i=a[r];return void 0===i&&(i=new eh({depthPacking:nn,morphTargets:t,skinning:e}),a[r]=i),i}function S(t,e,n){const r=t<<0|e<<1|n<<2;let i=c[r];return void 0===i&&(i=new nh({morphTargets:t,skinning:e}),c[r]=i),i}function T(e,n,r,i,s,o,a){let l=null,c=M,u=e.customDepthMaterial;if(!0===i.isPointLight&&(c=S,u=e.customDistanceMaterial),void 0===u){let t=!1;!0===r.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let i=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?i=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(t,i,!0===e.isInstancedMesh)}else l=u;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){const t=l.uuid,e=r.uuid;let n=m[t];void 0===n&&(n={},m[t]=n);let i=n[e];void 0===i&&(i=l.clone(),n[e]=i),l=i}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=a===h?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:f[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=s,l.farDistance=o),l}function E(n,i,s,o,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===h)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=i[c.materialIndex];if(h&&h.visible){const e=T(n,r,h,o,s.near,s.far,a);t.renderBufferDirect(s,null,r,e,n,c)}}}else if(i.visible){const e=T(n,r,i,o,s.near,s.far,a);t.renderBufferDirect(s,null,r,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)E(l[t],i,s,o,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=l,this.render=function(e,a,l){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===e.length)return;const c=t.getRenderTarget(),u=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.state;d.setBlending(g),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let m=0,f=e.length;m<f;m++){const c=e[m],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;i.copy(u.mapSize);const p=u.getFrameExtents();if(i.multiply(p),s.copy(u.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(s.x=Math.floor(n/p.x),i.x=s.x*p.x,u.mapSize.x=s.x),i.y>n&&(s.y=Math.floor(n/p.y),i.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&this.type===h){const t={minFilter:gt,magFilter:gt,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new jn(i.x,i.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:ut,magFilter:ut,format:Nt};u.map=new jn(i.x,i.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(o),u.updateMatrices(c,t),r=u.getFrustum(),E(a,l,u.camera,c,this.type)}u.isPointLightShadow||this.type!==h||w(u,l),u.needsUpdate=!1}b.needsUpdate=!1,t.setRenderTarget(c,u,p)}}function oh(t,e,n){const o=n.isWebGL2;const a=new function(){let e=!1;const n=new Wn;let r=null;const i=new Wn(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,s,o,a){!0===a&&(e*=o,r*=o,s*=o),n.set(e,r,s,o),!1===i.equals(n)&&(t.clearColor(e,r,s,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},l=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?mt(2929):ft(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case z:t.depthFunc(512);break;case G:t.depthFunc(519);break;case H:t.depthFunc(513);break;case U:t.depthFunc(515);break;case k:t.depthFunc(514);break;case V:t.depthFunc(518);break;case W:t.depthFunc(516);break;case j: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}}},c=new function(){let e=!1,n=null,r=null,i=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(t){e||(t?mt(2960):ft(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&s===o||(t.stencilFunc(e,n,o),r=e,i=n,s=o)},setOp:function(e,n,r){o===e&&a===n&&l===r||(t.stencilOp(e,n,r),o=e,a=n,l=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,s=null,o=null,a=null,l=null,c=null}}};let h={},u=null,m=!1,f=null,q=null,X=null,Y=null,Z=null,J=null,Q=null,K=!1,$=null,tt=null,et=null,nt=null,rt=null;const it=t.getParameter(35661);let st=!1,ot=0;const at=t.getParameter(7938);-1!==at.indexOf("WebGL")?(ot=parseFloat(/^WebGL (\d)/.exec(at)[1]),st=ot>=1):-1!==at.indexOf("OpenGL ES")&&(ot=parseFloat(/^OpenGL ES (\d)/.exec(at)[1]),st=ot>=2);let lt=null,ct={};const ht=new Wn,ut=new Wn;function pt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return s}const dt={};function mt(e){!0!==h[e]&&(t.enable(e),h[e]=!0)}function ft(e){!1!==h[e]&&(t.disable(e),h[e]=!1)}dt[3553]=pt(3553,3553,1),dt[34067]=pt(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),mt(2929),l.setFunc(U),yt(!1),_t(i),mt(2884),vt(g);const gt={[w]:32774,[M]:32778,[S]:32779};if(o)gt[T]=32775,gt[E]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(gt[T]=t.MIN_EXT,gt[E]=t.MAX_EXT)}const xt={[A]:0,[L]:1,[R]:768,[P]:770,[O]:776,[N]:774,[I]:772,[C]:769,[D]:771,[F]:775,[B]:773};function vt(e,n,r,i,s,o,a,l){if(e!==g){if(!1===m&&(mt(3042),m=!0),e===b)s=s||n,o=o||r,a=a||i,n===q&&s===Z||(t.blendEquationSeparate(gt[n],gt[s]),q=n,Z=s),r===X&&i===Y&&o===J&&a===Q||(t.blendFuncSeparate(xt[r],xt[i],xt[o],xt[a]),X=r,Y=i,J=o,Q=a),f=e,K=null;else if(e!==f||l!==K){if(q===w&&Z===w||(t.blendEquation(32774),q=w,Z=w),l)switch(e){case x:t.blendFuncSeparate(1,771,1,771);break;case v:t.blendFunc(1,1);break;case y:t.blendFuncSeparate(0,0,769,771);break;case _:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case x:t.blendFuncSeparate(770,771,1,771);break;case v:t.blendFunc(770,1);break;case y:t.blendFunc(0,769);break;case _:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}X=null,Y=null,J=null,Q=null,f=e,K=l}}else!0===m&&(ft(3042),m=!1)}function yt(e){$!==e&&(e?t.frontFace(2304):t.frontFace(2305),$=e)}function _t(e){e!==r?(mt(2884),e!==tt&&(e===i?t.cullFace(1029):e===s?t.cullFace(1028):t.cullFace(1032))):ft(2884),tt=e}function bt(e,n,r){e?(mt(32823),nt===n&&rt===r||(t.polygonOffset(n,r),nt=n,rt=r)):ft(32823)}function wt(e){void 0===e&&(e=33984+it-1),lt!==e&&(t.activeTexture(e),lt=e)}return{buffers:{color:a,depth:l,stencil:c},enable:mt,disable:ft,useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:vt,setMaterial:function(t,e){t.side===d?ft(2884):mt(2884);let n=t.side===p;e&&(n=!n),yt(n),t.blending===x&&!1===t.transparent?vt(g):vt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),l.setFunc(t.depthFunc),l.setTest(t.depthTest),l.setMask(t.depthWrite),a.setMask(t.colorWrite);const r=t.stencilWrite;c.setTest(r),r&&(c.setMask(t.stencilWriteMask),c.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),c.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),bt(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)},setFlipSided:yt,setCullFace:_t,setLineWidth:function(e){e!==et&&(st&&t.lineWidth(e),et=e)},setPolygonOffset:bt,setScissorTest:function(t){t?mt(3089):ft(3089)},activeTexture:wt,bindTexture:function(e,n){null===lt&&wt();let r=ct[lt];void 0===r&&(r={type:void 0,texture:void 0},ct[lt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||dt[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=ct[lt];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(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(e){!1===ht.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ht.copy(e))},viewport:function(e){!1===ut.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),ut.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},lt=null,ct={},u=null,m=!1,f=null,q=null,X=null,Y=null,Z=null,J=null,Q=null,K=!1,$=null,tt=null,et=null,nt=null,rt=null,a.reset(),l.reset(),c.reset()}}}function ah(t,e,n,r,i,s,o){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,h=i.maxTextureSize,u=i.maxSamples,p=new WeakMap;let d,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(z){}function f(t,e){return m?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(t,e,n,r){let 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){const r=e?Fn.floorPowerOfTwo:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===d&&(d=f(s,o));const a=n?f(s,o):d;return a.width=s,a.height=o,a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Fn.isPowerOfTwo(t.width)&&Fn.isPowerOfTwo(t.height)}function v(t,e){return t.generateMipmaps&&e&&t.minFilter!==ut&&t.minFilter!==gt}function y(e,n,i,s){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,s))}function _(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function b(t){return t===ut||t===pt||t===mt?9728:9729}function w(e){const n=e.target;n.removeEventListener("dispose",w),function(e){const 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){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),s=r.get(n);if(!e)return;void 0!==s.__webglTexture&&t.deleteTexture(s.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let r=0;r<6;r++)t.deleteFramebuffer(i.__webglFramebuffer[r]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[r]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(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 E(e,i){const o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;C(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=o||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const u=h[0],p=x(u)||a,d=s.convert(r.format),m=s.convert(r.type),f=_(r.internalFormat,d,m);let b;if(R(34067,r,p),o){for(let t=0;t<6;t++){b=h[t].mipmaps;for(let e=0;e<b.length;e++){const i=b[e];r.format!==Nt&&r.format!==Bt?null!==d?n.compressedTexImage2D(34069+t,e,f,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,f,i.width,i.height,0,d,m,i.data)}}e.__maxMipLevel=b.length-1}else{b=r.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,f,h[t].width,h[t].height,0,d,m,h[t].data);for(let e=0;e<b.length;e++){const r=b[e],i=r.image[t].image;n.texImage2D(34069+t,e+1,f,i.width,i.height,0,d,m,i.data)}}else{n.texImage2D(34069+t,0,f,d,m,h[t]);for(let e=0;e<b.length;e++){const r=b[e];n.texImage2D(34069+t,e+1,f,d,m,r.image[t])}}e.__maxMipLevel=b.length}v(r,p)&&y(34067,r,u.width,u.height);e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(o,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))}const A={[lt]:10497,[ct]:33071,[ht]:33648},L={[ut]:9728,[pt]:9984,[mt]:9986,[gt]:9729,[xt]:9985,[yt]:9987};function R(n,s,o){if(o?(t.texParameteri(n,10242,A[s.wrapS]),t.texParameteri(n,10243,A[s.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,A[s.wrapR]),t.texParameteri(n,10240,L[s.magFilter]),t.texParameteri(n,10241,L[s.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),s.wrapS===ct&&s.wrapT===ct||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,b(s.magFilter)),t.texParameteri(n,10241,b(s.minFilter)),s.minFilter!==ut&&s.minFilter!==gt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(s.type===At&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Lt&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function C(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w),e.__webglTexture=t.createTexture(),o.memory.textures++)}function P(e,r,i){let 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),t.pixelStorei(37443,0);const l=function(t){return!a&&(t.wrapS!==ct||t.wrapT!==ct||t.minFilter!==ut&&t.minFilter!==gt)}(r)&&!1===x(r.image),c=g(r.image,l,!1,h),u=x(c)||a,p=s.convert(r.format);let d,m=s.convert(r.type),f=_(r.internalFormat,p,m);R(o,r,u);const b=r.mipmaps;if(r.isDepthTexture)f=6402,a?f=r.type===At?36012:r.type===Et?33190:r.type===Dt?35056:33189:r.type===At&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Gt&&6402===f&&r.type!==St&&r.type!==Et&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=St,m=s.convert(r.type)),r.format===Ht&&6402===f&&(f=34041,r.type!==Dt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Dt,m=s.convert(r.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(b.length>0&&u){for(let t=0,e=b.length;t<e;t++)d=b[t],n.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);r.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,f,c.width,c.height,0,p,m,c.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(let t=0,e=b.length;t<e;t++)d=b[t],r.format!==Nt&&r.format!==Bt?null!==p?n.compressedTexImage2D(3553,t,f,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,f,d.width,d.height,0,p,m,d.data);e.__maxMipLevel=b.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,f,c.width,c.height,c.depth,0,p,m,c.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,f,c.width,c.height,c.depth,0,p,m,c.data),e.__maxMipLevel=0;else if(b.length>0&&u){for(let t=0,e=b.length;t<e;t++)d=b[t],n.texImage2D(3553,t,f,p,m,d);r.generateMipmaps=!1,e.__maxMipLevel=b.length-1}else n.texImage2D(3553,0,f,p,m,c),e.__maxMipLevel=0;v(r,u)&&y(o,r,c.width,c.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(e,i,o,a){const l=i.texture,c=s.convert(l.format),h=s.convert(l.type),u=_(l.internalFormat,c,h);32879===a||35866===a?n.texImage3D(a,0,u,i.width,i.height,i.depth,0,c,h,null):n.texImage2D(a,0,u,i.width,i.height,0,c,h,null),t.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,a,r.get(l).__webglTexture,0),t.bindFramebuffer(36160,null)}function I(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===At?i=36012:e.type===Et&&(i=33190));const r=N(n);t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const e=N(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=n.texture,i=s.convert(e.format),o=s.convert(e.type),a=_(e.internalFormat,i,o);if(r){const e=N(n);t.renderbufferStorageMultisample(36161,e,a,n.width,n.height)}else t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function B(e){const n=r.get(e),i=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,n){if(n&&n.isWebGLCubeRenderTarget)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),T(n.depthTexture,0);const i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Gt)t.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==Ht)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)t.bindFramebuffer(36160,n.__webglFramebuffer[r]),n.__webglDepthbuffer[r]=t.createRenderbuffer(),I(n.__webglDepthbuffer[r],e,!1)}else t.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),I(n.__webglDepthbuffer,e,!1);t.bindFramebuffer(36160,null)}function N(t){return a&&t.isWebGLMultisampleRenderTarget?Math.min(u,t.samples):0}let F=!1,O=!1;this.allocateTextureUnit=function(){const 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=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const i=e.texture,l=r.get(e),c=r.get(i);e.addEventListener("dispose",M),c.__webglTexture=t.createTexture(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,p=i.isDataTexture3D||i.isDataTexture2DArray,d=x(e)||a;if(!a||i.format!==Bt||i.type!==At&&i.type!==Lt||(i.format=Nt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(i.format),r=s.convert(i.type),o=_(i.internalFormat,n,r),a=N(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),I(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),R(34067,i,d);for(let t=0;t<6;t++)D(l.__webglFramebuffer[t],e,36064,34069+t);v(i,d)&&y(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;p&&(a?t=i.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),R(t,i,d),D(l.__webglFramebuffer,e,36064,t),v(i,d)&&y(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(v(e,x(t)||a)){const i=t.isWebGLCubeRenderTarget?34067:3553,s=r.get(e).__webglTexture;n.bindTexture(i,s),y(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(a){const n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const i=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),E(t,e)}}function lh(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===bt)return 5121;if(t===Rt)return 32819;if(t===Ct)return 32820;if(t===Pt)return 33635;if(t===wt)return 5120;if(t===Mt)return 5122;if(t===St)return 5123;if(t===Tt)return 5124;if(t===Et)return 5125;if(t===At)return 5126;if(t===Lt)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(t===It)return 6406;if(t===Bt)return 6407;if(t===Nt)return 6408;if(t===Ft)return 6409;if(t===Ot)return 6410;if(t===Gt)return 6402;if(t===Ht)return 34041;if(t===Ut)return 6403;if(t===kt)return 36244;if(t===Vt)return 33319;if(t===Wt)return 33320;if(t===jt)return 36248;if(t===qt)return 36249;if(t===Xt||t===Yt||t===Zt||t===Jt){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===Xt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Yt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Jt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===Kt||t===$t||t===te){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Kt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===$t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ee)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ne||t===re)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===ne)return n.COMPRESSED_RGB8_ETC2;if(t===re)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===ie||t===se||t===oe||t===ae||t===le||t===ce||t===he||t===ue||t===pe||t===de||t===me||t===fe||t===ge||t===xe||t===ye||t===_e||t===be||t===we||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===De?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:t===ve?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===Dt?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(t=[]){xs.call(this),this.cameras=t}ch.prototype=Object.assign(Object.create(xs.prototype),{constructor:ch,isArrayCamera:!0});class hh extends Xr{constructor(){super(),this.type="Group"}}function uh(){this._targetRay=null,this._grip=null,this._hand=null}function ph(t,e){const n=this;let r=null,i=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new xs;h.layers.enable(1),h.viewport=new Wn;const u=new xs;u.layers.enable(2),u.viewport=new Wn;const p=[h,u],d=new ch;d.layers.enable(1),d.layers.enable(2);let m=null,f=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function x(){c.forEach(function(t,e){t.disconnect(e)}),c.clear(),m=null,f=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(t){const e=r.inputSources;for(let n=0;n<l.length;n++)c.set(e[n],l[n]);for(let n=0;n<t.removed.length;n++){const e=t.removed[n],r=c.get(e);r&&(r.dispatchEvent({type:"disconnected",data:e}),c.delete(e))}for(let n=0;n<t.added.length;n++){const e=t.added[n],r=c.get(e);r&&r.dispatchEvent({type:"connected",data:e})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=l[t];return void 0===e&&(e=new uh,l[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=l[t];return void 0===e&&(e=new uh,l[t]=e),e.getGripSpace()},this.getHand=function(t){let e=l[t];return void 0===e&&(e=new uh,l[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getSession=function(){return r},this.setSession=async function(t){if(null!==(r=t)){r.addEventListener("select",g),r.addEventListener("selectstart",g),r.addEventListener("selectend",g),r.addEventListener("squeeze",g),r.addEventListener("squeezestart",g),r.addEventListener("squeezeend",g),r.addEventListener("end",x),r.addEventListener("inputsourceschange",v);const t=e.getContextAttributes();!0!==t.xrCompatible&&await e.makeXRCompatible();const a={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:i},l=new XRWebGLLayer(r,e,a);r.updateRenderState({baseLayer:l}),s=await r.requestReferenceSpace(o),M.setContext(r),M.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const y=new Yn,_=new Yn;function b(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.getCamera=function(t){d.near=u.near=h.near=t.near,d.far=u.far=h.far=t.far,m===d.near&&f===d.far||(r.updateRenderState({depthNear:d.near,depthFar:d.far}),m=d.near,f=d.far);const e=t.parent,n=d.cameras;b(d,e);for(let r=0;r<n.length;r++)b(n[r],e);t.matrixWorld.copy(d.matrixWorld),t.matrix.copy(d.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);const i=t.children;for(let r=0,s=i.length;r<s;r++)i[r].updateMatrixWorld(!0);return 2===n.length?function(t,e,n){y.setFromMatrixPosition(e.matrixWorld),_.setFromMatrixPosition(n.matrixWorld);const r=y.distanceTo(_),i=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=i[14]/(i[10]-1),a=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],h=(i[8]-1)/i[0],u=(s[8]+1)/s[0],p=o*h,d=o*u,m=r/(-h+u),f=m*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=o+m,x=a+m,v=p-f,b=d+(r-f),w=l*a/x*g,M=c*a/x*g;t.projectionMatrix.makePerspective(v,b,w,M,g,x)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};let w=null;const M=new As;M.setAnimationLoop(function(e,n){if(null!==(a=n.getViewerPose(s))){const e=a.views,n=r.renderState.baseLayer;t.setFramebuffer(n.framebuffer);let i=!1;e.length!==d.cameras.length&&(d.cameras.length=0,i=!0);for(let t=0;t<e.length;t++){const r=e[t],s=n.getViewport(r),o=p[t];o.matrix.fromArray(r.transform.matrix),o.projectionMatrix.fromArray(r.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===t&&d.matrix.copy(o.matrix),!0===i&&d.cameras.push(o)}}const i=r.inputSources;for(let t=0;t<l.length;t++){const e=l[t],r=i[t];e.update(r,n,s)}w&&w(e,n)}),this.setAnimationLoop=function(t){w=t},this.dispose=function(){}}function dh(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap);const r=t.get(n).envMap;if(r){e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&r._needsFlipEnvMap?-1:1,e.reflectivity.value=n.reflectivity,e.refractionRatio.value=n.refractionRatio;const i=t.get(r).__maxMipLevel;void 0!==i&&(e.maxMipLevel.value=i)}let i,s;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(i=n.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===p&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===p&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms: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)},refreshMaterialUniforms:function(t,r,i,s){r.isMeshBasicMaterial?e(t,r):r.isMeshLambertMaterial?(e(t,r),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,r)):r.isMeshToonMaterial?(e(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshPhongMaterial?(e(t,r),function(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===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshStandardMaterial?(e(t,r),r.isMeshPhysicalMaterial?function(t,e){n(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.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===p&&t.clearcoatNormalScale.value.negate()),t.transmission.value=e.transmission,e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap)}(t,r):n(t,r)):r.isMeshMatcapMaterial?(e(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDepthMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDistanceMaterial?(e(t,r),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}(t,r)):r.isMeshNormalMaterial?(e(t,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===p&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===p&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,s):r.isSpriteMaterial?function(t,e){let n;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),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function mh(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}function fh(t){const e=void 0!==(t=t||{}).canvas?t.canvas:mh(),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,p=null;const d=[],m=[];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.outputEncoding=Xe,this.physicallyCorrectLights=!1,this.toneMapping=Z,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;const f=this;let g=!1,x=null,v=0,y=0,_=null,b=null,w=-1,M=null;const S=new Wn,T=new Wn;let E=null,A=e.width,L=e.height,R=1,C=null,P=null;const D=new Wn(0,0,A,L),I=new Wn(0,0,A,L);let B=!1;const N=new Es;let F=!1,O=!1;const z=new wr,G=new Yn,H={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function U(){return null===_?R:1}let k,V,W,j,q,X,Y,J,Q,K,$,tt,et,nt,rt,it,st,ot,at,lt,ct,ht=n;function ut(t,n){for(let r=0;r<t.length;r++){const i=t[r],s=e.getContext(i,n);if(null!==s)return s}return null}try{const t={alpha:r,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(e.addEventListener("webglcontextlost",ft,!1),e.addEventListener("webglcontextrestored",gt,!1),null===ht){const e=["webgl2","webgl","experimental-webgl"];if(!0===f.isWebGL1Renderer&&e.shift(),null===(ht=ut(e,t)))throw ut(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ht.getShaderPrecisionFormat&&(ht.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Et){throw console.error("THREE.WebGLRenderer: "+Et.message),Et}function pt(){k=new al(ht),V=new il(ht,k,t),k.init(V),lt=new lh(ht,k,V),(W=new oh(ht,k,V)).scissor(T.copy(I).multiplyScalar(R).floor()),W.viewport(S.copy(D).multiplyScalar(R).floor()),j=new hl(ht),q=new Vc,X=new ah(ht,k,W,q,V,lt,j),Y=new ol(f),J=new Ls(ht,V),ct=new nl(ht,k,J,V),Q=new ll(ht,J,j,ct),K=new ml(ht,Q,J,j),st=new dl(ht),rt=new sl(q),$=new kc(f,Y,k,V,ct,rt),tt=new dh(q),et=new Xc(q),nt=new th(k,V),it=new el(f,Y,W,K,a),ot=new rl(ht,k,j,V),at=new cl(ht,k,j,V),j.programs=$.programs,f.capabilities=V,f.extensions=k,f.properties=q,f.renderLists=et,f.state=W,f.info=j}pt();const dt=new ph(f,ht);this.xr=dt;const mt=new sh(f,K,V.maxTextureSize);function ft(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function gt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1,pt()}function xt(t){const e=t.target;e.removeEventListener("dispose",xt),function(t){vt(t),q.remove(t)}(e)}function vt(t){const e=q.get(t).program;void 0!==e&&$.releaseProgram(e)}this.shadowMap=mt,this.getContext=function(){return ht},this.getContextAttributes=function(){return ht.getContextAttributes()},this.forceContextLoss=function(){const t=k.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=k.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return R},this.setPixelRatio=function(t){void 0!==t&&(R=t,this.setSize(A,L,!1))},this.getSize=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),t=new On),t.set(A,L)},this.setSize=function(t,n,r){dt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(A=t,L=n,e.width=Math.floor(t*R),e.height=Math.floor(n*R),!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 On),t.set(A*R,L*R).floor()},this.setDrawingBufferSize=function(t,n,r){A=t,L=n,R=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 Wn),t.copy(S)},this.getViewport=function(t){return t.copy(D)},this.setViewport=function(t,e,n,r){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,r),W.viewport(S.copy(D).multiplyScalar(R).floor())},this.getScissor=function(t){return t.copy(I)},this.setScissor=function(t,e,n,r){t.isVector4?I.set(t.x,t.y,t.z,t.w):I.set(t,e,n,r),W.scissor(T.copy(I).multiplyScalar(R).floor())},this.getScissorTest=function(){return B},this.setScissorTest=function(t){W.setScissorTest(B=t)},this.setOpaqueSort=function(t){C=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return void 0===t&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),t=new xi),t.copy(it.getClearColor())},this.setClearColor=function(){it.setClearColor.apply(it,arguments)},this.getClearAlpha=function(){return it.getClearAlpha()},this.setClearAlpha=function(){it.setClearAlpha.apply(it,arguments)},this.clear=function(t,e,n){let r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),ht.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",ft,!1),e.removeEventListener("webglcontextrestored",gt,!1),et.dispose(),nt.dispose(),q.dispose(),Y.dispose(),K.dispose(),ct.dispose(),dt.dispose(),_t.stop()},this.renderBufferImmediate=function(t,e){ct.initAttributes();const n=q.get(t);t.hasPositions&&!n.position&&(n.position=ht.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=ht.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=ht.createBuffer()),t.hasColors&&!n.color&&(n.color=ht.createBuffer());const r=e.getAttributes();t.hasPositions&&(ht.bindBuffer(34962,n.position),ht.bufferData(34962,t.positionArray,35048),ct.enableAttribute(r.position),ht.vertexAttribPointer(r.position,3,5126,!1,0,0)),t.hasNormals&&(ht.bindBuffer(34962,n.normal),ht.bufferData(34962,t.normalArray,35048),ct.enableAttribute(r.normal),ht.vertexAttribPointer(r.normal,3,5126,!1,0,0)),t.hasUvs&&(ht.bindBuffer(34962,n.uv),ht.bufferData(34962,t.uvArray,35048),ct.enableAttribute(r.uv),ht.vertexAttribPointer(r.uv,2,5126,!1,0,0)),t.hasColors&&(ht.bindBuffer(34962,n.color),ht.bufferData(34962,t.colorArray,35048),ct.enableAttribute(r.color),ht.vertexAttribPointer(r.color,3,5126,!1,0,0)),ct.disableUnusedAttributes(),ht.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,r,i,s){null===e&&(e=H);const o=i.isMesh&&i.matrixWorld.determinant()<0,a=Tt(t,e,r,i);W.setMaterial(r,o);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===r.wireframe&&(l=Q.getWireframeAttribute(n),u=2),(r.morphTargets||r.morphNormals)&&st.update(i,n,r,a),ct.setup(i,r,a,n,l);let p=ot;null!==l&&(h=J.get(l),(p=at).setIndex(h));const d=null!==l?l.count:c.count,m=n.drawRange.start*u,f=n.drawRange.count*u,g=null!==s?s.start*u:0,x=null!==s?s.count*u:1/0,v=Math.max(m,g),y=Math.min(d,m+f,g+x)-1,_=Math.max(0,y-v+1);if(0!==_){if(i.isMesh)!0===r.wireframe?(W.setLineWidth(r.wireframeLinewidth*U()),p.setMode(1)):p.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),W.setLineWidth(t*U()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(v,_,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(v,_,t)}else p.render(v,_)}},this.compile=function(t,e){(p=nt.get(t)).init(),t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(p.pushLight(t),t.castShadow&&p.pushShadow(t))}),p.setupLights();const n=new WeakMap;t.traverse(function(e){const r=e.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){const s=r[i];!1===n.has(s)&&(St(s,t,e),n.set(s))}else!1===n.has(r)&&(St(r,t,e),n.set(r))})};let yt=null;const _t=new As;function wt(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,s=t.length;i<s;i++){const s=t[i],o=s.object,a=s.geometry,l=null===r?s.material:r,c=s.group;if(n.isArrayCamera){const t=n.cameras;for(let n=0,r=t.length;n<r;n++){const r=t[n];o.layers.test(r.layers)&&(W.viewport(S.copy(r.viewport)),p.setupLightsView(r),Mt(o,e,r,a,l,c))}}else Mt(o,e,n,a,l,c)}}function Mt(t,e,n,r,i,s){if(t.onBeforeRender(f,e,n,r,i,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const r=Tt(n,e,i,t);W.setMaterial(i),ct.reset(),function(t,e){t.render(function(t){f.renderBufferImmediate(t,e)})}(t,r)}else f.renderBufferDirect(n,e,r,i,t,s);t.onAfterRender(f,e,n,r,i,s)}function St(t,e,n){!0!==e.isScene&&(e=H);const r=q.get(t),i=p.state.lights,s=p.state.shadowsArray,o=i.state.version,a=$.getParameters(t,i.state,s,e,n),l=$.getProgramCacheKey(a);let c=r.program,h=!0;if(r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=Y.get(t.envMap||r.environment),void 0===c)t.addEventListener("dispose",xt);else if(c.cacheKey!==l)vt(t);else if(r.lightsStateVersion!==o)h=!1;else{if(void 0!==a.shaderID)return;h=!1}h&&(a.uniforms=$.getUniforms(t),t.onBeforeCompile(a,f),c=$.acquireProgram(a,l),r.program=c,r.uniforms=a.uniforms,r.outputEncoding=a.outputEncoding);const u=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=rt.numPlanes,r.numIntersection=rt.numIntersection,u.clippingPlanes=rt.uniform),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=o,r.needsLights&&(u.ambientLightColor.value=i.state.ambient,u.lightProbe.value=i.state.probe,u.directionalLights.value=i.state.directional,u.directionalLightShadows.value=i.state.directionalShadow,u.spotLights.value=i.state.spot,u.spotLightShadows.value=i.state.spotShadow,u.rectAreaLights.value=i.state.rectArea,u.ltc_1.value=i.state.rectAreaLTC1,u.ltc_2.value=i.state.rectAreaLTC2,u.pointLights.value=i.state.point,u.pointLightShadows.value=i.state.pointShadow,u.hemisphereLights.value=i.state.hemi,u.directionalShadowMap.value=i.state.directionalShadowMap,u.directionalShadowMatrix.value=i.state.directionalShadowMatrix,u.spotShadowMap.value=i.state.spotShadowMap,u.spotShadowMatrix.value=i.state.spotShadowMatrix,u.pointShadowMap.value=i.state.pointShadowMap,u.pointShadowMatrix.value=i.state.pointShadowMatrix);const d=r.program.getUniforms(),m=dc.seqWithValue(d.seq,u);r.uniformsList=m}function Tt(t,e,n,r){!0!==e.isScene&&(e=H),X.resetTextureUnits();const i=e.fog,s=n.isMeshStandardMaterial?e.environment:null,o=null===_?f.outputEncoding:_.texture.encoding,a=Y.get(n.envMap||s),l=q.get(n),c=p.state.lights;if(!0===F&&(!0===O||t!==M)){const e=t===M&&n.id===w;rt.setState(n,t,e)}n.version===l.__version?n.fog&&l.fog!==i?St(n,e,r):l.environment!==s?St(n,e,r):l.needsLights&&l.lightsStateVersion!==c.state.version?St(n,e,r):void 0===l.numClippingPlanes||l.numClippingPlanes===rt.numPlanes&&l.numIntersection===rt.numIntersection?l.outputEncoding!==o?St(n,e,r):l.envMap!==a&&St(n,e,r):St(n,e,r):(St(n,e,r),l.__version=n.version);let h=!1,u=!1,d=!1;const m=l.program,g=m.getUniforms(),x=l.uniforms;if(W.useProgram(m.program)&&(h=!0,u=!0,d=!0),n.id!==w&&(w=n.id,u=!0),h||M!==t){if(g.setValue(ht,"projectionMatrix",t.projectionMatrix),V.logarithmicDepthBuffer&&g.setValue(ht,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),M!==t&&(M=t,u=!0,d=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=g.map.cameraPosition;void 0!==e&&e.setValue(ht,G.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(ht,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&g.setValue(ht,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){g.setOptional(ht,r,"bindMatrix"),g.setOptional(ht,r,"bindMatrixInverse");const t=r.skeleton;if(t){const e=t.bones;if(V.floatVertexTextures){if(null===t.boneTexture){let n=Math.sqrt(4*e.length);n=Fn.ceilPowerOfTwo(n),n=Math.max(n,4);const r=new Float32Array(n*n*4);r.set(t.boneMatrices);const i=new Ms(r,n,n,Nt,At);t.boneMatrices=r,t.boneTexture=i,t.boneTextureSize=n}g.setValue(ht,"boneTexture",t.boneTexture,X),g.setValue(ht,"boneTextureSize",t.boneTextureSize)}else g.setOptional(ht,t,"boneMatrices")}}var v,y;return(u||l.receiveShadow!==r.receiveShadow)&&(l.receiveShadow=r.receiveShadow,g.setValue(ht,"receiveShadow",r.receiveShadow)),u&&(g.setValue(ht,"toneMappingExposure",f.toneMappingExposure),l.needsLights&&(y=d,(v=x).ambientLightColor.needsUpdate=y,v.lightProbe.needsUpdate=y,v.directionalLights.needsUpdate=y,v.directionalLightShadows.needsUpdate=y,v.pointLights.needsUpdate=y,v.pointLightShadows.needsUpdate=y,v.spotLights.needsUpdate=y,v.spotLightShadows.needsUpdate=y,v.rectAreaLights.needsUpdate=y,v.hemisphereLights.needsUpdate=y),i&&n.fog&&tt.refreshFogUniforms(x,i),tt.refreshMaterialUniforms(x,n,R,L),dc.upload(ht,l.uniformsList,x,X)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(dc.upload(ht,l.uniformsList,x,X),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(ht,"center",r.center),g.setValue(ht,"modelViewMatrix",r.modelViewMatrix),g.setValue(ht,"normalMatrix",r.normalMatrix),g.setValue(ht,"modelMatrix",r.matrixWorld),m}_t.setAnimationLoop(function(t){dt.isPresenting||yt&&yt(t)}),"undefined"!=typeof window&&_t.setContext(window),this.setAnimationLoop=function(t){yt=t,dt.setAnimationLoop(t),null===t?_t.stop():_t.start()},this.render=function(t,e){let 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]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;ct.resetDefaultState(),w=-1,M=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===dt.enabled&&!0===dt.isPresenting&&(e=dt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(f,t,e,n||_),(p=nt.get(t,m.length)).init(),m.push(p),z.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),N.setFromProjectionMatrix(z),O=this.localClippingEnabled,F=rt.init(this.clippingPlanes,O,e),(u=et.get(t,d.length)).init(),d.push(u),function t(e,n,r,i){if(!1===e.visible)return;const s=e.layers.test(n.layers);if(s)if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||N.intersectsSprite(e)){i&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(z);const t=K.update(e),n=e.material;n.visible&&u.push(e,t,n,r,G.z,null)}}else if(e.isImmediateRenderObject)i&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(z),u.push(e,null,e.material,r,G.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==j.render.frame&&(e.skeleton.update(),e.skeleton.frame=j.render.frame),!e.frustumCulled||N.intersectsObject(e))){i&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(z);const t=K.update(e),n=e.material;if(Array.isArray(n)){const i=t.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=n[o.materialIndex];a&&a.visible&&u.push(e,t,a,r,G.z,o)}}else n.visible&&u.push(e,t,n,r,G.z,null)}const o=e.children;for(let a=0,l=o.length;a<l;a++)t(o[a],n,r,i)}(t,e,0,f.sortObjects),u.finish(),!0===f.sortObjects&&u.sort(C,P),!0===F&&rt.beginShadows();const i=p.state.shadowsArray;mt.render(i,t,e),p.setupLights(),p.setupLightsView(e),!0===F&&rt.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),it.render(u,t,e,r);const s=u.opaque,o=u.transparent;s.length>0&&wt(s,t,e),o.length>0&&wt(o,t,e),!0===t.isScene&&t.onAfterRender(f,t,e),null!==_&&(X.updateRenderTargetMipmap(_),X.updateMultisampleRenderTarget(_)),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1),m.pop(),p=m.length>0?m[m.length-1]:null,d.pop(),u=d.length>0?d[d.length-1]:null},this.setFramebuffer=function(t){x!==t&&null===_&&ht.bindFramebuffer(36160,t),x=t},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===q.get(t).__webglFramebuffer&&X.setupRenderTarget(t);let r=x,i=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=o[e],i=!0):r=t.isWebGLMultisampleRenderTarget?q.get(t).__webglMultisampledFramebuffer:o,S.copy(t.viewport),T.copy(t.scissor),E=t.scissorTest}else S.copy(D).multiplyScalar(R).floor(),T.copy(I).multiplyScalar(R).floor(),E=B;if(b!==r&&(ht.bindFramebuffer(36160,r),b=r),W.viewport(S),W.scissor(T),W.setScissorTest(E),i){const r=q.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(s){const r=q.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==b&&(ht.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==Nt&&lt.convert(l)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===Lt&&(k.has("EXT_color_buffer_half_float")||V.isWebGL2&&k.has("EXT_color_buffer_float"));if(!(c===bt||lt.convert(c)===ht.getParameter(35738)||c===At&&(V.isWebGL2||k.has("OES_texture_float")||k.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,lt.convert(l),lt.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&ht.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),o=lt.convert(e.format);X.setTexture2D(e,0),ht.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),W.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=lt.convert(n.format),a=lt.convert(n.type);X.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=lt.convert(r.format),c=lt.convert(r.type);let h;if(r.isDataTexture3D)X.setTexture3D(r,0),h=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");X.setTexture2DArray(r,0),h=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const u=ht.getParameter(3314),p=ht.getParameter(32878),d=ht.getParameter(3316),m=ht.getParameter(3315),g=ht.getParameter(32877);ht.pixelStorei(3314,s),ht.pixelStorei(32878,o),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),ht.texSubImage3D(h,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,a),ht.pixelStorei(3314,u),ht.pixelStorei(32878,p),ht.pixelStorei(3316,d),ht.pixelStorei(3315,m),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(h),W.unbindTexture()},this.initTexture=function(t){X.setTexture2D(t,0),W.unbindTexture()},this.resetState=function(){W.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}exports.Group=hh,hh.prototype.isGroup=!0,Object.assign(uh.prototype,{constructor:uh,getHandSpace:function(){return null===this._hand&&(this._hand=new hh,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new hh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new hh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let r=null,i=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(l&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===l.joints[s.jointName]){const t=new hh;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[s.jointName]=t,l.add(t)}const r=l.joints[s.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==s),this}}),Object.assign(ph.prototype,In.prototype);class gh extends fh{}exports.WebGL1Renderer=gh,gh.prototype.isWebGL1Renderer=!0;class xh{constructor(t,e){this.name="",this.color=new xi(t),this.density=void 0!==e?e:25e-5}clone(){return new xh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}exports.FogExp2=xh,xh.prototype.isFogExp2=!0;class vh{constructor(t,e,n){this.name="",this.color=new xi(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new vh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}exports.Fog=vh,vh.prototype.isFog=!0;class yh extends Xr{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.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(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function _h(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=wn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn.generateUUID()}exports.Scene=yh,yh.prototype.isScene=!0,Object.defineProperty(_h.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(_h.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(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this},set:function(t,e=0){return this.array.set(t,e),this},clone:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Fn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new _h(new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),this.stride);return e.setUsage(this.usage),e},onUpload:function(t){return this.onUploadCallback=t,this},toJSON:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Fn.generateUUID()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}});const bh=new Yn;function wh(t,e,n,r){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}Object.defineProperties(wh.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(t){this.data.needsUpdate=t}}}),Object.assign(wh.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(let e=0,n=this.data.count;e<n;e++)bh.x=this.getX(e),bh.y=this.getY(e),bh.z=this.getZ(e),bh.applyMatrix4(t),this.setXYZ(e,bh.x,bh.y,bh.z);return this},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},clone:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new bi(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new wh(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}});class Mh extends hi{constructor(t){super(),this.type="SpriteMaterial",this.color=new xi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Sh;exports.SpriteMaterial=Mh,Mh.prototype.isSpriteMaterial=!0;const Th=new Yn,Eh=new Yn,Ah=new Yn,Lh=new On,Rh=new On,Ch=new wr,Ph=new Yn,Dh=new Yn,Ih=new Yn,Bh=new On,Nh=new On,Fh=new On;class Oh extends Xr{constructor(t){if(super(),this.type="Sprite",void 0===Sh){Sh=new ki;const t=new _h(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Sh.setIndex([0,1,2,0,2,3]),Sh.setAttribute("position",new wh(t,3,0,!1)),Sh.setAttribute("uv",new wh(t,2,3,!1))}this.geometry=Sh,this.material=void 0!==t?t:new Mh,this.center=new On(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Eh.setFromMatrixScale(this.matrixWorld),Ch.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ah.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Eh.multiplyScalar(-Ah.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const s=this.center;zh(Ph.set(-.5,-.5,0),Ah,s,Eh,r,i),zh(Dh.set(.5,-.5,0),Ah,s,Eh,r,i),zh(Ih.set(.5,.5,0),Ah,s,Eh,r,i),Bh.set(0,0),Nh.set(1,0),Fh.set(1,1);let o=t.ray.intersectTriangle(Ph,Dh,Ih,!1,Th);if(null===o&&(zh(Dh.set(-.5,.5,0),Ah,s,Eh,r,i),Nh.set(0,1),null===(o=t.ray.intersectTriangle(Ph,Ih,Dh,!1,Th))))return;const a=t.ray.origin.distanceTo(Th);a<t.near||a>t.far||e.push({distance:a,point:Th.clone(),uv:li.getUV(Th,Ph,Dh,Ih,Bh,Nh,Fh,new On),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function zh(t,e,n,r,i,s){Lh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Rh.x=s*Lh.x-i*Lh.y,Rh.y=i*Lh.x+s*Lh.y):Rh.copy(Lh),t.copy(e),t.x+=Rh.x,t.y+=Rh.y,t.applyMatrix4(Ch)}exports.Sprite=Oh,Oh.prototype.isSprite=!0;const Gh=new Yn,Hh=new Yn;class Uh extends Xr{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n<r;n++){const t=e[n];this.addLevel(t.object.clone(),t.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let r;for(r=0;r<n.length&&!(e<n[r].distance);r++);return n.splice(r,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,r;for(n=1,r=e.length;n<r&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){Gh.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Gh);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Gh.setFromMatrixPosition(t.matrixWorld),Hh.setFromMatrixPosition(this.matrixWorld);const n=Gh.distanceTo(Hh)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r<i&&n>=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)e[r].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let r=0,i=n.length;r<i;r++){const t=n[r];e.object.levels.push({object:t.object.uuid,distance:t.distance})}return e}}exports.LOD=Uh;const kh=new Yn,Vh=new Wn,Wh=new Wn,jh=new Yn,qh=new wr;function Xh(t,e){os.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new wr,this.bindMatrixInverse=new wr}function Yh(){Xr.call(this),this.type="Bone"}Xh.prototype=Object.assign(Object.create(os.prototype),{constructor:Xh,isSkinnedMesh:!0,copy:function(t){return os.prototype.copy.call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){const t=new Wn,e=this.geometry.attributes.skinWeight;for(let 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);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}},updateMatrixWorld:function(t){os.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(t,e){const n=this.skeleton,r=this.geometry;Vh.fromBufferAttribute(r.attributes.skinIndex,t),Wh.fromBufferAttribute(r.attributes.skinWeight,t),kh.fromBufferAttribute(r.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let i=0;i<4;i++){const t=Wh.getComponent(i);if(0!==t){const r=Vh.getComponent(i);qh.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(jh.copy(kh).applyMatrix4(qh),t)}}return e.applyMatrix4(this.bindMatrixInverse)}}),Yh.prototype=Object.assign(Object.create(Xr.prototype),{constructor:Yh,isBone:!0});const Zh=new wr,Jh=new wr;class Qh{constructor(t=[],e=[]){this.uuid=Fn.generateUUID(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new wr)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new wr;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let i=0,s=t.length;i<s;i++){const r=t[i]?t[i].matrixWorld:Jh;Zh.multiplyMatrices(r,e[i]),Zh.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}clone(){return new Qh(this.bones,this.boneInverses)}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,r=t.bones.length;n<r;n++){const r=t.bones[n];let i=e[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new Yh),this.bones.push(i),this.boneInverses.push((new wr).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let r=0,i=e.length;r<i;r++){const i=e[r];t.bones.push(i.uuid);const s=n[r];t.boneInverses.push(s.toArray())}return t}}exports.Skeleton=Qh;const Kh=new wr,$h=new wr,tu=[],eu=new os;function nu(t,e,n){os.call(this,t,e),this.instanceMatrix=new bi(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}nu.prototype=Object.assign(Object.create(os.prototype),{constructor:nu,isInstancedMesh:!0,copy:function(t){return os.prototype.copy.call(this,t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this},getColorAt:function(t,e){e.fromArray(this.instanceColor.array,3*t)},getMatrixAt:function(t,e){e.fromArray(this.instanceMatrix.array,16*t)},raycast:function(t,e){const n=this.matrixWorld,r=this.count;if(eu.geometry=this.geometry,eu.material=this.material,void 0!==eu.material)for(let i=0;i<r;i++){this.getMatrixAt(i,Kh),$h.multiplyMatrices(n,Kh),eu.matrixWorld=$h,eu.raycast(t,tu);for(let t=0,n=tu.length;t<n;t++){const n=tu[t];n.instanceId=i,n.object=this,e.push(n)}tu.length=0}},setColorAt:function(t,e){null===this.instanceColor&&(this.instanceColor=new bi(new Float32Array(3*this.count),3)),e.toArray(this.instanceColor.array,3*t)},setMatrixAt:function(t,e){e.toArray(this.instanceMatrix.array,16*t)},updateMorphTargets:function(){},dispose:function(){this.dispatchEvent({type:"dispose"})}});class ru extends hi{constructor(t){super(),this.type="LineBasicMaterial",this.color=new xi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}exports.LineBasicMaterial=ru,ru.prototype.isLineBasicMaterial=!0;const iu=new Yn,su=new Yn,ou=new wr,au=new br,lu=new dr;function cu(t=new ki,e=new ru){Xr.call(this),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}cu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:cu,isLine:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)iu.fromBufferAttribute(e,t-1),su.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=iu.distanceTo(su);t.setAttribute("lineDistance",new Ci(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),lu.copy(n.boundingSphere),lu.applyMatrix4(r),lu.radius+=i,!1===t.ray.intersectsSphere(lu))return;ou.copy(r).invert(),au.copy(t.ray).applyMatrix4(ou);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,a=new Yn,l=new Yn,c=new Yn,h=new Yn,u=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,s=n.length-1;r<s;r+=u){const s=n[r],u=n[r+1];if(a.fromBufferAttribute(i,s),l.fromBufferAttribute(i,u),au.distanceSqToSegment(a,l,h,c)>o)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);p<t.near||p>t.far||e.push({distance:p,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else for(let n=0,s=i.count-1;n<s;n+=u){if(a.fromBufferAttribute(i,n),l.fromBufferAttribute(i,n+1),au.distanceSqToSegment(a,l,h,c)>o)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);r<t.near||r>t.far||e.push({distance:r,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const hu=new Yn,uu=new Yn;function pu(t,e){cu.call(this,t,e),this.type="LineSegments"}pu.prototype=Object.assign(Object.create(cu.prototype),{constructor:pu,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)hu.fromBufferAttribute(e,t),uu.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+hu.distanceTo(uu);t.setAttribute("lineDistance",new Ci(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}});class du extends cu{constructor(t,e){super(t,e),this.type="LineLoop"}}exports.LineLoop=du,du.prototype.isLineLoop=!0;class mu extends hi{constructor(t){super(),this.type="PointsMaterial",this.color=new xi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(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}}exports.PointsMaterial=mu,mu.prototype.isPointsMaterial=!0;const fu=new wr,gu=new br,xu=new dr,vu=new Yn;function yu(t=new ki,e=new mu){Xr.call(this),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}function _u(t,e,n,r,i,s,o){const a=gu.distanceSqToPoint(t);if(a<n){const n=new Yn;gu.closestPointToPoint(t,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}yu.prototype=Object.assign(Object.create(Xr.prototype),{constructor:yu,isPoints:!0,copy:function(t){return Xr.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),xu.copy(n.boundingSphere),xu.applyMatrix4(r),xu.radius+=i,!1===t.ray.intersectsSphere(xu))return;fu.copy(r).invert(),gu.copy(t.ray).applyMatrix4(fu);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const i=n.index,s=n.attributes.position;if(null!==i){const n=i.array;for(let i=0,a=n.length;i<a;i++){const a=n[i];vu.fromBufferAttribute(s,a),_u(vu,a,o,r,t,e,this)}}else for(let n=0,a=s.count;n<a;n++)vu.fromBufferAttribute(s,n),_u(vu,n,o,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class bu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.format=void 0!==o?o:Bt,this.minFilter=void 0!==s?s:gt,this.magFilter=void 0!==i?i:gt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}exports.VideoTexture=bu,bu.prototype.isVideoTexture=!0;class wu extends kn{constructor(t,e,n,r,i,s,o,a,l,c,h,u){super(null,s,o,a,l,c,r,i,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}exports.CompressedTexture=wu,wu.prototype.isCompressedTexture=!0;class Mu extends kn{constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r,i,s,o,a,l),this.needsUpdate=!0}}exports.CanvasTexture=Mu,Mu.prototype.isCanvasTexture=!0;class Su extends kn{constructor(t,e,n,r,i,s,o,a,l,c){if((c=void 0!==c?c:Gt)!==Gt&&c!==Ht)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Gt&&(n=St),void 0===n&&c===Ht&&(n=Dt),super(null,r,i,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==a?a:ut,this.flipY=!1,this.generateMipmaps=!1}}exports.DepthTexture=Su,Su.prototype.isDepthTexture=!0;class Tu extends ki{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],l=new Yn,c=new On;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let h=0,u=3;h<=e;h++,u+=3){const i=n+h/e*r;l.x=t*Math.cos(i),l.y=t*Math.sin(i),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[u]/t+1)/2,c.y=(s[u+1]/t+1)/2,a.push(c.x,c.y)}for(let h=1;h<=e;h++)i.push(h,h+1,0);this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("normal",new Ci(o,3)),this.setAttribute("uv",new Ci(a,2))}}exports.CircleGeometry=exports.CircleBufferGeometry=Tu;class Eu extends ki{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],h=[],u=[],p=[];let d=0;const m=[],f=n/2;let g=0;function x(n){const i=d,s=new On,m=new Yn;let x=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=r;t++)h.push(0,f*y,0),u.push(0,y,0),p.push(.5,.5),d++;const _=d;for(let t=0;t<=r;t++){const e=t/r*a+o,n=Math.cos(e),i=Math.sin(e);m.x=v*i,m.y=f*y,m.z=v*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*i*y+.5,p.push(s.x,s.y),d++}for(let t=0;t<r;t++){const e=i+t,r=_+t;!0===n?c.push(r,r+1,e):c.push(r+1,r,e),x+=3}l.addGroup(g,x,!0===n?1:2),g+=x}!function(){const s=new Yn,x=new Yn;let v=0;const y=(e-t)/n;for(let l=0;l<=i;l++){const c=[],g=l/i,v=g*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*a+o,l=Math.sin(i),m=Math.cos(i);x.x=v*l,x.y=-g*n+f,x.z=v*m,h.push(x.x,x.y,x.z),s.set(l,y,m).normalize(),u.push(s.x,s.y,s.z),p.push(e,1-g),c.push(d++)}m.push(c)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=m[e][t],r=m[e+1][t],i=m[e+1][t+1],s=m[e][t+1];c.push(n,r,s),c.push(r,i,s),v+=6}l.addGroup(g,v,0),g+=v}(),!1===s&&(t>0&&x(!0),e>0&&x(!1)),this.setIndex(c),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}}exports.CylinderGeometry=exports.CylinderBufferGeometry=Eu;class Au extends Eu{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}}exports.ConeGeometry=exports.ConeBufferGeometry=Au;class Lu extends ki{constructor(t,e,n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),l=i-o;for(let t=0;t<=l;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/l)}for(let o=0;o<i;o++)for(let t=0;t<2*(i-o)-1;t++){const e=Math.floor(t/2);t%2==0?(a(s[o][e+1]),a(s[o+1][e]),a(s[o][e])):(a(s[o][e+1]),a(s[o+1][e+1]),a(s[o+1][e]))}}function a(t){i.push(t.x,t.y,t.z)}function l(e,n){const r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(t,e,n,r){r<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=r/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new Yn,r=new Yn,i=new Yn;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],r),l(e[s+2],i),o(n,r,i,t)}(r),function(t){const e=new Yn;for(let 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(){const t=new Yn;for(let n=0;n<i.length;n+=3){t.x=i[n+0],t.y=i[n+1],t.z=i[n+2];const r=h(t)/2/Math.PI+.5,o=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(r,1-o)}var e;(function(){const t=new Yn,e=new Yn,n=new Yn,r=new Yn,o=new On,a=new On,l=new On;for(let u=0,p=0;u<i.length;u+=9,p+=6){t.set(i[u+0],i[u+1],i[u+2]),e.set(i[u+3],i[u+4],i[u+5]),n.set(i[u+6],i[u+7],i[u+8]),o.set(s[p+0],s[p+1]),a.set(s[p+2],s[p+3]),l.set(s[p+4],s[p+5]),r.copy(t).add(e).add(n).divideScalar(3);const d=h(r);c(o,p+0,t,d),c(a,p+2,e,d),c(l,p+4,n,d)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],r=s[t+4],i=Math.max(e,n,r),o=Math.min(e,n,r);i>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(i.slice(),3)),this.setAttribute("uv",new Ci(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}}exports.PolyhedronGeometry=exports.PolyhedronBufferGeometry=Lu;class Ru extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-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],[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="DodecahedronGeometry",this.parameters={radius:t,detail:e}}}exports.DodecahedronGeometry=exports.DodecahedronBufferGeometry=Ru;const Cu=new Yn,Pu=new Yn,Du=new Yn,Iu=new li;class Bu extends ki{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),r=Math.cos(Fn.DEG2RAD*e),i=t.getIndex(),s=t.getAttribute("position"),o=i?i.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let p=0;p<o;p+=3){i?(a[0]=i.getX(p),a[1]=i.getX(p+1),a[2]=i.getX(p+2)):(a[0]=p,a[1]=p+1,a[2]=p+2);const{a:t,b:e,c:o}=Iu;if(t.fromBufferAttribute(s,a[0]),e.fromBufferAttribute(s,a[1]),o.fromBufferAttribute(s,a[2]),Iu.getNormal(Du),c[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,c[1]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,c[2]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,c[0]!==c[1]&&c[1]!==c[2]&&c[2]!==c[0])for(let n=0;n<3;n++){const t=(n+1)%3,e=c[n],i=c[t],s=Iu[l[n]],o=Iu[l[t]],p=`${e}_${i}`,d=`${i}_${e}`;d in h&&h[d]?(Du.dot(h[d].normal)<=r&&(u.push(s.x,s.y,s.z),u.push(o.x,o.y,o.z)),h[d]=null):p in h||(h[p]={index0:a[n],index1:a[t],normal:Du.clone()})}}for(const p in h)if(h[p]){const{index0:t,index1:e}=h[p];Cu.fromBufferAttribute(s,t),Pu.fromBufferAttribute(s,e),u.push(Cu.x,Cu.y,Cu.z),u.push(Pu.x,Pu.y,Pu.z)}this.setAttribute("position",new Ci(u,3))}}exports.EdgesGeometry=Bu;const Nu={triangulate:function(t,e,n){n=n||2;const r=e&&e.length,i=r?e[0]*n:t.length;let s=Fu(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,p,d;if(r&&(s=Vu(t,e,s,n)),t.length>80*n){a=c=t[0],l=h=t[1];for(let e=n;e<i;e+=n)(u=t[e])<a&&(a=u),(p=t[e+1])<l&&(l=p),u>c&&(c=u),p>h&&(h=p);d=0!==(d=Math.max(c-a,h-l))?1/d:0}return zu(s,o,n,a,l,d),o}};function Fu(t,e,n,r,i){let s,o;if(i===pp(t,e,n,r)>0)for(s=e;s<n;s+=r)o=cp(s,t[s],t[s+1],o);else for(s=n-r;s>=e;s-=r)o=cp(s,t[s],t[s+1],o);return o&&ep(o,o.next)&&(hp(o),o=o.next),o}function Ou(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!ep(r,r.next)&&0!==tp(r.prev,r,r.next))r=r.next;else{if(hp(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zu(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Yu(t,r,i,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Hu(t,r,i,s):Gu(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),hp(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?zu(t=Uu(Ou(t),e,n),e,n,r,i,s,2):2===o&&ku(t,e,n,r,i,s):zu(Ou(t),e,n,r,i,s,1);break}}function Gu(t){const e=t.prev,n=t,r=t.next;if(tp(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ku(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&tp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Hu(t,e,n,r){const i=t.prev,s=t,o=t.next;if(tp(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,l=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,c=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,h=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,u=Ju(a,l,e,n,r),p=Ju(c,h,e,n,r);let d=t.prevZ,m=t.nextZ;for(;d&&d.z>=u&&m&&m.z<=p;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,d.x,d.y)&&tp(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=p;){if(m!==t.prev&&m!==t.next&&Ku(i.x,i.y,s.x,s.y,o.x,o.y,m.x,m.y)&&tp(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Uu(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!ep(i,s)&&np(i,r,r.next,s)&&op(i,s)&&op(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),hp(r),hp(r.next),r=t=s),r=r.next}while(r!==t);return Ou(r)}function ku(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&$u(o,t)){let a=lp(o,t);return o=Ou(o,o.next),a=Ou(a,a.next),zu(o,e,n,r,i,s),void zu(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function Vu(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)(c=Fu(t,a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,r,!1))===c.next&&(c.steiner=!0),i.push(Qu(c));for(i.sort(Wu),s=0;s<i.length;s++)ju(i[s],n),n=Ou(n,n.next);return n}function Wu(t,e){return t.x-e.x}function ju(t,e){if(e=qu(t,e)){const n=lp(e,t);Ou(e,e.next),Ou(n,n.next)}}function qu(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!s)return null;if(r===o)return s;const a=s,l=s.x,c=s.y;let h,u=1/0;n=s;do{r>=n.x&&n.x>=l&&r!==n.x&&Ku(i<c?r:o,i,l,c,i<c?o:r,i,n.x,n.y)&&(h=Math.abs(i-n.y)/(r-n.x),op(n,t)&&(h<u||h===u&&(n.x>s.x||n.x===s.x&&Xu(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}function Xu(t,e){return tp(t.prev,t,e.prev)<0&&tp(e.next,t,t.next)<0}function Yu(t,e,n,r){let i=t;do{null===i.z&&(i.z=Ju(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,Zu(i)}function Zu(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ);e++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function Ju(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 Qu(t){let 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 Ku(t,e,n,r,i,s,o,a){return(i-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function $u(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!sp(t,e)&&(op(t,e)&&op(e,t)&&ap(t,e)&&(tp(t.prev,t,e.prev)||tp(t,e.prev,e))||ep(t,e)&&tp(t.prev,t,t.next)>0&&tp(e.prev,e,e.next)>0)}function tp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ep(t,e){return t.x===e.x&&t.y===e.y}function np(t,e,n,r){const i=ip(tp(t,e,n)),s=ip(tp(t,e,r)),o=ip(tp(n,r,t)),a=ip(tp(n,r,e));return i!==s&&o!==a||(!(0!==i||!rp(t,n,e))||(!(0!==s||!rp(t,r,e))||(!(0!==o||!rp(n,t,r))||!(0!==a||!rp(n,e,r)))))}function rp(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ip(t){return t>0?1:t<0?-1:0}function sp(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&np(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function op(t,e){return tp(t.prev,t,t.next)<0?tp(t,e,t.next)>=0&&tp(t,t.prev,e)>=0:tp(t,e,t.prev)<0||tp(t,t.next,e)<0}function ap(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function lp(t,e){const n=new up(t.i,t.x,t.y),r=new up(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cp(t,e,n,r){const i=new up(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 hp(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 up(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}function pp(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}const dp={area:function(t){const e=t.length;let n=0;for(let 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 dp.area(t)<0},triangulateShape:function(t,e){const n=[],r=[],i=[];mp(t),fp(n,t);let s=t.length;e.forEach(mp);for(let a=0;a<e.length;a++)r.push(s),s+=e[a].length,fp(n,e[a]);const o=Nu.triangulate(n,r);for(let a=0;a<o.length;a+=3)i.push(o.slice(a,a+3));return i}};function mp(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function fp(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}exports.ShapeUtils=dp;class gp extends ki{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let o=0,a=t.length;o<a;o++){s(t[o])}function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:h-2,p=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:xp;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,x,v,y,_,b=!1;m&&(g=m.getSpacedPoints(a),b=!0,c=!1,x=m.computeFrenetFrames(a,!1),v=new Yn,y=new Yn,_=new Yn),c||(d=0,h=0,u=0,p=0);const w=t.extractPoints(o);let M=w.shape;const S=w.holes;if(!dp.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];dp.isClockWise(e)&&(S[t]=e.reverse())}}const T=dp.triangulateShape(M,S),E=M;for(let e=0,n=S.length;e<n;e++){const t=S[e];M=M.concat(t)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const L=M.length,R=T.length;function C(t,e,n){let r,i,s;const o=t.x-e.x,a=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=o*o+a*a,u=o*c-a*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),p=Math.sqrt(l*l+c*c),d=e.x-a/u,m=e.y+o/u,f=((n.x-c/p-d)*c-(n.y+l/p-m)*l)/(o*c-a*l),g=(r=d+o*f-t.x)*r+(i=m+a*f-t.y)*i;if(g<=2)return new On(r,i);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(h)):(r=o,i=a,s=Math.sqrt(h/2))}return new On(r/s,i/s)}const P=[];for(let e=0,n=E.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),P[e]=C(E[e],E[r],E[i]);const D=[];let I,B=P.concat();for(let e=0,n=S.length;e<n;e++){const t=S[e];I=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),I[e]=C(t[e],t[r],t[i]);D.push(I),B=B.concat(I)}for(let e=0;e<d;e++){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e<i;e++){const t=A(E[e],P[e],r);O(t.x,t.y,-n)}for(let e=0,i=S.length;e<i;e++){const t=S[e];I=D[e];for(let e=0,i=t.length;e<i;e++){const i=A(t[e],I[e],r);O(i.x,i.y,-n)}}}const N=u+p;for(let e=0;e<L;e++){const t=c?A(M[e],B[e],N):M[e];b?(y.copy(x.normals[0]).multiplyScalar(t.x),v.copy(x.binormals[0]).multiplyScalar(t.y),_.copy(g[0]).add(y).add(v),O(_.x,_.y,_.z)):O(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<L;t++){const n=c?A(M[t],B[t],N):M[t];b?(y.copy(x.normals[e]).multiplyScalar(n.x),v.copy(x.binormals[e]).multiplyScalar(n.y),_.copy(g[e]).add(y).add(v),O(_.x,_.y,_.z)):O(n.x,n.y,l/a*e)}for(let e=d-1;e>=0;e--){const t=e/d,n=h*Math.cos(t*Math.PI/2),r=u*Math.sin(t*Math.PI/2)+p;for(let e=0,i=E.length;e<i;e++){const t=A(E[e],P[e],r);O(t.x,t.y,l+n)}for(let e=0,i=S.length;e<i;e++){const t=S[e];I=D[e];for(let e=0,i=t.length;e<i;e++){const i=A(t[e],I[e],r);b?O(i.x,i.y+g[a-1].y,g[a-1].x+n):O(i.x,i.y,l+n)}}}function F(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*d;t<n;t++){const n=L*t,s=L*(t+1);G(e+r+n,e+i+n,e+i+s,e+r+s)}}}function O(t,e,n){s.push(t),s.push(e),s.push(n)}function z(t,e,i){H(t),H(e),H(i);const s=r.length/3,o=f.generateTopUV(n,r,s-3,s-2,s-1);U(o[0]),U(o[1]),U(o[2])}function G(t,e,i,s){H(t),H(e),H(s),H(e),H(i),H(s);const o=r.length/3,a=f.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);U(a[0]),U(a[1]),U(a[3]),U(a[1]),U(a[2]),U(a[3])}function H(t){r.push(s[3*t+0]),r.push(s[3*t+1]),r.push(s[3*t+2])}function U(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(c){let t=0,e=L*t;for(let n=0;n<R;n++){const t=T[n];z(t[2]+e,t[1]+e,t[0]+e)}e=L*(t=a+2*d);for(let n=0;n<R;n++){const t=T[n];z(t[0]+e,t[1]+e,t[2]+e)}}else{for(let t=0;t<R;t++){const e=T[t];z(e[2],e[1],e[0])}for(let t=0;t<R;t++){const e=T[t];z(e[0]+L*a,e[1]+L*a,e[2]+L*a)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;F(E,e),e+=E.length;for(let n=0,r=S.length;n<r;n++){const t=S[n];F(t,e),e+=t.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new Ci(r,3)),this.setAttribute("uv",new Ci(i,2)),this.computeVertexNormals()}toJSON(){const t=ki.prototype.toJSON.call(this);return vp(this.parameters.shapes,this.parameters.options,t)}}exports.ExtrudeGeometry=exports.ExtrudeBufferGeometry=gp;const xp={generateTopUV:function(t,e,n,r,i){const s=e[3*n],o=e[3*n+1],a=e[3*r],l=e[3*r+1],c=e[3*i],h=e[3*i+1];return[new On(s,o),new On(a,l),new On(c,h)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[3*n],a=e[3*n+1],l=e[3*n+2],c=e[3*r],h=e[3*r+1],u=e[3*r+2],p=e[3*i],d=e[3*i+1],m=e[3*i+2],f=e[3*s],g=e[3*s+1],x=e[3*s+2];return Math.abs(a-h)<.01?[new On(o,1-l),new On(c,1-u),new On(p,1-m),new On(f,1-x)]:[new On(a,1-l),new On(h,1-u),new On(d,1-m),new On(g,1-x)]}};function vp(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const e=t[r];n.shapes.push(e.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class yp extends Lu{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-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],[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="IcosahedronGeometry",this.parameters={radius:t,detail:e}}}exports.IcosahedronGeometry=exports.IcosahedronBufferGeometry=yp;class _p extends ki{constructor(t,e=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e),r=Fn.clamp(r,0,2*Math.PI);const i=[],s=[],o=[],a=1/e,l=new Yn,c=new On;for(let h=0;h<=e;h++){const i=n+h*a*r,u=Math.sin(i),p=Math.cos(i);for(let n=0;n<=t.length-1;n++)l.x=t[n].x*u,l.y=t[n].y,l.z=t[n].x*p,s.push(l.x,l.y,l.z),c.x=h/e,c.y=n/(t.length-1),o.push(c.x,c.y)}for(let h=0;h<e;h++)for(let e=0;e<t.length-1;e++){const n=e+h*t.length,r=n,s=n+t.length,o=n+t.length+1,a=n+1;i.push(r,s,a),i.push(s,o,a)}if(this.setIndex(i),this.setAttribute("position",new Ci(s,3)),this.setAttribute("uv",new Ci(o,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new Yn,i=new Yn,s=new Yn,o=e*t.length*3;for(let e=0,a=0;e<t.length;e++,a+=3)r.x=n[a+0],r.y=n[a+1],r.z=n[a+2],i.x=n[o+a+0],i.y=n[o+a+1],i.z=n[o+a+2],s.addVectors(r,i).normalize(),n[a+0]=n[o+a+0]=s.x,n[a+1]=n[o+a+1]=s.y,n[a+2]=n[o+a+2]=s.z}}}exports.LatheGeometry=exports.LatheBufferGeometry=_p;class bp extends Lu{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}}function wp(t,e,n){ki.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n};const r=[],i=[],s=[],o=[],a=new Yn,l=new Yn,c=new Yn,h=new Yn,u=new Yn;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const p=e+1;for(let d=0;d<=n;d++){const r=d/n;for(let n=0;n<=e;n++){const p=n/e;t(p,r,l),i.push(l.x,l.y,l.z),p-1e-5>=0?(t(p-1e-5,r,c),h.subVectors(l,c)):(t(p+1e-5,r,c),h.subVectors(c,l)),r-1e-5>=0?(t(p,r-1e-5,c),u.subVectors(l,c)):(t(p,r+1e-5,c),u.subVectors(c,l)),a.crossVectors(h,u).normalize(),s.push(a.x,a.y,a.z),o.push(p,r)}}for(let d=0;d<n;d++)for(let t=0;t<e;t++){const e=d*p+t,n=d*p+t+1,i=(d+1)*p+t+1,s=(d+1)*p+t;r.push(e,n,s),r.push(n,i,s)}this.setIndex(r),this.setAttribute("position",new Ci(i,3)),this.setAttribute("normal",new Ci(s,3)),this.setAttribute("uv",new Ci(o,2))}exports.OctahedronGeometry=exports.OctahedronBufferGeometry=bp,wp.prototype=Object.create(ki.prototype),wp.prototype.constructor=wp;class Mp extends ki{constructor(t=.5,e=1,n=8,r=1,i=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=t;const u=(e-t)/(r=Math.max(1,r)),p=new Yn,d=new On;for(let m=0;m<=r;m++){for(let t=0;t<=n;t++){const r=i+t/n*s;p.x=h*Math.cos(r),p.y=h*Math.sin(r),a.push(p.x,p.y,p.z),l.push(0,0,1),d.x=(p.x/e+1)/2,d.y=(p.y/e+1)/2,c.push(d.x,d.y)}h+=u}for(let m=0;m<r;m++){const t=m*(n+1);for(let e=0;e<n;e++){const r=e+t,i=r,s=r+n+1,a=r+n+2,l=r+1;o.push(i,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new Ci(a,3)),this.setAttribute("normal",new Ci(l,3)),this.setAttribute("uv",new Ci(c,2))}}exports.RingGeometry=exports.RingBufferGeometry=Mp;class Sp extends ki{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],r=[],i=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))l(t);else for(let c=0;c<t.length;c++)l(t[c]),this.addGroup(o,a,c),o+=a,a=0;function l(t){const o=r.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===dp.isClockWise(c)&&(c=c.reverse());for(let e=0,n=h.length;e<n;e++){const t=h[e];!0===dp.isClockWise(t)&&(h[e]=t.reverse())}const u=dp.triangulateShape(c,h);for(let e=0,n=h.length;e<n;e++){const t=h[e];c=c.concat(t)}for(let e=0,n=c.length;e<n;e++){const t=c[e];r.push(t.x,t.y,0),i.push(0,0,1),s.push(t.x,t.y)}for(let e=0,r=u.length;e<r;e++){const t=u[e],r=t[0]+o,i=t[1]+o,s=t[2]+o;n.push(r,i,s),a+=3}}this.setIndex(n),this.setAttribute("position",new Ci(r,3)),this.setAttribute("normal",new Ci(i,3)),this.setAttribute("uv",new Ci(s,2))}toJSON(){const t=ki.prototype.toJSON.call(this);return Tp(this.parameters.shapes,t)}}function Tp(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}exports.ShapeGeometry=exports.ShapeBufferGeometry=Sp;class Ep extends ki{constructor(t=1,e=8,n=6,r=0,i=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new Yn,u=new Yn,p=[],d=[],m=[],f=[];for(let g=0;g<=n;g++){const p=[],x=g/n;let v=0;0==g&&0==s?v=.5/e:g==n&&a==Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(r+a*i)*Math.sin(s+x*o),h.y=t*Math.cos(s+x*o),h.z=t*Math.sin(r+a*i)*Math.sin(s+x*o),d.push(h.x,h.y,h.z),u.copy(h).normalize(),m.push(u.x,u.y,u.z),f.push(a+v,1-x),p.push(l++)}c.push(p)}for(let g=0;g<n;g++)for(let t=0;t<e;t++){const e=c[g][t+1],r=c[g][t],i=c[g+1][t],o=c[g+1][t+1];(0!==g||s>0)&&p.push(e,r,o),(g!==n-1||a<Math.PI)&&p.push(r,i,o)}this.setIndex(p),this.setAttribute("position",new Ci(d,3)),this.setAttribute("normal",new Ci(m,3)),this.setAttribute("uv",new Ci(f,2))}}exports.SphereGeometry=exports.SphereBufferGeometry=Ep;class Ap extends Lu{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}}exports.TetrahedronGeometry=exports.TetrahedronBufferGeometry=Ap;class Lp extends gp{constructor(t,e={}){const n=e.font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ki;const 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),super(r,e),this.type="TextGeometry"}}exports.TextGeometry=exports.TextBufferGeometry=Lp;class Rp extends ki{constructor(t=1,e=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const s=[],o=[],a=[],l=[],c=new Yn,h=new Yn,u=new Yn;for(let p=0;p<=n;p++)for(let s=0;s<=r;s++){const d=s/r*i,m=p/n*Math.PI*2;h.x=(t+e*Math.cos(m))*Math.cos(d),h.y=(t+e*Math.cos(m))*Math.sin(d),h.z=e*Math.sin(m),o.push(h.x,h.y,h.z),c.x=t*Math.cos(d),c.y=t*Math.sin(d),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(s/r),l.push(p/n)}for(let p=1;p<=n;p++)for(let t=1;t<=r;t++){const e=(r+1)*p+t-1,n=(r+1)*(p-1)+t-1,i=(r+1)*(p-1)+t,o=(r+1)*p+t;s.push(e,n,o),s.push(n,i,o)}this.setIndex(s),this.setAttribute("position",new Ci(o,3)),this.setAttribute("normal",new Ci(a,3)),this.setAttribute("uv",new Ci(l,2))}}exports.TorusGeometry=exports.TorusBufferGeometry=Rp;class Cp extends ki{constructor(t=1,e=.4,n=64,r=8,i=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:s},n=Math.floor(n),r=Math.floor(r);const o=[],a=[],l=[],c=[],h=new Yn,u=new Yn,p=new Yn,d=new Yn,m=new Yn,f=new Yn,g=new Yn;for(let v=0;v<=n;++v){const o=v/n*i*Math.PI*2;x(o,i,s,t,p),x(o+.01,i,s,t,d),f.subVectors(d,p),g.addVectors(d,p),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let t=0;t<=r;++t){const i=t/r*Math.PI*2,s=-e*Math.cos(i),o=e*Math.sin(i);h.x=p.x+(s*g.x+o*m.x),h.y=p.y+(s*g.y+o*m.y),h.z=p.z+(s*g.z+o*m.z),a.push(h.x,h.y,h.z),u.subVectors(h,p).normalize(),l.push(u.x,u.y,u.z),c.push(v/n),c.push(t/r)}}for(let v=1;v<=n;v++)for(let t=1;t<=r;t++){const e=(r+1)*(v-1)+(t-1),n=(r+1)*v+(t-1),i=(r+1)*v+t,s=(r+1)*(v-1)+t;o.push(e,n,s),o.push(n,i,s)}function x(t,e,n,r,i){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,l=Math.cos(a);i.x=r*(2+l)*.5*s,i.y=r*(2+l)*o*.5,i.z=r*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new Ci(a,3)),this.setAttribute("normal",new Ci(l,3)),this.setAttribute("uv",new Ci(c,2))}}exports.TorusKnotGeometry=exports.TorusKnotBufferGeometry=Cp;class Pp extends ki{constructor(t,e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const s=t.computeFrenetFrames(e,i);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new Yn,a=new Yn,l=new On;let c=new Yn;const h=[],u=[],p=[],d=[];function m(i){c=t.getPointAt(i/e,c);const l=s.normals[i],p=s.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),s=-Math.cos(e);a.x=s*l.x+i*p.x,a.y=s*l.y+i*p.y,a.z=s*l.z+i*p.z,a.normalize(),u.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)m(t);m(!1===i?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)l.x=t/e,l.y=n/r,p.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),s=(r+1)*t+e,o=(r+1)*(t-1)+e;d.push(n,i,o),d.push(i,s,o)}}()}(),this.setIndex(d),this.setAttribute("position",new Ci(h,3)),this.setAttribute("normal",new Ci(u,3)),this.setAttribute("uv",new Ci(p,2))}toJSON(){const t=ki.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t}}exports.TubeGeometry=exports.TubeBufferGeometry=Pp;class Dp extends ki{constructor(t){if(super(),this.type="WireframeGeometry",!0===t.isGeometry)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const e=[],n=[0,0],r={},i=new Yn;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,e=a.length;t<e;++t){const e=a[t],i=e.start;for(let t=i,s=i+e.count;t<s;t+=3)for(let e=0;e<3;e++){const i=o.getX(t+e),s=o.getX(t+(e+1)%3);n[0]=Math.min(i,s),n[1]=Math.max(i,s);const a=n[0]+","+n[1];void 0===r[a]&&(r[a]={index1:n[0],index2:n[1]})}}for(const t in r){const n=r[t];i.fromBufferAttribute(s,n.index1),e.push(i.x,i.y,i.z),i.fromBufferAttribute(s,n.index2),e.push(i.x,i.y,i.z)}}else{const n=t.attributes.position;for(let t=0,r=n.count/3;t<r;t++)for(let s=0;s<3;s++){const r=3*t+s;i.fromBufferAttribute(n,r),e.push(i.x,i.y,i.z);const o=3*t+(s+1)%3;i.fromBufferAttribute(n,o),e.push(i.x,i.y,i.z)}}this.setAttribute("position",new Ci(e,3))}}exports.WireframeGeometry=Dp;var Ip=Object.freeze({__proto__:null,BoxGeometry:cs,BoxBufferGeometry:cs,CircleGeometry:Tu,CircleBufferGeometry:Tu,ConeGeometry:Au,ConeBufferGeometry:Au,CylinderGeometry:Eu,CylinderBufferGeometry:Eu,DodecahedronGeometry:Ru,DodecahedronBufferGeometry:Ru,EdgesGeometry:Bu,ExtrudeGeometry:gp,ExtrudeBufferGeometry:gp,IcosahedronGeometry:yp,IcosahedronBufferGeometry:yp,LatheGeometry:_p,LatheBufferGeometry:_p,OctahedronGeometry:bp,OctahedronBufferGeometry:bp,ParametricGeometry:wp,ParametricBufferGeometry:wp,PlaneGeometry:Rs,PlaneBufferGeometry:Rs,PolyhedronGeometry:Lu,PolyhedronBufferGeometry:Lu,RingGeometry:Mp,RingBufferGeometry:Mp,ShapeGeometry:Sp,ShapeBufferGeometry:Sp,SphereGeometry:Ep,SphereBufferGeometry:Ep,TetrahedronGeometry:Ap,TetrahedronBufferGeometry:Ap,TextGeometry:Lp,TextBufferGeometry:Lp,TorusGeometry:Rp,TorusBufferGeometry:Rp,TorusKnotGeometry:Cp,TorusKnotBufferGeometry:Cp,TubeGeometry:Pp,TubeBufferGeometry:Pp,WireframeGeometry:Dp});class Bp extends hi{constructor(t){super(),this.type="ShadowMaterial",this.color=new xi(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}exports.ShadowMaterial=Bp,Bp.prototype.isShadowMaterial=!0;class Np extends fs{constructor(t){super(t),this.type="RawShaderMaterial"}}function Fp(t){hi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xi(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new On(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.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}function Op(t){Fp.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new On(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Fn.clamp(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(t)}exports.RawShaderMaterial=Np,Np.prototype.isRawShaderMaterial=!0,Fp.prototype=Object.create(hi.prototype),Fp.prototype.constructor=Fp,Fp.prototype.isMeshStandardMaterial=!0,Fp.prototype.copy=function(t){return hi.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.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this},Op.prototype=Object.create(Fp.prototype),Op.prototype.constructor=Op,Op.prototype.isMeshPhysicalMaterial=!0,Op.prototype.copy=function(t){return Fp.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new xi).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this};class zp extends hi{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new xi(16777215),this.specular=new xi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new On(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=q,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.flatShading=!1,this.setValues(t)}copy(t){return super.copy(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.flatShading=t.flatShading,this}}exports.MeshPhongMaterial=zp,zp.prototype.isMeshPhongMaterial=!0;class Gp extends hi{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new On(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,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.alphaMap=t.alphaMap,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}}exports.MeshToonMaterial=Gp,Gp.prototype.isMeshToonMaterial=!0;class Hp extends hi{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new On(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.flatShading=!1,this.setValues(t)}copy(t){return super.copy(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.flatShading=t.flatShading,this}}exports.MeshNormalMaterial=Hp,Hp.prototype.isMeshNormalMaterial=!0;class Up extends hi{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new xi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=q,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)}copy(t){return super.copy(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}}exports.MeshLambertMaterial=Up,Up.prototype.isMeshLambertMaterial=!0;class kp extends hi{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=rn,this.normalScale=new On(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(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.flatShading=t.flatShading,this}}exports.MeshMatcapMaterial=kp,kp.prototype.isMeshMatcapMaterial=!0;class Vp extends ru{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}exports.LineDashedMaterial=Vp,Vp.prototype.isLineDashedMaterial=!0;var Wp=Object.freeze({__proto__:null,ShadowMaterial:Bp,SpriteMaterial:Mh,RawShaderMaterial:Np,ShaderMaterial:fs,PointsMaterial:mu,MeshPhysicalMaterial:Op,MeshStandardMaterial:Fp,MeshPhongMaterial:zp,MeshToonMaterial:Gp,MeshNormalMaterial:Hp,MeshLambertMaterial:Up,MeshDepthMaterial:eh,MeshDistanceMaterial:nh,MeshBasicMaterial:vi,MeshMatcapMaterial:kp,LineDashedMaterial:Vp,LineBasicMaterial:ru,Material:hi});const jp={arraySlice:function(t,e,n){return jp.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){const e=t.length,n=new Array(e);for(let 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){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const r=n[s]*e;for(let n=0;n!==e;++n)i[o++]=t[r+n]}return i},flattenJSON:function(t,e,n,r){let i=1,s=t[0];for(;void 0!==s&&void 0===s[r];)s=t[i++];if(void 0===s)return;let o=s[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=s[r])&&(e.push(s.time),n.push.apply(n,o)),s=t[i++]}while(void 0!==s);else if(void 0!==o.toArray)do{void 0!==(o=s[r])&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++]}while(void 0!==s);else do{void 0!==(o=s[r])&&(e.push(s.time),n.push(o)),s=t[i++]}while(void 0!==s)},subclip:function(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const t=s.tracks[l],e=t.getValueSize(),a=[],c=[];for(let s=0;s<t.times.length;++s){const o=t.times[s]*i;if(!(o<n||o>=r)){a.push(t.times[s]);for(let n=0;n<e;++n)c.push(t.values[s*e+n])}}0!==a.length&&(t.times=jp.convertArray(a,t.times.constructor),t.values=jp.convertArray(c,t.values.constructor),o.push(t))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const e=n.tracks[o],r=e.ValueTypeName;if("bool"===r||"string"===r)continue;const i=t.tracks.find(function(t){return t.name===e.name&&t.ValueTypeName===r});if(void 0===i)continue;let a=0;const l=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=e.times.length-1;let p;if(s<=e.times[0]){const t=a,n=l-a;p=jp.arraySlice(e.values,t,n)}else if(s>=e.times[u]){const t=u*l+a,n=t+l-a;p=jp.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=l-a;t.evaluate(s),p=jp.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){(new Xn).fromArray(p).normalize().conjugate().toArray(p)}const d=i.times.length;for(let t=0;t<d;++t){const e=t*h+c;if("quaternion"===r)Xn.multiplyQuaternionsFlat(i.values,e,p,0,i.values,e);else{const t=h-2*c;for(let n=0;n<t;++n)i.values[e+n]-=p[n]}}}return t.blendMode=Ve,t}};function qp(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 Xp(t,e,n,r){qp.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Yp(t,e,n,r){qp.call(this,t,e,n,r)}function Zp(t,e,n,r){qp.call(this,t,e,n,r)}exports.AnimationUtils=jp,Object.assign(qp.prototype,{evaluate:function(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{let s;n:{r:if(!(t<r)){for(let s=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===s)break;if(i=r,t<(r=e[++n]))break e}s=e.length;break n}if(t>=i)break t;{const o=e[1];t<o&&(n=2,i=o);for(let s=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===s)break;if(r=i,t>=(i=e[--n-1]))break e}s=n,n=0}}for(;n<s;){const r=n+s>>>1;t<e[r]?s=r:n=r+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){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r;for(let s=0;s!==r;++s)e[s]=n[i+s];return e},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(qp.prototype,{beforeStart_:qp.prototype.copySampleValue_,afterEnd_:qp.prototype.copySampleValue_}),Xp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Xp,DefaultSettings_:{endingStart:Ge,endingEnd:Ge},intervalChanged_:function(t,e,n){const r=this.parameterPositions;let i=t-2,s=t+1,o=r[i],a=r[s];if(void 0===o)switch(this.getSettings_().endingStart){case He:i=t,o=2*e-n;break;case Ue:o=e+r[i=r.length-2]-r[i+1];break;default:i=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case He:s=t,a=2*n-e;break;case Ue:s=1,a=n+r[1]-r[0];break;default:s=t-1,a=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=i*c,this._offsetNext=s*c},interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-e)/(r-e),m=d*d,f=m*d,g=-u*f+2*u*m-u*d,x=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*d+1,v=(-1-p)*f+(1.5+p)*m+.5*d,y=p*f-p*m;for(let _=0;_!==o;++_)i[_]=g*s[c+_]+x*s[l+_]+v*s[a+_]+y*s[h+_];return i}}),Yp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Yp,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=(n-e)/(r-e),h=1-c;for(let u=0;u!==o;++u)i[u]=s[l+u]*h+s[a+u]*c;return i}}),Zp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Zp,interpolate_:function(t){return this.copySampleValue_(t-1)}});class Jp{constructor(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=jp.convertArray(e,this.TimeBufferType),this.values=jp.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:jp.convertArray(t.times,Array),values:jp.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Zp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Yp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xp(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Fe:e=this.InterpolantFactoryMethodDiscrete;break;case Oe:e=this.InterpolantFactoryMethodLinear;break;case ze:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Fe;case this.InterpolantFactoryMethodLinear:return Oe;case this.InterpolantFactoryMethodSmooth:return ze}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let i=0,s=r-1;for(;i!==r&&n[i]<t;)++i;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==i||s!==r){i>=s&&(i=(s=Math.max(s,1))-1);const t=this.getValueSize();this.times=jp.arraySlice(n,i,s),this.values=jp.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"==typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&jp.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=jp.arraySlice(this.times),e=jp.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===ze,i=t.length-1;let s=1;for(let o=1;o<i;++o){let i=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==t[0]))if(r)i=!0;else{const t=o*n,r=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[r+o]||n!==e[s+o]){i=!0;break}}}if(i){if(o!==s){t[s]=t[o];const r=o*n,i=s*n;for(let t=0;t!==n;++t)e[i+t]=e[r+t]}++s}}if(i>0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=jp.arraySlice(t,0,s),this.values=jp.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=jp.arraySlice(this.times,0),e=jp.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}exports.KeyframeTrack=Jp,Jp.prototype.TimeBufferType=Float32Array,Jp.prototype.ValueBufferType=Float32Array,Jp.prototype.DefaultInterpolation=Oe;class Qp extends Jp{}exports.BooleanKeyframeTrack=Qp,Qp.prototype.ValueTypeName="bool",Qp.prototype.ValueBufferType=Array,Qp.prototype.DefaultInterpolation=Fe,Qp.prototype.InterpolantFactoryMethodLinear=void 0,Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends Jp{}exports.ColorKeyframeTrack=Kp,Kp.prototype.ValueTypeName="color";class $p extends Jp{}function td(t,e,n,r){qp.call(this,t,e,n,r)}exports.NumberKeyframeTrack=$p,$p.prototype.ValueTypeName="number",td.prototype=Object.assign(Object.create(qp.prototype),{constructor:td,interpolate_:function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let l=t*o;for(let c=l+o;l!==c;l+=4)Xn.slerpFlat(i,0,s,l-o,s,l,a);return i}});class ed extends Jp{InterpolantFactoryMethodLinear(t){return new td(this.times,this.values,this.getValueSize(),t)}}exports.QuaternionKeyframeTrack=ed,ed.prototype.ValueTypeName="quaternion",ed.prototype.DefaultInterpolation=Oe,ed.prototype.InterpolantFactoryMethodSmooth=void 0;class nd extends Jp{}exports.StringKeyframeTrack=nd,nd.prototype.ValueTypeName="string",nd.prototype.ValueBufferType=Array,nd.prototype.DefaultInterpolation=Fe,nd.prototype.InterpolantFactoryMethodLinear=void 0,nd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends Jp{}exports.VectorKeyframeTrack=rd,rd.prototype.ValueTypeName="vector";class id{constructor(t,e=-1,n,r=ke){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=Fn.generateUUID(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(od(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(Jp.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o<i;o++){let t=[],a=[];t.push((o+i-1)%i,o,(o+1)%i),a.push(0,1,0);const l=jp.getKeyframeOrder(t);t=jp.sortedArray(t,1,l),a=jp.sortedArray(a,1,l),r||0!==t[0]||(t.push(i),a.push(a[0])),s.push(new $p(".morphTargetInfluences["+e[o].name+"]",t,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let o=0,a=t.length;o<a;o++){const e=t[o],n=e.name.match(i);if(n&&n.length>1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];jp.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let c=0;c<l.length;c++){const t=l[c].keys;if(t&&0!==t.length)if(t[0].morphTargets){const e={};let n;for(n=0;n<t.length;n++)if(t[n].morphTargets)for(let r=0;r<t[n].morphTargets.length;r++)e[t[n].morphTargets[r]]=-1;for(const i in e){const e=[],s=[];for(let r=0;r!==t[n].morphTargets.length;++r){const r=t[n];e.push(r.time),s.push(r.morphTarget===i?1:0)}r.push(new $p(".morphTargetInfluence["+i+"]",e,s))}a=e.length*(s||1)}else{const i=".bones["+e[c].name+"]";n(rd,i+".position",t,"pos",r),n(ed,i+".quaternion",t,"rot",r),n(rd,i+".scale",t,"scl",r)}}return 0===r.length?null:new this(i,a,r,o)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function sd(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return $p;case"vector":case"vector2":case"vector3":case"vector4":return rd;case"color":return Kp;case"quaternion":return ed;case"bool":case"boolean":return Qp;case"string":return nd}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function od(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=sd(t.type);if(void 0===t.times){const e=[],n=[];jp.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}exports.AnimationClip=id;const ad={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 ld(t,e,n){const r=this;let i=!1,s=0,o=0,a=void 0;const l=[];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,s,o),i=!0},this.itemEnd=function(t){s++,void 0!==r.onProgress&&r.onProgress(t,s,o),s===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 a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],r=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}exports.Cache=ad;const cd=new ld;function hd(t){this.manager=void 0!==t?t:cd,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}exports.DefaultLoadingManager=cd,Object.assign(hd.prototype,{load:function(){},loadAsync:function(t,e){const n=this;return new Promise(function(r,i){n.load(t,r,e,i)})},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}});const ud={};function pd(t){hd.call(this,t)}pd.prototype=Object.assign(Object.create(hd.prototype),{constructor:pd,load:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,s=ad.get(t);if(void 0!==s)return i.manager.itemStart(t),setTimeout(function(){e&&e(s),i.manager.itemEnd(t)},0),s;if(void 0!==ud[t])return void ud[t].push({onLoad:e,onProgress:n,onError:r});const o=t.match(/^data:(.*?)(;base64)?,(.*)$/);let a;if(o){const n=o[1],s=!!o[2];let a=o[3];a=decodeURIComponent(a),s&&(a=atob(a));try{let s;const o=(this.responseType||"").toLowerCase();switch(o){case"arraybuffer":case"blob":const t=new Uint8Array(a.length);for(let n=0;n<a.length;n++)t[n]=a.charCodeAt(n);s="blob"===o?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;s=e.parseFromString(a,n);break;case"json":s=JSON.parse(a);break;default:s=a}setTimeout(function(){e&&e(s),i.manager.itemEnd(t)},0)}catch(l){setTimeout(function(){r&&r(l),i.manager.itemError(t),i.manager.itemEnd(t)},0)}}else{ud[t]=[],ud[t].push({onLoad:e,onProgress:n,onError:r}),(a=new XMLHttpRequest).open("GET",t,!0),a.addEventListener("load",function(e){const n=this.response,r=ud[t];if(delete ud[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ad.add(t,n);for(let t=0,e=r.length;t<e;t++){const e=r[t];e.onLoad&&e.onLoad(n)}i.manager.itemEnd(t)}else{for(let t=0,n=r.length;t<n;t++){const n=r[t];n.onError&&n.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)}},!1),a.addEventListener("progress",function(e){const n=ud[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onProgress&&r.onProgress(e)}},!1),a.addEventListener("error",function(e){const n=ud[t];delete ud[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)},!1),a.addEventListener("abort",function(e){const n=ud[t];delete ud[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}i.manager.itemError(t),i.manager.itemEnd(t)},!1),void 0!==this.responseType&&(a.responseType=this.responseType),void 0!==this.withCredentials&&(a.withCredentials=this.withCredentials),a.overrideMimeType&&a.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)a.setRequestHeader(t,this.requestHeader[t]);a.send(null)}return i.manager.itemStart(t),a},setResponseType:function(t){return this.responseType=t,this},setMimeType:function(t){return this.mimeType=t,this}});class dd extends hd{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new pd(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}},n,r)}parse(t){const e=[];for(let n=0;n<t.length;n++){const r=id.parse(t[n]);e.push(r)}return e}}function md(t){hd.call(this,t)}exports.AnimationLoader=dd,md.prototype=Object.assign(Object.create(hd.prototype),{constructor:md,load:function(t,e,n,r){const i=this,s=[],o=new wu,a=new pd(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials);let l=0;function c(c){a.load(t[c],function(t){const n=i.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=gt),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))},n,r)}if(Array.isArray(t))for(let h=0,u=t.length;h<u;++h)c(h);else a.load(t,function(t){const n=i.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=gt),o.format=n.format,o.needsUpdate=!0,e&&e(o)},n,r);return o}});class fd extends hd{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,s=ad.get(t);if(void 0!==s)return i.manager.itemStart(t),setTimeout(function(){e&&e(s),i.manager.itemEnd(t)},0),s;const o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function a(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1),ad.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}exports.ImageLoader=fd;class gd extends hd{constructor(t){super(t)}load(t,e,n,r){const i=new bs,s=new fd(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],function(t){i.images[n]=t,6===++o&&(i.needsUpdate=!0,e&&e(i))},void 0,r)}for(let l=0;l<t.length;++l)a(l);return i}}function xd(t){hd.call(this,t)}function vd(t){hd.call(this,t)}function yd(){this.type="Curve",this.arcLengthDivisions=200}exports.CubeTextureLoader=gd,xd.prototype=Object.assign(Object.create(hd.prototype),{constructor:xd,load:function(t,e,n,r){const i=this,s=new Ms,o=new pd(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(t,function(t){const n=i.parse(t);n&&(void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:ct,s.wrapT=void 0!==n.wrapT?n.wrapT:ct,s.magFilter=void 0!==n.magFilter?n.magFilter:gt,s.minFilter=void 0!==n.minFilter?n.minFilter:gt,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(s.encoding=n.encoding),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=yt),1===n.mipmapCount&&(s.minFilter=gt),s.needsUpdate=!0,e&&e(s,n))},n,r),s}}),vd.prototype=Object.assign(Object.create(hd.prototype),{constructor:vd,load:function(t,e,n,r){const i=new kn,s=new fd(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(n){i.image=n;const r=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);i.format=r?Bt:Nt,i.needsUpdate=!0,void 0!==e&&e(i)},n,r),i}}),Object.assign(yd.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const 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;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)i+=(n=this.getPoint(s/t)).distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,l=i-1;for(;a<=l;)if((o=n[r=Math.floor(a+(l-a)/2)]-s)<0)a=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(n[r=l]===s)return r/(i-1);const c=n[r];return(r+(s-c)/(n[r+1]-c))/(i-1)},getTangent:function(t,e){let n=t-1e-4,r=t+1e-4;n<0&&(n=0),r>1&&(r=1);const i=this.getPoint(n),s=this.getPoint(r),o=e||(i.isVector2?new On:new Yn);return o.copy(s).sub(i).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new Yn,r=[],i=[],s=[],o=new Yn,a=new wr;for(let p=0;p<=t;p++){const e=p/t;r[p]=this.getTangentAt(e,new Yn),r[p].normalize()}i[0]=new Yn,s[0]=new Yn;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),h=Math.abs(r[0].y),u=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let p=1;p<=t;p++){if(i[p]=i[p-1].clone(),s[p]=s[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Fn.clamp(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(a.makeRotationAxis(o,t))}s[p].crossVectors(r[p],i[p])}if(!0===e){let e=Math.acos(Fn.clamp(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const 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}});class _d extends yd{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new On,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=s?0:r),!0!==this.aClockwise||s||(i===r?i=-r:i-=r);const o=this.aStartAngle+t*i;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,r=l-this.aY;a=n*t-r*e+this.aX,l=n*e+r*t+this.aY}return n.set(a,l)}copy(t){return super.copy(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}toJSON(){const t=super.toJSON();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}fromJSON(t){return super.fromJSON(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}}exports.EllipseCurve=_d,_d.prototype.isEllipseCurve=!0;class bd extends _d{constructor(t,e,n,r,i,s){super(t,e,n,n,r,i,s),this.type="ArcCurve"}}function wd(){let t=0,e=0,n=0,r=0;function i(i,s,o,a){t=i,e=o,n=-3*i+3*s-2*o-a,r=2*i-2*s+o+a}return{initCatmullRom:function(t,e,n,r,s){i(e,n,s*(n-t),s*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,s,o,a){let l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,c=(n-e)/o-(r-e)/(o+a)+(r-n)/a;i(e,n,l*=o,c*=o)},calc:function(i){const s=i*i;return t+e*i+n*s+r*(s*i)}}}exports.ArcCurve=bd,bd.prototype.isArcCurve=!0;const Md=new Yn,Sd=new wd,Td=new wd,Ed=new wd;class Ad extends yd{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Yn){const n=e,r=this.points,i=r.length,s=(i-(this.closed?0:1))*t;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?o=r[(l-1)%i]:(Md.subVectors(r[0],r[1]).add(r[0]),o=Md);const h=r[l%i],u=r[(l+1)%i];if(this.closed||l+2<i?a=r[(l+2)%i]:(Md.subVectors(r[i-1],r[i-2]).add(r[i-1]),a=Md),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),r=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),Sd.initNonuniformCatmullRom(o.x,h.x,u.x,a.x,e,n,r),Td.initNonuniformCatmullRom(o.y,h.y,u.y,a.y,e,n,r),Ed.initNonuniformCatmullRom(o.z,h.z,u.z,a.z,e,n,r)}else"catmullrom"===this.curveType&&(Sd.initCatmullRom(o.x,h.x,u.x,a.x,this.tension),Td.initCatmullRom(o.y,h.y,u.y,a.y,this.tension),Ed.initCatmullRom(o.z,h.z,u.z,a.z,this.tension));return n.set(Sd.calc(c),Td.calc(c),Ed.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Yn).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Ld(t,e,n,r,i){const s=.5*(r-e),o=.5*(i-n),a=t*t;return(2*n-2*r+s+o)*(t*a)+(-3*n+3*r-2*s-o)*a+s*t+n}function Rd(t,e){const n=1-t;return n*n*e}function Cd(t,e){return 2*(1-t)*t*e}function Pd(t,e){return t*t*e}function Dd(t,e,n,r){return Rd(t,e)+Cd(t,n)+Pd(t,r)}function Id(t,e){const n=1-t;return n*n*n*e}function Bd(t,e){const n=1-t;return 3*n*n*t*e}function Nd(t,e){return 3*(1-t)*t*t*e}function Fd(t,e){return t*t*t*e}function Od(t,e,n,r,i){return Id(t,e)+Bd(t,n)+Nd(t,r)+Fd(t,i)}exports.CatmullRomCurve3=Ad,Ad.prototype.isCatmullRomCurve3=!0;class zd extends yd{constructor(t=new On,e=new On,n=new On,r=new On){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new On){const n=e,r=this.v0,i=this.v1,s=this.v2,o=this.v3;return n.set(Od(t,r.x,i.x,s.x,o.x),Od(t,r.y,i.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}exports.CubicBezierCurve=zd,zd.prototype.isCubicBezierCurve=!0;class Gd extends yd{constructor(t=new Yn,e=new Yn,n=new Yn,r=new Yn){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Yn){const n=e,r=this.v0,i=this.v1,s=this.v2,o=this.v3;return n.set(Od(t,r.x,i.x,s.x,o.x),Od(t,r.y,i.y,s.y,o.y),Od(t,r.z,i.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}exports.CubicBezierCurve3=Gd,Gd.prototype.isCubicBezierCurve3=!0;class Hd extends yd{constructor(t=new On,e=new On){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new On){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new On;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}exports.LineCurve=Hd,Hd.prototype.isLineCurve=!0;class Ud extends yd{constructor(t=new Yn,e=new Yn){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new Yn){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}exports.LineCurve3=Ud;class kd extends yd{constructor(t=new On,e=new On,n=new On){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new On){const n=e,r=this.v0,i=this.v1,s=this.v2;return n.set(Dd(t,r.x,i.x,s.x),Dd(t,r.y,i.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}exports.QuadraticBezierCurve=kd,kd.prototype.isQuadraticBezierCurve=!0;class Vd extends yd{constructor(t=new Yn,e=new Yn,n=new Yn){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Yn){const n=e,r=this.v0,i=this.v1,s=this.v2;return n.set(Dd(t,r.x,i.x,s.x),Dd(t,r.y,i.y,s.y),Dd(t,r.z,i.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}exports.QuadraticBezierCurve3=Vd,Vd.prototype.isQuadraticBezierCurve3=!0;class Wd extends yd{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new On){const n=e,r=this.points,i=(r.length-1)*t,s=Math.floor(i),o=i-s,a=r[0===s?s:s-1],l=r[s],c=r[s>r.length-2?r.length-1:s+1],h=r[s>r.length-3?r.length-1:s+2];return n.set(Ld(o,a.x,l.x,c.x,h.x),Ld(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new On).fromArray(n))}return this}}exports.SplineCurve=Wd,Wd.prototype.isSplineCurve=!0;var jd=Object.freeze({__proto__:null,ArcCurve:bd,CatmullRomCurve3:Ad,CubicBezierCurve:zd,CubicBezierCurve3:Gd,EllipseCurve:_d,LineCurve:Hd,LineCurve3:Ud,QuadraticBezierCurve:kd,QuadraticBezierCurve3:Vd,SplineCurve:Wd});class qd extends yd{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Hd(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=e){const t=n[r]-e,i=this.curves[r],s=i.getLength(),o=0===s?0:1-t/s;return i.getPointAt(o)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const s=i[r],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const r=a[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new jd[n.type]).fromJSON(n))}return this}}exports.CurvePath=qd;class Xd extends qd{constructor(t){super(),this.type="Path",this.currentPoint=new On,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Hd(this.currentPoint.clone(),new On(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new kd(this.currentPoint.clone(),new On(t,e),new On(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,s){const o=new zd(this.currentPoint.clone(),new On(t,e),new On(n,r),new On(i,s));return this.curves.push(o),this.currentPoint.set(i,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Wd(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,r,i,s),this}absarc(t,e,n,r,i,s){return this.absellipse(t,e,n,n,r,i,s),this}ellipse(t,e,n,r,i,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,r,i,s,o,a),this}absellipse(t,e,n,r,i,s,o,a){const l=new _d(t,e,n,r,i,s,o,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}exports.Path=Xd;class Yd extends Xd{constructor(t){super(t),this.uuid=Fn.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new Xd).fromJSON(n))}return this}}exports.Shape=Yd;class Zd extends Xr{constructor(t,e=1){super(),this.type="Light",this.color=new xi(t),this.intensity=e}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(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}}exports.Light=Zd,Zd.prototype.isLight=!0;class Jd extends Zd{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Xr.DefaultUp),this.updateMatrix(),this.groundColor=new xi(e)}copy(t){return Zd.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}exports.HemisphereLight=Jd,Jd.prototype.isHemisphereLight=!0;const Qd=new wr,Kd=new Yn,$d=new Yn;class tm{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new On(512,512),this.map=null,this.mapPass=null,this.matrix=new wr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Es,this._frameExtents=new On(1,1),this._viewportCount=1,this._viewports=[new Wn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Kd.setFromMatrixPosition(t.matrixWorld),e.position.copy(Kd),$d.setFromMatrixPosition(t.target.matrixWorld),e.lookAt($d),e.updateMatrixWorld(),Qd.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Qd),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(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class em extends tm{constructor(){super(new xs(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*Fn.RAD2DEG*t.angle*this.focus,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()),super.updateMatrices(t)}}em.prototype.isSpotLightShadow=!0;class nm extends Zd{constructor(t,e,n=0,r=Math.PI/3,i=0,s=1){super(t,e),this.type="SpotLight",this.position.copy(Xr.DefaultUp),this.updateMatrix(),this.target=new Xr,this.distance=n,this.angle=r,this.penumbra=i,this.decay=s,this.shadow=new em}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}copy(t){return super.copy(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}}exports.SpotLight=nm,nm.prototype.isSpotLight=!0;const rm=new wr,im=new Yn,sm=new Yn;class om extends tm{constructor(){super(new xs(90,1,.5,500)),this._frameExtents=new On(4,2),this._viewportCount=6,this._viewports=[new Wn(2,1,1,1),new Wn(0,1,1,1),new Wn(3,1,1,1),new Wn(1,1,1,1),new Wn(3,0,1,1),new Wn(1,0,1,1)],this._cubeDirections=[new Yn(1,0,0),new Yn(-1,0,0),new Yn(0,0,1),new Yn(0,0,-1),new Yn(0,1,0),new Yn(0,-1,0)],this._cubeUps=[new Yn(0,1,0),new Yn(0,1,0),new Yn(0,1,0),new Yn(0,1,0),new Yn(0,0,1),new Yn(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix;im.setFromMatrixPosition(t.matrixWorld),n.position.copy(im),sm.copy(n.position),sm.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(sm),n.updateMatrixWorld(),r.makeTranslation(-im.x,-im.y,-im.z),rm.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rm)}}om.prototype.isPointLightShadow=!0;class am extends Zd{constructor(t,e,n=0,r=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new om}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}exports.PointLight=am,am.prototype.isPointLight=!0;class lm extends gs{constructor(t=-1,e=1,n=1,r=-1,i=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t,e,n,r,i,s){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=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const 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;let i=n-t,s=n+t,o=r+e,a=r-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s=(i+=t*this.view.offsetX)+t*this.view.width,a=(o-=e*this.view.offsetY)-e*this.view.height}this.projectionMatrix.makeOrthographic(i,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=Xr.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}}exports.OrthographicCamera=lm,lm.prototype.isOrthographicCamera=!0;class cm extends tm{constructor(){super(new lm(-5,5,5,-5,.5,500))}}cm.prototype.isDirectionalLightShadow=!0;class hm extends Zd{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Xr.DefaultUp),this.updateMatrix(),this.target=new Xr,this.shadow=new cm}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}exports.DirectionalLight=hm,hm.prototype.isDirectionalLight=!0;class um extends Zd{constructor(t,e){super(t,e),this.type="AmbientLight"}}exports.AmbientLight=um,um.prototype.isAmbientLight=!0;class pm extends Zd{constructor(t,e,n=10,r=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=r}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}exports.RectAreaLight=pm,pm.prototype.isRectAreaLight=!0;class dm{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Yn)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,r=t.y,i=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*r),e.addScaledVector(s[2],.488603*i),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*r*1.092548),e.addScaledVector(s[5],r*i*1.092548),e.addScaledVector(s[6],.315392*(3*i*i-1)),e.addScaledVector(s[7],n*i*1.092548),e.addScaledVector(s[8],.546274*(n*n-r*r)),e}getIrradianceAt(t,e){const n=t.x,r=t.y,i=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*r),e.addScaledVector(s[2],1.023328*i),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*r),e.addScaledVector(s[5],.858086*r*i),e.addScaledVector(s[6],.743125*i*i-.247708),e.addScaledVector(s[7],.858086*n*i),e.addScaledVector(s[8],.429043*(n*n-r*r)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this}toArray(t=[],e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}static getBasisAt(t,e){const 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)}}exports.SphericalHarmonics3=dm,dm.prototype.isSphericalHarmonics3=!0;class mm extends Zd{constructor(t=new dm,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}exports.LightProbe=mm,mm.prototype.isLightProbe=!0;class fm extends hd{constructor(t){super(t),this.textures={}}load(t,e,n,r){const i=this,s=new pd(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}},n,r)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const r=new Wp[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new xi).setHex(t.sheen)),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),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.vertexTangents&&(r.vertexTangents=t.vertexTangents),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new xi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new On).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new Yn).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Wn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new zn).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new wr).fromArray(e.value);break;default:r.uniforms[i].value=e.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(const i in t.extensions)r.extensions[i]=t.extensions[i];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)),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){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new On).fromArray(e)}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.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new On).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r}setTextures(t){return this.textures=t,this}}exports.MaterialLoader=fm;const gm={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r<i;r++)e+=String.fromCharCode(t[r]);try{return decodeURIComponent(escape(e))}catch(n){return e}},extractUrlBase:function(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}};function xm(){ki.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function vm(t,e,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),bi.call(this,t,e,n),this.meshPerAttribute=r||1}exports.LoaderUtils=gm,xm.prototype=Object.assign(Object.create(ki.prototype),{constructor:xm,isInstancedBufferGeometry:!0,copy:function(t){return ki.prototype.copy.call(this,t),this.instanceCount=t.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){const t=ki.prototype.toJSON.call(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}),vm.prototype=Object.assign(Object.create(bi.prototype),{constructor:vm,isInstancedBufferAttribute:!0,copy:function(t){return bi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},toJSON:function(){const t=bi.prototype.toJSON.call(this);return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}});class ym extends hd{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new pd(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,function(n){try{e(i.parse(JSON.parse(n)))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}},n,r)}parse(t){const e={},n={};function r(t,r){if(void 0!==e[r])return e[r];const i=t.interleavedBuffers[r],s=function(t,e){if(void 0!==n[e])return n[e];const r=t.arrayBuffers[e],i=new Uint32Array(r).buffer;return n[e]=i,i}(t,i.buffer),o=new _h(Bi(i.type,s),i.stride);return o.uuid=i.uuid,e[r]=o,o}const i=t.isInstancedBufferGeometry?new xm:new ki,s=t.data.index;if(void 0!==s){const t=Bi(s.type,s.array);i.setIndex(new bi(t,1))}const o=t.data.attributes;for(const h in o){const e=o[h];let n;if(e.isInterleavedBufferAttribute){n=new wh(r(t.data,e.data),e.itemSize,e.offset,e.normalized)}else{const t=Bi(e.type,e.array);n=new(e.isInstancedBufferAttribute?vm:bi)(t,e.itemSize,e.normalized)}void 0!==e.name&&(n.name=e.name),i.setAttribute(h,n)}const a=t.data.morphAttributes;if(a)for(const h in a){const e=a[h],n=[];for(let i=0,s=e.length;i<s;i++){const s=e[i];let o;if(s.isInterleavedBufferAttribute){o=new wh(r(t.data,s.data),s.itemSize,s.offset,s.normalized)}else{o=new bi(Bi(s.type,s.array),s.itemSize,s.normalized)}void 0!==s.name&&(o.name=s.name),n.push(o)}i.morphAttributes[h]=n}t.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let h=0,u=l.length;h!==u;++h){const t=l[h];i.addGroup(t.start,t.count,t.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new Yn;void 0!==c.center&&t.fromArray(c.center),i.boundingSphere=new dr(t,c.radius)}return t.name&&(i.name=t.name),t.userData&&(i.userData=t.userData),i}}exports.BufferGeometryLoader=ym;class _m extends hd{constructor(t){super(t)}load(t,e,n,r){const i=this,s=""===this.path?gm.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new pd(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(n){let s=null;try{s=JSON.parse(n)}catch(a){return void 0!==r&&r(a),void console.error("THREE:ObjectLoader: Can't parse "+t+".",a.message)}const o=s.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(s,e):console.error("THREE.ObjectLoader: Can't load "+t)},n,r)}parse(t,e){const n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),s=this.parseImages(t.images,function(){void 0!==e&&e(l)}),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,i,a,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){let t=!1;for(const e in s)if(s[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}parseShapes(t){const e={};if(void 0!==t)for(let n=0,r=t.length;n<r;n++){const r=(new Yd).fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){const n={},r={};if(e.traverse(function(t){t.isBone&&(r[t.uuid]=t)}),void 0!==t)for(let i=0,s=t.length;i<s;i++){const e=(new Qh).fromJSON(t[i],r);n[e.uuid]=e}return n}parseGeometries(t,e){const n={};let r;if(void 0!==t){const i=new ym;for(let s=0,o=t.length;s<o;s++){let o;const a=t[s];switch(a.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Ip[a.type](a.width,a.height,a.widthSegments,a.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":o=new Ip[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Ip[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Ip[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Ip[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Ip[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Ip[a.type](a.radius,a.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Ip[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Ip[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Ip[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Ip[a.type]((new jd[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Ip[a.type](a.points,a.segments,a.phiStart,a.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Ip[a.type](a.vertices,a.indices,a.radius,a.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":r=[];for(let n=0,i=a.shapes.length;n<i;n++){const t=e[a.shapes[n]];r.push(t)}o=new Ip[a.type](r,a.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":r=[];for(let n=0,i=a.shapes.length;n<i;n++){const t=e[a.shapes[n]];r.push(t)}const t=a.options.extrudePath;void 0!==t&&(a.options.extrudePath=(new jd[t.type]).fromJSON(t)),o=new Ip[a.type](r,a.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(a);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+a.type+'"');continue}o.uuid=a.uuid,void 0!==a.name&&(o.name=a.name),!0===o.isBufferGeometry&&void 0!==a.userData&&(o.userData=a.userData),n[a.uuid]=o}}return n}parseMaterials(t,e){const n={},r={};if(void 0!==t){const i=new fm;i.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];if("MultiMaterial"===s.type){const t=[];for(let e=0;e<s.materials.length;e++){const r=s.materials[e];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),t.push(n[r.uuid])}r[s.uuid]=t}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const r=t[n],i=id.parse(r);e[i.uuid]=i}return e}parseImages(t,e){const n=this,r={};let i;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),i.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemError(t),n.manager.itemEnd(t)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:Bi(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new ld(e);(i=new fd(n)).setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const n=t[e],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let t=0,e=i.length;t<e;t++){const e=s(i[t]);null!==e&&(e instanceof HTMLImageElement?r[n.uuid].push(e):r[n.uuid].push(new Ms(e.data,e.width,e.height)))}}else{const t=s(n.url);null!==t&&(r[n.uuid]=t)}}}return r}parseTextures(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])}const r={};if(void 0!==t)for(let i=0,s=t.length;i<s;i++){const s=t[i];let o;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);const a=e[s.image];Array.isArray(a)?(o=new bs(a),6===a.length&&(o.needsUpdate=!0)):(o=a&&a.data?new Ms(a.data,a.width,a.height):new kn(a),a&&(o.needsUpdate=!0)),o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,bm)),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],wm),o.wrapT=n(s.wrap[1],wm)),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,Mm)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Mm)),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(t,e,n,r){let i,s,o;function a(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),e.push(n[i])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}switch(t.type){case"Scene":i=new yh,void 0!==t.background&&Number.isInteger(t.background)&&(i.background=new xi(t.background)),void 0!==t.fog&&("Fog"===t.fog.type?i.fog=new vh(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(i.fog=new xh(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":i=new xs(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(i.focus=t.focus),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.filmGauge&&(i.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(i.filmOffset=t.filmOffset),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"OrthographicCamera":i=new lm(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(i.zoom=t.zoom),void 0!==t.view&&(i.view=Object.assign({},t.view));break;case"AmbientLight":i=new um(t.color,t.intensity);break;case"DirectionalLight":i=new hm(t.color,t.intensity);break;case"PointLight":i=new am(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":i=new pm(t.color,t.intensity,t.width,t.height);break;case"SpotLight":i=new nm(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":i=new Jd(t.color,t.groundColor,t.intensity);break;case"LightProbe":i=(new mm).fromJSON(t);break;case"SkinnedMesh":i=new Xh(s=a(t.geometry),o=l(t.material)),void 0!==t.bindMode&&(i.bindMode=t.bindMode),void 0!==t.bindMatrix&&i.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(i.skeleton=t.skeleton);break;case"Mesh":i=new os(s=a(t.geometry),o=l(t.material));break;case"InstancedMesh":s=a(t.geometry),o=l(t.material);const e=t.count,n=t.instanceMatrix;(i=new nu(s,o,e)).instanceMatrix=new bi(new Float32Array(n.array),16);break;case"LOD":i=new Uh;break;case"Line":i=new cu(a(t.geometry),l(t.material));break;case"LineLoop":i=new du(a(t.geometry),l(t.material));break;case"LineSegments":i=new pu(a(t.geometry),l(t.material));break;case"PointCloud":case"Points":i=new yu(a(t.geometry),l(t.material));break;case"Sprite":i=new Oh(l(t.material));break;case"Group":i=new hh;break;case"Bone":i=new Yh;break;default:i=new Xr}if(i.uuid=t.uuid,void 0!==t.name&&(i.name=t.name),void 0!==t.matrix?(i.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(i.matrixAutoUpdate=t.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.rotation&&i.rotation.fromArray(t.rotation),void 0!==t.quaternion&&i.quaternion.fromArray(t.quaternion),void 0!==t.scale&&i.scale.fromArray(t.scale)),void 0!==t.castShadow&&(i.castShadow=t.castShadow),void 0!==t.receiveShadow&&(i.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(i.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(i.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(i.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&i.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(i.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.frustumCulled&&(i.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(i.renderOrder=t.renderOrder),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.layers&&(i.layers.mask=t.layers),void 0!==t.children){const s=t.children;for(let t=0;t<s.length;t++)i.add(this.parseObject(s[t],e,n,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];i.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(i.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],r=i.getObjectByProperty("uuid",n.object);void 0!==r&&i.addLevel(r,n.distance)}}return i}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse(function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}exports.ObjectLoader=_m;const bm={UVMapping:et,CubeReflectionMapping:nt,CubeRefractionMapping:rt,EquirectangularReflectionMapping:it,EquirectangularRefractionMapping:st,CubeUVReflectionMapping:ot,CubeUVRefractionMapping:at},wm={RepeatWrapping:lt,ClampToEdgeWrapping:ct,MirroredRepeatWrapping:ht},Mm={NearestFilter:ut,NearestMipmapNearestFilter:pt,NearestMipmapLinearFilter:mt,LinearFilter:gt,LinearMipmapNearestFilter:xt,LinearMipmapLinearFilter:yt};function Sm(t){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),hd.call(this,t),this.options={premultiplyAlpha:"none"}}Sm.prototype=Object.assign(Object.create(hd.prototype),{constructor:Sm,isImageBitmapLoader:!0,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);const i=this,s=ad.get(t);if(void 0!==s)return i.manager.itemStart(t),setTimeout(function(){e&&e(s),i.manager.itemEnd(t)},0),s;const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(n){ad.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)}});class Tm{constructor(){this.type="ShapePath",this.color=new xi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Xd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}bezierCurveTo(t,e,n,r,i,s){return this.currentPath.bezierCurveTo(t,e,n,r,i,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n],i=new Yd;i.curves=r.curves,e.push(i)}return e}function r(t,e){const n=e.length;let r=!1;for(let i=n-1,s=0;s<n;i=s++){let n=e[i],o=e[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[i],l=-l),t.y<n.y||t.y>o.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;r=!r}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return r}const i=dp.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],(l=new Yd).curves=a.curves,c.push(l),c;let h=!i(s[0].getPoints());h=t?!h:h;const u=[],p=[];let d,m,f=[],g=0;p[g]=void 0,f[g]=[];for(let x=0,v=s.length;x<v;x++)o=i(d=(a=s[x]).getPoints()),(o=t?!o:o)?(!h&&p[g]&&g++,p[g]={s:new Yd,p:d},p[g].s.curves=a.curves,h&&g++,f[g]=[]):f[g].push({h:a,p:d[0]});if(!p[0])return n(s);if(p.length>1){let t=!1;const e=[];for(let n=0,r=p.length;n<r;n++)u[n]=[];for(let n=0,i=p.length;n<i;n++){const i=f[n];for(let s=0;s<i.length;s++){const o=i[s];let a=!0;for(let i=0;i<p.length;i++)r(o.p,p[i].p)&&(n!==i&&e.push({froms:n,tos:i,hole:s}),a?(a=!1,u[i].push(o)):t=!0);a&&u[n].push(o)}}e.length>0&&(t||(f=u))}for(let x=0,v=p.length;x<v;x++){l=p[x].s,c.push(l);for(let t=0,e=(m=f[x]).length;t<e;t++)l.holes.push(m[t].h)}return c}}exports.ShapePath=Tm;class Em{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],r=Am(t,e,this.data);for(let i=0,s=r.length;i<s;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}function Am(t,e,n){const r=Array.from(t),i=e/n.resolution,s=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[];let a=0,l=0;for(let c=0;c<r.length;c++){const t=r[c];if("\n"===t)a=0,l-=s;else{const e=Lm(t,i,a,l,n);a+=e.offsetX,o.push(e.path)}}return o}function Lm(t,e,n,r,i){const s=i.glyphs[t]||i.glyphs["?"];if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+i.familyName+".");const o=new Tm;let a,l,c,h,u,p,d,m;if(s.o){const t=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let i=0,s=t.length;i<s;){switch(t[i++]){case"m":a=t[i++]*e+n,l=t[i++]*e+r,o.moveTo(a,l);break;case"l":a=t[i++]*e+n,l=t[i++]*e+r,o.lineTo(a,l);break;case"q":c=t[i++]*e+n,h=t[i++]*e+r,u=t[i++]*e+n,p=t[i++]*e+r,o.quadraticCurveTo(u,p,c,h);break;case"b":c=t[i++]*e+n,h=t[i++]*e+r,u=t[i++]*e+n,p=t[i++]*e+r,d=t[i++]*e+n,m=t[i++]*e+r,o.bezierCurveTo(u,p,d,m,c,h)}}}return{offsetX:s.ha*e,path:o}}exports.Font=Em,Em.prototype.isFont=!0;class Rm extends hd{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new pd(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,function(t){let n;try{n=JSON.parse(t)}catch(s){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const r=i.parse(n);e&&e(r)},n,r)}parse(t){return new Em(t)}}let Cm;exports.FontLoader=Rm;const Pm={getContext:function(){return void 0===Cm&&(Cm=new(window.AudioContext||window.webkitAudioContext)),Cm},setContext:function(t){Cm=t}};exports.AudioContext=Pm;class Dm extends hd{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new pd(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(n){try{const o=n.slice(0);Pm.getContext().decodeAudioData(o,function(t){e(t)})}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}},n,r)}}exports.AudioLoader=Dm;class Im extends mm{constructor(t,e,n=1){super(void 0,n);const r=(new xi).set(t),i=(new xi).set(e),s=new Yn(r.r,r.g,r.b),o=new Yn(i.r,i.g,i.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(o).multiplyScalar(a),this.sh.coefficients[1].copy(s).sub(o).multiplyScalar(l)}}exports.HemisphereLightProbe=Im,Im.prototype.isHemisphereLightProbe=!0;class Bm extends mm{constructor(t,e=1){super(void 0,e);const n=(new xi).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}exports.AmbientLightProbe=Bm,Bm.prototype.isAmbientLightProbe=!0;const Nm=new wr,Fm=new wr;class Om{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new xs,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new xs,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}}update(t){const 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;const n=t.projectionMatrix.clone(),r=e.eyeSep/2,i=r*e.near/e.focus,s=e.near*Math.tan(Fn.DEG2RAD*e.fov*.5)/e.zoom;let o,a;Fm.elements[12]=-r,Nm.elements[12]=r,o=-s*e.aspect+i,a=s*e.aspect+i,n.elements[0]=2*e.near/(a-o),n.elements[8]=(a+o)/(a-o),this.cameraL.projectionMatrix.copy(n),o=-s*e.aspect-i,a=s*e.aspect-i,n.elements[0]=2*e.near/(a-o),n.elements[8]=(a+o)/(a-o),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Fm),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Nm)}}exports.StereoCamera=Om;class zm{constructor(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Gm(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Gm();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Gm(){return("undefined"==typeof performance?Date:performance).now()}exports.Clock=zm;const Hm=new Yn,Um=new Xn,km=new Yn,Vm=new Yn;class Wm extends Xr{constructor(){super(),this.type="AudioListener",this.context=Pm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new zm}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(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(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Hm,Um,km),Vm.set(0,0,-1).applyQuaternion(Um),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Hm.x,t),e.positionY.linearRampToValueAtTime(Hm.y,t),e.positionZ.linearRampToValueAtTime(Hm.z,t),e.forwardX.linearRampToValueAtTime(Vm.x,t),e.forwardY.linearRampToValueAtTime(Vm.y,t),e.forwardZ.linearRampToValueAtTime(Vm.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Hm.x,Hm.y,Hm.z),e.setOrientation(Vm.x,Vm.y,Vm.z,n.x,n.y,n.z)}}exports.AudioListener=Wm;class jm extends Xr{constructor(t){super(),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.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(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(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(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(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(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(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}exports.Audio=jm;const qm=new Yn,Xm=new Xn,Ym=new Yn,Zm=new Yn;class Jm extends jm{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(qm,Xm,Ym),Zm.set(0,0,1).applyQuaternion(Xm);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(qm.x,t),e.positionY.linearRampToValueAtTime(qm.y,t),e.positionZ.linearRampToValueAtTime(qm.z,t),e.orientationX.linearRampToValueAtTime(Zm.x,t),e.orientationY.linearRampToValueAtTime(Zm.y,t),e.orientationZ.linearRampToValueAtTime(Zm.z,t)}else e.setPosition(qm.x,qm.y,qm.z),e.setOrientation(Zm.x,Zm.y,Zm.z)}}exports.PositionalAudio=Jm;class Qm{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}exports.AudioAnalyser=Qm;class Km{constructor(t,e,n){let r,i,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,r=this.valueSize,i=t*r+r;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==r;++t)n[i+t]=n[t];s=e}else{const t=e/(s+=e);this._mixBufferRegion(n,i,0,t,r)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const t=e*this._origIndex;this._mixBufferRegion(n,r,t,1-i,e)}s>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,l=e+e;a!==l;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,r,i){if(r>=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){Xn.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;Xn.multiplyQuaternionsFlat(t,s,t,e,t,n),Xn.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}exports.PropertyMixer=Km;const $m="\\[\\]\\.:\\/",tf=new RegExp("[\\[\\]\\.:\\/]","g"),ef="[^\\[\\]\\.:\\/]",nf="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",rf=/((?:WC+[\/:])*)/.source.replace("WC",ef),sf=/(WCOD+)?/.source.replace("WCOD",nf),of=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ef),af=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ef),lf=new RegExp("^"+rf+sf+of+af+"$"),cf=["material","materials","bones"];function hf(t,e,n){const r=n||uf.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function uf(t,e,n){this.path=e,this.parsedPath=n||uf.parseTrackName(e),this.node=uf.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(hf.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(uf,{Composite:hf,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new uf.Composite(t,e,n):new uf(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(tf,"")},parseTrackName:function(t){const e=lf.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const 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){const t=n.nodeName.substring(r+1);-1!==cf.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}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||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.name===e||i.uuid===e)return i;const s=n(i.children);if(s)return s}return null},r=n(t.children);if(r)return r}return null}}),Object.assign(uf.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){const n=this.resolvedProperty;for(let 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){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++]},function(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){const n=this.resolvedProperty;for(let 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(){let t=this.node;const e=this.parsedPath,n=e.objectName,r=e.propertyName;let i=e.propertyIndex;if(t||(t=uf.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=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(let e=0;e<t.length;e++)if(t[e].name===r){r=e;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!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const s=t[r];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=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)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(uf.prototype,{_getValue_unbound:uf.prototype.getValue,_setValue_unbound:uf.prototype.setValue});class pf{constructor(){this.uuid=Fn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,s=i.length;let o=void 0,a=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let p=e[u];if(void 0===p){p=a++,e[u]=p,t.push(h);for(let t=0,e=s;t!==e;++t)i[t].push(new uf(h,n[t],r[t]))}else if(p<l){o=t[p];const a=--l,c=t[a];e[c.uuid]=p,t[p]=c,e[u]=a,t[a]=h;for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[a];let o=e[p];e[p]=s,void 0===o&&(o=new uf(h,n[t],r[t])),e[a]=o}}else t[p]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=e[a];if(void 0!==l&&l>=i){const s=i++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[l];e[l]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<i){const o=--i,a=t[o],c=--s,h=t[c];e[a.uuid]=l,t[l]=a,e[h.uuid]=o,t[o]=h,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[o],i=e[c];e[l]=r,e[o]=i,e.pop()}}else{const i=--s,o=t[i];i>0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(h);for(let u=c,p=a.length;u!==p;++u){const n=a[u];h[u]=new uf(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}exports.AnimationObjectGroup=pf,pf.prototype.isAnimationObjectGroup=!0;class df{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:Ge,endingEnd:Ge};for(let l=0;l!==s;++l){const t=i[l].createInterpolant(null);o[l]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Be,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}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=i,a[1]=i+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case Ve:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case ke:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const 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(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===Ne;if(0===t)return-1===i?r:s&&1==(1&i)?e-r:r;if(n===Ie){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,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,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=He,r.endingEnd=He):(r.endingStart=t?this.zeroSlopeAtStart?He:Ge:Ue,r.endingEnd=e?this.zeroSlopeAtEnd?He:Ge:Ue)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class mf extends In{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let h=0;h!==i;++h){const t=r[h],i=t.name;let l=c[i];if(void 0!==l)s[h]=l;else{if(void 0!==(l=s[h])){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,a,i));continue}const r=e&&e._propertyBindings[h].binding.parsedPath;++(l=new Km(uf.create(n,i,r),t.ValueTypeName,t.getValueSize())).referenceCount,this._addInactiveBinding(l,a,i),s[h]=l}o[h].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const 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)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const 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(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const r=this._actions,i=this._actionsByClip;let s=i[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=r.length,r.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;const i=t._clip.uuid,s=this._actionsByClip,o=s[i],a=o.knownActions,l=a[a.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete s[i],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let n=0,r=e.length;n!==r;++n){const t=e[n];0==--t.referenceCount&&this._removeInactiveBinding(t)}}_lendAction(t){const 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(t){const 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(t,e,n){const r=this._bindingsByRootAndName,i=this._bindings;let s=r[e];void 0===s&&(s={},r[e]=s),s[n]=t,t._cacheIndex=i.length,i.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,s=this._bindingsByRootAndName,o=s[r],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete o[i],0===Object.keys(o).length&&delete s[r]}_lendBinding(t){const 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(t){const 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(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&((n=new Yp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}clipAction(t,e,n){const r=e||this._root,i=r.uuid;let s="string"==typeof t?id.findByName(r,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:ke),void 0!==a){const t=a.actionByRoot[i];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new df(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,o,i),c}existingAction(t,e){const n=e||this._root,r=n.uuid,i="string"==typeof t?id.findByName(n,t):t,s=i?i.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[r]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==n;++l){e[l]._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let l=0;l!==a;++l)o[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const t=i.knownActions;for(let n=0,r=t.length;n!==r;++n){const r=t[n];this._deactivateAction(r);const i=r._cacheIndex,s=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,s._cacheIndex=i,e[i]=s,e.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const i in n){const t=n[i].actionByRoot[e];void 0!==t&&(this._deactivateAction(t),this._removeInactiveAction(t))}const r=this._bindingsByRootAndName[e];if(void 0!==r)for(const i in r){const t=r[i];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}exports.AnimationMixer=mf,mf.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class ff{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new ff(void 0===this.value.clone?this.value:this.value.clone())}}function gf(t,e,n){_h.call(this,t,e),this.meshPerAttribute=n||1}function xf(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}function vf(t,e,n=0,r=1/0){this.ray=new br(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Ir,this.params={Mesh:{},Line:{threshold:1},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 yf(t,e){return t.distance-e.distance}function _f(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)_f(r[t],e,n,!0)}}exports.Uniform=ff,gf.prototype=Object.assign(Object.create(_h.prototype),{constructor:gf,isInstancedInterleavedBuffer:!0,copy:function(t){return _h.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},clone:function(t){const e=_h.prototype.clone.call(this,t);return e.meshPerAttribute=this.meshPerAttribute,e},toJSON:function(t){const e=_h.prototype.toJSON.call(this,t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}),Object.defineProperty(xf.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(xf.prototype,{isGLBufferAttribute:!0,setBuffer:function(t){return this.buffer=t,this},setType:function(t,e){return this.type=t,this.elementSize=e,this},setItemSize:function(t){return this.itemSize=t,this},setCount:function(t){return this.count=t,this}}),Object.assign(vf.prototype,{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: "+e.type)},intersectObject:function(t,e=!1,n=[]){return _f(t,this,n,e),n.sort(yf),n},intersectObjects:function(t,e=!1,n=[]){for(let r=0,i=t.length;r<i;r++)_f(t[r],this,n,e);return n.sort(yf),n}});class bf{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(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(Fn.clamp(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}exports.Spherical=bf;class wf{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}exports.Cylindrical=wf;const Mf=new On;class Sf{constructor(t=new On(1/0,1/0),e=new On(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Mf.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return void 0===t&&(console.warn("THREE.Box2: .getCenter() target is now required"),t=new On),this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return void 0===t&&(console.warn("THREE.Box2: .getSize() target is now required"),t=new On),this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(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(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new On),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(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(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new On),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Mf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}exports.Box2=Sf,Sf.prototype.isBox2=!0;const Tf=new Yn,Ef=new Yn;class Af{constructor(t=new Yn,e=new Yn){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new Yn),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new Yn),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new Yn),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tf.subVectors(t,this.start),Ef.subVectors(this.end,this.start);const n=Ef.dot(Ef);let r=Ef.dot(Tf)/n;return e&&(r=Fn.clamp(r,0,1)),r}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Yn),this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}function Lf(t){Xr.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}exports.Line3=Af,Lf.prototype=Object.create(Xr.prototype),Lf.prototype.constructor=Lf,Lf.prototype.isImmediateRenderObject=!0;const Rf=new Yn;class Cf extends Xr{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new ki,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];for(let s=0,o=1,a=32;s<a;s++,o++){const t=s/a*Math.PI*2,e=o/a*Math.PI*2;r.push(Math.cos(t),Math.sin(t),1,Math.cos(e),Math.sin(e),1)}n.setAttribute("position",new Ci(r,3));const i=new ru({fog:!1,toneMapped:!1});this.cone=new pu(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Rf.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Rf),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}exports.SpotLightHelper=Cf;const Pf=new Yn,Df=new wr,If=new wr;class Bf extends pu{constructor(t){const e=Nf(t),n=new ki,r=[],i=[],s=new xi(0,0,1),o=new xi(0,1,0);for(let a=0;a<e.length;a++){const t=e[a];t.parent&&t.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(s.r,s.g,s.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new Ci(r,3)),n.setAttribute("color",new Ci(i,3)),super(n,new ru({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,r=n.getAttribute("position");If.copy(this.root.matrixWorld).invert();for(let i=0,s=0;i<e.length;i++){const t=e[i];t.parent&&t.parent.isBone&&(Df.multiplyMatrices(If,t.matrixWorld),Pf.setFromMatrixPosition(Df),r.setXYZ(s,Pf.x,Pf.y,Pf.z),Df.multiplyMatrices(If,t.parent.matrixWorld),Pf.setFromMatrixPosition(Df),r.setXYZ(s+1,Pf.x,Pf.y,Pf.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}function Nf(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Nf(t.children[n]));return e}exports.SkeletonHelper=Bf;class Ff extends os{constructor(t,e,n){super(new Ep(e,4,2),new vi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}exports.PointLightHelper=Ff;const Of=new Yn,zf=new xi,Gf=new xi;class Hf extends Xr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new bp(e);r.rotateY(.5*Math.PI),this.material=new vi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),s=new Float32Array(3*i.count);r.setAttribute("color",new bi(s,3)),this.add(new os(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");zf.copy(this.light.color),Gf.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const r=t<n/2?zf:Gf;e.setXYZ(t,r.r,r.g,r.b)}e.needsUpdate=!0}t.lookAt(Of.setFromMatrixPosition(this.light.matrixWorld).negate())}}exports.HemisphereLightHelper=Hf;class Uf extends pu{constructor(t=10,e=10,n=4473924,r=8947848){n=new xi(n),r=new xi(r);const i=e/2,s=t/e,o=t/2,a=[],l=[];for(let h=0,u=0,p=-o;h<=e;h++,p+=s){a.push(-o,0,p,o,0,p),a.push(p,0,-o,p,0,o);const t=h===i?n:r;t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3}const c=new ki;c.setAttribute("position",new Ci(a,3)),c.setAttribute("color",new Ci(l,3)),super(c,new ru({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}exports.GridHelper=Uf;class kf extends pu{constructor(t=10,e=16,n=8,r=64,i=4473924,s=8947848){i=new xi(i),s=new xi(s);const o=[],a=[];for(let c=0;c<=e;c++){const n=c/e*(2*Math.PI),r=Math.sin(n)*t,l=Math.cos(n)*t;o.push(0,0,0),o.push(r,0,l);const h=1&c?i:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let c=0;c<=n;c++){const e=1&c?i:s,l=t-t/n*c;for(let t=0;t<r;t++){let n=t/r*(2*Math.PI),i=Math.sin(n)*l,s=Math.cos(n)*l;o.push(i,0,s),a.push(e.r,e.g,e.b),n=(t+1)/r*(2*Math.PI),i=Math.sin(n)*l,s=Math.cos(n)*l,o.push(i,0,s),a.push(e.r,e.g,e.b)}}const l=new ki;l.setAttribute("position",new Ci(o,3)),l.setAttribute("color",new Ci(a,3)),super(l,new ru({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}exports.PolarGridHelper=kf;const Vf=new Yn,Wf=new Yn,jf=new Yn;class qf extends Xr{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let r=new ki;r.setAttribute("position",new Ci([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const i=new ru({fog:!1,toneMapped:!1});this.lightPlane=new cu(r,i),this.add(this.lightPlane),(r=new ki).setAttribute("position",new Ci([0,0,0,0,0,1],3)),this.targetLine=new cu(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Vf.setFromMatrixPosition(this.light.matrixWorld),Wf.setFromMatrixPosition(this.light.target.matrixWorld),jf.subVectors(Wf,Vf),this.lightPlane.lookAt(Wf),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(Wf),this.targetLine.scale.z=jf.length()}}exports.DirectionalLightHelper=qf;const Xf=new Yn,Yf=new gs;class Zf extends pu{constructor(t){const e=new ki,n=new ru({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],s={},o=new xi(16755200),a=new xi(16711680),l=new xi(43775),c=new xi(16777215),h=new xi(3355443);function u(t,e,n){p(t,n),p(e,n)}function p(t,e){r.push(0,0,0),i.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(r.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",a),u("p","n2",a),u("p","n3",a),u("p","n4",a),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),e.setAttribute("position",new Ci(r,3)),e.setAttribute("color",new Ci(i,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const t=this.geometry,e=this.pointMap;Yf.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Jf("c",e,t,Yf,0,0,-1),Jf("t",e,t,Yf,0,0,1),Jf("n1",e,t,Yf,-1,-1,-1),Jf("n2",e,t,Yf,1,-1,-1),Jf("n3",e,t,Yf,-1,1,-1),Jf("n4",e,t,Yf,1,1,-1),Jf("f1",e,t,Yf,-1,-1,1),Jf("f2",e,t,Yf,1,-1,1),Jf("f3",e,t,Yf,-1,1,1),Jf("f4",e,t,Yf,1,1,1),Jf("u1",e,t,Yf,.7,1.1,-1),Jf("u2",e,t,Yf,-.7,1.1,-1),Jf("u3",e,t,Yf,0,2,-1),Jf("cf1",e,t,Yf,-1,0,1),Jf("cf2",e,t,Yf,1,0,1),Jf("cf3",e,t,Yf,0,-1,1),Jf("cf4",e,t,Yf,0,1,1),Jf("cn1",e,t,Yf,-1,0,-1),Jf("cn2",e,t,Yf,1,0,-1),Jf("cn3",e,t,Yf,0,-1,-1),Jf("cn4",e,t,Yf,0,1,-1),t.getAttribute("position").needsUpdate=!0}}function Jf(t,e,n,r,i,s,o){Xf.set(i,s,o).unproject(r);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],Xf.x,Xf.y,Xf.z)}}exports.CameraHelper=Zf;const Qf=new Qn;class Kf extends pu{constructor(t,e=16776960){const 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 ki;i.setIndex(new bi(n,1)),i.setAttribute("position",new bi(r,3)),super(i,new ru({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Qf.setFromObject(this.object),Qf.isEmpty())return;const e=Qf.min,n=Qf.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()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return pu.prototype.copy.call(this,t),this.object=t.object,this}}exports.BoxHelper=Kf;class $f extends pu{constructor(t,e=16776960){const 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 ki;r.setIndex(new bi(n,1)),r.setAttribute("position",new Ci([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new ru({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}exports.Box3Helper=$f;class tg extends cu{constructor(t,e=1,n=16776960){const r=n,i=new ki;i.setAttribute("position",new Ci([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(),super(i,new ru({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new ki;s.setAttribute("position",new Ci([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),s.computeBoundingSphere(),this.add(new os(s,new vi({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let 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?p:u,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}exports.PlaneHelper=tg;const eg=new Yn;let ng,rg;class ig extends Xr{constructor(t=new Yn(0,0,1),e=new Yn(0,0,0),n=1,r=16776960,i=.2*n,s=.2*i){super(),this.type="ArrowHelper",void 0===ng&&((ng=new ki).setAttribute("position",new Ci([0,0,0,0,1,0],3)),(rg=new Eu(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(e),this.line=new cu(ng,new ru({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new os(rg,new vi({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,s)}setDirection(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{eg.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(eg,e)}}setLength(t,e=.2*t,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()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}exports.ArrowHelper=ig;class sg extends pu{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new ki;n.setAttribute("position",new Ci(e,3)),n.setAttribute("color",new Ci([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ru({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}}exports.AxesHelper=sg;const og=new Float32Array(1),ag=new Int32Array(og.buffer),lg={toHalfFloat:function(t){og[0]=t;const e=ag[0];let n=e>>16&32768,r=e>>12&2047;const i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}};exports.DataUtils=lg;const cg=4,hg=8,ug=Math.pow(2,hg),pg=[.125,.215,.35,.446,.526,.582],dg=hg-cg+1+pg.length,mg=20,fg={[Xe]:0,[Ye]:1,[Je]:2,[Ke]:3,[$e]:4,[tn]:5,[Ze]:6},gg=new vi({side:p,depthWrite:!1,depthTest:!1}),xg=new os(new cs,gg),vg=new lm,{_lodPlanes:yg,_sizeLods:_g,_sigmas:bg}=Cg(),wg=new xi;let Mg=null;const Sg=(1+Math.sqrt(5))/2,Tg=1/Sg,Eg=[new Yn(1,1,1),new Yn(-1,1,1),new Yn(1,1,-1),new Yn(-1,1,-1),new Yn(0,Sg,Tg),new Yn(0,Sg,-Tg),new Yn(Tg,0,Sg),new Yn(-Tg,0,Sg),new Yn(Sg,Tg,0),new Yn(-Sg,Tg,0)];function Ag(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}class Lg{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Ig(mg),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Mg=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ng(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bg(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<yg.length;t++)yg[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Mg),t.scissorTest=!1,Dg(t,0,0,t.width,t.height)}_fromTexture(t){Mg=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:ut,minFilter:ut,generateMipmaps:!1,type:bt,format:zt,encoding:Rg(t)?t.encoding:Je,depthBuffer:!1},n=Pg(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Pg(e),n}_compileMaterial(t){const e=new os(yg[0],t);this._renderer.compile(e,vg)}_sceneToCubeUV(t,e,n,r){const i=new xs(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.outputEncoding,h=a.toneMapping;a.getClearColor(wg),a.toneMapping=Z,a.outputEncoding=Xe,a.autoClear=!1;let u=!1;const p=t.background;if(p){if(p.isColor){gg.color.copy(p).convertSRGBToLinear(),t.background=null;const e=Ag(gg.color);gg.opacity=e,u=!0}}else{gg.color.copy(wg).convertSRGBToLinear();const t=Ag(gg.color);gg.opacity=t,u=!0}for(let d=0;d<6;d++){const e=d%3;0==e?(i.up.set(0,s[d],0),i.lookAt(o[d],0,0)):1==e?(i.up.set(0,0,s[d]),i.lookAt(0,o[d],0)):(i.up.set(0,s[d],0),i.lookAt(0,0,o[d])),Dg(r,e*ug,d>2?ug:0,ug,ug),a.setRenderTarget(r),u&&a.render(xg,i),a.render(t,i)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ng()):null==this._equirectShader&&(this._equirectShader=Bg());const r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new os(yg[0],r),s=r.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=fg[t.encoding],s.outputEncoding.value=fg[e.texture.encoding],Dg(e,0,0,3*ug,2*ug),n.setRenderTarget(e),n.render(i,vg)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;r<dg;r++){const e=Math.sqrt(bg[r]*bg[r]-bg[r-1]*bg[r-1]),n=Eg[(r-1)%Eg.length];this._blur(t,r-1,r,e,n)}e.autoClear=n}_blur(t,e,n,r,i){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,r,"latitudinal",i),this._halfBlur(s,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new os(yg[r],l),h=l.uniforms,u=_g[n]-1,p=isFinite(i)?Math.PI/(2*u):2*Math.PI/(2*mg-1),d=i/p,m=isFinite(i)?1+Math.floor(3*d):mg;m>mg&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${mg}`);const f=[];let g=0;for(let v=0;v<mg;++v){const t=v/d,e=Math.exp(-t*t/2);f.push(e),0==v?g+=e:v<m&&(g+=2*e)}for(let v=0;v<f.length;v++)f[v]=f[v]/g;h.envMap.value=t.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o),h.dTheta.value=p,h.mipInt.value=hg-n,h.inputEncoding.value=fg[t.texture.encoding],h.outputEncoding.value=fg[t.texture.encoding];const x=_g[r];Dg(e,3*Math.max(0,ug-2*x),(0===r?0:2*ug)+2*x*(r>hg-cg?r-hg+cg:0),3*x,2*x),a.setRenderTarget(e),a.render(c,vg)}}function Rg(t){return void 0!==t&&t.type===bt&&(t.encoding===Xe||t.encoding===Ye||t.encoding===Ze)}function Cg(){const t=[],e=[],n=[];let r=hg;for(let i=0;i<dg;i++){const s=Math.pow(2,r);e.push(s);let o=1/s;i>hg-cg?o=pg[i-hg+cg-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,p=6,d=3,m=2,f=1,g=new Float32Array(d*p*u),x=new Float32Array(m*p*u),v=new Float32Array(f*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,d*p*t),x.set(h,m*p*t);const i=[t,t,t,t,t,t];v.set(i,f*p*t)}const y=new ki;y.setAttribute("position",new bi(g,d)),y.setAttribute("uv",new bi(x,m)),y.setAttribute("faceIndex",new bi(v,f)),t.push(y),r>cg&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Pg(t){const e=new jn(3*ug,3*ug,t);return e.texture.mapping=ot,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Dg(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ig(t){const e=new Float32Array(t),n=new Yn(0,1,0);return new Np({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Og()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Bg(){const t=new On(1,1);return new Np({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Og()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Ng(){return new Np({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:fg[Xe]},outputEncoding:{value:fg[Xe]}},vertexShader:Fg(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Og()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:g,depthTest:!1,depthWrite:!1})}function Fg(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Og(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}exports.PMREMGenerator=Lg;const zg=0;exports.LineStrip=0;const Gg=1;exports.LinePieces=1;const Hg=0;exports.NoColors=0;const Ug=1;exports.FaceColors=1;const kg=2;function Vg(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Wg(t=[]){return 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 jg(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yu(t,e)}function qg(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Oh(t)}function Xg(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yu(t,e)}function Yg(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Zg(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Jg(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new mu(t)}function Qg(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Yn(t,e,n)}function Kg(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new bi(t,e).setUsage(Mn)}function $g(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wi(t,e)}function tx(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mi(t,e)}function ex(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Si(t,e)}function nx(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ti(t,e)}function rx(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ei(t,e)}function ix(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ai(t,e)}function sx(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Li(t,e)}function ox(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Ci(t,e)}function ax(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Pi(t,e)}function lx(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new sg(t)}function cx(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Kf(t,e)}function hx(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new pu(new Bu(t.geometry),new ru({color:void 0!==e?e:16777215}))}function ux(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new pu(new Dp(t.geometry),new ru({color:void 0!==e?e:16777215}))}function px(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new pd(t)}function dx(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new xd(t)}function mx(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ws(t,n)}function fx(){console.error("THREE.CanvasRenderer has been removed")}function gx(){console.error("THREE.JSONLoader has been removed.")}exports.VertexColors=2,yd.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(yd.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Xd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Uf.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bf.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hd.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),gm.extractUrlBase(t)},hd.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.")}},Sf.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Sf.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Sf.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Sf.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Qn.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Qn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Qn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Qn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},dr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Af.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fn.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},Fn.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Fn.floorPowerOfTwo(t)},Fn.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Fn.ceilPowerOfTwo(t)},zn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},zn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},zn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},zn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},zn.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},wr.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},wr.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},wr.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Yn).setFromMatrixColumn(this,3)},wr.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},wr.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},wr.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},wr.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},wr.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},wr.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},wr.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},wr.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},wr.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},wr.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},wr.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},wr.prototype.makeFrustum=function(t,e,n,r,i,s){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,s)},wr.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Qr.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Xn.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Xn.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},br.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},br.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},br.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},li.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},li.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},li.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},li.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},li.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},li.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),li.getBarycoord(t,e,n,r,i)},li.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),li.getNormal(t,e,n,r)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new gp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Sp(this,t)},On.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},On.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},On.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Yn.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Yn.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Yn.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Yn.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Yn.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Yn.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Yn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Yn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Yn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Wn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xr.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xr.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xr.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xr.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xr.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xr.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.")}}}),os.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(os.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Uh.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Qh.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Xh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(yd.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}}),xs.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(Zd.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(bi.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===Mn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Mn)}}}),bi.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},bi.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},bi.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ki.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ki.prototype.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 bi(arguments[1],arguments[2])))},ki.prototype.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)},ki.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ki.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ki.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ki.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ki.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(xm.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(vf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(_h.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Mn},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),_h.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Mn:wn),this},_h.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},gp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},gp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},gp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},yh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(ff.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(hi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},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(zp.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(Op.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(fs.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}}}),fh.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)},fh.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},fh.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},fh.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},fh.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},fh.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},fh.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},fh.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},fh.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},fh.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},fh.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},fh.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},fh.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},fh.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},fh.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},fh.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},fh.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},fh.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},fh.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},fh.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},fh.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},fh.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},fh.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},fh.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},fh.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(fh.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()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Ye:Xe}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(sh.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(jn.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(jm.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Dm).load(t,function(t){e.setBuffer(t)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Qm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},_s.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},_s.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Hn.crossOrigin=void 0,Hn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new vd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new gd;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},Hn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Hn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const xx={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vx(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}exports.SceneUtils=xx,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"126"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="126");
  3. },{}],"pBGv":[function(require,module,exports) {
  4. var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
  5. },{}],"UUq2":[function(require,module,exports) {
  6. var process = require("process");
  7. var r=require("process");function t(r,t){for(var e=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r){"string"!=typeof r&&(r+="");var t,e=0,n=-1,o=!0;for(t=r.length-1;t>=0;--t)if(47===r.charCodeAt(t)){if(!o){e=t+1;break}}else-1===n&&(o=!1,n=t+1);return-1===n?"":r.slice(e,n)}function n(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}exports.resolve=function(){for(var e="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var i=s>=0?arguments[s]:r.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(e=i+"/"+e,o="/"===i.charAt(0))}return(o?"/":"")+(e=t(n(e.split("/"),function(r){return!!r}),!o).join("/"))||"."},exports.normalize=function(r){var e=exports.isAbsolute(r),s="/"===o(r,-1);return(r=t(n(r.split("/"),function(r){return!!r}),!e).join("/"))||e||(r="."),r&&s&&(r+="/"),(e?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(n(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),s=Math.min(n.length,o.length),i=s,u=0;u<s;u++)if(n[u]!==o[u]){i=u;break}var f=[];for(u=i;u<n.length;u++)f.push("..");return(f=f.concat(o.slice(i))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){if("string"!=typeof r&&(r+=""),0===r.length)return".";for(var t=r.charCodeAt(0),e=47===t,n=-1,o=!0,s=r.length-1;s>=1;--s)if(47===(t=r.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?e?"/":".":e&&1===n?"/":r.slice(0,n)},exports.basename=function(r,t){var n=e(r);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},exports.extname=function(r){"string"!=typeof r&&(r+="");for(var t=-1,e=0,n=-1,o=!0,s=0,i=r.length-1;i>=0;--i){var u=r.charCodeAt(i);if(47!==u)-1===n&&(o=!1,n=i+1),46===u?-1===t?t=i:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){e=i+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===e+1?"":r.slice(t,n)};var o="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return t<0&&(t=r.length+t),r.substr(t,e)};
  8. },{"process":"pBGv"}],"U1HP":[function(require,module,exports) {
  9. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.urlJoin=u;var r=e(require("path"));function e(r){return r&&r.__esModule?r:{default:r}}function t(r){return o(r)||a(r)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function a(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}function o(r){if(Array.isArray(r)){for(var e=0,t=new Array(r.length);e<r.length;e++)t[e]=r[e];return t}}function u(){for(var e=/^[a-zA-Z]+:\/\//,n=-1,a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];for(var i=0,l=o.length;i<l;i++)e.test(o[i])&&(n=i);if(-1===n)return r.default.join.apply(r.default,o).replace(/\\/g,"/");var f=n<=0?o:o.slice(n),c=f[0].match(e)[0];return f[0]=f[0].substring(c.length),(c+r.default.join.apply(r.default,t(f))).replace(/\\/g,"/")}
  10. },{"path":"UUq2"}],"upKt":[function(require,module,exports) {
  11. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}function n(e){Promise.resolve().then(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.LRUCache=void 0;var s=function(){function t(){e(this,t),this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;var i=this.itemSet;this.defaultPriorityCallback=function(e){return i.get(e)}}return i(t,[{key:"isFull",value:function(){return this.itemSet.size>=this.maxSize}},{key:"add",value:function(e,t){var i=this.itemSet;if(i.has(e))return!1;if(this.isFull())return!1;var n=this.usedSet,s=this.itemList,a=this.callbacks;return s.push(e),n.add(e),i.set(e,Date.now()),a.set(e,t),!0}},{key:"remove",value:function(e){var t=this.usedSet,i=this.itemSet,n=this.itemList,s=this.callbacks;if(i.has(e)){s.get(e)(e);var a=n.indexOf(e);return n.splice(a,1),t.delete(e),i.delete(e),s.delete(e),!0}return!1}},{key:"markUsed",value:function(e){var t=this.itemSet,i=this.usedSet;t.has(e)&&!i.has(e)&&(t.set(e,Date.now()),i.add(e))}},{key:"markAllUnused",value:function(){this.usedSet.clear()}},{key:"unloadUnusedContent",value:function(){var e=this.unloadPercent,t=this.minSize,i=this.itemList,n=this.itemSet,s=this.usedSet,a=this.callbacks,r=i.length-s.size,l=i.length-t,u=this.unloadPriorityCallback||this.defaultPriorityCallback;if(l>0&&r>0){i.sort(function(e,t){var i=s.has(e),n=s.has(t);return i&&n?0:i||n?i?1:-1:u(t)-u(e)});var h=Math.min(l,r),o=Math.max(t*e,h*e),c=Math.min(o,r);c=Math.ceil(c);for(var d=i.splice(0,c),f=0,v=d.length;f<v;f++){var m=d[f];a.get(m)(m),n.delete(m),a.delete(m)}}}},{key:"scheduleUnload",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scheduled||(this.scheduled=!0,n(function(){e.scheduled=!1,e.unloadUnusedContent(),t&&e.markAllUnused()}))}}]),t}();exports.LRUCache=s;
  12. },{}],"MK9K":[function(require,module,exports) {
  13. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.PriorityQueue=void 0;var r=function(){function t(){e(this,t),this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=function(){throw new Error("PriorityQueue: PriorityCallback function not defined.")}}return i(t,[{key:"sort",value:function(){var e=this.priorityCallback;this.items.sort(function(t,i){return e(t)-e(i)})}},{key:"add",value:function(e,t){var i=this;return new Promise(function(r,n){var o=i.items,s=i.callbacks;o.push(e),s.set(e,function(){return t.apply(void 0,arguments).then(r).catch(n)}),i.autoUpdate&&i.scheduleJobRun()})}},{key:"remove",value:function(e){var t=this.items,i=this.callbacks,r=t.indexOf(e);-1!==r&&(t.splice(r,1),i.delete(e))}},{key:"tryRunJobs",value:function(){var e=this;this.sort();for(var t=this.items,i=this.callbacks,r=this.maxJobs,n=this.currJobs;r>n&&t.length>0;){n++;var o=t.pop(),s=i.get(o);i.delete(o),s(o).then(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()}).catch(function(){e.currJobs--,e.autoUpdate&&e.scheduleJobRun()})}this.currJobs=n}},{key:"scheduleJobRun",value:function(){var e=this;this.scheduled||(requestAnimationFrame(function(){e.tryRunJobs(),e.scheduled=!1}),this.scheduled=!0)}}]),t}();exports.PriorityQueue=r;
  14. },{}],"ci3X":[function(require,module,exports) {
  15. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FAILED=exports.LOADED=exports.PARSING=exports.LOADING=exports.UNLOADED=void 0;var e=0;exports.UNLOADED=e;var r=1;exports.LOADING=r;var t=2;exports.PARSING=t;var o=3;exports.LOADED=o;var s=4;exports.FAILED=s;
  16. },{}],"oQJ2":[function(require,module,exports) {
  17. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.traverseSet=a,exports.determineFrustumSet=l,exports.markUsedSetLeaves=s,exports.skipTraversal=d,exports.toggleTiles=o;var e=require("./constants.js");function t(t){return t===e.LOADED||t===e.FAILED}function r(e,t){return e.__lastFrameVisited===t&&e.__used}function _(e,t){e.__lastFrameVisited!==t&&(e.__lastFrameVisited=t,e.__used=!1,e.__inFrustum=!1,e.__isLeaf=!1,e.__visible=!1,e.__active=!1,e.__error=0,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1)}function i(e,t,r){if(_(e,t),e.__used=!0,r.markUsed(e),e.__contentEmpty)for(var n=e.children,a=0,l=n.length;a<l;a++)i(n[a],t,r)}function n(e,r,_){if(e.__contentEmpty&&(!e.__externalTileSet||t(e.__loadingState)))for(var i=e.children,a=0,l=i.length;a<l;a++){var s=i[a];s.__depthFromRenderedParent=r,n(s,r,_)}else _.requestTileContents(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,_=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(t&&t(e,_,i))r&&r(e,_,i);else{for(var n=e.children,l=0,s=n.length;l<s;l++)a(n[l],t,r,e,i+1);r&&r(e,_,i)}}function l(e,t){var r=t.stats,n=t.frameCount,a=t.errorTarget,s=t.maxDepth,d=t.loadSiblings,o=t.lruCache,u=t.stopAtEmptyTiles;if(_(e,n),!1===t.tileInView(e))return!1;if(e.__used=!0,o.markUsed(e),e.__inFrustum=!0,r.inFrustum++,(u||!e.__contentEmpty)&&!e.__externalTileSet){var v=t.calculateError(e);if(e.__error=v,v<=a)return!0;if(t.maxDepth>0&&e.__depth+1>=s)return!0}for(var c=!1,f=e.children,h=0,m=f.length;h<m;h++){var p=l(f[h],t);c=c||p}if(c&&d)for(var g=0,F=f.length;g<F;g++){i(f[g],n,o)}return!0}function s(_,i){var n=i.stats,a=i.frameCount;if(r(_,a)){n.used++;for(var l=_.children,d=!1,o=0,u=l.length;o<u;o++){var v=l[o];d=d||r(v,a)}if(d){for(var c=!1,f=!0,h=0,m=l.length;h<m;h++){var p=l[h];if(s(p,i),c=c||p.__wasSetVisible||p.__childrenWereVisible,r(p,a)){var g=p.__allChildrenLoaded||!p.__contentEmpty&&t(p.__loadingState)||p.__externalTileSet&&p.__loadingState===e.FAILED;f=f&&g}}_.__childrenWereVisible=c,_.__allChildrenLoaded=f}else _.__isLeaf=!0}}function d(_,i){var a=i.stats,l=i.frameCount;if(r(_,l)){var s=_.parent,o=s?s.__depthFromRenderedParent:-1;_.__depthFromRenderedParent=o;var u=i.lruCache;if(_.__isLeaf)return _.__depthFromRenderedParent++,void(_.__loadingState===e.LOADED?(_.__inFrustum&&(_.__visible=!0,a.visible++),_.__active=!0,a.active++):u.isFull()||_.__contentEmpty&&!_.__externalTileSet||i.requestTileContents(_));var v=(i.errorTarget+1)*i.errorThreshold,c=_.__error<=v,f=c||"ADD"===_.refine,h=!_.__contentEmpty,m=h||_.__externalTileSet,p=t(_.__loadingState)&&m,g=_.__childrenWereVisible,F=_.children,S=_.__allChildrenLoaded;if(f&&h&&_.__depthFromRenderedParent++,f&&!p&&!u.isFull()&&m&&i.requestTileContents(_),(c&&!S&&!g&&p||"ADD"===_.refine&&p)&&(_.__inFrustum&&(_.__visible=!0,a.visible++),_.__active=!0,a.active++),"ADD"!==_.refine&&c&&!S&&p)for(var T=0,b=F.length;T<b;T++){var D=F[T];r(D,l)&&!u.isFull()&&(D.__depthFromRenderedParent=_.__depthFromRenderedParent+1,n(D,D.__depthFromRenderedParent,i))}else for(var L=0,E=F.length;L<E;L++){var x=F[L];r(x,l)&&d(x,i)}}}function o(t,_){var i=r(t,_.frameCount);if(i||t.__usedLastFrame){var n=!1,a=!1;i&&(n=t.__active,a=_.displayActiveTiles&&t.__active||t.__visible),t.__contentEmpty||t.__loadingState!==e.LOADED||(t.__wasSetActive!==n&&_.setTileActive(t,n),t.__wasSetVisible!==a&&_.setTileVisible(t,a)),t.__wasSetActive=n,t.__wasSetVisible=a,t.__usedLastFrame=i;for(var l=t.children,s=0,d=l.length;s<d;s++){o(l[s],_)}}}
  18. },{"./constants.js":"ci3X"}],"svb9":[function(require,module,exports) {
  19. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesRendererBase=void 0;var e=a(require("path")),t=require("../utilities/urlJoin.js"),n=require("../utilities/LRUCache.js"),r=require("../utilities/PriorityQueue.js"),i=require("./traverseFunctions.js"),o=require("./constants.js");function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),e}var c=function(e){return 1/(e.__depthFromRenderedParent+1)},d=function(){function a(e){s(this,a),this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;var t=new n.LRUCache;t.unloadPriorityCallback=c;var i=new r.PriorityQueue;i.maxJobs=4,i.priorityCallback=c;var o=new r.PriorityQueue;o.maxJobs=1,o.priorityCallback=c,this.lruCache=t,this.downloadQueue=i,this.parseQueue=o,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0}return u(a,[{key:"rootTileSet",get:function(){var e=this.tileSets[this.rootURL];return!e||e instanceof Promise?null:e}},{key:"root",get:function(){var e=this.rootTileSet;return e?e.root:null}}]),u(a,[{key:"traverse",value:function(e,t){var n=this.tileSets[this.rootURL];n&&n.root&&(0,i.traverseSet)(n.root,e,t)}},{key:"update",value:function(){var e=this.stats,t=this.lruCache,n=this.tileSets,r=n[this.rootURL];if(this.rootURL in n){if(r&&r.root){var o=r.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,(0,i.determineFrustumSet)(o,this),(0,i.markUsedSetLeaves)(o,this),(0,i.skipTraversal)(o,this),(0,i.toggleTiles)(o,this),t.scheduleUnload()}}else this.loadRootTileSet(this.rootURL)}},{key:"parseTile",value:function(e,t,n){return null}},{key:"disposeTile",value:function(e){}},{key:"preprocessNode",value:function(e,n,r){if(e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.uri&&(e.content.uri=(0,t.urlJoin)(r,e.content.uri)),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=n,e.children=e.children||[],e.content&&e.content.uri){var i=/\.json$/i.test(e.content.uri);e.__externalTileSet=i,e.__contentEmpty=i}else e.__externalTileSet=!1,e.__contentEmpty=!0;e.__error=0,e.__inFrustum=!1,e.__isLeaf=!1,e.__usedLastFrame=!1,e.__used=!1,e.__wasSetVisible=!1,e.__visible=!1,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1,e.__wasSetActive=!1,e.__active=!1,e.__loadingState=o.UNLOADED,e.__loadIndex=0,e.__loadAbort=null,e.__depthFromRenderedParent=-1,null===n?(e.__depth=0,e.refine=e.refine||"REPLACE"):(e.__depth=n.__depth+1,e.refine=e.refine||n.refine)}},{key:"setTileActive",value:function(e,t){}},{key:"setTileVisible",value:function(e,t){}},{key:"calculateError",value:function(e){return 0}},{key:"tileInView",value:function(e){return!0}},{key:"fetchTileSet",value:function(t,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return fetch(t,n).then(function(e){if(e.ok)return e.json();throw new Error('TilesRenderer: Failed to load tileset "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText))}).then(function(n){var a=n.asset.version;console.assert("1.0"===a||"0.0"===a,'asset.version is expected to be a string of "1.0" or "0.0"');var s=e.default.dirname(t);return(0,i.traverseSet)(n.root,function(e,t){return r.preprocessNode(e,t,s)},null,o,o?o.__depth:0),n})}},{key:"loadRootTileSet",value:function(e){var t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);var n=this.fetchTileSet(e,this.fetchOptions).then(function(n){t[e]=n});return n.catch(function(n){console.error(n),t[e]=n}),t[e]=n,n}},{key:"requestTileContents",value:function(e){var t=this;if(e.__loadingState===o.UNLOADED){var n=this.stats,r=this.lruCache,i=this.downloadQueue,a=this.parseQueue,s=e.__externalTileSet;r.add(e,function(e){e.__loadingState===o.LOADING?(e.__loadAbort.abort(),e.__loadAbort=null):s?e.children.length=0:t.disposeTile(e),e.__loadingState===o.LOADING?n.downloading--:e.__loadingState===o.PARSING&&n.parsing--,e.__loadingState=o.UNLOADED,e.__loadIndex++,a.remove(e),i.remove(e)}),e.__loadIndex++;var l=e.__loadIndex,u=new AbortController,c=u.signal;n.downloading++,e.__loadAbort=u,e.__loadingState=o.LOADING;var d=function(t){e.__loadIndex===l&&("AbortError"!==t.name?(a.remove(e),i.remove(e),e.__loadingState===o.PARSING?n.parsing--:e.__loadingState===o.LOADING&&n.downloading--,n.failed++,console.error('TilesRenderer : Failed to load tile at url "'.concat(e.content.uri,'".')),console.error(t),e.__loadingState=o.FAILED):r.remove(e))};s?i.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return t.fetchTileSet(n,Object.assign({signal:c},t.fetchOptions),e)}).then(function(t){e.__loadIndex===l&&(n.downloading--,e.__loadAbort=null,e.__loadingState=o.LOADED,e.children.push(t.root))}).catch(d):i.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=t.preprocessURL?t.preprocessURL(e.content.uri):e.content.uri;return fetch(n,Object.assign({signal:c},t.fetchOptions))}).then(function(t){if(e.__loadIndex===l){if(t.ok)return t.arrayBuffer();throw new Error("Failed to load model with error code ".concat(t.status))}}).then(function(r){if(e.__loadIndex===l)return n.downloading--,n.parsing++,e.__loadAbort=null,e.__loadingState=o.PARSING,a.add(e,function(e){if(e.__loadIndex!==l)return Promise.resolve();var n=e.content.uri.split(/\./g).pop();return t.parseTile(r,e,n)})}).then(function(){e.__loadIndex===l&&(n.parsing--,e.__loadingState=o.LOADED,e.__wasSetVisible&&t.setTileVisible(e,!0),e.__wasSetActive&&t.setTileActive(e,!0))}).catch(d)}}},{key:"dispose",value:function(){var e=this.lruCache;this.traverse(function(t){e.remove(t)})}}]),a}();exports.TilesRendererBase=d;
  20. },{"path":"UUq2","../utilities/urlJoin.js":"U1HP","../utilities/LRUCache.js":"upKt","../utilities/PriorityQueue.js":"MK9K","./traverseFunctions.js":"oQJ2","./constants.js":"ci3X"}],"M3Ed":[function(require,module,exports) {
  21. "use strict";function r(r){for(var e="",t=0,o=r.length;t<o;t++)e+=String.fromCharCode(r[t]);return e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayToString=r;
  22. },{}],"ON7I":[function(require,module,exports) {
  23. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BatchTable=exports.FeatureTable=void 0;var e=require("./arrayToString.js");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?n(e):r}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(e,t,r){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=a(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function a(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),e}var y=function(){function t(r,n,o,a){f(this,t),this.buffer=r,this.binOffset=n+o,this.binLength=a;var i=null;if(0!==o){var u=new Uint8Array(r,n,o);i=JSON.parse((0,e.arrayToString)(u))}else i={};this.header=i}return s(t,[{key:"getKeys",value:function(){return Object.keys(this.header)}},{key:"getData",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=this.header;if(!(e in o))return null;var a=o[e];if(a instanceof Object){if(Array.isArray(a))return a;var i,u,c=this.buffer,f=this.binOffset,l=this.binLength,s=a.byteOffset||0,y=a.type||n,b=a.componentType||r;if("type"in a&&n&&a.type!==n)throw new Error("FeatureTable: Specified type does not match expected type.");switch(y){case"SCALAR":i=1;break;case"VEC2":i=2;break;case"VEC3":i=3;break;case"VEC4":i=4;break;default:throw new Error('FeatureTable : Feature type not provided for "'.concat(e,'".'))}var p=f+s,h=t*i;switch(b){case"BYTE":u=new Int8Array(c,p,h);break;case"UNSIGNED_BYTE":u=new Uint8Array(c,p,h);break;case"SHORT":u=new Int16Array(c,p,h);break;case"UNSIGNED_SHORT":u=new Uint16Array(c,p,h);break;case"INT":u=new Int32Array(c,p,h);break;case"UNSIGNED_INT":u=new Uint32Array(c,p,h);break;case"FLOAT":u=new Float32Array(c,p,h);break;case"DOUBLE":u=new Float64Array(c,p,h);break;default:throw new Error('FeatureTable : Feature component type not provided for "'.concat(e,'".'))}if(p+h*u.BYTES_PER_ELEMENT>f+l)throw new Error("FeatureTable: Feature data read outside binary body length.");return u}return a}}]),t}();exports.FeatureTable=y;var b=function(e){function t(e,n,o,a,u){var c;return f(this,t),(c=r(this,i(t).call(this,e,o,a,u))).batchSize=n,c}return u(t,y),s(t,[{key:"getData",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return o(i(t.prototype),"getData",this).call(this,e,this.batchSize,n,r)}}]),t}();exports.BatchTable=b;
  24. },{"./arrayToString.js":"M3Ed"}],"DNWc":[function(require,module,exports) {
  25. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.B3DMLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}var a=function(){function r(){t(this,r),this.fetchOptions={}}return n(r,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(e){return t.parse(e)})}},{key:"parse",value:function(t){var r=new DataView(t),n=String.fromCharCode(r.getUint8(0))+String.fromCharCode(r.getUint8(1))+String.fromCharCode(r.getUint8(2))+String.fromCharCode(r.getUint8(3));console.assert("b3dm"===n);var a=r.getUint32(4,!0);console.assert(1===a);var o=r.getUint32(8,!0);console.assert(o===t.byteLength);var i=r.getUint32(12,!0),s=r.getUint32(16,!0),u=r.getUint32(20,!0),c=r.getUint32(24,!0),l=t.slice(28,28+i+s),f=new e.FeatureTable(l,0,i,s),h=28+i+s,g=t.slice(h,h+u+c),b=new e.BatchTable(g,f.getData("BATCH_LENGTH"),0,u,c),v=h+u+c;return{version:a,featureTable:f,batchTable:b,glbBytes:new Uint8Array(t,v,o-v)}}}]),r}();exports.B3DMLoaderBase=a;
  26. },{"../utilities/FeatureTable.js":"ON7I"}],"O6i0":[function(require,module,exports) {
  27. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GLTFLoader=void 0;var e=require("../../../build/three.module.js"),t=function(){function t(t){e.Loader.call(this,t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new i(e)}),this.register(function(e){return new l(e)}),this.register(function(e){return new u(e)}),this.register(function(e){return new o(e)}),this.register(function(e){return new n(e)}),this.register(function(e){return new c(e)})}function r(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}t.prototype=Object.assign(Object.create(e.Loader.prototype),{constructor:t,load:function(t,r,s,n){var a,i=this;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:e.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var o=function(e){n?n(e):console.error(e),i.manager.itemError(t),i.manager.itemEnd(t)},l=new e.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,function(e){try{i.parse(e,a,function(e){r(e),i.manager.itemEnd(t)},o)}catch(s){o(s)}},s,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(t,r,n,i){var o,l={},u={};if("string"==typeof t)o=t;else if(e.LoaderUtils.decodeText(new Uint8Array(t,0,4))===p){try{l[s.KHR_BINARY_GLTF]=new f(t)}catch(R){return void(i&&i(R))}o=l[s.KHR_BINARY_GLTF].content}else o=e.LoaderUtils.decodeText(new Uint8Array(t));var c=JSON.parse(o);if(void 0===c.asset||c.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var h=new K(c,{path:r||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(var d=0;d<this.pluginCallbacks.length;d++){var v=this.pluginCallbacks[d](h);u[v.name]=v,l[v.name]=!0}if(c.extensionsUsed)for(d=0;d<c.extensionsUsed.length;++d){var x=c.extensionsUsed[d],M=c.extensionsRequired||[];switch(x){case s.KHR_MATERIALS_UNLIT:l[x]=new a;break;case s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:l[x]=new T;break;case s.KHR_DRACO_MESH_COMPRESSION:l[x]=new m(c,this.dracoLoader);break;case s.KHR_TEXTURE_TRANSFORM:l[x]=new g;break;case s.KHR_MESH_QUANTIZATION:l[x]=new y;break;default:M.indexOf(x)>=0&&void 0===u[x]&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}h.setExtensions(l),h.setPlugins(u),h.parse(n,i)}}});var s={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};function n(e){this.parser=e,this.name=s.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=s.KHR_MATERIALS_UNLIT}function i(e){this.parser=e,this.name=s.KHR_MATERIALS_CLEARCOAT}function o(e){this.parser=e,this.name=s.KHR_MATERIALS_TRANSMISSION}function l(e){this.parser=e,this.name=s.KHR_TEXTURE_BASISU}function u(e){this.parser=e,this.name=s.EXT_TEXTURE_WEBP,this.isSupported=null}function c(e){this.name=s.EXT_MESHOPT_COMPRESSION,this.parser=e}n.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,s=t.length;r<s;r++){var n=t[r];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}},n.prototype._loadLight=function(t){var r=this.parser,s="light:"+t,n=r.cache.get(s);if(n)return n;var a,i=r.json,o=((i.extensions&&i.extensions[this.name]||{}).lights||[])[t],l=new e.Color(16777215);void 0!==o.color&&l.fromArray(o.color);var u=void 0!==o.range?o.range:0;switch(o.type){case"directional":(a=new e.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new e.PointLight(l)).distance=u;break;case"spot":(a=new e.SpotLight(l)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,void 0!==o.intensity&&(a.intensity=o.intensity),a.name=r.createUniqueName(o.name||"light_"+t),n=Promise.resolve(a),r.cache.add(s,n),n},n.prototype.createNodeAttachment=function(e){var t=this,r=this.parser,s=r.json.nodes[e],n=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})},a.prototype.getMaterialType=function(){return e.MeshBasicMaterial},a.prototype.extendParams=function(t,r,s){var n=[];t.color=new e.Color(1,1,1),t.opacity=1;var a=r.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var i=a.baseColorFactor;t.color.fromArray(i),t.opacity=i[3]}void 0!==a.baseColorTexture&&n.push(s.assignTexture(t,"map",a.baseColorTexture))}return Promise.all(n)},i.prototype.getMaterialType=function(t){var r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null},i.prototype.extendMaterialParams=function(t,r){var s=this.parser,n=s.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],i=n.extensions[this.name];if(void 0!==i.clearcoatFactor&&(r.clearcoat=i.clearcoatFactor),void 0!==i.clearcoatTexture&&a.push(s.assignTexture(r,"clearcoatMap",i.clearcoatTexture)),void 0!==i.clearcoatRoughnessFactor&&(r.clearcoatRoughness=i.clearcoatRoughnessFactor),void 0!==i.clearcoatRoughnessTexture&&a.push(s.assignTexture(r,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),void 0!==i.clearcoatNormalTexture&&(a.push(s.assignTexture(r,"clearcoatNormalMap",i.clearcoatNormalTexture)),void 0!==i.clearcoatNormalTexture.scale)){var o=i.clearcoatNormalTexture.scale;r.clearcoatNormalScale=new e.Vector2(o,-o)}return Promise.all(a)},o.prototype.getMaterialType=function(t){var r=this.parser.json.materials[t];return r.extensions&&r.extensions[this.name]?e.MeshPhysicalMaterial:null},o.prototype.extendMaterialParams=function(e,t){var r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();var n=[],a=s.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)},l.prototype.loadTexture=function(e){var t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;var n=s.extensions[this.name],a=r.images[n.source],i=t.options.ktx2Loader;if(!i){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,i)},u.prototype.loadTexture=function(e){var t=this.name,r=this.parser,s=r.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],i=s.images[a.source],o=r.textureLoader;if(i.uri){var l=r.options.manager.getHandler(i.uri);null!==l&&(o=l)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,i,o);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported},c.prototype.loadBufferView=function(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var s=r.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then(function(e){var t=s.byteOffset||0,r=s.byteLength||0,n=s.count,i=s.byteStride,o=new ArrayBuffer(n*i),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,i,l,s.mode,s.filter),o})}return null};var p="glTF",h=12,d={JSON:1313821514,BIN:5130562};function f(t){this.name=s.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,h);if(this.header={magic:e.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==p)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-h,a=new DataView(t,h),i=0;i<n;){var o=a.getUint32(i,!0);i+=4;var l=a.getUint32(i,!0);if(i+=4,l===d.JSON){var u=new Uint8Array(t,h+i,o);this.content=e.LoaderUtils.decodeText(u)}else if(l===d.BIN){var c=h+i;this.body=t.slice(c,c+o)}i+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function m(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=s.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function g(){this.name=s.KHR_TEXTURE_TRANSFORM}function v(t){e.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var r=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),i=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),o={specular:{value:(new e.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var t in o)e.uniforms[t]=o[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",r).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",n).replace("#include <metalnessmap_fragment>",a).replace("#include <lights_physical_fragment>",i)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function T(){return{name:s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return v},extendParams:function(t,r,s){var n=r.extensions[this.name];t.color=new e.Color(1,1,1),t.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var i=n.diffuseFactor;t.color.fromArray(i),t.opacity=i[3]}if(void 0!==n.diffuseTexture&&a.push(s.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new e.Color(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new e.Color(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(s.assignTexture(t,"glossinessMap",o)),a.push(s.assignTexture(t,"specularMap",o))}return Promise.all(a)},createMaterial:function(t){var r=new v(t);return r.fog=!0,r.color=t.color,r.map=void 0===t.map?null:t.map,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=void 0===t.aoMap?null:t.aoMap,r.aoMapIntensity=1,r.emissive=t.emissive,r.emissiveIntensity=1,r.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,r.bumpMap=void 0===t.bumpMap?null:t.bumpMap,r.bumpScale=1,r.normalMap=void 0===t.normalMap?null:t.normalMap,r.normalMapType=e.TangentSpaceNormalMap,t.normalScale&&(r.normalScale=t.normalScale),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=void 0===t.specularMap?null:t.specularMap,r.specular=t.specular,r.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,r.glossiness=t.glossiness,r.alphaMap=null,r.envMap=void 0===t.envMap?null:t.envMap,r.envMapIntensity=1,r.refractionRatio=.98,r}}}function y(){this.name=s.KHR_MESH_QUANTIZATION}function x(t,r,s,n){e.Interpolant.call(this,t,r,s,n)}m.prototype.decodePrimitive=function(e,t){var r=this.json,s=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,i={},o={},l={};for(var u in a){var c=O[u]||u.toLowerCase();i[c]=a[u]}for(u in e.attributes){c=O[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],h=w[p.componentType];l[c]=h,o[c]=!0===p.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t){s.decodeDracoFile(e,function(e){for(var r in e.attributes){var s=e.attributes[r],n=o[r];void 0!==n&&(s.normalized=n)}t(e)},i,l)})})},g.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},v.prototype=Object.create(e.MeshStandardMaterial.prototype),v.prototype.constructor=v,v.prototype.copy=function(t){return e.MeshStandardMaterial.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},x.prototype=Object.create(e.Interpolant.prototype),x.prototype.constructor=x,x.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,n=e*s*3+s,a=0;a!==s;a++)t[a]=r[n+a];return t},x.prototype.beforeStart_=x.prototype.copySampleValue_,x.prototype.afterEnd_=x.prototype.copySampleValue_,x.prototype.interpolate_=function(e,t,r,s){for(var n=this.resultBuffer,a=this.sampleValues,i=this.valueSize,o=2*i,l=3*i,u=s-t,c=(r-t)/u,p=c*c,h=p*c,d=e*l,f=d-l,m=-2*h+3*p,g=h-p,v=1-m,T=g-p+c,y=0;y!==i;y++){var x=a[f+y+i],M=a[f+y+o]*u,R=a[d+y+i],S=a[d+y]*u;n[y]=v*x+T*M+m*R+g*S}return n};var M=0,R=1,S=2,A=3,_=4,E=5,L=6,w={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},b={9728:e.NearestFilter,9729:e.LinearFilter,9984:e.NearestMipmapNearestFilter,9985:e.LinearMipmapNearestFilter,9986:e.NearestMipmapLinearFilter,9987:e.LinearMipmapLinearFilter},I={33071:e.ClampToEdgeWrapping,33648:e.MirroredRepeatWrapping,10497:e.RepeatWrapping},P={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},O={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},N={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:e.InterpolateLinear,STEP:e.InterpolateDiscrete},F="OPAQUE",U="MASK",H="BLEND";function D(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e)}function k(e,t,r){for(var s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function B(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function G(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(r=0,s=n.length;r<s;r++)e.morphTargetDictionary[n[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function j(e){for(var t="",r=Object.keys(e).sort(),s=0,n=r.length;s<n;s++)t+=r[s]+":"+e[r[s]]+";";return t}function K(t,s){this.json=t||{},this.extensions={},this.plugins={},this.options=s||{},this.cache=new r,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new e.ImageBitmapLoader(this.options.manager):this.textureLoader=new e.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new e.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function V(t,r,s){var n=r.attributes,a=[];function i(e,r){return s.getDependency("accessor",e).then(function(e){t.setAttribute(r,e)})}for(var o in n){var l=O[o]||o.toLowerCase();l in t.attributes||a.push(i(n[o],l))}if(void 0!==r.indices&&!t.index){var u=s.getDependency("accessor",r.indices).then(function(e){t.setIndex(e)});a.push(u)}return B(t,r),function(t,r,s){var n=r.attributes,a=new e.Box3;if(void 0!==n.POSITION){var i=(d=s.json.accessors[n.POSITION]).min,o=d.max;if(void 0!==i&&void 0!==o){a.set(new e.Vector3(i[0],i[1],i[2]),new e.Vector3(o[0],o[1],o[2]));var l=r.targets;if(void 0!==l){for(var u=new e.Vector3,c=new e.Vector3,p=0,h=l.length;p<h;p++){var d,f=l[p];if(void 0!==f.POSITION)i=(d=s.json.accessors[f.POSITION]).min,o=d.max,void 0!==i&&void 0!==o?(c.setX(Math.max(Math.abs(i[0]),Math.abs(o[0]))),c.setY(Math.max(Math.abs(i[1]),Math.abs(o[1]))),c.setZ(Math.max(Math.abs(i[2]),Math.abs(o[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}a.expandByVector(u)}t.boundingBox=a;var m=new e.Sphere;a.getCenter(m.center),m.radius=a.min.distanceTo(a.max)/2,t.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,r,s),Promise.all(a).then(function(){return void 0!==r.targets?function(e,t,r){for(var s=!1,n=!1,a=0,i=t.length;a<i&&(void 0!==(u=t[a]).POSITION&&(s=!0),void 0!==u.NORMAL&&(n=!0),!s||!n);a++);if(!s&&!n)return Promise.resolve(e);var o=[],l=[];for(a=0,i=t.length;a<i;a++){var u=t[a];if(s){var c=void 0!==u.POSITION?r.getDependency("accessor",u.POSITION):e.attributes.position;o.push(c)}n&&(c=void 0!==u.NORMAL?r.getDependency("accessor",u.NORMAL):e.attributes.normal,l.push(c))}return Promise.all([Promise.all(o),Promise.all(l)]).then(function(t){var r=t[0],a=t[1];return s&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e})}(t,r.targets,s):t})}function X(t,r){var s=t.getIndex();if(null===s){var n=[],a=t.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var i=0;i<a.count;i++)n.push(i);t.setIndex(n),s=t.getIndex()}var o=s.count-2,l=[];if(r===e.TriangleFanDrawMode)for(i=1;i<=o;i++)l.push(s.getX(0)),l.push(s.getX(i)),l.push(s.getX(i+1));else for(i=0;i<o;i++)i%2==0?(l.push(s.getX(i)),l.push(s.getX(i+1)),l.push(s.getX(i+2))):(l.push(s.getX(i+2)),l.push(s.getX(i+1)),l.push(s.getX(i)));l.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(l),u}return K.prototype.setExtensions=function(e){this.extensions=e},K.prototype.setPlugins=function(e){this.plugins=e},K.prototype.parse=function(e,t){var r=this,s=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){var a={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};k(n,a,s),B(a,s),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){e(a)})}).catch(t)},K.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],s=0,n=t.length;s<n;s++)for(var a=t[s].joints,i=0,o=a.length;i<o;i++)e[a[i]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}},K.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},K.prototype._getNodeRef=function(e,t,r){if(e.refs[t]<=1)return r;var s=r.clone();return s.name+="_instance_"+e.uses[t]++,s},K.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var s=e(t[r]);if(s)return s}},K.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var r=[],s=0;s<t.length;s++){var n=e(t[s]);n&&r.push(n)}return r},K.prototype.getDependency=function(e,t){var r=e+":"+t,s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s},K.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map(function(t,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t},K.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[s.KHR_BINARY_GLTF].body);var n=this.options;return new Promise(function(e,s){r.load(D(t.uri,n.path),e,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})},K.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){var r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)})},K.prototype.loadAccessor=function(t){var r=this,s=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var a=[];return void 0!==n.bufferView?a.push(this.getDependency("bufferView",n.bufferView)):a.push(null),void 0!==n.sparse&&(a.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(a).then(function(t){var a,i,o=t[0],l=P[n.type],u=w[n.componentType],c=u.BYTES_PER_ELEMENT,p=c*l,h=n.byteOffset||0,d=void 0!==n.bufferView?s.bufferViews[n.bufferView].byteStride:void 0,f=!0===n.normalized;if(d&&d!==p){var m=Math.floor(h/d),g="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=r.cache.get(g);v||(a=new u(o,m*d,n.count*d/c),v=new e.InterleavedBuffer(a,d/c),r.cache.add(g,v)),i=new e.InterleavedBufferAttribute(v,l,h%d/c,f)}else a=null===o?new u(n.count*l):new u(o,h,n.count*l),i=new e.BufferAttribute(a,l,f);if(void 0!==n.sparse){var T=P.SCALAR,y=w[n.sparse.indices.componentType],x=n.sparse.indices.byteOffset||0,M=n.sparse.values.byteOffset||0,R=new y(t[1],x,n.sparse.count*T),S=new u(t[2],M,n.sparse.count*l);null!==o&&(i=new e.BufferAttribute(i.array.slice(),i.itemSize,i.normalized));for(var A=0,_=R.length;A<_;A++){var E=R[A];if(i.setX(E,S[A*l]),l>=2&&i.setY(E,S[A*l+1]),l>=3&&i.setZ(E,S[A*l+2]),l>=4&&i.setW(E,S[A*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})},K.prototype.loadTexture=function(e){var t=this.json,r=this.options,s=t.textures[e],n=t.images[s.source],a=this.textureLoader;if(n.uri){var i=r.manager.getHandler(n.uri);null!==i&&(a=i)}return this.loadTextureImage(e,n,a)},K.prototype.loadTextureImage=function(t,r,s){var n=this,a=this.json,i=this.options,o=a.textures[t],l=self.URL||self.webkitURL,u=r.uri,c=!1,p=!0;if("image/jpeg"===r.mimeType&&(p=!1),void 0!==r.bufferView)u=n.getDependency("bufferView",r.bufferView).then(function(e){if("image/png"===r.mimeType){var t=new DataView(e,25,1).getUint8(0,!1);p=6===t||4===t||3===t}c=!0;var s=new Blob([e],{type:r.mimeType});return u=l.createObjectURL(s)});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");return Promise.resolve(u).then(function(t){return new Promise(function(r,n){var a=r;!0===s.isImageBitmapLoader&&(a=function(t){r(new e.CanvasTexture(t))}),s.load(D(t,i.path),a,void 0,n)})}).then(function(r){!0===c&&l.revokeObjectURL(u),r.flipY=!1,o.name&&(r.name=o.name),p||(r.format=e.RGBFormat);var s=(a.samplers||{})[o.sampler]||{};return r.magFilter=b[s.magFilter]||e.LinearFilter,r.minFilter=b[s.minFilter]||e.LinearMipmapLinearFilter,r.wrapS=I[s.wrapS]||e.RepeatWrapping,r.wrapT=I[s.wrapT]||e.RepeatWrapping,n.associations.set(r,{type:"textures",index:t}),r})},K.prototype.assignTexture=function(e,t,r){var n=this;return this.getDependency("texture",r.index).then(function(a){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[s.KHR_TEXTURE_TRANSFORM]){var i=void 0!==r.extensions?r.extensions[s.KHR_TEXTURE_TRANSFORM]:void 0;if(i){var o=n.associations.get(a);a=n.extensions[s.KHR_TEXTURE_TRANSFORM].extendTexture(a,i),n.associations.set(a,o)}}e[t]=a})},K.prototype.assignFinalMaterial=function(t){var r=t.geometry,s=t.material,n=void 0!==r.attributes.tangent,a=void 0!==r.attributes.color,i=void 0===r.attributes.normal,o=!0===t.isSkinnedMesh,l=Object.keys(r.morphAttributes).length>0,u=l&&void 0!==r.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+s.uuid,p=this.cache.get(c);p||(p=new e.PointsMaterial,e.Material.prototype.copy.call(p,s),p.color.copy(s.color),p.map=s.map,p.sizeAttenuation=!1,this.cache.add(c,p)),s=p}else if(t.isLine){c="LineBasicMaterial:"+s.uuid;var h=this.cache.get(c);h||(h=new e.LineBasicMaterial,e.Material.prototype.copy.call(h,s),h.color.copy(s.color),this.cache.add(c,h)),s=h}if(n||a||i||o||l){c="ClonedMaterial:"+s.uuid+":";s.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),o&&(c+="skinning:"),n&&(c+="vertex-tangents:"),a&&(c+="vertex-colors:"),i&&(c+="flat-shading:"),l&&(c+="morph-targets:"),u&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=s.clone(),o&&(d.skinning=!0),a&&(d.vertexColors=!0),i&&(d.flatShading=!0),l&&(d.morphTargets=!0),u&&(d.morphNormals=!0),n&&(d.vertexTangents=!0,d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(c,d),this.associations.set(d,this.associations.get(s))),s=d}s.aoMap&&void 0===r.attributes.uv2&&void 0!==r.attributes.uv&&r.setAttribute("uv2",r.attributes.uv),t.material=s},K.prototype.getMaterialType=function(){return e.MeshStandardMaterial},K.prototype.loadMaterial=function(t){var r,n=this,a=this.json,i=this.extensions,o=a.materials[t],l={},u=o.extensions||{},c=[];if(u[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var p=i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];r=p.getMaterialType(),c.push(p.extendParams(l,o,n))}else if(u[s.KHR_MATERIALS_UNLIT]){var h=i[s.KHR_MATERIALS_UNLIT];r=h.getMaterialType(),c.push(h.extendParams(l,o,n))}else{var d=o.pbrMetallicRoughness||{};if(l.color=new e.Color(1,1,1),l.opacity=1,Array.isArray(d.baseColorFactor)){var f=d.baseColorFactor;l.color.fromArray(f),l.opacity=f[3]}void 0!==d.baseColorTexture&&c.push(n.assignTexture(l,"map",d.baseColorTexture)),l.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,l.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(n.assignTexture(l,"metalnessMap",d.metallicRoughnessTexture)),c.push(n.assignTexture(l,"roughnessMap",d.metallicRoughnessTexture))),r=this._invokeOne(function(e){return e.getMaterialType&&e.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,l)})))}!0===o.doubleSided&&(l.side=e.DoubleSide);var m=o.alphaMode||F;return m===H?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,m===U&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new e.Vector2(1,-1),void 0!==o.normalTexture.scale&&l.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&r!==e.MeshBasicMaterial&&(c.push(n.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&r!==e.MeshBasicMaterial&&(l.emissive=(new e.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&r!==e.MeshBasicMaterial&&c.push(n.assignTexture(l,"emissiveMap",o.emissiveTexture)),Promise.all(c).then(function(){var a;return a=r===v?i[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new r(l),o.name&&(a.name=o.name),a.map&&(a.map.encoding=e.sRGBEncoding),a.emissiveMap&&(a.emissiveMap.encoding=e.sRGBEncoding),B(a,o),n.associations.set(a,{type:"materials",index:t}),o.extensions&&k(i,a,o),a})},K.prototype.createUniqueName=function(t){for(var r=e.PropertyBinding.sanitizeNodeName(t||""),s=r,n=1;this.nodeNamesUsed[s];++n)s=r+"_"+n;return this.nodeNamesUsed[s]=!0,s},K.prototype.loadGeometries=function(t){var r=this,n=this.extensions,a=this.primitiveCache;function i(e){return n[s.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then(function(t){return V(t,e,r)})}for(var o,l,u=[],c=0,p=t.length;c<p;c++){var h,d=t[c],f=(l=void 0,(l=(o=d).extensions&&o.extensions[s.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+j(l.attributes):o.indices+":"+j(o.attributes)+":"+o.mode),m=a[f];if(m)u.push(m.promise);else h=d.extensions&&d.extensions[s.KHR_DRACO_MESH_COMPRESSION]?i(d):V(new e.BufferGeometry,d,r),a[f]={primitive:d,promise:h},u.push(h)}return Promise.all(u)},K.prototype.loadMesh=function(t){for(var r,s=this,n=this.json,a=this.extensions,i=n.meshes[t],o=i.primitives,l=[],u=0,c=o.length;u<c;u++){var p=void 0===o[u].material?(void 0===(r=this.cache).DefaultMaterial&&(r.DefaultMaterial=new e.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:e.FrontSide})),r.DefaultMaterial):this.getDependency("material",o[u].material);l.push(p)}return l.push(s.loadGeometries(o)),Promise.all(l).then(function(r){for(var n=r.slice(0,r.length-1),l=r[r.length-1],u=[],c=0,p=l.length;c<p;c++){var h,d=l[c],f=o[c],m=n[c];if(f.mode===_||f.mode===E||f.mode===L||void 0===f.mode)!0!==(h=!0===i.isSkinnedMesh?new e.SkinnedMesh(d,m):new e.Mesh(d,m)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),f.mode===E?h.geometry=X(h.geometry,e.TriangleStripDrawMode):f.mode===L&&(h.geometry=X(h.geometry,e.TriangleFanDrawMode));else if(f.mode===R)h=new e.LineSegments(d,m);else if(f.mode===A)h=new e.Line(d,m);else if(f.mode===S)h=new e.LineLoop(d,m);else{if(f.mode!==M)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);h=new e.Points(d,m)}Object.keys(h.geometry.morphAttributes).length>0&&G(h,i),h.name=s.createUniqueName(i.name||"mesh_"+t),B(h,i),f.extensions&&k(a,h,f),s.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var g=new e.Group;for(c=0,p=u.length;c<p;c++)g.add(u[c]);return g})},K.prototype.loadCamera=function(t){var r,s=this.json.cameras[t],n=s[s.type];if(n)return"perspective"===s.type?r=new e.PerspectiveCamera(e.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===s.type&&(r=new e.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(r.name=this.createUniqueName(s.name)),B(r,s),Promise.resolve(r);console.warn("THREE.GLTFLoader: Missing camera parameters.")},K.prototype.loadSkin=function(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then(function(e){return r.inverseBindMatrices=e,r})},K.prototype.loadAnimation=function(t){for(var r=this.json.animations[t],s=[],n=[],a=[],i=[],o=[],l=0,u=r.channels.length;l<u;l++){var c=r.channels[l],p=r.samplers[c.sampler],h=c.target,d=void 0!==h.node?h.node:h.id,f=void 0!==r.parameters?r.parameters[p.input]:p.input,m=void 0!==r.parameters?r.parameters[p.output]:p.output;s.push(this.getDependency("node",d)),n.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",m)),i.push(p),o.push(h)}return Promise.all([Promise.all(s),Promise.all(n),Promise.all(a),Promise.all(i),Promise.all(o)]).then(function(s){for(var n=s[0],a=s[1],i=s[2],o=s[3],l=s[4],u=[],c=0,p=n.length;c<p;c++){var h=n[c],d=a[c],f=i[c],m=o[c],g=l[c];if(void 0!==h){var v;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,N[g.path]){case N.weights:v=e.NumberKeyframeTrack;break;case N.rotation:v=e.QuaternionKeyframeTrack;break;case N.position:case N.scale:default:v=e.VectorKeyframeTrack}var T=h.name?h.name:h.uuid,y=void 0!==m.interpolation?C[m.interpolation]:e.InterpolateLinear,M=[];N[g.path]===N.weights?h.traverse(function(e){!0===e.isMesh&&e.morphTargetInfluences&&M.push(e.name?e.name:e.uuid)}):M.push(T);var R=f.array;if(f.normalized){var S;if(R.constructor===Int8Array)S=1/127;else if(R.constructor===Uint8Array)S=1/255;else if(R.constructor==Int16Array)S=1/32767;else{if(R.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var A=new Float32Array(R.length),_=0,E=R.length;_<E;_++)A[_]=R[_]*S;R=A}for(_=0,E=M.length;_<E;_++){var L=new v(M[_]+"."+N[g.path],d.array,R,y);"CUBICSPLINE"===m.interpolation&&(L.createInterpolant=function(e){return new x(this.times,this.values,this.getValueSize()/3,e)},L.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(L)}}}var w=r.name?r.name:"animation_"+t;return new e.AnimationClip(w,void 0,u)})},K.prototype.loadNode=function(t){var r,s=this.json,n=this.extensions,a=this,i=s.nodes[t],o=i.name?a.createUniqueName(i.name):"";return(r=[],void 0!==i.mesh&&r.push(a.getDependency("mesh",i.mesh).then(function(e){var t=a._getNodeRef(a.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(var t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})),void 0!==i.camera&&r.push(a.getDependency("camera",i.camera).then(function(e){return a._getNodeRef(a.cameraCache,i.camera,e)})),a._invokeAll(function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)}).forEach(function(e){r.push(e)}),Promise.all(r)).then(function(r){var s;if((s=!0===i.isBone?new e.Bone:r.length>1?new e.Group:1===r.length?r[0]:new e.Object3D)!==r[0])for(var l=0,u=r.length;l<u;l++)s.add(r[l]);if(i.name&&(s.userData.name=i.name,s.name=o),B(s,i),i.extensions&&k(n,s,i),void 0!==i.matrix){var c=new e.Matrix4;c.fromArray(i.matrix),s.applyMatrix4(c)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);return a.associations.set(s,{type:"nodes",index:t}),s})},K.prototype.loadScene=function(){function t(r,s,n,a){var i=n.nodes[r];return a.getDependency("node",r).then(function(t){return void 0===i.skin?t:a.getDependency("skin",i.skin).then(function(e){for(var t=[],s=0,n=(r=e).joints.length;s<n;s++)t.push(a.getDependency("node",r.joints[s]));return Promise.all(t)}).then(function(s){return t.traverse(function(t){if(t.isMesh){for(var n=[],a=[],i=0,o=s.length;i<o;i++){var l=s[i];if(l){n.push(l);var u=new e.Matrix4;void 0!==r.inverseBindMatrices&&u.fromArray(r.inverseBindMatrices.array,16*i),a.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',r.joints[i])}t.bind(new e.Skeleton(n,a),t.matrixWorld)}}),t});var r}).then(function(e){s.add(e);var r=[];if(i.children)for(var o=i.children,l=0,u=o.length;l<u;l++){var c=o[l];r.push(t(c,e,n,a))}return Promise.all(r)})}return function(r){var s=this.json,n=this.extensions,a=this.json.scenes[r],i=new e.Group;a.name&&(i.name=this.createUniqueName(a.name)),B(i,a),a.extensions&&k(n,i,a);for(var o=a.nodes||[],l=[],u=0,c=o.length;u<c;u++)l.push(t(o[u],i,s,this));return Promise.all(l).then(function(){return i})}}(),t}();exports.GLTFLoader=t;
  28. },{"../../../build/three.module.js":"dKqR"}],"rU0W":[function(require,module,exports) {
  29. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.B3DMLoader=void 0;var e=require("../base/B3DMLoaderBase.js"),t=require("three"),r=require("three/examples/jsm/loaders/GLTFLoader.js");function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function i(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=l(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function l(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(n){function a(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return o(this,a),(e=i(this,s(a).call(this))).manager=r,e}return p(a,e.B3DMLoaderBase),u(a,[{key:"parse",value:function(e){var t=this,n=f(s(a.prototype),"parse",this).call(this,e),o=n.glbBytes.slice().buffer;return new Promise(function(e,a){var u=t.manager;(u.getHandler("path.gltf")||new r.GLTFLoader(u)).parse(o,null,function(t){var r=n.batchTable,o=n.featureTable,a=t.scene,u=o.getData("RTC_CENTER");u&&(a.position.x+=u[0],a.position.y+=u[1],a.position.z+=u[2]),t.batchTable=r,t.featureTable=o,a.batchTable=r,a.featureTable=o,e(t)},a)})}}]),a}();exports.B3DMLoader=y;
  30. },{"../base/B3DMLoaderBase.js":"DNWc","three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0"}],"RlAR":[function(require,module,exports) {
  31. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PNTSLoaderBase=void 0;var e=require("../utilities/FeatureTable.js");function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}var a=function(){function r(){t(this,r),this.fetchOptions={}}return n(r,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(e){return t.parse(e)})}},{key:"parse",value:function(t){var r=new DataView(t),n=String.fromCharCode(r.getUint8(0))+String.fromCharCode(r.getUint8(1))+String.fromCharCode(r.getUint8(2))+String.fromCharCode(r.getUint8(3));console.assert("pnts"===n);var a=r.getUint32(4,!0);console.assert(1===a);var o=r.getUint32(8,!0);console.assert(o===t.byteLength);var i=r.getUint32(12,!0),s=r.getUint32(16,!0),u=r.getUint32(20,!0),c=r.getUint32(24,!0),f=t.slice(28,28+i+s),l=new e.FeatureTable(f,0,i,s),h=28+i+s,g=t.slice(h,h+u+c),v=new e.BatchTable(g,l.getData("BATCH_LENGTH")||l.getData("POINTS_LENGTH"),0,u,c);return{version:a,featureTable:l,batchTable:v}}}]),r}();exports.PNTSLoaderBase=a;
  32. },{"../utilities/FeatureTable.js":"ON7I"}],"Pr3e":[function(require,module,exports) {
  33. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PNTSLoader=void 0;var e=require("../base/PNTSLoaderBase.js"),t=require("three");function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,r){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=f(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function f(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=function(r){function o(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return n(this,o),(e=a(this,l(o).call(this))).manager=r,e}return s(o,e.PNTSLoaderBase),u(o,[{key:"parse",value:function(e){var r=c(l(o.prototype),"parse",this).call(this,e),n=r.featureTable,u=n.getData("POINTS_LENGTH"),a=n.getData("POSITION",u,"FLOAT","VEC3"),i=n.getData("RGB",u,"UNSIGNED_BYTE","VEC3");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach(function(e){e in n.header&&console.warn('PNTSLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))});var f=new t.BufferGeometry;f.setAttribute("position",new t.BufferAttribute(a,3,!1));var s=new t.PointsMaterial;s.size=2,s.sizeAttenuation=!1,null!==i&&(f.setAttribute("color",new t.BufferAttribute(i,3,!0)),s.vertexColors=!0);var p=new t.Points(f,s);return r.scene=p,r.scene.featureTable=n,r}}]),o}();exports.PNTSLoader=b;
  34. },{"../base/PNTSLoaderBase.js":"RlAR","three":"dKqR"}],"qWWH":[function(require,module,exports) {
  35. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.I3DMLoaderBase=void 0;var t=require("../utilities/FeatureTable.js"),e=require("../utilities/arrayToString.js");function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}var i=function(){function n(){r(this,n),this.fetchOptions={},this.workingPath=""}return a(n,[{key:"resolveExternalURL",value:function(t){return this.workingPath+"/"+t}},{key:"load",value:function(t){var e=this;return fetch(t,this.fetchOptions).then(function(e){if(!e.ok)throw new Error('Failed to load file "'.concat(t,'" with status ').concat(e.status," : ").concat(e.statusText));return e.arrayBuffer()}).then(function(r){if(""===e.workingPath){var n=t.split(/\\\//g);n.pop(),e.workingPath=n.join("/")}return e.parse(r)})}},{key:"parse",value:function(r){var n=new DataView(r),a=String.fromCharCode(n.getUint8(0))+String.fromCharCode(n.getUint8(1))+String.fromCharCode(n.getUint8(2))+String.fromCharCode(n.getUint8(3));console.assert("i3dm"===a);var i=n.getUint32(4,!0);console.assert(1===i);var o=n.getUint32(8,!0);console.assert(o===r.byteLength);var s=n.getUint32(12,!0),u=n.getUint32(16,!0),c=n.getUint32(20,!0),l=n.getUint32(24,!0),f=n.getUint32(28,!0),h=r.slice(32,32+s+u),g=new t.FeatureTable(h,0,s,u),v=32+s+u,w=r.slice(v,v+c+l),d=new t.BatchTable(w,g.getData("INSTANCES_LENGTH"),0,c,l),p=v+c+l,y=new Uint8Array(r,p,o-p),U=null,b=null;if(f)U=y,b=Promise.resolve();else{var T=this.resolveExternalURL((0,e.arrayToString)(y));b=fetch(T,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('I3DMLoaderBase : Failed to load file "'.concat(T,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(t){U=new Uint8Array(t)})}return b.then(function(){return{version:i,featureTable:g,batchTable:d,glbBytes:U}})}}]),n}();exports.I3DMLoaderBase=i;
  36. },{"../utilities/FeatureTable.js":"ON7I","../utilities/arrayToString.js":"M3Ed"}],"iNV5":[function(require,module,exports) {
  37. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.I3DMLoader=void 0;var e=require("../base/I3DMLoaderBase.js"),t=require("three"),r=require("three/examples/jsm/loaders/GLTFLoader.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function c(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?u(e):t}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t,r){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=l(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function l(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b=new t.Vector3,O=new t.Vector3,h=new t.Vector3,T=new t.Vector3,v=new t.Quaternion,d=new t.Vector3,L=new t.Matrix4,g=function(o){function a(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DefaultLoadingManager;return n(this,a),(e=c(this,f(a).call(this))).manager=r,e}return p(a,e.I3DMLoaderBase),i(a,[{key:"resolveExternalURL",value:function(e){return this.manager.resolveURL(s(f(a.prototype),"resolveExternalURL",this).call(this,e))}},{key:"parse",value:function(e){var o=this;return s(f(a.prototype),"parse",this).call(this,e).then(function(e){var n=e.featureTable,a=e.batchTable,i=e.glbBytes.slice().buffer;return new Promise(function(e,c){var u=o.manager;(u.getHandler("path.gltf")||new r.GLTFLoader(u)).parse(i,null,function(r){var o=n.getData("INSTANCES_LENGTH"),i=n.getData("POSITION",o,"FLOAT","VEC3"),c=n.getData("NORMAL_UP",o,"FLOAT","VEC3"),u=n.getData("NORMAL_RIGHT",o,"FLOAT","VEC3"),s=n.getData("SCALE_NON_UNIFORM",o,"FLOAT","VEC3"),l=n.getData("SCALE",o,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach(function(e){e in n.header&&console.warn('I3DMLoader: Unsupported FeatureTable feature "'.concat(e,'" detected.'))});var f=new Map,p=[];r.scene.traverse(function(e){if(e.isMesh){var r=e.geometry,n=e.material,a=new t.InstancedMesh(r,n,o);a.position.copy(e.position),a.rotation.copy(e.rotation),a.scale.copy(e.scale),p.push(a),f.set(e,a)}});for(var y=new t.Vector3,g=0;g<o;g++)y.x+=i[3*g+0]/o,y.y+=i[3*g+1]/o,y.z+=i[3*g+2]/o;f.forEach(function(e,t){var r=t.parent;r&&(r.remove(t),r.add(e),e.updateMatrixWorld(),e.position.copy(y).applyMatrix4(e.matrixWorld))});for(var _=0;_<o;_++){T.set(i[3*_+0]-y.x,i[3*_+1]-y.y,i[3*_+2]-y.z),c?(O.set(c[3*_+0],c[3*_+1],c[3*_+2]),h.set(u[3*_+0],u[3*_+1],u[3*_+2]),b.crossVectors(h,O).normalize(),L.makeBasis(h,O,b),v.setFromRotationMatrix(L)):v.set(0,0,0,1),l?d.setScalar(l[_]):s?d.set(s[3*_+0],s[3*_+1],s[3*_+2]):d.set(1,1,1),L.compose(T,v,d);for(var E=0,m=p.length;E<m;E++){p[E].setMatrixAt(_,L)}}r.batchTable=a,r.featureTable=n,r.scene.batchTable=a,r.scene.featureTable=n,e(r)},c)})})}}]),a}();exports.I3DMLoader=g;
  38. },{"../base/I3DMLoaderBase.js":"qWWH","three":"dKqR","three/examples/jsm/loaders/GLTFLoader.js":"O6i0"}],"c0Qu":[function(require,module,exports) {
  39. "use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.CMPTLoaderBase=void 0;var n=function(){function t(){e(this,t),this.fetchOptions={},this.workingPath=""}return r(t,[{key:"load",value:function(e){var t=this;return fetch(e,this.fetchOptions).then(function(t){if(!t.ok)throw new Error('Failed to load file "'.concat(e,'" with status ').concat(t.status," : ").concat(t.statusText));return t.arrayBuffer()}).then(function(r){if(""===t.workingPath){var n=e.split(/\\\//g);n.pop(),t.workingPath=n.join("/")}return t.parse(r)})}},{key:"parse",value:function(e){var t=new DataView(e),r=String.fromCharCode(t.getUint8(0))+String.fromCharCode(t.getUint8(1))+String.fromCharCode(t.getUint8(2))+String.fromCharCode(t.getUint8(3));console.assert("cmpt"===r,'CMPTLoader: The magic bytes equal "cmpt".');var n=t.getUint32(4,!0);console.assert(1===n,'CMPTLoader: The version listed in the header is "1".');var o=t.getUint32(8,!0);console.assert(o===e.byteLength,"CMPTLoader: The contents buffer length listed in the header matches the file.");for(var i=t.getUint32(12,!0),a=[],s=16,f=0;f<i;f++){var h=new DataView(e,s,12),c=String.fromCharCode(h.getUint8(0))+String.fromCharCode(h.getUint8(1))+String.fromCharCode(h.getUint8(2))+String.fromCharCode(h.getUint8(3)),u=h.getUint32(4,!0),g=h.getUint32(8,!0),l=new Uint8Array(e,s,g);a.push({type:c,buffer:l,version:u}),s+=g}return{version:n,tiles:a}}}]),t}();exports.CMPTLoaderBase=n;
  40. },{}],"hwVX":[function(require,module,exports) {
  41. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CMPTLoader=void 0;var e=require("three"),r=require("../base/CMPTLoaderBase.js"),t=require("./B3DMLoader.js"),n=require("./PNTSLoader.js"),o=require("./I3DMLoader.js");function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&u(e.prototype,r),t&&u(e,t),e}function f(e,r){return!r||"object"!==i(r)&&"function"!=typeof r?s(e):r}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,r,t){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=p(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function p(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=b(e)););return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&h(e,r)}function h(e,r){return(h=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}var d=function(i){function u(){var r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DefaultLoadingManager;return a(this,u),(r=f(this,b(u).call(this))).manager=t,r}return y(u,r.CMPTLoaderBase),c(u,[{key:"parse",value:function(r){var i=l(b(u.prototype),"parse",this).call(this,r),a=this.manager,c=[];for(var f in i.tiles){var s=i.tiles[f],p=s.type,y=s.buffer;switch(p){case"b3dm":var h=y.slice(),d=new t.B3DMLoader(a).parse(h.buffer);c.push(d);break;case"pnts":var v=y.slice(),P=new n.PNTSLoader(a).parse(v.buffer),g=Promise.resolve(P);c.push(g);break;case"i3dm":var w=y.slice(),O=new o.I3DMLoader(a);O.workingPath=this.workingPath,O.fetchOptions=this.fetchOptions;var m=O.parse(w.buffer);c.push(m)}}return Promise.all(c).then(function(r){var t=new e.Group;return r.forEach(function(e){t.add(e.scene)}),{tiles:r,scene:t}})}}]),u}();exports.CMPTLoader=d;
  42. },{"three":"dKqR","../base/CMPTLoaderBase.js":"c0Qu","./B3DMLoader.js":"rU0W","./PNTSLoader.js":"Pr3e","./I3DMLoader.js":"iNV5"}],"tTab":[function(require,module,exports) {
  43. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesGroup=void 0;var t=require("three");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function n(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),t}function i(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?u(t):r}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var s=new t.Matrix4,f=function(e){function o(t){var e;return r(this,o),(e=i(this,a(o).call(this))).tilesRenderer=t,e}return c(o,t.Group),n(o,[{key:"raycast",value:function(t,e){this.tilesRenderer.raycast(t,e)}},{key:"updateMatrixWorld",value:function(t){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||t){null===this.parent?s.copy(this.matrix):s.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;for(var e=s.elements,r=this.matrixWorld.elements,o=!1,n=0;n<16;n++){var i=e[n],u=r[n];if(Math.abs(i-u)>Number.EPSILON){o=!0;break}}if(o){this.matrixWorld.copy(s);for(var a=this.children,c=0,l=a.length;c<l;c++)a[c].updateMatrixWorld()}}}}]),o}();exports.TilesGroup=f;
  44. },{"three":"dKqR"}],"Hcez":[function(require,module,exports) {
  45. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.raycastTraverseFirstHit=l,exports.raycastTraverse=h;var e=require("three"),r=new e.Sphere,t=new e.Matrix4,a=new e.Vector3,n=new e.Vector3,i=new e.Ray,s=[];function c(e,r){return e.distance-r.distance}function o(e,r,t){e.traverse(function(e){Object.getPrototypeOf(e).raycast.call(e,r,t)})}function l(e,h,p,u){if(p.has(e)){if(o(e.cached.scene,u,s),s.length>0){s.length>1&&s.sort(c);var y=s[0];return s.length=0,y}return null}for(var f=[],v=e.children,d=0,x=v.length;d<x;d++){var g=v[d],m=g.cached,M=h.matrixWorld;t.copy(M);var b=m.sphere;if(!b||(r.copy(b),r.applyMatrix4(t),u.ray.intersectsSphere(r))){var w=m.box,T=m.boxTransform;if(w){if(t.multiply(T).invert(),i.copy(u.ray),i.applyMatrix4(t),!i.intersectBox(w,a))continue;var S;n.setFromMatrixScale(t),S=n.x,Math.abs(Math.max(n.x-n.y,n.x-n.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");var O={distance:1/0,tile:null};f.push(O),O.distance=a.distanceToSquared(i.origin)*S*S,O.tile=g}}}f.sort(c);for(var j=1/0,q=null,B=0,F=f.length;B<F;B++){var P=f[B];if(P.distance>j)break;var R=P.tile,V=R.cached.scene,W=null;if(p.has(R)?(o(V,u,s),s.length>0&&(s.length>1&&s.sort(c),W=s[0])):W=l(R,h,p,u),W){var _=W.distance*W.distance;_<j&&(j=_,q=W),s.length=0}}return q}function h(e,a,n,s,c){var l=e.cached,p=a.matrixWorld;t.copy(p);var u=l.sphere;if(!u||(r.copy(u),r.applyMatrix4(t),s.ray.intersectsSphere(r))){var y=l.box,f=l.boxTransform;if(!y||(t.multiply(f).invert(),i.copy(s.ray).applyMatrix4(t),i.intersectsBox(y))){var v=l.scene;if(n.has(e))o(v,s,c);else for(var d=e.children,x=0,g=d.length;x<g;x++)h(d[x],a,n,s,c)}}}
  46. },{"three":"dKqR"}],"wXIB":[function(require,module,exports) {
  47. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TilesRenderer=void 0;var e=require("../base/TilesRendererBase.js"),r=require("./B3DMLoader.js"),t=require("./PNTSLoader.js"),n=require("./I3DMLoader.js"),o=require("./CMPTLoader.js"),a=require("./TilesGroup.js"),i=require("three"),s=require("./raycastTraverse.js");function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function c(e,r){return!r||"object"!==l(r)&&"function"!=typeof r?p(e):r}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,r,t){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=x(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function h(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,r,t){return r&&h(e.prototype,r),t&&h(e,t),e}function m(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&v(e,r)}function v(e,r){return(v=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function y(e,r,t,n){return(y="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,n){var o,a=x(e,r);if(a){if((o=Object.getOwnPropertyDescriptor(a,r)).set)return o.set.call(n,t),!0;if(!o.writable)return!1}if(o=Object.getOwnPropertyDescriptor(n,r)){if(!o.writable)return!1;o.value=t,Object.defineProperty(n,r,o)}else b(n,r,t);return!0})(e,r,t,n)}function g(e,r,t,n,o){if(!y(e,r,t,n||e)&&o)throw new Error("failed to set property");return t}function b(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function x(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=w(e)););return e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var T=Symbol("INITIAL_FRUSTUM_CULLED"),M=i.Math.DEG2RAD,R=new i.Matrix4,S=new i.Matrix4,k=new i.Vector3,O=new i.Vector3,P=new i.Vector3,j=new i.Vector3,L=new i.Vector3(1,0,0),D=new i.Vector3(0,1,0);function I(){}function _(e,r){e.traverse(function(e){e.frustumCulled=e[T]&&r})}var C=function(l){function h(){var e,r;u(this,h);for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];(r=c(this,(e=w(h)).call.apply(e,[this].concat(n)))).group=new a.TilesGroup(p(r)),r.cameras=[],r.cameraMap=new Map,r.cameraInfo=[],r.activeTiles=new Set,r.visibleTiles=new Set,r._autoDisableRendererCulling=!0,r.onLoadTileSet=null,r.onLoadModel=null,r.onDisposeModel=null;var s=new i.LoadingManager;return s.setURLModifier(function(e){return r.preprocessURL?r.preprocessURL(e):e}),r.manager=s,r}return m(h,e.TilesRendererBase),d(h,[{key:"autoDisableRendererCulling",get:function(){return this._autoDisableRendererCulling},set:function(e){this._autoDisableRendererCulling!==e&&(g(w(h.prototype),"_autoDisableRendererCulling",e,this,!0),this.traverse(function(r){r.scene&&_(r.scene,e)}))}}]),d(h,[{key:"getBounds",value:function(e){if(!this.root)return!1;var r=this.root.cached,t=r.box,n=r.boxTransform;return!!t&&(e.copy(t),e.applyMatrix4(n),!0)}},{key:"getOrientedBounds",value:function(e,r){if(!this.root)return!1;var t=this.root.cached,n=t.box,o=t.boxTransform;return!!e&&(e.copy(n),r.copy(o),!0)}},{key:"forEachLoadedModel",value:function(e){this.traverse(function(r){var t=r.cached.scene;t&&e(t,r)})}},{key:"raycast",value:function(e,r){if(this.root)if(e.firstHitOnly){var t=(0,s.raycastTraverseFirstHit)(this.root,this.group,this.activeTiles,e);t&&r.push(t)}else(0,s.raycastTraverse)(this.root,this.group,this.activeTiles,e,r)}},{key:"hasCamera",value:function(e){return this.cameraMap.has(e)}},{key:"setCamera",value:function(e){var r=this.cameras,t=this.cameraMap;return!t.has(e)&&(t.set(e,new i.Vector2),r.push(e),!0)}},{key:"setResolution",value:function(e,r,t){var n=this.cameraMap;return!!n.has(e)&&(r instanceof i.Vector2?n.get(e).copy(r):n.get(e).set(r,t),!0)}},{key:"setResolutionFromRenderer",value:function(e,r){var t=this.cameraMap;if(!t.has(e))return!1;var n=t.get(e);return r.getSize(n),n.multiplyScalar(r.getPixelRatio()),!0}},{key:"deleteCamera",value:function(e){var r=this.cameras,t=this.cameraMap;if(t.has(e)){var n=r.indexOf(e);return r.splice(n,1),t.delete(e),!0}return!1}},{key:"fetchTileSet",value:function(e){for(var r,t=this,n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];var i=(r=f(w(h.prototype),"fetchTileSet",this)).call.apply(r,[this,e].concat(o));return i.then(function(r){t.onLoadTileSet&&Promise.resolve().then(function(){t.onLoadTileSet(r,e)})}),i}},{key:"update",value:function(){var e=this.group,r=this.cameras,t=this.cameraMap,n=this.cameraInfo;if(0!==r.length){for(;n.length>r.length;)n.pop();for(;n.length<r.length;)n.push({frustum:new i.Frustum,sseDenominator:-1,position:new i.Vector3,invScale:-1,pixelSize:0});var o;S.copy(e.matrixWorld).invert(),k.setFromMatrixScale(S),o=k.x,Math.abs(Math.max(k.x-k.y,k.x-k.z))>1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(var a=0,s=n.length;a<s;a++){var l=r[a],u=n[a],c=u.frustum,p=u.position,d=t.get(l);if(0!==d.width&&0!==d.height||console.warn("TilesRenderer: resolution for camera error calculation is not set."),l.isPerspectiveCamera&&(u.sseDenominator=2*Math.tan(.5*l.fov*M)/d.height),l.isOrthographicCamera){var m=l.right-l.left,v=l.top-l.bottom;u.pixelSize=Math.max(v/d.height,m/d.width)}u.invScale=o,R.copy(e.matrixWorld),R.premultiply(l.matrixWorldInverse),R.premultiply(l.projectionMatrix),c.setFromProjectionMatrix(R),p.set(0,0,0),p.applyMatrix4(l.matrixWorld),p.applyMatrix4(S)}f(w(h.prototype),"update",this).call(this)}else console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.")}},{key:"preprocessNode",value:function(e,r,t){f(w(h.prototype),"preprocessNode",this).call(this,e,r,t);var n=new i.Matrix4;if(e.transform)for(var o=e.transform,a=0;a<16;a++)n.elements[a]=o[a];else n.identity();r&&n.premultiply(r.cached.transform);var s=null,l=null,u=null;if("box"in e.boundingVolume){var c=e.boundingVolume.box;s=new i.Box3,l=new i.Matrix4,u=new i.Matrix4,O.set(c[3],c[4],c[5]),P.set(c[6],c[7],c[8]),j.set(c[9],c[10],c[11]);var p=O.length(),d=P.length(),m=j.length();O.normalize(),P.normalize(),j.normalize(),l.set(O.x,P.x,j.x,c[0],O.y,P.y,j.y,c[1],O.z,P.z,j.z,c[2],0,0,0,1),l.premultiply(n),u.copy(l).invert(),s.min.set(-p,-d,-m),s.max.set(p,d,m)}var v=null;if("sphere"in e.boundingVolume){var y=e.boundingVolume.sphere;(v=new i.Sphere).center.set(y[0],y[1],y[2]),v.radius=y[3],v.applyMatrix4(n)}else if("box"in e.boundingVolume){var g=e.boundingVolume.box;v=new i.Sphere,s.getBoundingSphere(v),v.center.set(g[0],g[1],g[2]),v.applyMatrix4(n)}"region"in e.boundingVolume&&console.warn("ThreeTilesRenderer: region bounding volume not supported."),e.cached={loadIndex:0,transform:n,active:!1,inFrustum:[],box:s,boxTransform:l,boxTransformInverse:u,sphere:v,region:null,scene:null,geometry:null,material:null,distance:1/0}}},{key:"parseTile",value:function(e,a,i){var s=this;a._loadIndex=a._loadIndex||0,a._loadIndex++;var l=a.content.uri.split(/[\\\/]/g);l.pop();var u=l.join("/"),c=this.fetchOptions,p=this.manager,f=a._loadIndex,h=null;switch(i){case"b3dm":h=new r.B3DMLoader(p).parse(e).then(function(e){return e.scene});break;case"pnts":h=Promise.resolve(new t.PNTSLoader(p).parse(e).scene);break;case"i3dm":var d=new n.I3DMLoader(p);d.workingPath=u,d.fetchOptions=c,h=d.parse(e).then(function(e){return e.scene});break;case"cmpt":var m=new o.CMPTLoader(p);m.workingPath=u,m.fetchOptions=c,h=m.parse(e).then(function(e){return e.scene});break;default:console.warn('TilesRenderer: Content type "'.concat(i,'" not supported.')),h=Promise.resolve(null)}return h.then(function(e){if(a._loadIndex===f){var r=s.rootTileSet.asset&&s.rootTileSet.asset.gltfUpAxis||"y",t=a.cached,n=t.transform;switch(r.toLowerCase()){case"x":e.matrix.makeRotationAxis(D,-Math.PI/2);break;case"y":e.matrix.makeRotationAxis(L,Math.PI/2)}e.matrix.premultiply(n),e.matrix.decompose(e.position,e.quaternion,e.scale),e.traverse(function(e){e[T]=e.frustumCulled}),_(e,s.autoDisableRendererCulling),t.scene=e,e.traverse(function(e){e.raycast=I});var o=[],i=[],l=[];e.traverse(function(e){if(e.geometry&&i.push(e.geometry),e.material){var r=e.material;for(var t in o.push(e.material),r){var n=r[t];n&&n.isTexture&&l.push(n)}}}),t.materials=o,t.geometry=i,t.textures=l,s.onLoadModel&&s.onLoadModel(e,a)}})}},{key:"disposeTile",value:function(e){var r=e.cached;if(r.scene){for(var t=r.materials,n=r.geometry,o=r.textures,a=0,i=n.length;a<i;a++)n[a].dispose();for(var s=0,l=t.length;s<l;s++)t[s].dispose();for(var u=0,c=o.length;u<c;u++){o[u].dispose()}this.onDisposeModel&&this.onDisposeModel(r.scene,e),r.scene=null,r.materials=null,r.textures=null,r.geometry=null}e._loadIndex++}},{key:"setTileVisible",value:function(e,r){var t=e.cached.scene,n=this.visibleTiles,o=this.group;r?(o.add(t),n.add(e),t.updateMatrixWorld(!0)):(o.remove(t),n.delete(e))}},{key:"setTileActive",value:function(e,r){var t=this.activeTiles;r?t.add(e):t.delete(e)}},{key:"calculateError",value:function(e){if(0===e.geometricError)return 0;var r=e.cached,t=r.inFrustum,n=this.cameras,o=this.cameraInfo,a=e.boundingVolume;if("box"in a){for(var i=r.box,s=r.boxTransformInverse,l=-1/0,u=1/0,c=0,p=n.length;c<p;c++)if(t[c]){var f=n[c],h=o[c],d=h.invScale;k.copy(h.position),k.applyMatrix4(s);var m=void 0;if(f.isOrthographicCamera){var v=h.pixelSize;m=e.geometricError/(v*d)}else{var y=i.distanceToPoint(k)*d,g=h.sseDenominator;m=e.geometricError/(y*g),u=Math.min(u,y)}l=Math.max(l,m)}return e.cached.distance=u,l}return"sphere"in a?console.warn("ThreeTilesRenderer : Sphere bounds not supported."):"region"in a&&console.warn("ThreeTilesRenderer : Region bounds not supported."),1/0}},{key:"tileInView",value:function(e){var r=e.cached,t=r.sphere,n=r.inFrustum;if(t){for(var o=this.cameraInfo,a=!1,i=0,s=o.length;i<s;i++){o[i].frustum.intersectsSphere(t)?(a=!0,n[i]=!0):n[i]=!1}return a}return!0}}]),h}();exports.TilesRenderer=C;
  48. },{"../base/TilesRendererBase.js":"svb9","./B3DMLoader.js":"rU0W","./PNTSLoader.js":"Pr3e","./I3DMLoader.js":"iNV5","./CMPTLoader.js":"hwVX","./TilesGroup.js":"tTab","three":"dKqR","./raycastTraverse.js":"Hcez"}],"Tf2v":[function(require,module,exports) {
  49. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SphereHelper=void 0;var e=require("three");function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function i(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?u(e):r}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,r){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=a(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function a(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var s=new e.Vector3,y=["x","y","z"],h=function(t){function o(t){var n,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:40;r(this,o);for(var a=new e.BufferGeometry,p=[],l=0;l<3;l++){var h=y[l],b=y[(l+1)%3];s.set(0,0,0);for(var v=0;v<c;v++){var d=void 0;d=2*Math.PI*v/(c-1),s[h]=Math.sin(d),s[b]=Math.cos(d),p.push(s.x,s.y,s.z),d=2*Math.PI*(v+1)/(c-1),s[h]=Math.sin(d),s[b]=Math.cos(d),p.push(s.x,s.y,s.z)}}return a.setAttribute("position",new e.BufferAttribute(new Float32Array(p),3)),a.computeBoundingSphere(),(n=i(this,f(o).call(this,a,new e.LineBasicMaterial({color:u,toneMapped:!1})))).sphere=t,n.type="SphereHelper",n}return p(o,e.LineSegments),n(o,[{key:"updateMatrixWorld",value:function(e){var t=this.sphere;this.position.copy(t.center),this.scale.setScalar(t.radius),c(f(o.prototype),"updateMatrixWorld",this).call(this,e)}}]),o}();exports.SphereHelper=h;
  50. },{"three":"dKqR"}],"v73V":[function(require,module,exports) {
  51. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DebugTilesRenderer=exports.RANDOM_COLOR=exports.IS_LEAF=exports.RELATIVE_DEPTH=exports.DEPTH=exports.DISTANCE=exports.GEOMETRIC_ERROR=exports.SCREEN_ERROR=exports.NONE=void 0;var e=require("three"),r=require("./TilesRenderer.js"),t=require("./SphereHelper.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}function s(e,r){return!r||"object"!==o(r)&&"function"!=typeof r?l(e):r}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,r,t){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var o=p(e,r);if(o){var a=Object.getOwnPropertyDescriptor(o,r);return a.get?a.get.call(t):a.value}})(e,r,t||e)}function p(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=u(e)););return e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&d(e,r)}function d(e,r){return(d=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}var f=Symbol("ORIGINAL_MATERIAL"),v=Symbol("HAS_RANDOM_COLOR");function b(){}var m=0;exports.NONE=m;var x=1;exports.SCREEN_ERROR=x;var y=2;exports.GEOMETRIC_ERROR=y;var E=3;exports.DISTANCE=E;var R=4;exports.DEPTH=R;var g=5;exports.RELATIVE_DEPTH=g;var _=6;exports.IS_LEAF=_;var D=7;exports.RANDOM_COLOR=D;var O=function(o){function i(){var r,t;a(this,i);for(var o=arguments.length,n=new Array(o),l=0;l<o;l++)n[l]=arguments[l];var c=(t=s(this,(r=u(i)).call.apply(r,[this].concat(n)))).group,p=new e.Group;c.add(p);var h=new e.Group;return c.add(h),t.displayBoxBounds=!1,t.displaySphereBounds=!1,t.colorMode=m,t.boxGroup=p,t.sphereGroup=h,t.maxDebugDepth=-1,t.maxDebugDistance=-1,t.maxDebugError=-1,t.extremeDebugDepth=-1,t.extremeDebugError=-1,t}return h(i,r.TilesRenderer),n(i,[{key:"initExtremes",value:function(){var e=-1;this.traverse(function(r){e=Math.max(e,r.__depth)});var r=-1;this.traverse(function(e){r=Math.max(r,e.geometricError)}),this.extremeDebugDepth=e,this.extremeDebugError=r}},{key:"loadTileSet",value:function(){for(var e,r=this,t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var n=(e=c(u(i.prototype),"loadTileSet",this)).call.apply(e,[this].concat(o));return n.then(function(){return r.initExtremes()}).catch(function(){}),n}},{key:"getTileInformationFromActiveObject",value:function(e){var r=null;return this.activeTiles.forEach(function(t){if(r)return!0;var o=t.cached.scene;o&&o.traverse(function(o){o===e&&(r=t)})}),r?{distanceToCamera:r.cached.distance,geometricError:r.geometricError,screenSpaceError:r.__error,depth:r.__depth,isLeaf:r.__isLeaf}:null}},{key:"update",value:function(){if(c(u(i.prototype),"update",this).call(this),this.root){this.boxGroup.visible=this.displayBoxBounds,this.sphereGroup.visible=this.displaySphereBounds;var r=-1;r=-1===this.maxDebugDepth?this.extremeDebugDepth:this.maxDebugDepth;var t=-1;t=-1===this.maxDebugError?this.extremeDebugError:this.maxDebugError;var o=-1;o=-1===this.maxDebugDistance?this.root.cached.sphere.radius:this.maxDebugDistance;var a=this.errorTarget,n=this.colorMode;this.visibleTiles.forEach(function(i){var s,l,c,p=i.cached.scene;n===D&&(s=Math.random(),l=.5+.5*Math.random(),c=.375+.25*Math.random()),p.traverse(function(p){var u=p.material;if(u){var h=p[f];if(n===m&&u!==h)p.material.dispose(),p.material=p[f];else if(n!==m&&u===h)if(p.isPoints){var d=new e.PointsMaterial;d.size=h.size,d.sizeAttenuation=h.sizeAttenuation,p.material=d}else p.material=new e.MeshBasicMaterial;switch(n!==D&&delete p.material[v],n){case R:var b=i.__depth/r;p.material.color.setRGB(b,b,b);break;case g:var O=i.__depthFromRenderedParent/r;p.material.color.setRGB(O,O,O);break;case x:var T=i.__error/a;T>1?p.material.color.setRGB(1,0,0):p.material.color.setRGB(T,T,T);break;case y:var G=Math.min(i.geometricError/t,1);p.material.color.setRGB(G,G,G);break;case E:var S=Math.min(i.cached.distance/o,1);p.material.color.setRGB(S,S,S);break;case _:i.children&&0!==i.children.length?p.material.color.set(0):p.material.color.set(16777215);break;case D:p.material[v]||(p.material.color.setHSL(s,l,c),p.material[v]=!0)}}})})}}},{key:"setTileVisible",value:function(e,r){c(u(i.prototype),"setTileVisible",this).call(this,e,r);var t=e.cached,o=this.sphereGroup,a=this.boxGroup,n=t.boxHelperGroup,s=t.sphereHelper;r?(a.add(n),n.updateMatrixWorld(!0),o.add(s),s.updateMatrixWorld(!0)):(a.remove(n),o.remove(s))}},{key:"parseTile",value:function(r,o,a){var n=this;return c(u(i.prototype),"parseTile",this).call(this,r,o,a).then(function(){var r=o.cached,a=r.scene;if(a){var i=r.box,s=r.boxTransform,l=new e.Group;l.matrix.copy(s),l.matrix.decompose(l.position,l.quaternion,l.scale);var c=new e.Box3Helper(i);c.raycast=b,l.add(c),r.boxHelperGroup=l,n.visibleTiles.has(o)&&n.displayBoxBounds&&(n.boxGroup.add(l),l.updateMatrixWorld(!0));var p=r.sphere,u=new t.SphereHelper(p);u.raycast=b,r.sphereHelper=u,n.visibleTiles.has(o)&&n.displaySphereBounds&&(n.sphereGroup.add(u),u.updateMatrixWorld(!0)),a.traverse(function(e){var r=e.material;r&&(e[f]=r)})}})}},{key:"disposeTile",value:function(e){c(u(i.prototype),"disposeTile",this).call(this,e);var r=e.cached;r.boxHelperGroup&&(r.boxHelperGroup.children[0].geometry.dispose(),r.sphereHelper.geometry.dispose(),delete r.boxHelperGroup,delete r.sphereHelper)}}]),i}();exports.DebugTilesRenderer=O;
  52. },{"three":"dKqR","./TilesRenderer.js":"wXIB","./SphereHelper.js":"Tf2v"}],"uBxZ":[function(require,module,exports) {
  53. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"DebugTilesRenderer",{enumerable:!0,get:function(){return e.DebugTilesRenderer}}),Object.defineProperty(exports,"NONE",{enumerable:!0,get:function(){return e.NONE}}),Object.defineProperty(exports,"SCREEN_ERROR",{enumerable:!0,get:function(){return e.SCREEN_ERROR}}),Object.defineProperty(exports,"GEOMETRIC_ERROR",{enumerable:!0,get:function(){return e.GEOMETRIC_ERROR}}),Object.defineProperty(exports,"DISTANCE",{enumerable:!0,get:function(){return e.DISTANCE}}),Object.defineProperty(exports,"DEPTH",{enumerable:!0,get:function(){return e.DEPTH}}),Object.defineProperty(exports,"RELATIVE_DEPTH",{enumerable:!0,get:function(){return e.RELATIVE_DEPTH}}),Object.defineProperty(exports,"IS_LEAF",{enumerable:!0,get:function(){return e.IS_LEAF}}),Object.defineProperty(exports,"RANDOM_COLOR",{enumerable:!0,get:function(){return e.RANDOM_COLOR}}),Object.defineProperty(exports,"TilesRenderer",{enumerable:!0,get:function(){return r.TilesRenderer}}),Object.defineProperty(exports,"B3DMLoader",{enumerable:!0,get:function(){return t.B3DMLoader}}),Object.defineProperty(exports,"PNTSLoader",{enumerable:!0,get:function(){return n.PNTSLoader}}),Object.defineProperty(exports,"I3DMLoader",{enumerable:!0,get:function(){return o.I3DMLoader}}),Object.defineProperty(exports,"CMPTLoader",{enumerable:!0,get:function(){return u.CMPTLoader}}),Object.defineProperty(exports,"TilesRendererBase",{enumerable:!0,get:function(){return i.TilesRendererBase}}),Object.defineProperty(exports,"B3DMLoaderBase",{enumerable:!0,get:function(){return a.B3DMLoaderBase}}),Object.defineProperty(exports,"I3DMLoaderBase",{enumerable:!0,get:function(){return s.I3DMLoaderBase}}),Object.defineProperty(exports,"PNTSLoaderBase",{enumerable:!0,get:function(){return d.PNTSLoaderBase}}),Object.defineProperty(exports,"CMPTLoaderBase",{enumerable:!0,get:function(){return b.CMPTLoaderBase}}),Object.defineProperty(exports,"LRUCache",{enumerable:!0,get:function(){return c.LRUCache}}),Object.defineProperty(exports,"PriorityQueue",{enumerable:!0,get:function(){return p.PriorityQueue}});var e=require("./three/DebugTilesRenderer.js"),r=require("./three/TilesRenderer.js"),t=require("./three/B3DMLoader.js"),n=require("./three/PNTSLoader.js"),o=require("./three/I3DMLoader.js"),u=require("./three/CMPTLoader.js"),i=require("./base/TilesRendererBase.js"),a=require("./base/B3DMLoaderBase.js"),s=require("./base/I3DMLoaderBase.js"),d=require("./base/PNTSLoaderBase.js"),b=require("./base/CMPTLoaderBase.js"),c=require("./utilities/LRUCache.js"),p=require("./utilities/PriorityQueue.js");
  54. },{"./three/DebugTilesRenderer.js":"v73V","./three/TilesRenderer.js":"wXIB","./three/B3DMLoader.js":"rU0W","./three/PNTSLoader.js":"Pr3e","./three/I3DMLoader.js":"iNV5","./three/CMPTLoader.js":"hwVX","./base/TilesRendererBase.js":"svb9","./base/B3DMLoaderBase.js":"DNWc","./base/I3DMLoaderBase.js":"qWWH","./base/PNTSLoaderBase.js":"RlAR","./base/CMPTLoaderBase.js":"c0Qu","./utilities/LRUCache.js":"upKt","./utilities/PriorityQueue.js":"MK9K"}],"xTGv":[function(require,module,exports) {
  55. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MapControls=exports.OrbitControls=void 0;var e=require("../../../build/three.module.js"),t=function(t,n){var o,a,i,r,c,s;void 0===n&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=n,this.enabled=!0,this.target=new e.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return E.phi},this.getAzimuthalAngle=function(){return E.theta},this.listenToKeyEvents=function(e){e.addEventListener("keydown",Q),this._domElementKeyEvents=e},this.saveState=function(){u.target0.copy(u.target),u.position0.copy(u.object.position),u.zoom0=u.object.zoom},this.reset=function(){u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.zoom=u.zoom0,u.object.updateProjectionMatrix(),u.dispatchEvent(l),u.update(),d=h.NONE},this.update=(o=new e.Vector3,a=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),i=a.clone().invert(),r=new e.Vector3,c=new e.Quaternion,s=2*Math.PI,function(){var e=u.object.position;o.copy(e).sub(u.target),o.applyQuaternion(a),E.setFromVector3(o),u.autoRotate&&d===h.NONE&&R(2*Math.PI/60/60*u.autoRotateSpeed),u.enableDamping?(E.theta+=f.theta*u.dampingFactor,E.phi+=f.phi*u.dampingFactor):(E.theta+=f.theta,E.phi+=f.phi);var t=u.minAzimuthAngle,n=u.maxAzimuthAngle;return isFinite(t)&&isFinite(n)&&(t<-Math.PI?t+=s:t>Math.PI&&(t-=s),n<-Math.PI?n+=s:n>Math.PI&&(n-=s),E.theta=t<=n?Math.max(t,Math.min(n,E.theta)):E.theta>(t+n)/2?Math.max(t,E.theta):Math.min(n,E.theta)),E.phi=Math.max(u.minPolarAngle,Math.min(u.maxPolarAngle,E.phi)),E.makeSafe(),E.radius*=O,E.radius=Math.max(u.minDistance,Math.min(u.maxDistance,E.radius)),!0===u.enableDamping?u.target.addScaledVector(g,u.dampingFactor):u.target.add(g),o.setFromSpherical(E),o.applyQuaternion(i),e.copy(u.target).add(o),u.object.lookAt(u.target),!0===u.enableDamping?(f.theta*=1-u.dampingFactor,f.phi*=1-u.dampingFactor,g.multiplyScalar(1-u.dampingFactor)):(f.set(0,0,0),g.set(0,0,0)),O=1,!!(v||r.distanceToSquared(u.object.position)>b||8*(1-c.dot(u.object.quaternion))>b)&&(u.dispatchEvent(l),r.copy(u.object.position),c.copy(u.object.quaternion),v=!1,!0)}),this.dispose=function(){u.domElement.removeEventListener("contextmenu",te),u.domElement.removeEventListener("pointerdown",B),u.domElement.removeEventListener("wheel",q),u.domElement.removeEventListener("touchstart",J),u.domElement.removeEventListener("touchend",ee),u.domElement.removeEventListener("touchmove",$),u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),null!==u._domElementKeyEvents&&u._domElementKeyEvents.removeEventListener("keydown",Q)};var u=this,l={type:"change"},m={type:"start"},p={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,b=1e-6,E=new e.Spherical,f=new e.Spherical,O=1,g=new e.Vector3,v=!1,T=new e.Vector2,y=new e.Vector2,P=new e.Vector2,L=new e.Vector2,w=new e.Vector2,A=new e.Vector2,N=new e.Vector2,M=new e.Vector2,j=new e.Vector2;function D(){return Math.pow(.95,u.zoomSpeed)}function R(e){f.theta-=e}function S(e){f.phi-=e}var k,C=(k=new e.Vector3,function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),g.add(k)}),Y=function(){var t=new e.Vector3;return function(e,n){!0===u.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(u.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),x=function(){var t=new e.Vector3;return function(e,n){var o=u.domElement;if(u.object.isPerspectiveCamera){var a=u.object.position;t.copy(a).sub(u.target);var i=t.length();i*=Math.tan(u.object.fov/2*Math.PI/180),C(2*e*i/o.clientHeight,u.object.matrix),Y(2*n*i/o.clientHeight,u.object.matrix)}else u.object.isOrthographicCamera?(C(e*(u.object.right-u.object.left)/u.object.zoom/o.clientWidth,u.object.matrix),Y(n*(u.object.top-u.object.bottom)/u.object.zoom/o.clientHeight,u.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),u.enablePan=!1)}}();function H(e){u.object.isPerspectiveCamera?O/=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom*e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function U(e){u.object.isPerspectiveCamera?O*=e:u.object.isOrthographicCamera?(u.object.zoom=Math.max(u.minZoom,Math.min(u.maxZoom,u.object.zoom/e)),u.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),u.enableZoom=!1)}function _(e){T.set(e.clientX,e.clientY)}function V(e){L.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}}function I(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,n)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);N.set(0,o)}function F(e){if(1==e.touches.length)y.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);y.set(t,n)}P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var o=u.domElement;R(2*Math.PI*P.x/o.clientHeight),S(2*Math.PI*P.y/o.clientHeight),T.copy(y)}function Z(e){if(1==e.touches.length)w.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);w.set(t,n)}A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w)}function K(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(t*t+n*n);M.set(0,o),j.set(0,Math.pow(M.y/N.y,u.zoomSpeed)),H(j.y),N.copy(M)}function B(t){if(!1!==u.enabled)switch(t.pointerType){case"mouse":case"pen":!function(t){var n;switch(t.preventDefault(),u.domElement.focus?u.domElement.focus():window.focus(),t.button){case 0:n=u.mouseButtons.LEFT;break;case 1:n=u.mouseButtons.MIDDLE;break;case 2:n=u.mouseButtons.RIGHT;break;default:n=-1}switch(n){case e.MOUSE.DOLLY:if(!1===u.enableZoom)return;!function(e){N.set(e.clientX,e.clientY)}(t),d=h.DOLLY;break;case e.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enablePan)return;V(t),d=h.PAN}else{if(!1===u.enableRotate)return;_(t),d=h.ROTATE}break;case e.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===u.enableRotate)return;_(t),d=h.ROTATE}else{if(!1===u.enablePan)return;V(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(u.domElement.ownerDocument.addEventListener("pointermove",G),u.domElement.ownerDocument.addEventListener("pointerup",W),u.dispatchEvent(m))}(t)}}function G(e){if(!1!==u.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===u.enabled)return;switch(e.preventDefault(),d){case h.ROTATE:if(!1===u.enableRotate)return;!function(e){y.set(e.clientX,e.clientY),P.subVectors(y,T).multiplyScalar(u.rotateSpeed);var t=u.domElement;R(2*Math.PI*P.x/t.clientHeight),S(2*Math.PI*P.y/t.clientHeight),T.copy(y),u.update()}(e);break;case h.DOLLY:if(!1===u.enableZoom)return;!function(e){M.set(e.clientX,e.clientY),j.subVectors(M,N),j.y>0?H(D()):j.y<0&&U(D()),N.copy(M),u.update()}(e);break;case h.PAN:if(!1===u.enablePan)return;!function(e){w.set(e.clientX,e.clientY),A.subVectors(w,L).multiplyScalar(u.panSpeed),x(A.x,A.y),L.copy(w),u.update()}(e)}}(e)}}function W(e){switch(e.pointerType){case"mouse":case"pen":!function(e){if(u.domElement.ownerDocument.removeEventListener("pointermove",G),u.domElement.ownerDocument.removeEventListener("pointerup",W),!1===u.enabled)return;u.dispatchEvent(p),d=h.NONE}()}}function q(e){!1===u.enabled||!1===u.enableZoom||d!==h.NONE&&d!==h.ROTATE||(e.preventDefault(),e.stopPropagation(),u.dispatchEvent(m),function(e){e.deltaY<0?U(D()):e.deltaY>0&&H(D()),u.update()}(e),u.dispatchEvent(p))}function Q(e){!1!==u.enabled&&!1!==u.enablePan&&function(e){var t=!1;switch(e.keyCode){case u.keys.UP:x(0,u.keyPanSpeed),t=!0;break;case u.keys.BOTTOM:x(0,-u.keyPanSpeed),t=!0;break;case u.keys.LEFT:x(u.keyPanSpeed,0),t=!0;break;case u.keys.RIGHT:x(-u.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),u.update())}(e)}function J(t){if(!1!==u.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(u.touches.ONE){case e.TOUCH.ROTATE:if(!1===u.enableRotate)return;z(t),d=h.TOUCH_ROTATE;break;case e.TOUCH.PAN:if(!1===u.enablePan)return;I(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(u.touches.TWO){case e.TOUCH.DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&X(e),u.enablePan&&I(e)}(t),d=h.TOUCH_DOLLY_PAN;break;case e.TOUCH.DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&X(e),u.enableRotate&&z(e)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&u.dispatchEvent(m)}}function $(e){if(!1!==u.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===u.enableRotate)return;F(e),u.update();break;case h.TOUCH_PAN:if(!1===u.enablePan)return;Z(e),u.update();break;case h.TOUCH_DOLLY_PAN:if(!1===u.enableZoom&&!1===u.enablePan)return;!function(e){u.enableZoom&&K(e),u.enablePan&&Z(e)}(e),u.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===u.enableZoom&&!1===u.enableRotate)return;!function(e){u.enableZoom&&K(e),u.enableRotate&&F(e)}(e),u.update();break;default:d=h.NONE}}function ee(e){!1!==u.enabled&&(u.dispatchEvent(p),d=h.NONE)}function te(e){!1!==u.enabled&&e.preventDefault()}u.domElement.addEventListener("contextmenu",te),u.domElement.addEventListener("pointerdown",B),u.domElement.addEventListener("wheel",q),u.domElement.addEventListener("touchstart",J),u.domElement.addEventListener("touchend",ee),u.domElement.addEventListener("touchmove",$),this.update()};exports.OrbitControls=t,t.prototype=Object.create(e.EventDispatcher.prototype),t.prototype.constructor=t;var n=function(n,o){t.call(this,n,o),this.screenSpacePanning=!1,this.mouseButtons.LEFT=e.MOUSE.PAN,this.mouseButtons.RIGHT=e.MOUSE.ROTATE,this.touches.ONE=e.TOUCH.PAN,this.touches.TWO=e.TOUCH.DOLLY_ROTATE};exports.MapControls=n,n.prototype=Object.create(e.EventDispatcher.prototype),n.prototype.constructor=n;
  56. },{"../../../build/three.module.js":"dKqR"}],"irr3":[function(require,module,exports) {
  57. "use strict";function e(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function t(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GUI=exports.gui=exports.dom=exports.controllers=exports.color=void 0;var n=Array.prototype.forEach,o=Array.prototype.slice,i={BREAK:{},extend:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(o.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=o.call(arguments);return function(){for(var t=o.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,o);else if(e.length===e.length+0){var i,r=void 0;for(r=0,i=e.length;r<i;r++)if(r in e&&t.call(o,e[r],r)===this.BREAK)return}else for(var s in e)if(t.call(o,e[s],s)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var o=void 0;return function(){var i=this,r=arguments;var s=n||!o;clearTimeout(o),o=setTimeout(function(){o=null,n||e.apply(i,r)},t),s&&e.apply(i,r)}},toArray:function(e){return e.toArray?e.toArray():o.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return e instanceof Function}},r=[{litmus:i.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:t},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:t},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:t},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:t}}},{litmus:i.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:i.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:i.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(i.isNumber(e.r)&&i.isNumber(e.g)&&i.isNumber(e.b)&&i.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(i.isNumber(e.r)&&i.isNumber(e.g)&&i.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(i.isNumber(e.h)&&i.isNumber(e.s)&&i.isNumber(e.v)&&i.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(i.isNumber(e.h)&&i.isNumber(e.s)&&i.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],s=void 0,a=void 0,l=function(){a=!1;var e=arguments.length>1?i.toArray(arguments):arguments[0];return i.each(r,function(t){if(t.litmus(e))return i.each(t.conversions,function(t,n){if(s=t.read(e),!1===a&&!1!==s)return a=s,s.conversionName=n,s.conversion=t,i.BREAK}),i.BREAK}),a},d=void 0,c={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(d=8*t)|e&~(255<<d)}},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},h=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),p=function e(t,n,o){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,o)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(o):void 0},f=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},m=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},g=function(){function e(){if(_(this,e),this.__state=l.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return h(e,[{key:"toString",value:function(){return t(this)}},{key:"toHexString",value:function(){return t(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function b(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(g.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(g.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function v(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(g.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(g.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}g.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=c.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");i.extend(e.__state,c.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},g.recalculateHSV=function(e){var t=c.rgb_to_hsv(e.r,e.g,e.b);i.extend(e.__state,{s:t.s,v:t.v}),i.isNaN(t.h)?i.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},g.COMPONENTS=["r","g","b","h","s","v","hex","a"],b(g.prototype,"r",2),b(g.prototype,"g",1),b(g.prototype,"b",0),v(g.prototype,"h"),v(g.prototype,"s"),v(g.prototype,"v"),Object.defineProperty(g.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(g.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=c.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var y=function(){function e(t,n){_(this,e),this.initialValue=t[n],this.domElement=document.createElement("div"),this.object=t,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return h(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),e}(),w={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},x={};i.each(w,function(e,t){i.each(e,function(e){x[e]=t})});var E=/(\d+(\.\d+)?)px/;function C(e){if("0"===e||i.isUndefined(e))return 0;var t=e.match(E);return i.isNull(t)?0:parseFloat(t[1])}var A={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var o=n,r=t;i.isUndefined(r)&&(r=!0),i.isUndefined(o)&&(o=!0),e.style.position="absolute",r&&(e.style.left=0,e.style.right=0),o&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,o){var r=n||{},s=x[t];if(!s)throw new Error("Event type "+t+" not supported.");var a=document.createEvent(s);switch(s){case"MouseEvents":var l=r.x||r.clientX||0,d=r.y||r.clientY||0;a.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,l,d,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=a.initKeyboardEvent||a.initKeyEvent;i.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:a.initEvent(t,r.bubbles||!1,r.cancelable||!0)}i.defaults(a,o),e.dispatchEvent(a)},bind:function(e,t,n,o){var i=o||!1;return e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),A},unbind:function(e,t,n,o){var i=o||!1;return e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),A},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return A},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),o=n.indexOf(t);-1!==o&&(n.splice(o,1),e.className=n.join(" "))}else e.className=void 0;return A},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return C(t["border-left-width"])+C(t["border-right-width"])+C(t["padding-left"])+C(t["padding-right"])+C(t.width)},getHeight:function(e){var t=getComputedStyle(e);return C(t["border-top-width"])+C(t["border-bottom-width"])+C(t["padding-top"])+C(t["padding-bottom"])+C(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do{n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent}while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},k=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;return o.__prev=o.getValue(),o.__checkbox=document.createElement("input"),o.__checkbox.setAttribute("type","checkbox"),A.bind(o.__checkbox,"change",function(){i.setValue(!i.__prev)},!1),o.domElement.appendChild(o.__checkbox),o.updateDisplay(),o}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),S=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o,a=r;if(r.__select=document.createElement("select"),i.isArray(s)){var l={};i.each(s,function(e){l[e]=e}),s=l}return i.each(s,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),a.__select.appendChild(n)}),r.updateDisplay(),A.bind(r.__select,"change",function(){var e=this.options[this.selectedIndex].value;a.setValue(e)}),r.domElement.appendChild(r.__select),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return A.isActive(this.__select)?this:(this.__select.value=this.getValue(),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(),O=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;function r(){i.setValue(i.__input.value)}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),A.bind(o.__input,"keyup",r),A.bind(o.__input,"change",r),A.bind(o.__input,"blur",function(){i.__onFinishChange&&i.__onFinishChange.call(i,i.getValue())}),A.bind(o.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){return A.isActive(this.__input)||(this.__input.value=this.getValue()),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function T(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var L=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),s=o||{};return r.__min=s.min,r.__max=s.max,r.__step=s.step,i.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=T(r.__impliedStep),r}return f(t,y),h(t,[{key:"setValue",value:function(e){var n=e;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=T(e),this}}]),t}();function R(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var B=function(e){function t(e,n,o){_(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));r.__truncationSuspended=!1;var s=r,a=void 0;function l(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}function d(e){var t=a-e.clientY;s.setValue(s.getValue()+t*s.__impliedStep),a=e.clientY}function c(){A.unbind(window,"mousemove",d),A.unbind(window,"mouseup",c),l()}return r.__input=document.createElement("input"),r.__input.setAttribute("type","text"),A.bind(r.__input,"change",function(){var e=parseFloat(s.__input.value);i.isNaN(e)||s.setValue(e)}),A.bind(r.__input,"blur",function(){l()}),A.bind(r.__input,"mousedown",function(e){A.bind(window,"mousemove",d),A.bind(window,"mouseup",c),a=e.clientY}),A.bind(r.__input,"keydown",function(e){13===e.keyCode&&(s.__truncationSuspended=!0,this.blur(),s.__truncationSuspended=!1,l())}),r.updateDisplay(),r.domElement.appendChild(r.__input),r}return f(t,L),h(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():R(this.getValue(),this.__precision),p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function N(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var H=function(e){function t(e,n,o,i,r){_(this,t);var s=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(N(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){A.unbind(window,"mousemove",l),A.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(N(t,n.left,n.right,a.__min,a.__max))}function u(){A.unbind(window,"touchmove",c),A.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),A.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),A.bind(window,"mousemove",l),A.bind(window,"mouseup",d),l(e)}),A.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;A.bind(window,"touchmove",c),A.bind(window,"touchend",u),c(e)}),A.addClass(s.__background,"slider"),A.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return f(t,L),h(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",p(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),F=function(e){function t(e,n,o){_(this,t);var i=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,A.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),A.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return f(t,y),h(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(),P=function(e){function t(e,n){_(this,t);var o=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new g(o.getValue()),o.__temp=new g(0);var r=o;o.domElement=document.createElement("div"),A.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",A.bind(o.__input,"keydown",function(e){13===e.keyCode&&h.call(this)}),A.bind(o.__input,"blur",h),A.bind(o.__selector,"mousedown",function(){A.addClass(this,"drag").bind(window,"mouseup",function(){A.removeClass(r.__selector,"drag")})}),A.bind(o.__selector,"touchstart",function(){A.addClass(this,"drag").bind(window,"touchend",function(){A.removeClass(r.__selector,"drag")})});var s=document.createElement("div");function a(e){f(e),A.bind(window,"mousemove",f),A.bind(window,"touchmove",f),A.bind(window,"mouseup",c),A.bind(window,"touchend",c)}function d(e){b(e),A.bind(window,"mousemove",b),A.bind(window,"touchmove",b),A.bind(window,"mouseup",u),A.bind(window,"touchend",u)}function c(){A.unbind(window,"mousemove",f),A.unbind(window,"touchmove",f),A.unbind(window,"mouseup",c),A.unbind(window,"touchend",c),p()}function u(){A.unbind(window,"mousemove",b),A.unbind(window,"touchmove",b),A.unbind(window,"mouseup",u),A.unbind(window,"touchend",u),p()}function h(){var e=l(this.value);!1!==e?(r.__color.__state=e,r.setValue(r.__color.toOriginal())):this.value=r.__color.toString()}function p(){r.__onFinishChange&&r.__onFinishChange.call(r,r.__color.toOriginal())}function f(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,i=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(i-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),r.__color.v=a,r.__color.s=s,r.setValue(r.__color.toOriginal()),!1}function b(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=r.__hue_field.getBoundingClientRect(),n=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),r.__color.h=360*n,r.setValue(r.__color.toOriginal()),!1}return i.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(s.style,{width:"100%",height:"100%",background:"none"}),j(s,"top","rgba(0,0,0,0)","#000"),i.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),V(o.__hue_field),i.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),A.bind(o.__saturation_field,"mousedown",a),A.bind(o.__saturation_field,"touchstart",a),A.bind(o.__field_knob,"mousedown",a),A.bind(o.__field_knob,"touchstart",a),A.bind(o.__hue_field,"mousedown",d),A.bind(o.__hue_field,"touchstart",d),o.__saturation_field.appendChild(s),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return f(t,y),h(t,[{key:"updateDisplay",value:function(){var e=l(this.getValue());if(!1!==e){var t=!1;i.each(g.COMPONENTS,function(n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,j(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),i.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(),D=["-moz-","-o-","-webkit-","-ms-",""];function j(e,t,n,o){e.style.background="",i.each(D,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "})}function V(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var I={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},z='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n\n </div>\n\n </div>\n\n</div>',M=function(e,t){var n=e[t];return i.isArray(arguments[2])||i.isObject(arguments[2])?new S(e,t,arguments[2]):i.isNumber(n)?i.isNumber(arguments[2])&&i.isNumber(arguments[3])?i.isNumber(arguments[4])?new H(e,t,arguments[2],arguments[3],arguments[4]):new H(e,t,arguments[2],arguments[3]):i.isNumber(arguments[4])?new B(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new B(e,t,{min:arguments[2],max:arguments[3]}):i.isString(n)?new O(e,t):i.isFunction(n)?new F(e,t,""):i.isBoolean(n)?new k(e,t):null};function G(e){setTimeout(e,1e3/60)}var U=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||G,X=function(){function e(){_(this,e),this.backgroundElement=document.createElement("div"),i.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),A.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),i.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;A.bind(this.backgroundElement,"click",function(){t.hide()})}return h(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),i.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",A.unbind(e.domElement,"webkitTransitionEnd",t),A.unbind(e.domElement,"transitionend",t),A.unbind(e.domElement,"oTransitionEnd",t)};A.bind(this.domElement,"webkitTransitionEnd",t),A.bind(this.domElement,"transitionend",t),A.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-A.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-A.getHeight(this.domElement)/2+"px"}}]),e}(),K=e(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");I.inject(K);var Y="dg",J=72,W=20,Q="Default",q=function(){try{return!!window.localStorage}catch(e){return!1}}(),Z=void 0,$=!0,ee=void 0,te=!1,ne=[],oe=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),A.addClass(this.domElement,Y),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=i.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=i.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),i.isUndefined(o.load)?o.load={preset:Q}:o.preset&&(o.load.preset=o.preset),i.isUndefined(o.parent)&&o.hideable&&ne.push(this),o.resizable=i.isUndefined(o.parent)&&o.resizable,o.autoPlace&&i.isUndefined(o.scrollable)&&(o.scrollable=!0);var r,s=q&&"true"===localStorage.getItem(ce(this,"isLocal")),a=void 0,l=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ge(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,fe(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,l&&(l.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?A.addClass(n.__ul,e.CLASS_CLOSED):A.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return s},set:function(e){q&&(s=e,e?A.bind(window,"unload",a):A.unbind(window,"unload",a),localStorage.setItem(ce(n,"isLocal"),e))}}}),i.isUndefined(o.parent)){if(this.closed=o.closed||!1,A.addClass(this.domElement,e.CLASS_MAIN),A.makeSelectable(this.domElement,!1),q&&s){n.useLocalStorage=!0;var d=localStorage.getItem(ce(this,"gui"));d&&(o.load=JSON.parse(d))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,A.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(A.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(A.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),A.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===o.closed&&(o.closed=!0);var c=document.createTextNode(o.name);A.addClass(c,"controller-name"),l=ie(n,c);A.addClass(this.__ul,e.CLASS_CLOSED),A.addClass(l,"title"),A.bind(l,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),o.closed||(this.closed=!1)}o.autoPlace&&(i.isUndefined(o.parent)&&($&&(ee=document.createElement("div"),A.addClass(ee,Y),A.addClass(ee,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(ee),$=!1),ee.appendChild(this.domElement),A.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fe(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},A.bind(window,"resize",this.__resizeHandler),A.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),A.bind(this.__ul,"transitionend",this.__resizeHandler),A.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&pe(this),a=function(){q&&"true"===localStorage.getItem(ce(n,"isLocal"))&&localStorage.setItem(ce(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,o.parent||((r=n.getRoot()).width+=1,i.defer(function(){r.width-=1}))};function ie(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function re(e){A.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&A.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function se(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ae(e,t,n){if(n.__li=t,n.__gui=e,i.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:o,factoryArgs:[i.toArray(arguments)]})}if(i.isArray(t)||i.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),de(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof H){var o=new B(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});i.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}}),A.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof B){var r=function(t){if(i.isNumber(n.__min)&&i.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var s=de(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return s.name(o),r&&s.listen(),s}return t};n.min=i.compose(r,n.min),n.max=i.compose(r,n.max)}else n instanceof k?(A.bind(t,"click",function(){A.fakeEvent(n.__checkbox,"click")}),A.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof F?(A.bind(t,"click",function(){A.fakeEvent(n.__button,"click")}),A.bind(t,"mouseover",function(){A.addClass(n.__button,"hover")}),A.bind(t,"mouseout",function(){A.removeClass(n.__button,"hover")})):n instanceof P&&(A.addClass(t,"color"),n.updateDisplay=i.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=i.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&se(e.getRoot(),!0),t},n.setValue)}function le(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[Q])return;s=r[Q]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function de(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new P(t,n);else{var r=[t,n].concat(o.factoryArgs);i=M.apply(e,r)}o.before instanceof y&&(o.before=o.before.__li),le(e,i),A.addClass(i.domElement,"c");var s=document.createElement("span");A.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ie(e,a,o.before);return A.addClass(l,oe.CLASS_CONTROLLER_ROW),i instanceof P?A.addClass(l,"color"):A.addClass(l,u(i.getValue())),ae(e,l,i),e.__controllers.push(i),i}function ce(e,t){return document.location.href+"."+t}function ue(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function _e(e,t){t.style.display=e.useLocalStorage?"block":"none"}function he(e){var t=e.__save_row=document.createElement("li");A.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),A.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",A.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",A.addClass(o,"button"),A.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",A.addClass(r,"button"),A.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",A.addClass(s,"button"),A.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?i.each(e.load.remembered,function(t,n){ue(e,n,n===e.preset)}):ue(e,Q,!1),A.bind(a,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(a),t.appendChild(n),t.appendChild(o),t.appendChild(r),t.appendChild(s),q){var l=document.getElementById("dg-local-explain"),d=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(ce(e,"isLocal"))&&d.setAttribute("checked","checked"),_e(e,l),A.bind(d,"change",function(){e.useLocalStorage=!e.useLocalStorage,_e(e,l)})}var c=document.getElementById("dg-new-constructor");A.bind(c,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||Z.hide()}),A.bind(n,"click",function(){c.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),Z.show(),c.focus(),c.select()}),A.bind(o,"click",function(){e.save()}),A.bind(r,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),A.bind(s,"click",function(){e.revert()})}function pe(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function o(){A.removeClass(e.__closeButton,oe.CLASS_DRAG),A.unbind(window,"mousemove",n),A.unbind(window,"mouseup",o)}function r(i){return i.preventDefault(),t=i.clientX,A.addClass(e.__closeButton,oe.CLASS_DRAG),A.bind(window,"mousemove",n),A.bind(window,"mouseup",o),!1}e.__resize_handle=document.createElement("div"),i.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),A.bind(e.__resize_handle,"mousedown",r),A.bind(e.__closeButton,"mousedown",r),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function fe(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function me(e,t){var n={};return i.each(e.__rememberedObjects,function(o,r){var s={},a=e.__rememberedObjectIndecesToControllers[r];i.each(a,function(e,n){s[n]=t?e.initialValue:e.getValue()}),n[r]=s}),n}function ge(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function be(e){0!==e.length&&U.call(window,function(){be(e)}),i.each(e,function(e){e.updateDisplay()})}oe.toggleHide=function(){te=!te,i.each(ne,function(e){e.domElement.style.display=te?"none":""})},oe.CLASS_AUTO_PLACE="a",oe.CLASS_AUTO_PLACE_CONTAINER="ac",oe.CLASS_MAIN="main",oe.CLASS_CONTROLLER_ROW="cr",oe.CLASS_TOO_TALL="taller-than-window",oe.CLASS_CLOSED="closed",oe.CLASS_CLOSE_BUTTON="close-button",oe.CLASS_CLOSE_TOP="close-top",oe.CLASS_CLOSE_BOTTOM="close-bottom",oe.CLASS_DRAG="drag",oe.DEFAULT_WIDTH=245,oe.TEXT_CLOSED="Close Controls",oe.TEXT_OPEN="Open Controls",oe._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==J&&e.keyCode!==J||oe.toggleHide()},A.bind(window,"keydown",oe._keydownHandler,!1),i.extend(oe.prototype,{add:function(e,t){return de(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return de(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;i.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&ee.removeChild(this.domElement);var e=this;i.each(this.__folders,function(t){e.removeFolder(t)}),A.unbind(window,"keydown",oe._keydownHandler,!1),re(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new oe(t);this.__folders[e]=n;var o=ie(this,n.domElement);return A.addClass(o,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],re(e);var t=this;i.each(e.__folders,function(t){e.removeFolder(t)}),i.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=A.getOffset(e.__ul).top,n=0;i.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=A.getHeight(t))}),window.innerHeight-t-W<n?(A.addClass(e.domElement,oe.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-W+"px"):(A.removeClass(e.domElement,oe.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&i.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:i.debounce(function(){this.onResize()},50),remember:function(){if(i.isUndefined(Z)&&((Z=new X).domElement.innerHTML=z),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;i.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&he(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&fe(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=me(this)),e.folders={},i.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=me(this),se(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[Q]=me(this,!0)),this.load.remembered[e]=me(this),this.preset=e,ue(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){i.each(this.__controllers,function(t){this.getRoot().load.remembered?le(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),i.each(this.__folders,function(e){e.revert(e)}),e||se(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&be(this.__listening)},updateDisplay:function(){i.each(this.__controllers,function(e){e.updateDisplay()}),i.each(this.__folders,function(e){e.updateDisplay()})}});var ve={Color:g,math:c,interpret:l};exports.color=ve;var ye={Controller:y,BooleanController:k,OptionController:S,StringController:O,NumberController:L,NumberControllerBox:B,NumberControllerSlider:H,FunctionController:F,ColorController:P};exports.controllers=ye;var we={dom:A};exports.dom=we;var xe={GUI:oe};exports.gui=xe;var Ee=oe;exports.GUI=Ee;var Ce={color:ve,controllers:ye,dom:we,gui:xe,GUI:Ee},Ae=Ce;exports.default=Ae;
  58. },{}],"eCSS":[function(require,module,exports) {
  59. "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){var t=0,l=document.createElement("div");function n(e){return l.appendChild(e.dom),e}function a(e){for(var n=0;n<l.children.length;n++)l.children[n].style.display=n===e?"block":"none";t=e}l.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",l.addEventListener("click",function(e){e.preventDefault(),a(++t%l.children.length)},!1);var i=(performance||Date).now(),o=i,r=0,f=n(new e.Panel("FPS","#0ff","#002")),d=n(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=n(new e.Panel("MB","#f08","#201"));return a(0),{REVISION:16,dom:l,addPanel:n,showPanel:a,begin:function(){i=(performance||Date).now()},end:function(){r++;var e=(performance||Date).now();if(d.update(e-i,200),e>=o+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,c)){var t=performance.memory;c.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:a}};e.Panel=function(e,t,l){var n=1/0,a=0,i=Math.round,o=i(window.devicePixelRatio||1),r=80*o,f=48*o,d=3*o,c=2*o,p=3*o,s=15*o,u=74*o,m=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=l,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,d,c),v.fillRect(p,s,u,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p,s,u,m),{dom:h,update:function(f,x){n=Math.min(n,f),a=Math.max(a,f),v.fillStyle=l,v.globalAlpha=1,v.fillRect(0,0,r,s),v.fillStyle=t,v.fillText(i(f)+" "+e+" ("+i(n)+"-"+i(a)+")",d,c),v.drawImage(h,p+o,s,u-o,m,p,s,u-o,m),v.fillRect(p+u-o,s,o,m),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p+u-o,s,o,i((1-f/x)*m))}}};var t=e;exports.default=t;
  60. },{}],"ei6e":[function(require,module,exports) {
  61. "use strict";var t,e,n,i,o,a,r,s,d,l,c,w=require("../src/index.js"),m=require("three"),p=require("three/examples/jsm/controls/OrbitControls.js"),h=g(require("three/examples/jsm/libs/dat.gui.module.js")),u=v(require("three/examples/jsm/libs/stats.module.js"));function v(t){return t&&t.__esModule?t:{default:t}}function f(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return f=function(){return t},t}function g(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var e=f();if(e&&e.has(t))return e.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var a=i?Object.getOwnPropertyDescriptor(t,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=t[o]}return n.default=t,e&&e.set(t,n),n}var y=0,x=1,P=2,S=3,b={material:y,orthographic:!1,rebuild:O},M={vertexShader:"\n\t\tvarying vec3 wPosition;\n\t\tvoid main() {\n\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\twPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;\n\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec3 wPosition;\n\t\tvoid main() {\n\n\t\t\tfloat minVal = - 30.0;\n\t\t\tfloat maxVal = 30.0;\n\n\t\t\tfloat val = ( wPosition.y - minVal ) / ( maxVal - minVal );\n\n\t\t\tvec4 color1 = vec4( 0.149, 0.196, 0.219, 1.0 ) * 0.5;\n\t\t\tvec4 color2 = vec4( 1.0 );\n\n\t\t\tgl_FragColor = mix( color1, color2, val );\n\n\t\t}\n\t"},C={extensions:{derivatives:!0},vertexShader:"\n\t\tvarying vec3 wPosition;\n\t\tvarying vec3 vViewPosition;\n\t\tvoid main() {\n\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\twPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;\n\t\t\tvViewPosition = - mvPosition.xyz;\n\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec3 wPosition;\n\t\tvarying vec3 vViewPosition;\n\t\tvoid main() {\n\n\t\t\t// lighting\n\t\t\tvec3 fdx = vec3( dFdx( wPosition.x ), dFdx( wPosition.y ), dFdx( wPosition.z ) );\n\t\t\tvec3 fdy = vec3( dFdy( wPosition.x ), dFdy( wPosition.y ), dFdy( wPosition.z ) );\n\t\t\tvec3 worldNormal = normalize( cross( fdx, fdy ) );\n\n\t\t\tfloat lighting =\n\t\t\t\t0.4 +\n\t\t\t\tclamp( dot( worldNormal, vec3( 1.0, 1.0, 1.0 ) ), 0.0, 1.0 ) * 0.5 +\n\t\t\t\tclamp( dot( worldNormal, vec3( - 1.0, 1.0, - 1.0 ) ), 0.0, 1.0 ) * 0.3;\n\n\t\t\t// thickness scale\n\t\t\tfloat upwardness = dot( worldNormal, vec3( 0.0, 1.0, 0.0 ) );\n\t\t\tfloat yInv = clamp( 1.0 - abs( upwardness ), 0.0, 1.0 );\n\t\t\tfloat thicknessScale = pow( yInv, 0.4 );\n\t\t\tthicknessScale *= 0.25 + 0.5 * ( vViewPosition.z + 1.0 ) / 2.0;\n\n\t\t\t// thickness\n\t\t\tfloat thickness = 0.01 * thicknessScale;\n\t\t\tfloat thickness2 = thickness / 2.0;\n\t\t\tfloat m = mod( wPosition.y, 3.0 );\n\n\t\t\t// soften edge\n\t\t\tfloat center = thickness2;\n\t\t\tfloat dist = clamp( abs( m - thickness2 ) / thickness2, 0.0, 1.0 );\n\n\t\t\tvec4 topoColor = vec4( 0.149, 0.196, 0.219, 1.0 ) * 0.5;\n\t\t\tgl_FragColor = mix( topoColor * lighting, vec4( lighting ), dist );\n\n\t\t}\n\t"};function j(t){var e=parseFloat(b.material);t.traverse(function(t){if(t.isMesh)switch(t.material.dispose(),e){case y:t.material=t.originalMaterial,t.material.side=2,t.receiveShadow=!1,t.castShadow=!1;break;case x:t.material=new m.ShaderMaterial(M),t.material.side=2,t.receiveShadow=!1,t.castShadow=!1;break;case P:t.material=new m.ShaderMaterial(C),t.material.side=2,t.material.flatShading=!0,t.receiveShadow=!1,t.castShadow=!1;break;case S:t.material=new m.MeshStandardMaterial,t.material.side=2,t.receiveShadow=!0,t.castShadow=!0}})}function k(t){t.traverse(function(t){t.isMesh&&(t.originalMaterial=t.material)}),j(t)}function F(t){t.traverse(function(t){t.isMesh&&t.material.dispose()})}function O(){o&&(o.group.parent.remove(o.group),o.dispose());var t=window.location.hash.replace(/^#/,"")||"../data/tileset.json";(o=new w.TilesRenderer(t)).errorTarget=2,o.onLoadModel=k,o.onDisposeModel=F,r.add(o.group)}function R(){n=new m.Scene,(i=new m.WebGLRenderer({antialias:!0})).setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),i.setClearColor(1383455),i.shadowMap.enabled=!0,i.shadowMap.type=m.PCFSoftShadowMap,i.outputEncoding=m.sRGBEncoding,document.body.appendChild(i.domElement),(t=new m.PerspectiveCamera(60,window.innerWidth/window.innerHeight,1,4e3)).position.set(400,400,400),a=new m.OrthographicCamera,(e=new p.OrbitControls(t,i.domElement)).screenSpacePanning=!1,e.minDistance=1,e.maxDistance=2e3,(d=new m.DirectionalLight(16777215,1.25)).position.set(1,2,3).multiplyScalar(40),d.castShadow=!0,d.shadow.bias=-.01,d.shadow.mapSize.setScalar(2048);var w=d.shadow.camera;w.left=-200,w.bottom=-200,w.right=200,w.top=200,w.updateProjectionMatrix(),n.add(d);var v=new m.AmbientLight(16777215,.05);n.add(v),s=new m.Box3,r=new m.Group,n.add(r),O(),z(),window.addEventListener("resize",z,!1);var f=new h.GUI;f.width=300,f.add(b,"orthographic"),f.add(b,"material",{DEFAULT:y,GRADIENT:x,TOPOGRAPHIC_LINES:P,LIGHTING:S}).onChange(function(){o.forEachLoadedModel(j)}),f.add(b,"rebuild"),f.open(),(c=new u.default).showPanel(0),document.body.appendChild(c.dom),(l=document.createElement("div")).style.position="absolute",l.style.top=0,l.style.left=0,l.style.color="white",l.style.width="100%",l.style.textAlign="center",l.style.padding="5px",l.style.pointerEvents="none",l.style.lineHeight="1.5em",document.body.appendChild(l)}function z(){t.aspect=window.innerWidth/window.innerHeight,i.setPixelRatio(window.devicePixelRatio),i.setSize(window.innerWidth,window.innerHeight),t.updateProjectionMatrix(),E()}function E(){a.position.copy(t.position),a.rotation.copy(t.rotation);var n=t.position.distanceTo(e.target)/2,i=window.innerWidth/window.innerHeight;a.left=-i*n,a.right=i*n,a.bottom=-n,a.top=n,a.near=t.near,a.far=t.far,a.updateProjectionMatrix()}function W(){requestAnimationFrame(W),b.orthographic?(o.deleteCamera(t),o.setCamera(a),o.setResolutionFromRenderer(a,i)):(o.deleteCamera(a),o.setCamera(t),o.setResolutionFromRenderer(t,i)),r.rotation.set(0,0,0),"-Z"===b.up&&(r.rotation.x=Math.PI/2),r.updateMatrixWorld(!0),o.getBounds(s)&&(s.getCenter(o.group.position),o.group.position.multiplyScalar(-1)),window.tiles=o,t.updateMatrixWorld(),a.updateMatrixWorld(),o.update(),_(),c.update()}function _(){E(),l.innerText="Geometries: ".concat(i.info.memory.geometries," ")+"Textures: ".concat(i.info.memory.textures," ")+"Programs: ".concat(i.info.programs.length," "),i.render(n,b.orthographic?a:t)}R(),W();
  62. },{"../src/index.js":"uBxZ","three":"dKqR","three/examples/jsm/controls/OrbitControls.js":"xTGv","three/examples/jsm/libs/dat.gui.module.js":"irr3","three/examples/jsm/libs/stats.module.js":"eCSS"}]},{},["ei6e"], null)
  63. //# sourceMappingURL=customMaterial.dd39ecee.js.map