PageSourceSearch

https://www.dacia.com.tr/client/dacia-3d-area-pkg-9795a6f0e491ac48.js

js dacia.com.tr collected 2026-09-24 18:07:40 UTC 1,026,295 bytes, 558 lines download raw bytes

1"use strict";(self.rspackChunkOne=self.rspackChunkOne||[]).push([[1522],{46451(e,t,n){var i=n(71763),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,s=i.useEffect,o=i.useLayoutEffect,l=i.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=a({inst:{value:n,getSnapshot:t}}),r=i[0].inst,c=i[1];return o(function(){r.value=n,r.getSnapshot=t,u(r)&&c({inst:r})},[e,n,t]),s(function(){return u(r)&&c({inst:r}),e(function(){u(r)&&c({inst:r})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:c},30232(e,t,n){var i=n(71763),r=n(87078),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=r.useSyncExternalStore,o=i.useRef,l=i.useEffect,u=i.useMemo,c=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var p=s(e,(h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=i(e),void 0!==r&&d.hasValue){var t=d.value;if(r(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=i(e);return void 0!==r&&r(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,i,r]))[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},87078(e,t,n){e.exports=n(46451)},41480(e,t,n){e.exports=n(30232)},40981(e,t,n){let i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,_,y,x,b,S,M,T;n.r(t),n.d(t,{default:()=>fI});var w,E,A={};n.r(A),n.d(A,{ACESFilmicToneMapping:()=>4,AddEquation:()=>100,AddOperation:()=>2,AdditiveAnimationBlendMode:()=>2501,AdditiveBlending:()=>2,AgXToneMapping:()=>6,AlphaFormat:()=>1021,AlwaysCompare:()=>519,AlwaysDepth:()=>1,AlwaysStencilFunc:()=>519,AmbientLight:()=>sL,AnimationAction:()=>og,AnimationClip:()=>a5,AnimationLoader:()=>sr,AnimationMixer:()=>o_,AnimationObjectGroup:()=>om,AnimationUtils:()=>aj,ArcCurve:()=>rR,ArrayCamera:()=>s1,ArrowHelper:()=>la,AttachedBindMode:()=>N,Audio:()=>oe,AudioAnalyser:()=>os,AudioContext:()=>sY,AudioListener:()=>s9,AudioLoader:()=>sZ,AxesHelper:()=>ls,BackSide:()=>1,BasicDepthPacking:()=>3200,BasicShadowMap:()=>0,BatchedMesh:()=>ij,BezierInterpolant:()=>aK,Bone:()=>ir,BooleanKeyframeTrack:()=>a$,Box2:()=>oU,Box3:()=>tL,Box3Helper:()=>ln,BoxGeometry:()=>rm,BoxHelper:()=>lt,BufferAttribute:()=>t0,BufferGeometry:()=>nh,BufferGeometryLoader:()=>sk,ByteType:()=>1010,Cache:()=>a6,Camera:()=>sx,CameraHelper:()=>o7,CanvasTexture:()=>rc,CapsuleGeometry:()=>rg,CatmullRomCurve3:()=>rO,CineonToneMapping:()=>3,CircleGeometry:()=>rv,ClampToEdgeWrapping:()=>1001,Clock:()=>oR,Color:()=>tp,ColorKeyframeTrack:()=>aQ,ColorManagement:()=>ew,Compatibility:()=>V,CompressedArrayTexture:()=>ro,CompressedCubeTexture:()=>rl,CompressedTexture:()=>rs,CompressedTextureLoader:()=>sa,ConeGeometry:()=>ry,ConstantAlphaFactor:()=>213,ConstantColorFactor:()=>211,Controls:()=>ll,CubeCamera:()=>s0,CubeDepthTexture:()=>rp,CubeReflectionMapping:()=>301,CubeRefractionMapping:()=>302,CubeTexture:()=>ru,CubeTextureLoader:()=>sl,CubeUVReflectionMapping:()=>306,CubicBezierCurve:()=>rk,CubicBezierCurve3:()=>rH,CubicInterpolant:()=>aq,CullFaceBack:()=>1,CullFaceFront:()=>2,CullFaceFrontBack:()=>3,CullFaceNone:()=>0,Curve:()=>rA,CurvePath:()=>rY,CustomBlending:()=>5,CustomToneMapping:()=>5,CylinderGeometry:()=>r_,Cylindrical:()=>oI,Data3DTexture:()=>ek,DataArrayTexture:()=>eB,DataTexture:()=>ia,DataTextureLoader:()=>su,DataUtils:()=>tK,DecrementStencilOp:()=>7683,DecrementWrapStencilOp:()=>34056,DefaultLoadingManager:()=>a9,DepthFormat:()=>1026,DepthStencilFormat:()=>1027,DepthTexture:()=>rd,DetachedBindMode:()=>U,DirectionalLight:()=>sI,DirectionalLightHelper:()=>o5,DiscreteInterpolant:()=>aZ,DodecahedronGeometry:()=>rb,DoubleSide:()=>2,DstAlphaFactor:()=>206,DstColorFactor:()=>208,DynamicCopyUsage:()=>35050,DynamicDrawUsage:()=>35048,DynamicReadUsage:()=>35049,EdgesGeometry:()=>rE,EllipseCurve:()=>rC,EqualCompare:()=>514,EqualDepth:()=>4,EqualStencilFunc:()=>514,EquirectangularReflectionMapping:()=>303,EquirectangularRefractionMapping:()=>304,Euler:()=>e$,EventDispatcher:()=>er,ExternalTexture:()=>rf,ExtrudeGeometry:()=>ao,FileLoader:()=>si,Float16BufferAttribute:()=>t7,Float32BufferAttribute:()=>t9,FloatType:()=>1015,Fog:()=>tg,FogExp2:()=>tm,FramebufferTexture:()=>ra,FrontSide:()=>0,Frustum:()=>iE,FrustumArray:()=>iC,GLBufferAttribute:()=>oT,GLSL1:()=>"100",GLSL3:()=>"300 es",GreaterCompare:()=>516,GreaterDepth:()=>6,GreaterEqualCompare:()=>518,GreaterEqualDepth:()=>5,GreaterEqualStencilFunc:()=>518,GreaterStencilFunc:()=>516,GridHelper:()=>o0,Group:()=>ts,HTMLTexture:()=>rh,HalfFloatType:()=>1016,HemisphereLight:()=>sd,HemisphereLightHelper:()=>oQ,IcosahedronGeometry:()=>au,ImageBitmapLoader:()=>sq,ImageLoader:()=>so,ImageUtils:()=>eC,IncrementStencilOp:()=>7682,IncrementWrapStencilOp:()=>34055,InstancedBufferAttribute:()=>iu,InstancedBufferGeometry:()=>sz,InstancedInterleavedBuffer:()=>oM,InstancedMesh:()=>i_,Int16BufferAttribute:()=>t4,Int32BufferAttribute:()=>t6,Int8BufferAttribute:()=>t1,IntType:()=>1013,InterleavedBuffer:()=>nd,InterleavedBufferAttribute:()=>nf,Interpolant:()=>aX,InterpolateBezier:()=>2303,InterpolateDiscrete:()=>2300,InterpolateLinear:()=>2301,InterpolateSmooth:()=>2302,InterpolationSamplingMode:()=>H,InterpolationSamplingType:()=>k,InvertStencilOp:()=>5386,KeepStencilOp:()=>7680,KeyframeTrack:()=>aJ,LOD:()=>nU,LatheGeometry:()=>ac,Layers:()=>eQ,LessCompare:()=>513,LessDepth:()=>2,LessEqualCompare:()=>515,LessEqualDepth:()=>3,LessEqualStencilFunc:()=>515,LessStencilFunc:()=>513,Light:()=>sh,LightProbe:()=>sD,Line:()=>i0,Line3:()=>oV,LineBasicMaterial:()=>iX,LineCurve:()=>rV,LineCurve3:()=>rG,LineDashedMaterial:()=>ak,LineLoop:()=>i5,LineSegments:()=>i4,LinearFilter:()=>1006,LinearInterpolant:()=>aY,LinearMipMapLinearFilter:()=>1008,LinearMipMapNearestFilter:()=>1007,LinearMipmapLinearFilter:()=>1008,LinearMipmapNearestFilter:()=>1007,LinearSRGBColorSpace:()=>O,LinearToneMapping:()=>1,LinearTransfer:()=>"linear",Loader:()=>se,LoaderUtils:()=>sB,LoadingManager:()=>a7,LoopOnce:()=>2200,LoopPingPong:()=>2202,LoopRepeat:()=>2201,MOUSE:()=>I,Material:()=>ng,MaterialBlending:()=>6,MaterialLoader:()=>sF,MathUtils:()=>em,Matrix2:()=>oL,Matrix3:()=>eb,Matrix4:()=>eV,MaxEquation:()=>104,Mesh:()=>n1,MeshBasicMaterial:()=>nG,MeshDepthMaterial:()=>aF,MeshDistanceMaterial:()=>aB,MeshLambertMaterial:()=>aO,MeshMatcapMaterial:()=>az,MeshNormalMaterial:()=>aD,MeshPhongMaterial:()=>aN,MeshPhysicalMaterial:()=>aL,MeshStandardMaterial:()=>aI,MeshToonMaterial:()=>aU,MinEquation:()=>103,MirroredRepeatWrapping:()=>1002,MixOperation:()=>1,MultiplyBlending:()=>4,MultiplyOperation:()=>0,NearestFilter:()=>1003,NearestMipMapLinearFilter:()=>1005,NearestMipMapNearestFilter:()=>1004,NearestMipmapLinearFilter:()=>1005,NearestMipmapNearestFilter:()=>1004,NeutralToneMapping:()=>7,NeverCompare:()=>512,NeverDepth:()=>0,NeverStencilFunc:()=>512,NoBlending:()=>0,NoColorSpace:()=>"",NoNormalPacking:()=>"",NoToneMapping:()=>0,NormalAnimationBlendMode:()=>2500,NormalBlending:()=>1,NormalGAPacking:()=>"ga",NormalRGPacking:()=>"rg",NotEqualCompare:()=>517,NotEqualDepth:()=>7,NotEqualStencilFunc:()=>517,NumberKeyframeTrack:()=>a0,Object3D:()=>ta,ObjectLoader:()=>sV,ObjectSpaceNormalMap:()=>1,OctahedronGeometry:()=>ah,OneFactor:()=>201,OneMinusConstantAlphaFactor:()=>214,OneMinusConstantColorFactor:()=>212,OneMinusDstAlphaFactor:()=>207,OneMinusDstColorFactor:()=>209,OneMinusSrcAlphaFactor:()=>205,OneMinusSrcColorFactor:()=>
1203,OrthographicCamera:()=>sR,PCFShadowMap:()=>1,PCFSoftShadowMap:()=>2,PMREMGenerator:()=>lL,Path:()=>rZ,PerspectiveCamera:()=>sT,Plane:()=>iS,PlaneGeometry:()=>ad,PlaneHelper:()=>li,PointLight:()=>sC,PointLightHelper:()=>oZ,Points:()=>rt,PointsMaterial:()=>i6,PolarGridHelper:()=>o1,PolyhedronGeometry:()=>rx,PositionalAudio:()=>oa,PropertyBinding:()=>of,PropertyMixer:()=>oo,QuadraticBezierCurve:()=>rW,QuadraticBezierCurve3:()=>rj,Quaternion:()=>ev,QuaternionKeyframeTrack:()=>a2,QuaternionLinearInterpolant:()=>a1,R11_EAC_Format:()=>37488,RED_GREEN_RGTC2_Format:()=>36285,RED_RGTC1_Format:()=>36283,REVISION:()=>"185",RG11_EAC_Format:()=>37490,RGBADepthPacking:()=>3201,RGBAFormat:()=>1023,RGBAIntegerFormat:()=>1033,RGBA_ASTC_10x10_Format:()=>37819,RGBA_ASTC_10x5_Format:()=>37816,RGBA_ASTC_10x6_Format:()=>37817,RGBA_ASTC_10x8_Format:()=>37818,RGBA_ASTC_12x10_Format:()=>37820,RGBA_ASTC_12x12_Format:()=>37821,RGBA_ASTC_4x4_Format:()=>37808,RGBA_ASTC_5x4_Format:()=>37809,RGBA_ASTC_5x5_Format:()=>37810,RGBA_ASTC_6x5_Format:()=>37811,RGBA_ASTC_6x6_Format:()=>37812,RGBA_ASTC_8x5_Format:()=>37813,RGBA_ASTC_8x6_Format:()=>37814,RGBA_ASTC_8x8_Format:()=>37815,RGBA_BPTC_Format:()=>36492,RGBA_ETC2_EAC_Format:()=>37496,RGBA_PVRTC_2BPPV1_Format:()=>35843,RGBA_PVRTC_4BPPV1_Format:()=>35842,RGBA_S3TC_DXT1_Format:()=>33777,RGBA_S3TC_DXT3_Format:()=>33778,RGBA_S3TC_DXT5_Format:()=>33779,RGBDepthPacking:()=>3202,RGBFormat:()=>1022,RGBIntegerFormat:()=>1032,RGB_BPTC_SIGNED_Format:()=>36494,RGB_BPTC_UNSIGNED_Format:()=>36495,RGB_ETC1_Format:()=>36196,RGB_ETC2_Format:()=>37492,RGB_PVRTC_2BPPV1_Format:()=>35841,RGB_PVRTC_4BPPV1_Format:()=>35840,RGB_S3TC_DXT1_Format:()=>33776,RGDepthPacking:()=>3203,RGFormat:()=>1030,RGIntegerFormat:()=>1031,RawShaderMaterial:()=>aP,Ray:()=>nV,Raycaster:()=>oE,RectAreaLight:()=>sN,RedFormat:()=>1028,RedIntegerFormat:()=>1029,ReinhardToneMapping:()=>2,RenderTarget:()=>eO,RenderTarget3D:()=>oy,RepeatWrapping:()=>1e3,ReplaceStencilOp:()=>7681,ReverseSubtractEquation:()=>102,RingGeometry:()=>ap,SIGNED_R11_EAC_Format:()=>37489,SIGNED_RED_GREEN_RGTC2_Format:()=>36286,SIGNED_RED_RGTC1_Format:()=>36284,SIGNED_RG11_EAC_Format:()=>37491,SRGBColorSpace:()=>"srgb",SRGBTransfer:()=>"srgb",Scene:()=>tv,ShaderChunk:()=>lp,ShaderLib:()=>lm,ShaderMaterial:()=>aR,ShadowMaterial:()=>aM,Shape:()=>rK,ShapeGeometry:()=>af,ShapePath:()=>lo,ShapeUtils:()=>ar,ShortType:()=>1011,Skeleton:()=>il,SkeletonHelper:()=>oY,SkinnedMesh:()=>ii,Source:()=>eP,Sphere:()=>ni,SphereGeometry:()=>am,Spherical:()=>oP,SphericalHarmonics3:()=>sU,SplineCurve:()=>rX,SpotLight:()=>sE,SpotLightHelper:()=>oW,Sprite:()=>nP,SpriteMaterial:()=>nv,SrcAlphaFactor:()=>204,SrcAlphaSaturateFactor:()=>210,SrcColorFactor:()=>202,StaticCopyUsage:()=>35046,StaticDrawUsage:()=>35044,StaticReadUsage:()=>35045,StereoCamera:()=>sQ,StreamCopyUsage:()=>35042,StreamDrawUsage:()=>35040,StreamReadUsage:()=>35041,StringKeyframeTrack:()=>a3,SubtractEquation:()=>101,SubtractiveBlending:()=>3,TOUCH:()=>L,TangentSpaceNormalMap:()=>0,TetrahedronGeometry:()=>ag,Texture:()=>eU,TextureLoader:()=>sc,TextureUtils:()=>lc,Timer:()=>s2,TimestampQuery:()=>z,TorusGeometry:()=>av,TorusKnotGeometry:()=>a_,Triangle:()=>tI,TriangleFanDrawMode:()=>2,TriangleStripDrawMode:()=>1,TrianglesDrawMode:()=>0,TubeGeometry:()=>ay,UVMapping:()=>300,Uint16BufferAttribute:()=>t5,Uint32BufferAttribute:()=>t8,Uint8BufferAttribute:()=>t2,Uint8ClampedBufferAttribute:()=>t3,Uniform:()=>ox,UniformsGroup:()=>oS,UniformsLib:()=>lf,UniformsUtils:()=>aC,UnsignedByteType:()=>1009,UnsignedInt101111Type:()=>35899,UnsignedInt248Type:()=>1020,UnsignedInt5999Type:()=>35902,UnsignedIntType:()=>1014,UnsignedShort4444Type:()=>1017,UnsignedShort5551Type:()=>1018,UnsignedShortType:()=>1012,VSMShadowMap:()=>3,Vector2:()=>eg,Vector3:()=>e_,Vector4:()=>eD,VectorKeyframeTrack:()=>a4,VideoFrameTexture:()=>rr,VideoTexture:()=>ri,WebGL3DRenderTarget:()=>eH,WebGLArrayRenderTarget:()=>ez,WebGLCoordinateSystem:()=>2e3,WebGLCubeRenderTarget:()=>lB,WebGLRenderTarget:()=>eF,WebGLRenderer:()=>cU,WebGLUtils:()=>cM,WebGPUCoordinateSystem:()=>2001,WebXRController:()=>tl,WireframeGeometry:()=>ax,WrapAroundEnding:()=>2402,ZeroCurvatureEnding:()=>2400,ZeroFactor:()=>200,ZeroSlopeEnding:()=>2401,ZeroStencilOp:()=>0,createCanvasElement:()=>q,error:()=>et,getConsoleFunction:()=>J,log:()=>$,setConsoleFunction:()=>K,warn:()=>ee,warnOnce:()=>en});var C=n(91987),R=n(71763),P=n.t(R,2);let I={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},L={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},N="attached",U="detached",D="srgb",O="srgb-linear",F="linear",B="srgb",z={COMPUTE:"compute",RENDER:"render"},k={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},H={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},V={TEXTURE_COMPARE:"depthTextureCompare"},G={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function W(e,t){return new G[e](t)}function j(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function X(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function q(){let e=X("canvas");return e.style.display="block",e}let Y={},Z=null;function K(e){Z=e}function J(){return Z}function $(...e){let t="THREE."+e.shift();Z?Z("log",t,...e):console.log(t,...e)}function Q(e){let t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){let t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function ee(...e){let t="THREE."+(e=Q(e)).shift();if(Z)Z("warn",t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function et(...e){let t="THREE."+(e=Q(e)).shift();if(Z)Z("error",t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function en(...e){let t=e.join(" ");t in Y||(Y[t]=!0,ee(...e))}let ei={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class er{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return void 0!==n&&void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){let n=this._listeners;if(void 0===n)return;let i=n[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let n=t[e.type];if(void 0!==n){e.target=this;let t=n.slice(0);for(let n=0,i=t.length;n<i;n++)t[n].call(this,e);e.target=null}}}let ea=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
15","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],es=1234567,eo=Math.PI/180,el=180/Math.PI;function eu(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0;return(ea[255&e]+ea[e>>8&255]+ea[e>>16&255]+ea[e>>24&255]+"-"+ea[255&t]+ea[t>>8&255]+"-"+ea[t>>16&15|64]+ea[t>>24&255]+"-"+ea[63&n|128]+ea[n>>8&255]+"-"+ea[n>>16&255]+ea[n>>24&255]+ea[255&i]+ea[i>>8&255]+ea[i>>16&255]+ea[i>>24&255]).toLowerCase()}function ec(e,t,n){return Math.max(t,Math.min(n,e))}function eh(e,t){return(e%t+t)%t}function ed(e,t,n){return(1-n)*e+n*t}function ep(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function ef(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("THREE.MathUtils: Invalid component type.")}}let em={DEG2RAD:eo,RAD2DEG:el,generateUUID:eu,clamp:ec,euclideanModulo:eh,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:ed,damp:function(e,t,n,i){return ed(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(eh(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(es=e);let t=es+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*eo},radToDeg:function(e){return e*el},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){let a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+i)/2),c=s((t+i)/2),h=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:ee("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:ef,denormalize:ep};class eg{static{eg.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 5,395 bytes, line 1
1sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ec(this.x,e.x,t.x),this.y=ec(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ec(this.x,e,t),this.y=ec(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ec(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ec(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ev{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(c!==f||o!==h||l!==d||u!==p){let e=o*h+l*d+u*p+c*f;e<0&&(h=-h,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let n=Math.acos(e),i=Math.sin(n);o=o*(t=Math.sin(t*n)/i)+h*(s=Math.sin(s*n)/i),l=l*t+d*s,u=u*t+p*s,c=c*t+f*s}else{let e=1/Math.sqrt((o=o*t+h*s)*o+(l=l*t+d*s)*l+(u=u*t+p*s)*u+(c=c*t+f*s)*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,a){let s=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:ee("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){let e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>c){let e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-n-c);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+c-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>
vendor: 9,842 bytes, line 1
1Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ec(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(0===n)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+i*l-r*o,this._y=i*u+a*o+r*s-n*l,this._z=r*u+a*l+n*o-i*s,this._w=a*u-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(n=-n,i=-i,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class e_{static{e_.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ex.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ex.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),u=2*(s*t-r*i),c=2*(r*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-r*c,this.z=i+o*c+r*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ec(this.x,e.x,t.x),this.y=ec(this.y,e.y,t.y),this.z=ec(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ec(this.x,e,t),this.y=ec(this.y,e,t),this.z=ec(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ec(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ey.copy(this).projectOnVector(e),this.sub(ey)}reflect(e){return this.sub(ey.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ec(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ey=new e_,ex=new ev;class eb{static{eb.prototype.isMatrix3=!0}constructor(e,t,n,i,r,a,s,o,l){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5
vendor: 4,181 bytes, line 1
1],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],_=i[4],y=i[7],x=i[2],b=i[5],S=i[8];return r[0]=a*f+s*v+o*x,r[3]=a*m+s*_+o*b,r[6]=a*g+s*y+o*S,r[1]=l*f+u*v+c*x,r[4]=l*m+u*_+c*b,r[7]=l*g+u*y+c*S,r[2]=h*f+d*v+p*x,r[5]=h*m+d*_+p*b,r[8]=h*g+d*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*r*u+n*s*o+i*r*l-i*a*o}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*r,d=l*r-a*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(i*l-u*n)*f,e[2]=(s*n-i*a)*f,e[3]=h*f,e[4]=(u*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return en("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(eS.makeScale(e,t)),this}rotate(e){return en("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(eS.makeRotation(-e)),this}translate(e,t){return en("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(eS.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let eS=new eb,eM=new eb().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eT=new eb().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ew=(f=[.64,.33,.3,.6,.15,.06],m=[.2126,.7152,.0722],g=[.3127,.329],(p={enabled:!0,workingColorSpace:O,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n&&(this.spaces[t].transfer===B&&(e.r=eE(e.r),e.g=eE(e.g),e.b=eE(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===B&&(e.r=eA(e.r),e.g=eA(e.g),e.b=eA(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?F:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return en("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),p.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return en("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),p.
1colorSpaceToWorking(e,t)}}).define({[O]:{primaries:f,whitePoint:g,transfer:F,toXYZ:eM,fromXYZ:eT,luminanceCoefficients:m,workingColorSpaceConfig:{unpackColorSpace:D},outputColorSpaceConfig:{drawingBufferColorSpace:D}},[D]:{primaries:f,whitePoint:g,transfer:B,toXYZ:eM,fromXYZ:eT,luminanceCoefficients:m,outputColorSpaceConfig:{drawingBufferColorSpace:D}}}),p);function eE(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function eA(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eC{static getDataURL(e,t="image/png"){let n;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)n=e;else{void 0===i&&(i=X("canvas")),i.width=e.width,i.height=e.height;let t=i.getContext("2d");e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=i}return n.toDataURL(t)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=X("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*eE(r[e]/255);return n.putImageData(i,0,0),t}if(!e.data)return ee("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*eE(t[e]/255)):t[e]=eE(t[e]);return{data:t,width:e.width,height:e.height}}}}let eR=0;class eP{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eR++}),this.uuid=eu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(eI(i[t].image)):e.push(eI(i[t]))}else e=eI(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function eI(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?eC.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(ee("Texture: Unable to serialize Texture."),{})}let eL=0,eN=new e_;class eU extends er{constructor(e=eU.DEFAULT_IMAGE,t=eU.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,s=1023,o=1009,l=eU.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eL++}),this.uuid=eu(),this.name="",this.source=new eP(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new eg(0,0),this.repeat=new eg(1,1),this.center=new eg(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eb,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(eN).x}get height(){return this.source.getSize(eN).y}get depth(){return this.source.getSize(eN).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace
vendor: 4,402 bytes, line 1
1=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(void 0===n){ee(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){ee(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}eU.DEFAULT_IMAGE=null,eU.DEFAULT_MAPPING=300,eU.DEFAULT_ANISOTROPY=1;class eD{static{eD.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[
11],c=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-d)&&.01>Math.abs(h-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+d)&&.1>Math.abs(h+p)&&.1>Math.abs(s+c+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+d)/4,_=(h+p)/4;return e>a&&e>m?e<.01?(n=0,i=.707106781,r=.707106781):(i=g/(n=Math.sqrt(e)),r=v/n):a>m?a<.01?(n=.707106781,i=0,r=.707106781):(n=g/(i=Math.sqrt(a)),r=_/i):m<.01?(n=.707106781,i=.707106781,r=0):(n=v/(r=Math.sqrt(m)),i=_/r),this.set(n,i,r,t),this}let m=Math.sqrt((p-h)*(p-h)+(l-d)*(l-d)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-h)/m,this.y=(l-d)/m,this.z=(u-o)/m,this.w=Math.acos((s+c+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ec(this.x,e.x,t.x),this.y=ec(this.y,e.y,t.y),this.z=ec(this.z,e.z,t.z),this.w=ec(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ec(this.x,e,t),this.y=ec(this.y,e,t),this.z=ec(this.z,e,t),this.w=ec(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(ec(n,e,t))}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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class eO extends er{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new eD(0,0,e,t),this.scissorTest=!1,this.viewport=new eD(0,0,e,t),this.textures=[];const i=new eU({width:e,height:t,depth:n.depth}),r=n.count;for(let e=0;e<r;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace
1=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new eP(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class eF extends eO{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class eB extends eU{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ez extends eF{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new eB(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ek extends eU{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eH extends eF{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new ek(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class eV{static{eV.prototype.isMatrix4=!0}constructor(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eV().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinantAffine()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2)),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinantAffine())return this.identity();let t=this.elements,n=e.elements,i=1/eG.setFromMatrixColumn(e,0).length(),r=1/eG.setFromMatrixColumn(e,1).length(),a=1/eG.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}
vendor: 5,846 bytes, line 1
1else if("YXZ"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*u,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=a*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=s*u,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ej,e,eX)}lookAt(e,t,n){let i=this.elements;return eZ.subVectors(e,t),0===eZ.lengthSq()&&(eZ.z=1),eZ.normalize(),eq.crossVectors(n,eZ),0===eq.lengthSq()&&(1===Math.abs(n.z)?eZ.x+=1e-4:eZ.z+=1e-4,eZ.normalize(),eq.crossVectors(n,eZ)),eq.normalize(),eY.crossVectors(eZ,eq),i[0]=eq.x,i[4]=eY.x,i[8]=eZ.x,i[1]=eq.y,i[5]=eY.y,i[9]=eZ.y,i[2]=eq.z,i[6]=eY.z,i[10]=eZ.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],_=n[7],y=n[11],x=n[15],b=i[0],S=i[4],M=i[8],T=i[12],w=i[1],E=i[5],A=i[9],C=i[13],R=i[2],P=i[6],I=i[10],L=i[14],N=i[3],U=i[7],D=i[11],O=i[15];return r[0]=a*b+s*w+o*R+l*N,r[4]=a*S+s*E+o*P+l*U,r[8]=a*M+s*A+o*I+l*D,r[12]=a*T+s*C+o*L+l*O,r[1]=u*b+c*w+h*R+d*N,r[5]=u*S+c*E+h*P+d*U,r[9]=u*M+c*A+h*I+d*D,r[13]=u*T+c*C+h*L+d*O,r[2]=p*b+f*w+m*R+g*N,r[6]=p*S+f*E+m*P+g*U,r[10]=p*M+f*A+m*I+g*D,r[14]=p*T+f*C+m*L+g*O,r[3]=v*b+_*w+y*R+x*N,r[7]=v*S+_*E+y*P+x*U,r[11]=v*M+_*A+y*I+x*D,r[15]=v*T+_*C+y*L+x*O,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*d-l*h,_=s*d-l*c,y=s*h-o*c,x=a*d-l*u,b=a*h-o*u,S=a*c-s*u;return t*(f*v-m*_+g*y)-n*(p*v-m*x+g*b)+i*(p*_-f*x+g*S)-r*(p*y-f*b+m*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],a=e[5],s=e[9],o=e[2],l=e[6],u=e[10];return t*(a*u-s*l)-n*(r*u-s*o)+i*(r*l-a*o)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=t*s-n*a,_=t*o-i*a,y=t*l-r*a,x=n*o-i*s,b=n*l-r*s,S=i*l-r*o,M=u*f-c*p,T=u*m-h*p,w=u*g-d*p,E=c*m-h*f,A=c*g-d*f,C=h*g-d*m,R=v*C-_*A+y*E+x*w-b*T+S*M;if(0===R)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let P=1/R;return e[0]=(s*C-o*A+l*E)*P,e[1]=(i*A-n*C-r*E)*P,e[2]=(f*S-m*b+g*x)*P,e[3]=(h*b-c*S-d*x)*P,e[4]=(o*w-a*C-l*T)*P,e[5]=(t*C-i*w+r*T)*P,e[6]=(m*y-p*S-g*_)*P,e[7]=(u*S-h*y+d*_)*P,e[8]=(a*A-s*w+l*M)*P,e[9]=(n*w-t*A-r*M)*P,e[10]=(p*b-f*y+g*v)*P,e[11]=(c*y-u*b-d*v)*P,e[12]=(s*T-a*E-o*M)*P,e[13]=(t*E-n*T+i*M)*P,e[14]=(f*_-p*x-m*v)*P,e[15]=(u*x-c*_+h*v)*P,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,u=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+n,u*o-i*a,0,l*o-i*s,u*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,u=a+a,c=s+s,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,g=s*c,v=o*l,_=o*u,y=o*c,x=n.x,b=n.y,S=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-_)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(h+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+_)*S,i[9]=(m-v)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(0===r)return n.set(1,1,1),t.identity(),this;let a=eG.set(i[0],i[1],i[2]).length(),s=eG.set(i[4],i[5],i[6]).length(),o=eG.set(i[8],i[9],i[10]).length();r<0&&(a=-a),eW.copy(this);let l=1/a,u=1/s,c=1/o;return eW.elements[0]*=l,eW.elements[1]*=l,eW.elements[2]*=l,eW.elements[4]*=u,eW.elements[5]*=u,eW.elements[6]*=u,eW.elements[8]*=c,eW.elements[9]*=c,eW.elements[10]*=c,t.setFromRotationMatrix(eW),n.x=a,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=r/(a-r),u=a*r/(a-r);else if(2e3===s)l=-(a+r)/(a-r),u=-2*a*r/(a-r);else if(2001===s)l=-a/(a-r),u=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);
1return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(n-i),c[9]=(n+i)/(n-i),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3,o=!1){let l,u,c=this.elements;if(o)l=1/(a-r),u=a/(a-r);else if(2e3===s)l=-2/(a-r),u=-(a+r)/(a-r);else if(2001===s)l=-1/(a-r),u=-r/(a-r);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(n-i),c[9]=0,c[13]=-(n+i)/(n-i),c[2]=0,c[6]=0,c[10]=l,c[14]=u,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}let eG=new e_,eW=new eV,ej=new e_(0,0,0),eX=new e_(1,1,1),eq=new e_,eY=new e_,eZ=new e_,eK=new eV,eJ=new ev;class e${constructor(e=0,t=0,n=0,i=e$.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(ec(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ec(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(ec(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ec(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ec(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-ec(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:ee("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return eK.makeRotationFromQuaternion(e),this.setFromRotationMatrix(eK,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eJ.setFromEuler(this),this.setFromQuaternion(eJ,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}e$.DEFAULT_ORDER="XYZ";class eQ{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let e0=0,e1=new e_,e2=new ev,e3=new eV,e4=new e_,e5=new e_,e6=new e_,e8=new ev,e7=new e_(1,0,0),e9=new e_(0,1,0),te=new e_(0,0,1),tt={type:"added"},tn={type:"removed"},ti={type:"childadded",child:null},tr={type:"childremoved",child:null};class ta extends er{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:e0++}),this.uuid=eu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ta.DEFAULT_UP.clone();const e=new e_,t=new e$,n=new ev,i=new e_(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new eV},normalMatrix:{value:new eb}}),this.matrix=new eV,this.matrixWorld=new eV,this.matrixAutoUpdate=ta.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ta.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new eQ,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,430 bytes, line 1
1setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return e2.setFromAxisAngle(e,t),this.quaternion.multiply(e2),this}rotateOnWorldAxis(e,t){return e2.setFromAxisAngle(e,t),this.quaternion.premultiply(e2),this}rotateX(e){return this.rotateOnAxis(e7,e)}rotateY(e){return this.rotateOnAxis(e9,e)}rotateZ(e){return this.rotateOnAxis(te,e)}translateOnAxis(e,t){return e1.copy(e).applyQuaternion(this.quaternion),this.position.add(e1.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(e7,e)}translateY(e){return this.translateOnAxis(e9,e)}translateZ(e){return this.translateOnAxis(te,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(e3.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?e4.copy(e):e4.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),e5.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e3.lookAt(e5,e4,this.up):e3.lookAt(e4,e5,this.up),this.quaternion.setFromRotationMatrix(e3),i&&(e3.extractRotation(i.matrixWorld),e2.setFromRotationMatrix(e3),this.quaternion.premultiply(e2.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?et("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(tt),ti.child=e,this.dispatchEvent(ti),ti.child=null):et("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tn),tr.child=e,this.dispatchEvent(tr),tr.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),e3.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),e3.multiply(e.parent.matrixWorld)),e.applyMatrix4(e3),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(tt),ti.child=e,this.dispatchEvent(ti),ti.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(e5,e,e6),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(e5,e8,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(null!==e){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),!1!==this.static&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),null!==this.pivot&&(i.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){let t=a(e.geometries),i=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),u=a(e.animations),c=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function a(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=null!==e.pivot?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}}ta.DEFAULT_UP=new e_(0,1,0),ta.DEFAULT_MATRIX_AUTO_UPDATE=!0,ta.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class ts extends ta{constructor(){super(),this.isGroup=!0,this.type="Group"}}let to={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ts,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new e_,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new e_),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new e_,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new e_,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let i of(a=!0,e.hand.values())
1){let e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:e,target:this}));null!==s&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(to)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let n=new ts;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}let tu={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},tc={h:0,s:0,l:0},th={h:0,s:0,l:0};function td(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*6*(2/3-n):e}class tp{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){return void 0===t&&void 0===n?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,n),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=D){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ew.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ew.workingColorSpace){return this.r=e,this.g=t,this.b=n,ew.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ew.workingColorSpace){if(e=eh(e,1),t=ec(t,0,1),n=ec(n,0,1),0===t)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=td(r,i,e+1/3),this.g=td(r,i,e),this.b=td(r,i,e-1/3)}return ew.colorSpaceToWorking(this,i),this}setStyle(e,t=D){let n;function i(t){void 0!==t&&1>parseFloat(t)&&ee("Color: Alpha component of "+e+" will be ignored.")}if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=n[1],s=n[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:ee("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(i,16),t);ee("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=D){let n=tu[e.toLowerCase()];return void 0!==n?this.setHex(n,t):ee("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=eE(e.r),this.g=eE(e.g),this.b=eE(e.b),this}copyLinearToSRGB(e){return this.r=eA(e.r),this.g=eA(e.g),this.b=eA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=D){return ew.workingToColorSpace(tf.copy(this),e),65536*Math.round(ec(255*tf.r,0,255))+256*Math.round(ec(255*tf.g,0,255))+Math.round(ec(255*tf.b,0,255))}getHexString(e=D){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ew.workingColorSpace){let n,i;ew.workingToColorSpace(tf.copy(this),t);let r=tf.r,a=tf.g,s=tf.b,o=Math.max(r,a,s),l=Math.min(r,a,s),u=(l+o)/2;if(l===o)n=0,i=0;else{let e=o-l;switch(i=u<=.5?e/(o+l):e/(2-o-l),o){case r:n=(a-s)/e+6*(a<s);break;case a:n=(s-r)/e+2;break;case s:n=(r-a)/e+4}n/=6}return e.h=n,e.s=i,e.l=u,e}getRGB(e,t=ew.workingColorSpace){return ew.workingToColorSpace(tf.copy(this),t),e.r=tf.r,e.g=tf.g,e.b=tf.b,e}
vendor: 14,290 bytes, line 1
1getStyle(e=D){ew.workingToColorSpace(tf.copy(this),e);let t=tf.r,n=tf.g,i=tf.b;return e!==D?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(tc),this.setHSL(tc.h+e,tc.s+t,tc.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(tc),e.getHSL(th);let n=ed(tc.h,th.h,t),i=ed(tc.s,th.s,t),r=ed(tc.l,th.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let tf=new tp;tp.NAMES=tu;class tm{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new tp(e),this.density=t}clone(){return new tm(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class tg{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new tp(e),this.near=t,this.far=n}clone(){return new tg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class tv extends ta{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new e$,this.environmentIntensity=1,this.environmentRotation=new e$,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}let t_=new e_,ty=new e_,tx=new e_,tb=new e_,tS=new e_,tM=new e_,tT=new e_,tw=new e_,tE=new e_,tA=new e_,tC=new eD,tR=new eD,tP=new eD;class tI{constructor(e=new e_,t=new e_,n=new e_){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),t_.subVectors(e,t),i.cross(t_);let r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){t_.subVectors(i,t),ty.subVectors(n,t),tx.subVectors(e,t);let a=t_.dot(t_),s=t_.dot(ty),o=t_.dot(tx),l=ty.dot(ty),u=ty.dot(tx),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,tb)&&tb.x>=0&&tb.y>=0&&tb.x+tb.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,tb)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,tb.x),o.addScaledVector(a,tb.y),o.addScaledVector(s,tb.z),o)}static getInterpolatedAttribute(e,t,n,i,r,a){return tC.setScalar(0),tR.setScalar(0),tP.setScalar(0),tC.fromBufferAttribute(e,t),tR.fromBufferAttribute(e,n),tP.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(tC,r.x),a.addScaledVector(tR,r.y),a.addScaledVector(tP,r.z),a}static isFrontFacing(e,t,n,i){return t_.subVectors(n,t),ty.subVectors(e,t),0>t_.cross(ty).dot(i)}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return t_.subVectors(this.c,this.b),ty.subVectors(this.a,this.b),.5*t_.cross(ty).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tI.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tI.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return tI.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return tI.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tI.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n,i,r=this.a,a=this.b,s=this.c;tS.subVectors(a,r),tM.subVectors(s,r),tw.subVectors(e,r);let o=tS.dot(tw),l=tM.dot(tw);if(o<=0&&l<=0)return t.copy(r);tE.subVectors(e,a);let u=tS.dot(tE),c=tM.dot(tE);if(u>=0&&c<=u)return t.copy(a);let h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return n=o/(o-u),t.copy(r).addScaledVector(tS,n);tA.subVectors(e,s);let d=tS.dot(tA),p=tM.dot(tA);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(tM,i);let m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return tT.subVectors(s,a),i=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(tT,i);let g=1/(m+f+h);return n=f*g,i=h*g,t.copy(r).addScaledVector(tS,n).addScaledVector(tM,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class tL{constructor(e=new e_(Infinity,Infinity,Infinity),t=new e_(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(tU.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(tU.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=tU.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(void 0!==n){let i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,tU):tU.fromBufferAttribute(i,t),tU.applyMatrix4(e.matrixWorld),this.expandByPoint(tU);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),tD.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),tD.copy(n.boundingBox)),tD.applyMatrix4(e.matrixWorld),this.union(tD)}let i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,tU),tU.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(tV),tG.subVectors(this.max,tV),tO.subVectors(e.a,tV),tF.subVectors(e.b,tV),tB.subVectors(e.c,tV),tz.subVectors(tF,tO),tk.subVectors(tB,tF),tH.subVectors(tO,tB);let t=[0,-tz.z,tz.y,0,-tk.z,tk.y,0,-tH.z,tH.y,tz.z,0,-tz.x,tk.z,0,-tk.x,tH.z,0,-tH.x,-tz.y,tz.x,0,-tk.y,tk.x,0,-tH.y,tH.x,0];return!!tX(t,tO,tF,tB,tG)&&!!tX(t=[1,0,0,0,1,0,0,0,1],tO,tF,tB,tG)&&(tW.crossVectors(tz,tk),tX(t=[tW.x,tW.y,tW.z],tO,tF,tB,tG))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tU).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(tU).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(tN[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),tN[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),tN[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),tN[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),tN[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),tN[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),tN[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),tN[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(tN)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let tN=[new e_,new e_,new e_,new e_,new e_,new e_,new e_,new e_],tU=new e_,tD=new tL,tO=new e_,tF=new e_,tB=new e_,tz=new e_,tk=new e_,tH=new e_,tV=new e_,tG=new e_,tW=new e_,tj=new e_;function tX(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){tj.fromArray(e,a);let s=r.x*Math.abs(tj.x)+r.y*Math.abs(tj.y)+r.z*Math.abs(tj.z),o=t.dot(tj),l=n.dot(tj),u=i.dot(tj);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let tq=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;(8388608&t)==0;)t<<=1,n-=8388608;t&=-8388609,n+=0x38800000,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();function tY(e){Math.abs(e)>65504&&ee("DataUtils.toHalfFloat(): Value out of range."),e=ec(e,-65504,65504),tq.floatView[0]=e;let t=tq.uint32View[0],n=t>>23&511;return tq.baseTable[n]+((8388607&t)>>tq.shiftTable[n])}function tZ(e){let t=e>>10;return tq.uint32View[0]=tq.mantissaTable[tq.offsetTable[t]+(1023&e)]+tq.exponentTable[t],tq.floatView[0]}class tK{static toHalfFloat(e){return tY(e)}static fromHalfFloat(e){return tZ(e)}}let tJ=new e_,t$=new eg,tQ=0;class t0 extends er{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:tQ++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;
vendor: 5,939 bytes, line 1
1for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)t$.fromBufferAttribute(this,t),t$.applyMatrix3(e),this.setXY(t,t$.x,t$.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)tJ.fromBufferAttribute(this,t),tJ.applyMatrix3(e),this.setXYZ(t,tJ.x,tJ.y,tJ.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)tJ.fromBufferAttribute(this,t),tJ.applyMatrix4(e),this.setXYZ(t,tJ.x,tJ.y,tJ.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)tJ.fromBufferAttribute(this,t),tJ.applyNormalMatrix(e),this.setXYZ(t,tJ.x,tJ.y,tJ.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)tJ.fromBufferAttribute(this,t),tJ.transformDirection(e),this.setXYZ(t,tJ.x,tJ.y,tJ.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=ep(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ef(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ep(t,this.array)),t}setX(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ep(t,this.array)),t}setY(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ep(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ep(t,this.array)),t}setW(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array),r=ef(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class t1 extends t0{constructor(e,t,n){super(new Int8Array(e),t,n)}}class t2 extends t0{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class t3 extends t0{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class t4 extends t0{constructor(e,t,n){super(new Int16Array(e),t,n)}}class t5 extends t0{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class t6 extends t0{constructor(e,t,n){super(new Int32Array(e),t,n)}}class t8 extends t0{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class t7 extends t0{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=tZ(this.array[e*this.itemSize]);return this.normalized&&(t=ep(t,this.array)),t}setX(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize]=tY(t),this}getY(e){let t=tZ(this.array[e*this.itemSize+1]);return this.normalized&&(t=ep(t,this.array)),t}setY(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+1]=tY(t),this}getZ(e){let t=tZ(this.array[e*this.itemSize+2]);return this.normalized&&(t=ep(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+2]=tY(t),this}getW(e){let t=tZ(this.array[e*this.itemSize+3]);return this.normalized&&(t=ep(t,this.array)),t}setW(e,t){return this.normalized&&(t=ef(t,this.array)),this.array[e*this.itemSize+3]=tY(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array)),this.array[e+0]=tY(t),this.array[e+1]=tY(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array)),this.array[e+0]=tY(t),this.array[e+1]=tY(n),this.array[e+2]=tY(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array),r=ef(r,this.array)),this.array[e+0]=tY(t),this.array[e+1]=tY(n),this.array[e+2]=tY(i),this.array[e+3]=tY(r),this}}class t9 extends t0{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ne=new tL,nt=new e_,nn=new e_;class ni{constructor(e=new e_,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;void 0!==t?n.copy(t):ne.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}
1applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;nt.subVectors(e,this.center);let t=nt.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(nt,n/e),this.radius+=n}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(nn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(nt.copy(e.center).add(nn)),this.expandByPoint(nt.copy(e.center).sub(nn)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let nr=0,na=new eV,ns=new ta,no=new e_,nl=new tL,nu=new tL,nc=new e_;class nh extends er{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:nr++}),this.uuid=eu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(!function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?t5:t8)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(void 0!==n){let t=new eb().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return na.makeRotationFromQuaternion(e),this.applyMatrix4(na),this}rotateX(e){return na.makeRotationX(e),this.applyMatrix4(na),this}rotateY(e){return na.makeRotationY(e),this.applyMatrix4(na),this}rotateZ(e){return na.makeRotationZ(e),this.applyMatrix4(na),this}translate(e,t,n){return na.makeTranslation(e,t,n),this.applyMatrix4(na),this}scale(e,t,n){return na.makeScale(e,t,n),this.applyMatrix4(na),this}lookAt(e){return ns.lookAt(e),ns.updateMatrix(),this.applyMatrix4(ns.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(no).negate(),this.translate(no.x,no.y,no.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let n=0,i=e.length;n<i;n++){let i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new t9(t,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&ee("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tL);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){et("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new e_(-1/0,-1/0,-1/0),new e_(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nl.setFromBufferAttribute(n),this.morphTargetsRelative?(nc.addVectors(this.boundingBox.min,nl.min),this.boundingBox.expandByPoint(nc),nc.addVectors(this.boundingBox.max,nl.max),this.boundingBox.expandByPoint(nc)):(this.boundingBox.expandByPoint(nl.min),this.boundingBox.expandByPoint(nl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&et('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ni);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){et("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new e_,1/0);return}if(e){let n=this.boundingSphere.center;if(nl.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];nu.setFromBufferAttribute(n),this.morphTargetsRelative?(nc.addVectors(nl.min,nu.min),nl.expandByPoint(nc),nc.addVectors(nl.max,nu.max),nl.expandByPoint(nc)):(nl.expandByPoint(nu.min),nl.expandByPoint(nu.max))}nl.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)nc.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(nc));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)nc.fromBufferAttribute(a,t),s&&(no.fromBufferAttribute(e,t),nc.add(no)),i=Math.max(i,n.distanceToSquared(nc))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&et('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void et("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let n=t.position,i=t.normal,r=t.uv,a=this.getAttribute("tangent");(void 0===a||a.count!==n.count)&&(a=new t0(new Float32Array(4*n.count),4),this.setAttribute("tangent",a));let s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new e_,o[e]=new e_;let l=new e_,u=new e_,c=new e_,h=new eg,d=new eg,p=new eg,f=new e_,m=new e_,g
vendor: 12,140 bytes, line 1
1=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,i=g.length;t<i;++t){let i=g[t],a=i.start,v=i.count;for(let t=a,i=a+v;t<i;t+=3)!function(e,t,i){l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),c.fromBufferAttribute(n,i),h.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),u.sub(l),c.sub(l),d.sub(h),p.sub(h);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(u).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),m.copy(c).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[i].add(f),o[e].add(m),o[t].add(m),o[i].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new e_,_=new e_,y=new e_,x=new e_;function b(e){y.fromBufferAttribute(i,e),x.copy(y);let t=s[e];v.copy(t),v.sub(y.multiplyScalar(y.dot(t))).normalize(),_.crossVectors(x,t);let n=_.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,n<0?-1:1)}for(let t=0,n=g.length;t<n;++t){let n=g[t],i=n.start,r=n.count;for(let t=i,n=i+r;t<n;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n||n.count!==t.count)n=new t0(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let i=new e_,r=new e_,a=new e_,s=new e_,o=new e_,l=new e_,u=new e_,c=new e_;if(e)for(let h=0,d=e.count;h<d;h+=3){let d=e.getX(h+0),p=e.getX(h+1),f=e.getX(h+2);i.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(u),o.add(u),l.add(u),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,r),c.subVectors(i,r),u.cross(c),n.setXYZ(e+0,u.x,u.y,u.z),n.setXYZ(e+1,u.x,u.y,u.z),n.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)nc.fromBufferAttribute(e,t),nc.normalize(),e.setXYZ(t,nc.x,nc.y,nc.z)}toNonIndexed(){function e(e,t){let n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[o++]=n[s++]}return new t0(a,i,r)}if(null===this.index)return ee("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new nh,n=this.index.array,i=this.attributes;for(let r in i){let a=e(i[r],n);t.setAttribute(r,a)}let r=this.morphAttributes;for(let i in r){let a=[],s=r[i];for(let t=0,i=s.length;t<i;t++){let i=e(s[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,n=a.length;e<n;e++){let n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=void 0!==this.parameters&&!0===this._transformed?"BufferGeometry":this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters&&!0!==this._transformed){let t=this.parameters;for(let n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let i=n[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},r=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){let i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;null!==n&&this.setIndex(n.clone());let i=e.attributes;for(let e in i){let n=i[e];this.setAttribute(e,n.clone(t))}let r=e.morphAttributes;for(let e in r){let n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class nd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=eu()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=eu()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=eu()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let np=new e_;class nf{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)np.fromBufferAttribute(this,t),np.applyMatrix4(e),this.setXYZ(t,np.x,np.y,np.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)np.fromBufferAttribute(this,t),np.applyNormalMatrix(e),this.setXYZ(t,np.x,np.y,np.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)np.fromBufferAttribute(this,t),np.transformDirection(e),this.setXYZ(t,np.x,np.y,np.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ep(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=ef(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=ef(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ef(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ef(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ef(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ep(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ep(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ep(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ep(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ef(t,this.array),n=ef(n,this.array),i=ef(i,this.array),r=ef(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nf(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{$("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new t0(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{$("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}}let nm=0;class ng extends er{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:nm++}),this.uuid=eu(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new tp(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let n=e[t];if(void 0===n){ee(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){ee(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector2&&n&&n.isVector2||i&&i.isEuler&&n&&n.isEuler||i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let n in e){let i=e[n];delete i.metadata,t.push(i)}return t}
vendor: 5,648 bytes, line 1
1if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),100!==this.blendEquation&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&
vendor: 4,913 bytes, line 1
1(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(n.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(n.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){let t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}fromJSON(e,t){if(void 0!==e.uuid&&(this.uuid=e.uuid),void 0!==e.name&&(this.name=e.name),void 0!==e.color&&void 0!==this.color&&this.color.setHex(e.color),void 0!==e.roughness&&(this.roughness=e.roughness),void 0!==e.metalness&&(this.metalness=e.metalness),void 0!==e.sheen&&(this.sheen=e.sheen),void 0!==e.sheenColor&&(this.sheenColor=new tp().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(this.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==this.emissive&&this.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==this.specular&&this.specular.setHex(e.specular),void 0!==e.specularIntensity&&(this.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==this.specularColor&&this.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(this.shininess=e.shininess),void 0!==e.clearcoat&&(this.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(this.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(this.dispersion=e.dispersion),void 0!==e.iridescence&&(this.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(this.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(this.transmission=e.transmission),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.attenuationDistance&&(this.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==this.attenuationColor&&this.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(this.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(this.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(this.fog=e.fog),void 0!==e.flatShading&&(this.flatShading=e.flatShading),void 0!==e.blending&&(this.blending=e.blending),void 0!==e.combine&&(this.combine=e.combine),void 0!==e.side&&(this.side=e.side),void 0!==e.shadowSide&&(this.shadowSide=e.shadowSide),void 0!==e.opacity&&(this.opacity=e.opacity),void 0!==e.transparent&&(this.transparent=e.transparent),void 0!==e.alphaTest&&(this.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(this.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(this.depthFunc=e.depthFunc),void 0!==e.depthTest&&(this.depthTest=e.depthTest),void 0!==e.depthWrite&&(this.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(this.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(this.blendSrc=e.blendSrc),void 0!==e.blendDst&&(this.blendDst=e.blendDst),void 0!==e.blendEquation&&(this.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(this.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&
1(this.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(this.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==this.blendColor&&this.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(this.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(this.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(this.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(this.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(this.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(this.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(this.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(this.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(this.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(this.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(this.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(this.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(this.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(this.rotation=e.rotation),void 0!==e.linewidth&&(this.linewidth=e.linewidth),void 0!==e.dashSize&&(this.dashSize=e.dashSize),void 0!==e.gapSize&&(this.gapSize=e.gapSize),void 0!==e.scale&&(this.scale=e.scale),void 0!==e.polygonOffset&&(this.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(this.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(this.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(this.dithering=e.dithering),void 0!==e.alphaToCoverage&&(this.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(this.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(this.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(this.allowOverride=e.allowOverride),void 0!==e.visible&&(this.visible=e.visible),void 0!==e.toneMapped&&(this.toneMapped=e.toneMapped),void 0!==e.userData&&(this.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),void 0!==e.size&&(this.size=e.size),void 0!==e.sizeAttenuation&&(this.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(this.map=t[e.map]||null),void 0!==e.matcap&&(this.matcap=t[e.matcap]||null),void 0!==e.alphaMap&&(this.alphaMap=t[e.alphaMap]||null),void 0!==e.bumpMap&&(this.bumpMap=t[e.bumpMap]||null),void 0!==e.bumpScale&&(this.bumpScale=e.bumpScale),void 0!==e.normalMap&&(this.normalMap=t[e.normalMap]||null),void 0!==e.normalMapType&&(this.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),this.normalScale=new eg().fromArray(t)}return void 0!==e.displacementMap&&(this.displacementMap=t[e.displacementMap]||null),void 0!==e.displacementScale&&(this.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(this.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(this.roughnessMap=t[e.roughnessMap]||null),void 0!==e.metalnessMap&&(this.metalnessMap=t[e.metalnessMap]||null),void 0!==e.emissiveMap&&(this.emissiveMap=t[e.emissiveMap]||null),void 0!==e.emissiveIntensity&&(this.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(this.specularMap=t[e.specularMap]||null),void 0!==e.specularIntensityMap&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),void 0!==e.specularColorMap&&(this.specularColorMap=t[e.specularColorMap]||null),void 0!==e.envMap&&(this.envMap=t[e.envMap]||null),void 0!==e.envMapRotation&&this.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(this.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(this.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(this.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(this.lightMap=t[e.lightMap]||null),void 0!==e.lightMapIntensity&&(this.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(this.aoMap=t[e.aoMap]||null),void 0!==e.aoMapIntensity&&(this.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(this.gradientMap=t[e.gradientMap]||null),void 0!==e.clearcoatMap&&(this.clearcoatMap=t[e.clearcoatMap]||null),void 0!==e.clearcoatRoughnessMap&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),void 0!==e.clearcoatNormalMap&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),void 0!==e.clearcoatNormalScale&&(this.clearcoatNormalScale=new eg().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(this.iridescenceMap=t[e.iridescenceMap]||null),void 0!==e.iridescenceThicknessMap&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),void 0!==e.transmissionMap&&(this.transmissionMap=t[e.transmissionMap]||null),void 0!==e.thicknessMap&&(this.thicknessMap=t[e.thicknessMap]||null),void 0!==e.anisotropyMap&&(this.anisotropyMap=t[e.anisotropyMap]||null),void 0!==e.sheenColorMap&&(this.sheenColorMap=t[e.sheenColorMap]||null),void 0!==e.sheenRoughnessMap&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(null!==t){let e=t.length;n=Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
1adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class nv extends ng{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new tp(0xffffff),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let n_=new e_,ny=new e_,nx=new e_,nb=new eg,nS=new eg,nM=new eV,nT=new e_,nw=new e_,nE=new e_,nA=new eg,nC=new eg,nR=new eg;class nP extends ta{constructor(e=new nv){if(super(),this.isSprite=!0,this.type="Sprite",void 0===r){r=new nh;const e=new nd(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);r.setIndex([0,1,2,0,2,3]),r.setAttribute("position",new nf(e,3,0,!1)),r.setAttribute("uv",new nf(e,2,3,!1))}this.geometry=r,this.material=e,this.center=new eg(.5,.5),this.count=1}raycast(e,t){let n,i;null===e.camera&&et('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ny.setFromMatrixScale(this.matrixWorld),nM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),nx.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ny.multiplyScalar(-nx.z);let r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));let a=this.center;nI(nT.set(-.5,-.5,0),nx,a,ny,n,i),nI(nw.set(.5,-.5,0),nx,a,ny,n,i),nI(nE.set(.5,.5,0),nx,a,ny,n,i),nA.set(0,0),nC.set(1,0),nR.set(1,1);let s=e.ray.intersectTriangle(nT,nw,nE,!1,n_);if(null===s&&(nI(nw.set(-.5,.5,0),nx,a,ny,n,i),nC.set(0,1),null===(s=e.ray.intersectTriangle(nT,nE,nw,!1,n_))))return;let o=e.ray.origin.distanceTo(n_);o<e.near||o>e.far||t.push({distance:o,point:n_.clone(),uv:tI.getInterpolation(n_,nT,nw,nE,nA,nC,nR,new eg),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function nI(e,t,n,i,r,a){nb.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(nS.x=a*nb.x-r*nb.y,nS.y=r*nb.x+a*nb.y):nS.copy(nb),e.copy(t),e.x+=nS.x,e.y+=nS.y,e.applyMatrix4(nM)}let nL=new e_,nN=new e_;class nU extends ta{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){let i;t=Math.abs(t);let r=this.levels;for(i=0;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){nL.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo(nL);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let n,i;nL.setFromMatrixPosition(e.matrixWorld),nN.setFromMatrixPosition(this.matrixWorld);let r=nL.distanceTo(nN)/e.zoom;for(t[0].object.visible=!0,n=1,i=t.length;n<i;n++){let e=t[n].distance;if(t[n].object.visible&&(e-=e*t[n].hysteresis),r>=e)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n<i;n++)t[n].object.visible=!1}}toJSON(e){let t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let e=0,i=n.length;e<i;e++){let i=n[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}let nD=new e_,nO=new e_,nF=new e_,nB=new e_,nz=new e_,nk=new e_,nH=new e_;class nV{constructor(e=new e_,t=new e_(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,nD)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=nD.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(nD.copy(this.origin).addScaledVector(this.direction,t),nD.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){let r,a,s,o;nO.copy(e).add(t).multiplyScalar(.5),nF.copy(t).sub(e).normalize(),nB.copy(this.origin).sub(nO);let l=.5*e.distanceTo(t),u=-this.direction.dot(nF),c=nB.dot(this.direction),h=-nB.dot(nF),d=nB.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(r=u*h-c,a=u*c-h,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+u*a+2*c)+a*(u*r+a+2*h)+d}else s=-(r=Math.max(0,-(u*(a=l)+c)))*r+a*(a+2*h)+d;else s=-(r=Math.max(0,-(u*(a=-l)+c)))*r+a*(a+2*h)+d;else a<=-o?(a=(r=Math.max(0,-(-u*l+c)))>0?-l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):(a=(r=Math.max(0,-(u*l+c)))>0?l:Math.min(Math.max(-l,-h),l),s=-r*r+a*(a+2*h)+d);else a=u>0?-l:l,s=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,r),i&&i.copy(nO).addScaledVector(nF,a),s}intersectSphere(e,t){nD.subVectors(e.center,this.origin);
1let n=nD.dot(this.direction),i=nD.dot(nD)-n*n,r=e.radius*e.radius;if(i>r)return null;let a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let n,i,r,a,s,o,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return(l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),c>=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>i||((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0)))?null:this.at(n>=0?n:i,t)}intersectsBox(e){return null!==this.intersectBox(e,nD)}intersectTriangle(e,t,n,i,r){let a;nz.subVectors(t,e),nk.subVectors(n,e),nH.crossVectors(nz,nk);let s=this.direction.dot(nH);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}nB.subVectors(this.origin,e);let o=a*this.direction.dot(nk.crossVectors(nB,nk));if(o<0)return null;let l=a*this.direction.dot(nz.cross(nB));if(l<0||o+l>s)return null;let u=-a*nB.dot(nH);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class nG extends ng{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new tp(0xffffff),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.envMapRotation=new e$,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let nW=new eV,nj=new nV,nX=new ni,nq=new e_,nY=new e_,nZ=new e_,nK=new e_,nJ=new e_,n$=new e_,nQ=new e_,n0=new e_;class n1 extends ta{constructor(e=new nh,t=new nG){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);let s=this.morphTargetInfluences;if(r&&s){n$.set(0,0,0);for(let n=0,i=r.length;n<i;n++){let i=s[n],o=r[n];0!==i&&(nJ.fromBufferAttribute(o,e),a?n$.addScaledVector(nJ,i):n$.addScaledVector(nJ.sub(t),i))}t.add(n$)}return t}raycast(e,t){let n=this.geometry,i=this.material,r=this.matrixWorld;void 0===i||(null===n.boundingSphere&&n.computeBoundingSphere(),nX.copy(n.boundingSphere),nX.applyMatrix4(r),nj.copy(e.ray).recast(e.near),!1===nX.containsPoint(nj.origin)&&(null===nj.intersectSphere(nX,nq)||nj.origin.distanceToSquared(nq)>(e.far-e.near)**2)||(nW.copy(r).invert(),nj.copy(e.ray).applyMatrix4(nW),(null===n.boundingBox||!1!==nj.intersectsBox(n.boundingBox))&&this._computeIntersections(e,t,nj)))}_computeIntersections(e,t,n){let i,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=h.length;r<o;r++){let o=h[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=n2(this,p,e,n,l,u,c,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let h=r;h<o;h+=3)(i=n2(this,a,e,n,l,u,c,s.getX(h),s.getX(h+1),s.getX(h+2)))&&(i.faceIndex=Math.floor(h/3),t.pu
1sh(i))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=h.length;r<s;r++){let s=h[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(i=n2(this,p,e,n,l,u,c,r,r+1,r+2))&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(i=n2(this,a,e,n,l,u,c,o,o+1,o+2))&&(i.faceIndex=Math.floor(o/3),t.push(i))}}}function n2(e,t,n,i,r,a,s,o,l,u){e.getVertexPosition(o,nY),e.getVertexPosition(l,nZ),e.getVertexPosition(u,nK);let c=function(e,t,n,i,r,a,s,o){if(null===(1===t.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===t.side,o)))return null;n0.copy(o),n0.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(n0);return l<n.near||l>n.far?null:{distance:l,point:n0.clone(),object:e}}(e,t,n,i,nY,nZ,nK,nQ);if(c){let e=new e_;tI.getBarycoord(nQ,nY,nZ,nK,e),r&&(c.uv=tI.getInterpolatedAttribute(r,o,l,u,e,new eg)),a&&(c.uv1=tI.getInterpolatedAttribute(a,o,l,u,e,new eg)),s&&(c.normal=tI.getInterpolatedAttribute(s,o,l,u,e,new e_),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new e_,materialIndex:0};tI.getNormal(nY,nZ,nK,t.normal),c.face=t,c.barycoord=e}return c}let n3=new eD,n4=new eD,n5=new eD,n6=new eD,n8=new eV,n7=new e_,n9=new ni,ie=new eV,it=new nV;class ii extends n1{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=N,this.bindMatrix=new eV,this.bindMatrixInverse=new eV,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new tL),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,n7),this.boundingBox.expandByPoint(n7)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new ni),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,n7),this.boundingSphere.expandByPoint(n7)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let n=this.material,i=this.matrixWorld;void 0===n||(null===this.boundingSphere&&this.computeBoundingSphere(),n9.copy(this.boundingSphere),n9.applyMatrix4(i),!1===e.ray.intersectsSphere(n9)||(ie.copy(i).invert(),it.copy(e.ray).applyMatrix4(ie),(null===this.boundingBox||!1!==it.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,it)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new eD,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);let i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===N?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===U?this.bindMatrixInverse.copy(this.bindMatrix).invert():ee("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,i=this.geometry;n4.fromBufferAttribute(i.attributes.skinIndex,e),n5.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(n3.copy(t),t.set(0,0,0,0)):(n3.set(...t,1),t.set(0,0,0)),n3.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let i=n5.getComponent(e);if(0!==i){let r=n4.getComponent(e);n8.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(n6.copy(n3).applyMatrix4(n8),i)}}return t.isVector4&&(t.w=n3.w),t.applyMatrix4(this.bindMatrixInverse)}}class ir extends ta{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ia extends eU{constructor(e=null,t=1,n=1,i,r,a,s,o,l=1003,u=1003,c,h){super(null,a,s,o,l,u,i,r,c,h),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let is=new eV,io=new eV;class il{constructor(e=[],t=[]){this.uuid=eu(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){ee("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new eV)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new eV;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){let r=e[i]?e[i].matrixWorld:io;is.multiplyMatrices(r,t[i]),is.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new il(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let n=new ia(t,e,e,1023,1015);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let i=e.bones[n],r=t[i];void 0===r&&(ee("Skeleton: No bone found with UUID:",i),r=new ir),this.bones.push(r),this.boneInverses.push(new eV().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){let r=t[i];e.bones.push(r.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}}class iu extends t0{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}let ic=new eV,ih=new eV,id=[],ip=new tL,im=new eV,ig=new n1,iv=new ni;class i_ extends n1{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new iu(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,im)}computeBoundingBox(){let e=this.geometry,t=this.count;
1null===this.boundingBox&&(this.boundingBox=new tL),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ic),ip.copy(e.boundingBox).applyMatrix4(ic),this.boundingBox.union(ip)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new ni),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ic),iv.copy(e.boundingSphere).applyMatrix4(ic),this.boundingSphere.union(iv)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return null===this.instanceColor?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){let n=this.matrixWorld,i=this.count;if((ig.geometry=this.geometry,ig.material=this.material,void 0!==ig.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),iv.copy(this.boundingSphere),iv.applyM
1atrix4(n),!1!==e.ray.intersectsSphere(iv)))for(let r=0;r<i;r++){this.getMatrixAt(r,ic),ih.multiplyMatrices(n,ic),ig.matrixWorld=ih,ig.raycast(e,id);for(let e=0,n=id.length;e<n;e++){let n=id[e];n.instanceId=r,n.object=this,t.push(n)}id.length=0}}setColorAt(e,t){return null===this.instanceColor&&(this.instanceColor=new iu(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,16*e),this}setMorphAt(e,t){let n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new ia(new Float32Array(i*this.count),i,this.count,1028,1015));let r=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=i*e;return r[o]=s,r.set(n,o+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let iy=new e_,ix=new e_,ib=new eb;class iS{constructor(e=new e_(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=iy.subVectors(n,t).cross(ix.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let i=e.delta(iy),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/r;return!0===n&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||ib.getNormalMatrix(e),i=this.coplanarPoint(iy).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let iM=new ni,iT=new eg(.5,.5),iw=new e_;class iE{constructor(e=new iS,t=new iS,n=new iS,i=new iS,r=new iS,a=new iS){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3,n=!1){let i=this.planes,r=e.elements,a=r[0],s=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],v=r[12],_=r[13],y=r[14],x=r[15];if(i[0].setComponents(l-a,d-u,g-p,x-v).normalize(),i[1].setComponents(l+a,d+u,g+p,x+v).normalize(),i[2].setComponents(l+s,d+c,g+f,x+_).normalize(),i[3].setComponents(l-s,d-c,g-f,x-_).normalize(),n)i[4].setComponents(o,h,m,y).normalize(),i[5].setComponents(l-o,d-h,g-m,x-y).normalize();else if(i[4].setComponents(l-o,d-h,g-m,x-y).normalize(),2e3===t)i[5].setComponents(l+o,d+h,g+m,x+y).normalize();else if(2001===t)i[5].setComponents(o,h,m,y).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),iM.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),iM.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(iM)}intersectsSprite(e){return iM.center.set(0,0,0),iM.radius=.7071067811865476+iT.distanceTo(e.center),iM.applyMatrix4(e.matrixWorld),this.intersectsSphere(iM)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(iw.x=i.normal.x>0?e.max.x:e.min.x,iw.y=i.normal.y>0?e.max.y:e.min.y,iw.z=i.normal.z>0?e.max.z:e.min.z,0>i.distanceToPoint(iw))return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(0>t[n].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}let iA=new eV;class iC{constructor(){this.coordinateSystem=2e3,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let e=0;e<t.length;e++){let i=t[e];iA.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),void 0===n[e]&&(n[e]=new iE),n[e].setFromProjectionMatrix(iA,i.coordinateSystem,i.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let i=0;i<e._count;i++)void 0===t[i]&&(t[i]=new iE),t[i].copy(n[i]);return this._count=e._count,this}clone(){return new iC().copy(this)}}function iR(e,t){return e-t}function iP(e,t){return e.z-t.z}function iI(e,t){return t.z-e.z}let iL=new eV,iN=new tp(1,1,1),iU=new iE,iD=new iC,iO=new tL,iF=new ni,iB=new e_,iz=new e_,ik=new e_,iH=new class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){let r=this.pool,a=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});let s=r[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=i}reset(){this.list.length=0,this.index=0}},iV=new n1,iG=[];function iW(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++)t[i]=e[i]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class ij extends n1{constructor(e,t,n=2*t,i){super(new nh,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount),t=new ia(new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4),e,e,1023,1015);this._matricesTexture=t}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new ia(new Uint32Array((e=Math.ceil(e))*e),e,e,1029,1014);this._indirectTexture=t}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new ia(new Float32Array((e=Math.ceil(e))*e*4).fill(1),e,e,1023,1015);
1t.colorSpace=ew.workingColorSpace,this._colorsTexture=t}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(let i in e.attributes){let{array:r,itemSize:a,normalized:s}=e.getAttribute(i),o=new t0(new r.constructor(n*a),a,s);t.setAttribute(i,o)}if(null!==e.getIndex()){let e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new t0(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tL);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;let i=t[n].geometryIndex;this.getMatrixAt(n,iL),this.getBoundingBoxAt(i,iO).applyMatrix4(iL),e.union(iO)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new ni);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;let i=t[n].geometryIndex;this.getMatrixAt(n,iL),this.getBoundingSphereAt(i,iF).applyMatrix4(iL),e.union(iF)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(iR),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let i=this._matricesTexture;iL.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;let r=this._colorsTexture;return r&&(iN.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){let i;this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=-1===t?e.getAttribute("position").count:t;let s=e.getIndex();if(null!==s&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=-1===n?s.count:n),-1!==r.indexStart&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(iR),a[i=this._availableGeometryIds.shift()]=r):(i=this._geometryCount,this._geometryCount++,a.push(r)),this.setGeometryAt(i,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,i}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(i&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,n.attributes){let i=t.getAttribute(e),r=n.getAttribute(e);!function(e,t,n=0){let i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let r=e.count;for(let a=0;a<r;a++)for(let r=0;r<i;r++)t.setComponent(a+n,r,e.getComponent(a,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}(i,r,o);let a=i.itemSize;
1for(let e=i.count;e<l;e++){let t=o+e;for(let e=0;e<a;e++)r.setComponent(t,e,0)}r.needsUpdate=!0,r.addUpdateRange(o*a,l*a)}if(i){let e=s.indexStart,n=s.reservedIndexCount;s.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)r.setX(e+t,o+a.getX(t));for(let t=a.count;t<n;t++)r.setX(e+t,o);r.needsUpdate=!0,r.addUpdateRange(e,s.reservedIndexCount)}return s.start=i?s.indexStart:s.vertexStart,s.count=i?s.indexCount:s.vertexCount,s.boundingBox=null,null!==t.boundingBox&&(s.boundingBox=t.boundingBox.clone()),s.boundingSphere=null,null!==t.boundingSphere&&(s.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;let n=this._instanceInfo;for(let t=0,i=n.length;t<i;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,i=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),r=this.geometry;for(let a=0,s=n.length;a<s;a++){let s=n[i[a]];if(!1!==s.active){if(null!==r.index){if(s.indexStart!==t){let{indexStart:n,vertexStart:i,reservedIndexCount:a}=s,o=r.index,l=o.array,u=e-i;for(let e=n;e<n+a;e++)l[e]=l[e]+u;o.array.copyWithin(t,n,n+a),o.addUpdateRange(t,a),o.needsUpdate=!0,s.indexStart=t}t+=s.reservedIndexCount}if(s.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=s,i=r.attributes;for(let r in i){let a=i[r],{array:s,itemSize:o}=a;s.copyWithin(e*o,t*o,(t+n)*o),a.addUpdateRange(e*o,n*o),a.needsUpdate=!0}s.vertexStart=e}e+=s.reservedVertexCount,s.start=r.index?s.indexStart:s.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){let e=new tL,t=n.index,r=n.attributes.position;for(let n=i.start,a=i.start+i.count;n<a;n++){let i=n;t&&(i=t.getX(i)),e.expandByPoint(iB.fromBufferAttribute(r,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){let t=new ni;this.getBoundingBoxAt(e,iO),iO.getCenter(t.center);let r=n.index,a=n.attributes.position,s=0;for(let e=i.start,n=i.start+i.count;e<n;e++){let n=e;r&&(n=r.getX(n)),iB.fromBufferAttribute(a,n),s=Math.max(s,t.center.distanceToSquared(iB))}t.radius=Math.sqrt(s),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return(this.validateInstanceId(e),null!==this._colorsTexture)?t.fromArray(this._colorsTexture.image.data,4*e):t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(iR);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let i=new Int32Array(e),r=new Int32Array(e);
1iW(this._multiDrawCounts,i),iW(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;let a=this._indirectTexture,s=this._matricesTexture,o=this._colorsTexture;a.dispose(),this._initIndirectTexture(),iW(a.image.data,this._indirectTexture.image.data),s.dispose(),this._initMatricesTexture(),iW(s.image.data,this._matricesTexture.image.data),o&&(o.dispose(),this._initColorsTexture(),iW(o.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new nh,this._initializeGeometry(i));let r=this.geometry;for(let e in i.index&&iW(i.index.array,r.index.array),i.attributes)iW(i.attributes[e].array,r.attributes[e].array)}raycast(e,t){let n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;iV.material=this.material,iV.geometry.index=a.index,iV.geometry.attributes=a.attributes,null===iV.geometry.boundingBox&&(iV.geometry.boundingBox=new tL),null===iV.geometry.boundingSphere&&(iV.geometry.boundingSphere=new ni);for(let a=0,s=n.length;a<s;a++){if(!n[a].visible||!n[a].active)continue;let s=n[a].geometryIndex,o=i[s];iV.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(a,iV.matrixWorld).premultiply(r),this.getBoundingBoxAt(s,iV.geometry.boundingBox),this.getBoundingSphereAt(s,iV.geometry.boundingSphere),iV.raycast(e,iG);for(let e=0,n=iG.length;e<n;e++){let n=iG[e];n.object=this,n.batchId=a,t.push(n)}iG.length=0}iV.material=null,iV.geometry.index=null,iV.geometry.attributes={},iV.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=i.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=1;r.wireframe&&(o=2,s=i.attributes.position.count>65535?4:2);let l=this._instanceInfo,u=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data,m=n.isArrayCamera?iD:iU;d&&(n.isArrayCamera?m.setFromArrayCamera(n):(iL.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),m.setFromProjectionMatrix(iL,n.coordinateSystem,n.reversedDepth)));let g=0;if(this.sortObjects){iL.copy(this.matrixWorld).invert(),iB.setFromMatrixPosition(n.matrixWorld).applyMatrix4(iL),iz.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(iL);for(let e=0,t=l.length;e<t;e++)if(l[e].visible&&l[e].active){let t=l[e].geometryIndex;this.getMatrixAt(e,iL),this.getBoundingSphereAt(t,iF).applyMatrix4(iL);let n=!1;if(d&&(n=!m.intersectsSphere(iF)),!n){let n=h[t],i=ik.subVectors(iF.center,iB).dot(iz);iH.push(n.start,n.count,i,e)}}let e=iH.list,t=this.customSort;null===t?e.sort(r.transparent?iI:iP):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){let n=e[t];u[g]=n.start*s*o,c[g]=n.count*o,f[g]=n.index,g++}iH.reset()}else for(let e=0,t=l.length;e<t;e++)if(l[e].visible&&l[e].active){let t=l[e].geometryIndex,n=!1;if(d&&(this.getMatrixAt(e,iL),this.getBoundingSphereAt(t,iF).applyMatrix4(iL),n=!m.intersectsSphere(iF)),!n){let n=h[t];u[g]=n.start*s*o,c[g]=n.count*o,f[g]=e,g++}}p.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,a){this.onBeforeRender(e,null,i,r,a)}}class iX extends ng{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new tp(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let iq=new e_,iY=new e_,iZ=new eV,iK=new nV,iJ=new ni,i$=new e_,iQ=new e_;class i0 extends ta{constructor(e=new nh,t=new iX){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)iq.fromBufferAttribute(t,e-1),iY.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=iq.distanceTo(iY);e.setAttribute("lineDistance",new t9(n,1))}else ee("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),iJ.copy(n.boundingSphere),iJ.applyM
1atrix4(i),iJ.radius+=r,!1===e.ray.intersectsSphere(iJ))return;iZ.copy(i).invert(),iK.copy(e.ray).applyMatrix4(iZ);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,u=n.index,c=n.attributes.position;if(null!==u){let n=Math.max(0,a.start),i=Math.min(u.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){let n=i1(this,e,iK,o,u.getX(r),u.getX(r+1),r);n&&t.push(n)}if(this.isLineLoop){let r=i1(this,e,iK,o,u.getX(i-1),u.getX(n),i-1);r&&t.push(r)}}else{let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){let n=i1(this,e,iK,o,r,r+1,r);n&&t.push(n)}if(this.isLineLoop){let r=i1(this,e,iK,o,i-1,n,i-1);r&&t.push(r)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function i1(e,t,n,i,r,a,s){let o=e.geometry.attributes.position;if(iq.fromBufferAttribute(o,r),iY.fromBufferAttribute(o,a),n.distanceSqToSegment(iq,iY,i$,iQ)>i)return;i$.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(i$);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:iQ.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let i2=new e_,i3=new e_;class i4 extends i0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)i2.fromBufferAttribute(t,e),i3.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+i2.distanceTo(i3);e.setAttribute("lineDistance",new t9(n,1))}else ee("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class i5 extends i0{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class i6 extends ng{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new tp(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let i8=new eV,i7=new nV,i9=new ni,re=new e_;class rt extends ta{constructor(e=new nh,t=new i6){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),i9.copy(n.boundingSphere),i9.applyMatrix4(i),i9.radius+=r,!1===e.ray.intersectsSphere(i9))return;i8.copy(i).invert(),i7.copy(e.ray).applyMatrix4(i8);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=n.index,u=n.attributes.position;if(null!==l){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let a=n;a<r;a++){let n=l.getX(a);re.fromBufferAttribute(u,n),rn(re,n,o,i,e,t,this)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let a=n;a<r;a++)re.fromBufferAttribute(u,a),rn(re,a,o,i,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function rn(e,t,n,i,r,a,s){let o=i7.distanceSqToPoint(e);if(o<n){let n=new e_;i7.closestPointToPoint(e,n),n.applyMatrix4(i);let l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class ri extends eU{constructor(e,t,n,i,r=1006,a=1006,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class rr extends ri{constructor(e,t,n,i,r,a,s,o){super({},e,t,n,i,r,a,s,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class ra extends eU{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class rs extends eU{constructor(e,t,n,i,r,a,s,o,l,u,c,h){super(null,a,s,o,l,u,i,r,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ro extends rs{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class rl extends rs{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ru extends eU{constructor(e=[],t=301,n,i,r,a,s,o,l,u){super(e,t,n,i,r,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class rc extends eU{constructor(e,t,n,i,r,a,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class rh extends eU{constructor(e,t,n,i,r,a,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const u=e?e.parentNode:null;null!==u&&"requestPaint"in u&&(u.onpaint=()=>{this.needsUpdate=!0},u.requestPaint())}dispose(){let e=this.image?this.image.parentNode:null;null!==e&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class rd extends eU{constructor(e,t,n=1014,i,r,a,s=1003,o=1003,l,u=1026,c=1){if(1026!==u&&1027!==u)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},i,r,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new eP(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class rp extends rd{constructor(e,t=1014,n=301,i,r,a=1003,s=1003,o,l=1026){const u={width:e,height:e,depth:1};super(e,e,t,n,i,r,a,s,o,l),this.image=[u,u,u,u,u,u],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class rf extends eU{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class rm extends nh{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){let _=a/m,y=p/g,x=a/2,b=p/2,S=f/2,M=m+1,T=g+1,w=0,E=0,A=new e_;for(let a=0;a<T;a++){let s=a*y-b;for(let o=0;o<M;o++){let h=o*_-x;A[e]=h*i,A[t]=s*r,A[n]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),c.push(o/m),c.push(1-a/g),w+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let n=h+t+M*e,i=h+t+M*(e+1),r=h+(t+1)+M*(e+1),a=h+(t+1)+M*e;o.push(n,i,a),o.push(i,r,a),E+=6}s.addGroup(d,E,v),d+=E,h+=w}p("z","y","x",-1,-1,n,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,n,t,-e,a,r,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new t9(l,3)),this.setAttribute("normal",new t9(u,3)),this.setAttribute("uv",new t9(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rm(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class rg extends nh{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
1s:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i));const a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+(r=Math.max(1,Math.floor(r))),f=i+1,m=new e_,g=new e_;for(let v=0;v<=p;v++){let _=0,y=0,x=0,b=0;if(v<=n){const t=v/n,i=t*Math.PI/2;y=-u-e*Math.cos(i),x=e*Math.sin(i),b=-e*Math.cos(i),_=t*c}else if(v<=n+r){const i=(v-n)/r;y=-u+i*t,x=e,b=0,_=c+i*h}else{const t=(v-n-r)/n,i=t*Math.PI/2;y=u+e*Math.sin(i),x=e*Math.cos(i),b=e*Math.sin(i),_=c+h+t*c}const S=Math.max(0,Math.min(1,_/d));let M=0;0===v?M=.5/i:v===p&&(M=-.5/i);for(let e=0;e<=i;e++){const t=e/i,n=t*Math.PI*2,r=Math.sin(n),a=Math.cos(n);g.x=-x*a,g.y=y,g.z=x*r,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*r),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+M,S)}if(v>0){const e=(v-1)*f;for(let t=0;t<i;t++){const n=e+t,i=e+t+1,r=v*f+t,s=v*f+t+1;a.push(n,i,r),a.push(i,s,r)}}}this.setIndex(a),this.setAttribute("position",new t9(s,3)),this.setAttribute("normal",new t9(o,3)),this.setAttribute("uv",new t9(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rg(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class rv extends nh{constructor(e=1,t=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],a=[],s=[],o=[],l=new e_,u=new eg;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let r=0,c=3;r<=t;r++,c+=3){const h=n+r/t*i;l.x=e*Math.cos(h),l.y=e*Math.sin(h),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[c]/e+1)/2,u.y=(a[c+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)r.push(e,e+1,0);this.setIndex(r),this.setAttribute("position",new t9(a,3)),this.setAttribute("normal",new t9(s,3)),this.setAttribute("uv",new t9(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rv(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class r_ extends nh{constructor(e=1,t=1,n=1,i=32,r=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:s,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],c=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){let r=p,a=new eg,f=new e_,v=0,_=!0===n?e:t,y=!0===n?1:-1;for(let e=1;e<=i;e++)c.push(0,m*y,0),h.push(0,y,0),d.push(.5,.5),p++;let x=p;for(let e=0;e<=i;e++){let t=e/i*o+s,n=Math.cos(t),r=Math.sin(t);f.x=_*r,f.y=m*y,f.z=_*n,c.push(f.x,f.y,f.z),h.push(0,y,0),a.x=.5*n+.5,a.y=.5*r*y+.5,d.push(a.x,a.y),p++}for(let e=0;e<i;e++){let t=r+e,i=x+e;!0===n?u.push(i,i+1,t):u.push(i+1,i,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}(function(){let a=new e_,v=new e_,_=0,y=(t-e)/n;for(let l=0;l<=r;l++){let u=[],g=l/r,_=g*(t-e)+e;for(let e=0;e<=i;e++){let t=e/i,r=t*o+s,l=Math.sin(r),f=Math.cos(r);v.x=_*l,v.y=-g*n+m,v.z=_*f,c.push(v.x,v.y,v.z),a.set(l,y,f).normalize(),h.push(a.x,a.y,a.z),d.push(t,1-g),u.push(p++)}f.push(u)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){let a=f[i][n],s=f[i+1][n],o=f[i+1][n+1],l=f[i][n+1];(e>0||0!==i)&&(u.push(a,s,l),_+=3),(t>0||i!==r-1)&&(u.push(s,o,l),_+=3)}l.addGroup(g,_,0),g+=_})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new t9(c,3)),this.setAttribute("normal",new t9(h,3)),this.setAttribute("uv",new t9(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new r_(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ry extends r_{constructor(e=1,t=1,n=32,i=1,r=!1,a=0,s=2*Math.PI){super(0,e,t,n,i,r,a,s),this.type="C
1oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(e){return new ry(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class rx extends nh{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function s(e){r.push(e.x,e.y,e.z)}function o(t,n){let i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function l(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let n=new e_,i=new e_,r=new e_;for(let a=0;a<t.length;a+=3)o(t[a+0],n),o(t[a+1],i),o(t[a+2],r),function(e,t,n,i){let r=i+1,a=[];for(let i=0;i<=r;i++){a[i]=[];let s=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)0===e&&i===r?a[i][e]=s:a[i][e]=s.clone().lerp(o,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){let n=Math.floor(t/2);t%2==0?(s(a[e][n+1]),s(a[e+1][n]),s(a[e][n])):(s(a[e][n+1]),s(a[e+1][n+1]),s(a[e+1][n]))}}(n,i,r,e)})(i),function(e){let t=new e_;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){let e=new e_;for(let n=0;n<r.length;n+=3){var t;e.x=r[n+0],e.y=r[n+1],e.z=r[n+2];let i=u(e)/2/Math.PI+.5,s=Math.atan2(-(t=e).y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;a.push(i,1-s)}(function(){let e=new e_,t=new e_,n=new e_,i=new e_,s=new eg,o=new eg,c=new eg;for(let h=0,d=0;h<r.length;h+=9,d+=6){e.set(r[h+0],r[h+1],r[h+2]),t.set(r[h+3],r[h+4],r[h+5]),n.set(r[h+6],r[h+7],r[h+8]),s.set(a[d+0],a[d+1]),o.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),i.copy(e).add(t).add(n).divideScalar(3);let p=u(i);l(s,d+0,e,p),l(o,d+2,t,p),l(c,d+4,n,p)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),s=Math.min(t,n,i);r>.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new t9(r,3)),this.setAttribute("normal",new t9(r.slice(),3)),this.setAttribute("uv",new t9(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new rx(e.vertices,e.indices,e.radius,e.detail)}}class rb extends rx{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
119,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new rb(e.radius,e.detail)}}let rS=new e_,rM=new e_,rT=new e_,rw=new tI;class rE extends nh{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=Math.cos(eo*t),i=e.getIndex(),r=e.getAttribute("position"),a=i?i.count:r.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},c=[];for(let e=0;e<a;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);const{a:t,b:a,c:h}=rw;if(t.fromBufferAttribute(r,s[0]),a.fromBufferAttribute(r,s[1]),h.fromBufferAttribute(r,s[2]),rw.getNormal(rT),l[0]=`${Math.round(1e4*t.x)},${Math.round(1e4*t.y)},${Math.round(1e4*t.z)}`,l[1]=`${Math.round(1e4*a.x)},${Math.round(1e4*a.y)},${Math.round(1e4*a.z)}`,l[2]=`${Math.round(1e4*h.x)},${Math.round(1e4*h.y)},${Math.round(1e4*h.z)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){const t=(e+1)%3,i=l[e],r=l[t],a=rw[o[e]],h=rw[o[t]],d=`${i}_${r}`,p=`${r}_${i}`;p in u&&u[p]?(rT.dot(u[p].normal)<=n&&(c.push(a.x,a.y,a.z),c.push(h.x,h.y,h.z)),u[p]=null):d in u||(u[d]={index0:s[e],index1:s[t],normal:rT.clone()})}}for(const e in u)if(u[e]){const{index0:t,index1:n}=u[e];rS.fromBufferAttribute(r,t),rM.fromBufferAttribute(r,n),c.push(rS.x,rS.y,rS.z),c.push(rM.x,rM.y,rM.z)}this.setAttribute("position",new t9(c,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class rA{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ee("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(n=this.getPoint(a/e)).distanceTo(i)),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=i[r=Math.floor(s+(o-s)/2)]-n)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(i[r=o]===n)return r/(a-1);let u=i[r],c=i[r+1];return(r+(n-u)/(c-u))/(a-1)}getTangent(e,t){let n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);let r=this.getPoint(n),a=this.getPoint(i),s=t||(r.isVector2?new eg:new e_);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new e_,i=[],r=[],a=[],s=new e_,o=new eV;for(let t=0;t<=e;t++){let n=t/e;i[t]=this.getTangentAt(n,new e_)}r[0]=new e_,a[0]=new e_;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),c=Math.abs(i[0].y),h=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(ec(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(ec(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class rC extends rA{constructor(e=0,t=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new eg){let n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,r=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=n;for(;i>n;)i-=n;i<Number.EPSILON&&(i=r?0:n),!0!==this.aClockwise||r||(i===n?i=-n:i-=n);let a=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,i=o-this.aY;s=n*e-i*t+this.aX,o=n*t+i*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class rR extends rC{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}}function rP(){let e=0,t=0,n=0,i=0;function r(r,a,s,o){e=r,t=s,n=-3*r+3*a-2*s-o,i=2*r-2*a+s+o}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,s,o){let l=(t-e)/a-(n-e)/(a+s)+(n-t)/s,u=(n-t)/s-(i-t)/(s+o)+(i-n)/o;r(t,n,l*=s,u*=s)},calc:function(r){let a=r*r;return e+t*r+n*a+a*r*i}}}let rI=new e_,rL=new e_,rN=new rP,rU=new rP,rD=new rP;class rO extends rA{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new e_){let n,i,r=this.points,a=r.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?n=r[(o-1)%a]:(rL.subVectors(r[0],r[1]).add(r[0]),n=rL);let u=r[o%a],c=r[(o+1)%a];if(this.closed||o+2<a?i=r[(o+2)%a]:(rI.subVectors(r[a-1],r[a-2]).add(r[a-1]),i=rI),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(n.distanceToSquared(u),e),r=Math.pow(u.distanceToSquared(c),e),a=Math.pow(c.distanceToSquared(i),e);r<1e-4&&(r=1),t<1e-4&&(t=r),a<1e-4&&(a=r),rN.initNonuniformCatmullRom(n.x,u.x,c.x,i.x,t,r,a),rU.initNonuniformCatmullRom(n.y,u.y,c.y,i.y,t,r,a),rD.initNonuniformCatmullRom(n.z,u.z,c.z,i.z,t,r,a)}else"catmullrom"===this.curveType&&(rN.initCatmullRom(n.x,u.x,c.x,i.x,this.tension),rU.init
1CatmullRom(n.y,u.y,c.y,i.y,this.tension),rD.initCatmullRom(n.z,u.z,c.z,i.z,this.tension));return t.set(rN.calc(l),rU.calc(l),rD.calc(l)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new e_().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function rF(e,t,n,i,r){let a=(i-t)*.5,s=(r-n)*.5,o=e*e;return e*o*(2*n-2*i+a+s)+(-3*n+3*i-2*a-s)*o+a*e+n}function rB(e,t,n,i){let r;return(r=1-e)*r*t+2*(1-e)*e*n+e*e*i}function rz(e,t,n,i,r){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*n+3*(1-e)*e*e*i+e*e*e*r}class rk extends rA{constructor(e=new eg,t=new eg,n=new eg,i=new eg){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new eg){let n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(rz(e,n.x,i.x,r.x,a.x),rz(e,n.y,i.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class rH extends rA{constructor(e=new e_,t=new e_,n=new e_,i=new e_){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new e_){let n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(rz(e,n.x,i.x,r.x,a.x),rz(e,n.y,i.y,r.y,a.y),rz(e,n.z,i.z,r.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class rV extends rA{constructor(e=new eg,t=new eg){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new eg){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new eg){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rG extends rA{constructor(e=new e_,t=new e_){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new e_){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new e_){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rW extends rA{constructor(e=new eg,t=new eg,n=new eg){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new eg){let n=this.v0,i=this.v1,r=this.v2;return t.set(rB(e,n.x,i.x,r.x),rB(e,n.y,i.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rj extends rA{constructor(e=new e_,t=new e_,n=new e_){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new e_){let n=this.v0,i=this.v1,r=this.v2;return t.set(rB(e,n.x,i.x,r.x),rB(e,n.y,i.y,r.y),rB(e,n.z,i.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class rX extends rA{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new eg){let n=this.points,i=(n.length-1)*e,r=Math.floor(i),a=i-r,s=n[0===r?r:r-1],o=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return t.set(rF(a,s.x,o.x,l.x,u.x),rF(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new eg().fromArray(n))}return this}}var rq=Object.freeze({__proto__:null,ArcCurve:rR,CatmullRomCurve3:rO,CubicBezierCurve:rk,CubicBezierCurve3:rH,EllipseCurve:rC,LineCurve:rV,LineCurve3:rG,QuadraticBezierCurve:rW,QuadraticBezierCurve3:rj,SplineCurve:rX});class rY extends rA{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new rq[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),i=this.getCurveLengths(),r=0;for(;r<i.length;){if(i[r]>=n){let e=i[r]-n,a=this.curves[r],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}r++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n<i;n++)e.push(t+=this.curves[n].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t,n=[];for(let i=0,r=this.curves;i<r.length;i++){let a=r[i],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isS
1plineCurve?e*a.points.length:e,o=a.getPoints(s);for(let e=0;e<o.length;e++){let i=o[e];t&&t.equals(i)||(n.push(i),t=i)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new rq[n.type]().fromJSON(n))}return this}}class rZ extends rY{constructor(e){super(),this.type="Path",this.currentPoint=new eg,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new rV(this.currentPoint.clone(),new eg(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){let r=new rW(this.currentPoint.clone(),new eg(e,t),new eg(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){let s=new rk(this.currentPoint.clone(),new eg(e,t),new eg(n,i),new eg(r,a));return this.curves.push(s),this.currentPoint.set(r,a),this}splineThru(e){let t=new rX([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,s,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,i,r,a,s,o),this}absellipse(e,t,n,i,r,a,s,o){let l=new rC(e,t,n,i,r,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class rK extends rZ{constructor(e){super(e),this.uuid=eu(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new rZ().fromJSON(n))}return this}}function rJ(e,t,n,i,r){let a;if(r===function(e,t,n,i){let r=0;for(let a=t,s=n-i;a<n;a+=i)r+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return r}(e,t,n,i)>0)for(let r=t;r<n;r+=i)a=ae(r/i|0,e[r],e[r+1],a);else for(let r=n-i;r>=t;r-=i)a=ae(r/i|0,e[r],e[r+1],a);return a&&r4(a,a.next)&&(at(a),a=a.next),a}function r$(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(r4(n,n.next)||0===r3(n.prev,n,n.next))){if(at(n),(n=t=n.prev)===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function rQ(e,t){let n=e.x-t.x;return 0===n&&0==(n=e.y-t.y)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function r0(e,t,n,i,r){return(e=((e=((e=((e=((e=(e-n)*r|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-i)*r|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function r1(e,t,n,i,r,a,s,o){return(r-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(r-s)*(i-o)}function r2(e,t,n,i,r,a,s,o){return(e!==s||t!==o)&&r1(e,t,n,i,r,a,s,o)}function r3(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function r4(e,t){return e.x===t.x&&e.y===t.y}function r5(e,t,n,i){let r=r8(r3(e,t,n)),a=r8(r3(e,t,i)),s=r8(r3(n,i,e)),o=r8(r3(n,i,t));return!!(r!==a&&s!==o||0===r&&r6(e,n,t)||0===a&&r6(e,i,t)||0===s&&r6(n,e,i)||0===o&&r6(n,t,i))}
1function r6(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function r8(e){return e>0?1:e<0?-1:0}function r7(e,t){return 0>r3(e.prev,e,e.next)?r3(e,t,e.next)>=0&&r3(e,e.prev,t)>=0:0>r3(e,t,e.prev)||0>r3(e,e.next,t)}function r9(e,t){let n=an(e.i,e.x,e.y),i=an(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function ae(e,t,n,i){let r=an(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function at(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function an(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ai{static triangulate(e,t,n=2){return function(e,t,n=2){let i,r,a,s=t&&t.length,o=s?t[0]*n:e.length,l=rJ(e,0,o,n,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,n,i){let r=[];for(let n=0,a=t.length;n<a;n++){let s=t[n]*i,o=n<a-1?t[n+1]*i:e.length,l=rJ(e,s,o,i,!1);l===l.next&&(l.steiner=!0),r.push(function(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}(l))}r.sort(rQ);for(let e=0;e<r.length;e++)n=function(e,t){let n=function(e,t){let n,i=t,r=e.x,a=e.y,s=-1/0;if(r4(e,i))return i;do{if(r4(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,n=i.x<i.next.x?i:i.next,e===r))return n}i=i.next}while(i!==t);if(!n)return null;let o=n,l=n.x,u=n.y,c=1/0;i=n;do{if(r>=i.x&&i.x>=l&&r!==i.x&&r1(a<u?r:s,a,l,u,a<u?s:r,a,i.x,i.y)){var h,d;let t=Math.abs(a-i.y)/(r-i.x);r7(i,e)&&(t<c||t===c&&(i.x>n.x||i.x===n.x&&(h=n,d=i,0>r3(h.prev,h,d.prev)&&0>r3(d.next,h,h.next))))&&(n=i,c=t)}i=i.next}while(i!==o);return n}(e,t);if(!n)return t;let i=r9(n,e);return r$(i,i.next),r$(n,n.next)}(r[e],n);return n}(e,t,l,n)),e.length>80*n){i=e[0],r=e[1];let t=i,s=r;for(let a=n;a<o;a+=n){let n=e[a],o=e[a+1];n<i&&(i=n),o<r&&(r=o),n>t&&(t=n),o>s&&(s=o)}a=0!==(a=Math.max(t-i,s-r))?32767/a:0}return function e(t,n,i,r,a,s,o){if(!t)return;!o&&s&&function(e,t,n,i){let r=e;do 0===r.z&&(r.z=r0(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n=1;do{let i,r=e;e=null;let a=null;for(t=0;r;){t++;let s=r,o=0;for(let e=0;e<n&&(o++,s=s.nextZ);e++);let l=n;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||r.z<=s.z)?(i=r,r=r.nextZ,o--):(i=s,s=s.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=s}a.nextZ=null,n*=2}while(t>1)}(r)}(t,r,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,c=t.next;if(s?function(e,t,n,i){let r=e.prev,a=e.next;if(r3(r,e,a)>=0)return!1;let s=r.x,o=e.x,l=a.x,u=r.y,c=e.y,h=a.y,d=Math.min(s,o,l),p=Math.min(u,c,h),f=Math.max(s,o,l),m=Math.max(u,c,h),g=r0(d,p,t,n,i),v=r0(f,m,t,n,i),_=e.prevZ,y=e.nextZ;for(;_&&_.z>=g&&y&&y.z<=v;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==a&&r2(s,u,o,c,l,h,_.x,_.y)&&r3(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==r&&y!==a&&r2(s,u,o,c,l,h,y.x,y.y)&&r3(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=g;){if(_.x>=d&&_.x<=f&&_.y>=p&&_.y<=m&&_!==r&&_!==a&&r2(s,u,o,c,l,h,_.x,_.y)&&r3(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=v;){if(y.x>=d&&y.x<=f&&y.y>=p&&y.y<=m&&y!==r&&y!==a&&r2(s,u,o,c,l,h,y.x,y.y)&&r3(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}(t,r,a,s):function(e){let t=e.prev,n=e.next;if(r3(t,e,n)>=0)return!1;let i=t.x,r=e.x,a=n.x,s=t.y,o=e.y,l=n.y,u=Math.min(i,r,a),c=Math.min(s,o,l),h=Math.max(i,r,a),d=Math.max(s,o,l),p=n.next;for(;p!==t;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&r2(i,s,r,o,a,l,p.x,p.y)&&r3(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){n.push(u.i,t.i,c.i),at(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let n=e;do{let i=n.prev,r=n.next.next;!r4(i,r)&&r5(i,n,n.next,r)&&r7(i,r)&&r7(r,i)&&(t.push(i.i,n.i,r.i),at(n),at(n.next),n=e=r),n=n.next}while(n!==e);return r$(n)}(r$(t),n),n,i,r,a,s,2):2===o&&function(t,n,i,r,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&r5(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(l,u)&&(r7(l,u)&&r7(u,l)&&function(e,t){let n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}(l,u)&&(r3(l.prev,l,u.prev)||r3(l,u.prev,u))||r4(l,u)&&r3(l.prev,l,l.next)>0&&r3(u.prev,u,u.next)>0))){let l=r9(o,t);o=r$(o,o.next),l=r$(l,l.next),e(o,n,i,r,a,s,0),e(l,n,i,r,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,n,i,r,a,s):e(r$(t),n,i,r,a,s,1);break}}}(l,u,n,i,r,a,0),u}(e,t,n)}}class ar{static area(e){let t=e.length,n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return .5*n}static isClockWise(e){return 0>ar.area(e)}static triangulateShape(e,t){let n=[],i=[],r=[];aa(e),as(n,e);let a=e.length;t.forEach(aa);for(let e=0;e<t.length;e++)i.push(a),a+=t[e].length,as(n,t[e]);let s=ai.triangulate(n,i);for(let e=0;e<s.length;e+=3)r.push(s.slice(e,e+3));return r}}function aa(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function as(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class ao extends nh{constructor(e=new rK([new eg(.5,.5),new eg(-.5,.5),new eg(-.5,-.5),new eg(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let a=0,s=e.length;a<s;a++)!function(e){let a,s,o,l,u,c=[],h=void 0!==t.curveSegments?t.curveSegments:12,d=void 0!==t.steps?t.steps:1,p=void 0!==t.depth?t.depth:1,f=void 0===t.bevelEnabled||t.bevelEnabled,m=void 0!==t.bevelThickness?t.bevelThickness:.2,g=void 0!==t.bevelSize?t.bevelSize:m-.1,v=void 0!==t.bevelOffset?t.bevelOffset:0,_=void 0!==t.bevelSegments?t.bevelSegments:3,y=t.extrudePath,x=void 0!==t.UVGenerator?t.UVGenerator:al,b,S=!1;if(y){b=y.getSpacedPoints(d),S=!0,f=!1;let e=!!y.isCatmullRomCurve3&&y.closed;a=y.computeFrenetFrames(d,e),s=new e_,o=new e_,l=new e_}f||(_=0,m=0,g=0,v=0);let M=e.extractPoints(h),T=M.shape,w=M.holes;
1if(!ar.isClockWise(T)){T=T.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];ar.isClockWise(t)&&(w[e]=t.reverse())}}function E(e){let t=1e-10*1e-10,n=e[0];for(let i=1;i<=e.length;i++){let r=i%e.length,a=e[r],s=a.x-n.x,o=a.y-n.y,l=s*s+o*o,u=Math.max(Math.abs(a.x),Math.abs(a.y),Math.abs(n.x),Math.abs(n.y));if(l<=t*u*u){e.splice(r,1),i--;continue}n=a}}E(T),w.forEach(E);let A=w.length,C=T;for(let e=0;e<A;e++){let t=w[e];T=T.concat(t)}function R(e,t,n){return t||et("ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}let P=T.length;function I(e,t,n){let i,r,a,s=e.x-t.x,o=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=s*s+o*o;if(Math.abs(s*u-o*l)>Number.EPSILON){let h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l),g=(i=p+s*m-e.x)*i+(r=f+o*m-e.y)*r;if(g<=2)return new eg(i,r);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,r=s,a=Math.sqrt(c)):(i=s,r=o,a=Math.sqrt(c/2))}return new eg(i/a,r/a)}let L=[];for(let e=0,t=C.length,n=t-1,i=e+1;e<t;e++,n++,i++)n===t&&(n=0),i===t&&(i=0),L[e]=I(C[e],C[n],C[i]);let N=[],U,D=L.concat();for(let e=0;e<A;e++){let t=w[e];U=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),U[e]=I(t[e],t[i],t[r]);N.push(U),D=D.concat(U)}if(0===_)u=ar.triangulateShape(C,w);else{let e=[],t=[];for(let n=0;n<_;n++){let i=n/_,r=m*Math.cos(i*Math.PI/2),a=g*Math.sin(i*Math.PI/2)+v;for(let t=0,n=C.length;t<n;t++){let n=R(C[t],L[t],a);z(n.x,n.y,-r),0===i&&e.push(n)}for(let e=0;e<A;e++){let n=w[e];U=N[e];let s=[];for(let e=0,t=n.length;e<t;e++){let t=R(n[e],U[e],a);z(t.x,t.y,-r),0===i&&s.push(t)}0===i&&t.push(s)}}u=ar.triangulateShape(e,t)}let O=u.length,F=g+v;for(let e=0;e<P;e++){let t=f?R(T[e],D[e],F):T[e];S?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(b[0]).add(o).add(s),z(l.x,l.y,l.z)):z(t.x,t.y,0)}for(let e=1;e<=d;e++)for(let t=0;t<P;t++){let n=f?R(T[t],D[t],F):T[t];S?(o.copy(a.normals[e]).multiplyScalar(n.x),s.copy(a.binormals[e]).multiplyScalar(n.y),l.copy(b[e]).add(o).add(s),z(l.x,l.y,l.z)):z(n.x,n.y,p/d*e)}for(let e=_-1;e>=0;e--){let t=e/_,n=m*Math.cos(t*Math.PI/2),i=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=C.length;e<t;e++){let t=R(C[e],L[e],i);z(t.x,t.y,p+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];U=N[e];for(let e=0,r=t.length;e<r;e++){let r=R(t[e],U[e],i);S?z(r.x,r.y+b[d-1].y,b[d-1].x+n):z(r.x,r.y,p+n)}}}function B(e,t){let r=e.length;for(;--r>=0;){let a=r,s=r-1;s<0&&(s=e.length-1);for(let e=0,r=d+2*_;e<r;e++){let r=P*e,o=P*(e+1);!function(e,t,r,a){H(e),H(t),H(a),H(t),H(r),H(a);let s=i.length/3,o=x.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);V(o[0]),V(o[1]),V(o[3]),V(o[1]),V(o[2]),V(o[3])}(t+a+r,t+s+r,t+s+o,t+a+o)}}}function z(e,t,n){c.push(e),c.push(t),c.push(n)}function k(e,t,r){H(e),H(t),H(r);let a=i.length/3,s=x.generateTopUV(n,i,a-3,a-2,a-1);V(s[0]),V(s[1]),V(s[2])}function H(e){i.push(c[3*e+0]),i.push(c[3*e+1]),i.push(c[3*e+2])}function V(e){r.push(e.x),r.push(e.y)}(function(){let e=i.length/3;if(f){let e=0*P;for(let t=0;t<O;t++){let n=u[t];k(n[2]+e,n[1]+e,n[0]+e)}e=P*(d+2*_);for(let t=0;t<O;t++){let n=u[t];k(n[0]+e,n[1]+e,n[2]+e)}}else{for(let e=0;e<O;e++){let t=u[e];k(t[2],t[1],t[0])}for(let e=0;e<O;e++){let t=u[e];k(t[0]+P*d,t[1]+P*d,t[2]+P*d)}}n.addGroup(e,i.length/3-e,0)})(),function(){let e=i.length/3,t=0;B(C,0),t+=C.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];B(n,t),t+=n.length}n.addGroup(e,i.length/3-e,1)}()}(e[a]);this.setAttribute("position",new t9(i,3)),this.setAttribute("uv",new t9(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){let i=e[t];n.shapes.push(i.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){let n=[];for(let i=0,r=e.shapes.length;i<r;i++){let r=t[e.shapes[i]];n.push(r)}let i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=new rq[i.type]().fromJSON(i)),new ao(n,e.options)}}let al={generateTopUV:function(e,t,n,i,r){let a=t[3*n],s=t[3*n+1],o=t[3*i],l=t[3*i+1],u=t[3*r],c=t[3*r+1];return[new eg(a,s),new eg(o,l),new eg(u,c)]},generateSideWallUV:function(e,t,n,i,r,a){let s=t[3*n],o=t[3*n+1],l=t[3*n+2],u=t[3*i],c=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(o-c)<Math.abs(s-u)?[new eg(s,1-l),new eg(u,1-h),new eg(d,1-f),new eg(m,1-v)]:[new eg(o,1-l),new eg(c,1-h),new eg(p,1-f),new eg(g,1-v)]}};class au extends rx{constructor(e=1,t=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],e,t),this.type="IcosahedronGeometry",this.parameters={radiu
vendor: 4,884 bytes, line 1
1s:e,detail:t}}static fromJSON(e){return new au(e.radius,e.detail)}}class ac extends nh{constructor(e=[new eg(0,-.5),new eg(.5,0),new eg(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=ec(i,0,2*Math.PI);const r=[],a=[],s=[],o=[],l=[],u=1/t,c=new e_,h=new eg,d=new e_,p=new e_,f=new e_;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,d.x=+(g=e[t+1].y-e[t].y),d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,d.x=+(g=e[t+1].y-e[t].y),d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let r=0;r<=t;r++){const d=n+r*u*i,p=Math.sin(d),f=Math.cos(d);for(let n=0;n<=e.length-1;n++){c.x=e[n].x*p,c.y=e[n].y,c.z=e[n].x*f,a.push(c.x,c.y,c.z),h.x=r/t,h.y=n/(e.length-1),s.push(h.x,h.y);const i=o[3*n+0]*p,u=o[3*n+1],d=o[3*n+0]*f;l.push(i,u,d)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const i=t+n*e.length,a=i+e.length,s=i+e.length+1,o=i+1;r.push(i,a,o),r.push(s,o,a)}this.setIndex(r),this.setAttribute("position",new t9(a,3)),this.setAttribute("uv",new t9(s,2)),this.setAttribute("normal",new t9(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ac(e.points,e.segments,e.phiStart,e.phiLength)}}class ah extends rx{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ah(e.radius,e.detail)}}class ad extends nh{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,s=Math.floor(n),o=Math.floor(i),l=s+1,u=o+1,c=e/s,h=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<u;e++){const t=e*h-a;for(let n=0;n<l;n++){const i=n*c-r;p.push(i,-t,0),f.push(0,0,1),m.push(n/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;d.push(n,i,a),d.push(i,r,a)}this.setIndex(d),this.setAttribute("position",new t9(p,3)),this.setAttribute("normal",new t9(f,3)),this.setAttribute("uv",new t9(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ad(e.width,e.height,e.widthSegments,e.heightSegments)}}class ap extends nh{constructor(e=.5,t=1,n=32,i=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n);const s=[],o=[],l=[],u=[];let c=e;const h=(t-e)/(i=Math.max(1,i)),d=new e_,p=new eg;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*a;d.x=c*Math.cos(i),d.y=c*Math.sin(i),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}c+=h}for(let e=0;e<i;e++){const t=e*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i+n+1,a=i+n+2,o=i+1;s.push(i,r,o),s.push(r,a,o)}}this.setIndex(s),this.setAttribute("position",new t9(o,3)),this.setAttribute("normal",new t9(l,3)),this.setAttribute("uv",new t9(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ap(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class af extends nh{constructor(e=new rK([new eg(0,.5),new eg(-.5,-.5),new eg(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],a=[];let s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,o,t),s+=o,o=0;function l(e){let s=i.length/3,l=e.extractPoints(t),u=l.shape,c=l.holes;!1===ar.isClockWise(u)&&(u=u.reverse());for(let e=0,t=c.length;e<t;e++){let t=c[e];!0===ar.isClockWise(t)&&(c[e]=t.reverse())}let h=ar.triangulateShape(u,c);for(let e=0,t=c.length;e<t;e++){let t=c[e];u=u.concat(t)}for(let e=0,t=u.length;e<t;e++){let t=u[e];i.push(t.x,t.y,0),r.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=h.length;e<t;e++){let t=h[e],i=t[0]+s,r=t[1]+s,a=t[2]+s;n.push(i,r,a),o+=3}}this.setIndex(n),this.setAttribute("position",new t9(i,3)),this.setAttribute("normal",new t9(r,3)),this.setAttribute("uv",new t9(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){let i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){let n=[];for(let i=0,r=e.shapes.length;i<r;i++){let r=t[e.shapes[i]];n.push(r)}return new af(n,e.curveSegments)}}class am extends nh{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radiu
1s:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const o=Math.min(a+s,Math.PI);let l=0;const u=[],c=new e_,h=new e_,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n,_=e*Math.cos(a+v*s),y=Math.sqrt(e*e-_*_);let x=0;0===d&&0===a?x=.5/t:d===n&&o===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){const n=e/t,a=i+n*r;c.x=-y*Math.cos(a),c.y=_,c.z=y*Math.sin(a),p.push(c.x,c.y,c.z),h.copy(c).normalize(),f.push(h.x,h.y,h.z),m.push(n+x,1-v),g.push(l++)}u.push(g)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=u[e][i+1],r=u[e][i],s=u[e+1][i],l=u[e+1][i+1];(0!==e||a>0)&&d.push(t,r,l),(e!==n-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new t9(p,3)),this.setAttribute("normal",new t9(f,3)),this.setAttribute("uv",new t9(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new am(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ag extends rx{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ag(e.radius,e.detail)}}class av extends nh{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI,a=0,s=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r,thetaStart:a,thetaLength:s},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],u=[],c=[],h=new e_,d=new e_,p=new e_;for(let o=0;o<=n;o++){const f=a+o/n*s;for(let a=0;a<=i;a++){const s=a/i*r;d.x=(e+t*Math.cos(f))*Math.cos(s),d.y=(e+t*Math.cos(f))*Math.sin(s),d.z=t*Math.sin(f),l.push(d.x,d.y,d.z),h.x=e*Math.cos(s),h.y=e*Math.sin(s),p.subVectors(d,h).normalize(),u.push(p.x,p.y,p.z),c.push(a/i),c.push(o/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*e+t-1,r=(i+1)*(e-1)+t-1,a=(i+1)*(e-1)+t,s=(i+1)*e+t;o.push(n,r,s),o.push(r,a,s)}this.setIndex(o),this.setAttribute("position",new t9(l,3)),this.setAttribute("normal",new t9(u,3)),this.setAttribute("uv",new t9(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new av(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class a_ extends nh{constructor(e=1,t=.4,n=64,i=8,r=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],l=[],u=[],c=new e_,h=new e_,d=new e_,p=new e_,f=new e_,m=new e_,g=new e_;for(let s=0;s<=n;++s){const _=s/n*r*Math.PI*2;v(_,r,a,e,d),v(_+.01,r,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,a=-t*Math.cos(r),p=t*Math.sin(r);c.x=d.x+(a*g.x+p*f.x),c.y=d.y+(a*g.y+p*f.y),c.z=d.z+(a*g.z+p*f.z),o.push(c.x,c.y,c.z),h.subVectors(c,d).normalize(),l.push(h.x,h.y,h.z),u.push(s/n),u.push(e/i)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),a=(i+1)*e+t,o=(i+1)*(e-1)+t;s.push(n,r,o),s.push(r,a,o)}function v(e,t,n,i,r){let a=Math.cos(e),s=Math.sin(e),o=n/t*e,l=Math.cos(o);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*s*.5,r.z=i*Math.sin(o)*.5}this.setIndex(s),this.setAttribute("position",new t9(o,3)),this.setAttribute("normal",new t9(l,3)),this.setAttribute("uv",new t9(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new a_(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ay extends nh{constructor(e=new rj(new e_(-1,-1,0),new e_(-1,1,0),new e_(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new e_,o=new e_,l=new eg;let u=new e_;const c=[],h=[],d=[],p=[];function f(r){u=e.getPointAt(r/t,u);let l=a.normals[r],d=a.binormals[r];for(let e=0;e<=i;e++){let t=e/i*Math.PI*2,r=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+r*d.x,o.y=a*l.y+r*d.y,o.z=a*l.z+r*d.z,o.normalize(),h.push(o.x,o.y,o.z),s.x=u.x+n*o.x,s.y=u.y+n*o.y,s.z=u.z+n*o.z,c.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)f(e);f(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){let n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),a=(i+1)*e+t,s=(i+1)*(e-1)+t;p.push(n,r,s),p.push(r,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new t9(c,3)),this.setAttribute("normal",new t9(h,3)),this.setAttribute("uv",new t9(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new ay(new rq[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class ax extends nh{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new e_,r=new e_;if(null!==e.index){const a=e.attributes.position,s=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],u=l.start,c=l.count;for(let e=u,o=u+c;e<o;e+=3)for(let o=0;o<3;o++){const l=s.getX(e+o),u=s.getX(e+(o+1)%3);i.fromBufferAttribute(a,l),r.fromBufferAttribute(a,u),!0===ab(i,r,n)&&(t.push(i.x,i.y,i.z),t.pu
1sh(r.x,r.y,r.z))}}}else{const a=e.attributes.position;for(let e=0,s=a.count/3;e<s;e++)for(let s=0;s<3;s++){const o=3*e+s,l=3*e+(s+1)%3;i.fromBufferAttribute(a,o),r.fromBufferAttribute(a,l),!0===ab(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new t9(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function ab(e,t,n){let i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var aS=Object.freeze({__proto__:null,BoxGeometry:rm,CapsuleGeometry:rg,CircleGeometry:rv,ConeGeometry:ry,CylinderGeometry:r_,DodecahedronGeometry:rb,EdgesGeometry:rE,ExtrudeGeometry:ao,IcosahedronGeometry:au,LatheGeometry:ac,OctahedronGeometry:ah,PlaneGeometry:ad,PolyhedronGeometry:rx,RingGeometry:ap,ShapeGeometry:af,SphereGeometry:am,TetrahedronGeometry:ag,TorusGeometry:av,TorusKnotGeometry:a_,TubeGeometry:ay,WireframeGeometry:ax});class aM extends ng{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new tp(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function aT(e){let t={};for(let n in e)for(let i in t[n]={},e[n]){let r=e[n][i];if(aE(r))r.isRenderTargetTexture?(ee("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone();else if(Array.isArray(r))if(aE(r[0])){let e=[];for(let t=0,n=r.length;t<n;t++)e[t]=r[t].clone();t[n][i]=e}else t[n][i]=r.slice();else t[n][i]=r}return t}function aw(e){let t={};for(let n=0;n<e.length;n++){let i=aT(e[n]);for(let e in i)t[e]=i[e]}return t}function aE(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function aA(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:ew.workingColorSpace}let aC={clone:aT,merge:aw};class aR extends ng{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=aT(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let n in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),void 0!==e.uniforms)for(let n in e.uniforms){let i=e.uniforms[n];switch(this.uniforms[n]={},i.type){case"t":this.uniforms[n].value=t[i.value]||null;break;case"c":this.uniforms[n].value=new tp().setHex(i.value);break;case"v2":this.uniforms[n].value=new eg().fromArray(i.value);break;case"v3":this.uniforms[n].value=new e_().fromArray(i.value);break;case"v4":this.uniforms[n].value=new eD().fromArray(i.value);break;case"m3":this.uniforms[n].value=new eb().fromArray(i.value);break;
vendor: 12,636 bytes, line 1
1case"m4":this.uniforms[n].value=new eV().fromArray(i.value);break;default:this.uniforms[n].value=i.value}}if(void 0!==e.defines&&(this.defines=e.defines),void 0!==e.vertexShader&&(this.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(this.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(this.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)this.extensions[t]=e.extensions[t];return void 0!==e.lights&&(this.lights=e.lights),void 0!==e.clipping&&(this.clipping=e.clipping),this}}class aP extends aR{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class aI extends ng{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new tp(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tp(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new e$,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aL extends aI{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new eg(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ec(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new tp(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new tp(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new tp(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class aN extends ng{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new tp(0xffffff),this.specular=new tp(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tp(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new e$,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aU extends ng{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new tp(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tp(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class aD extends ng{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class aO extends ng{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new tp(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new tp(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new e$,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class aF extends ng{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class aB extends ng{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}
1class az extends ng{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new tp(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eg(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ak extends iX{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function aH(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function aV(e){let t=e.length,n=Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function aG(e,t,n){let i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){let i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function aW(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[i])&&(t.push(a.time),n.push(...s)),a=e[r++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[i])&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++];while(void 0!==a);else do void 0!==(s=a[i])&&(t.push(a.time),n.push(s)),a=e[r++];while(void 0!==a)}class aj{static convertArray(e,t){return aH(e,t)}static isTypedArray(e){return j(e)}static getKeyframeOrder(e){return aV(e)}static sortedArray(e,t,n){return aG(e,t,n)}static flattenJSON(e,t,n,i){aW(e,t,n,i)}static subclip(e,t,n,i,r=30){return function(e,t,n,i,r=30){let a=e.clone();a.name=t;let s=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],o=t.getValueSize(),l=[],u=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*r;if(!(a<n)&&!(a>=i)){l.push(t.times[e]);for(let n=0;n<o;++n)u.push(t.values[e*o+n])}}0!==l.length&&(t.times=aH(l,t.times.constructor),t.values=aH(u,t.values.constructor),s.push(t))}a.tracks=s;let o=1/0;for(let e=0;e<a.tracks.length;++e)o>a.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*o);return a.resetDuration(),a}(e,t,n,i,r)}static makeClipAdditive(e,t=0,n=e,i=30){return function(e,t=0,n=e,i=30){i<=0&&(i=30);let r=n.tracks.length,a=t/i;for(let t=0;t<r;++t){let i,r=n.tracks[t],s=r.ValueTypeName;if("bool"===s||"string"===s)continue;let o=e.tracks.find(function(e){return e.name===r.name&&e.ValueTypeName===s});if(void 0===o)continue;let l=0,u=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let c=0,h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h
1/3);let d=r.times.length-1;if(a<=r.times[0]){let e=l,t=u-l;i=r.values.slice(e,t)}else if(a>=r.times[d]){let e=d*u+l,t=e+u-l;i=r.values.slice(e,t)}else{let e=r.createInterpolant(),t=l,n=u-l;e.evaluate(a),i=e.resultBuffer.slice(t,n)}"quaternion"===s&&new ev().fromArray(i).normalize().conjugate().toArray(i);let p=o.times.length;for(let e=0;e<p;++e){let t=e*h+c;if("quaternion"===s)ev.multiplyQuaternionsFlat(o.values,t,i,0,o.values,t);else{let e=h-2*c;for(let n=0;n<e;++n)o.values[t+n]-=i[n]}}}return e.blendMode=2501,e}(e,t,n,i)}}class aX{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(!(e>=r)){let s=t[1];e<s&&(n=2,r=s);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0;break n}break e}for(;n<a;){let i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class aq extends aX{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,a=e+1,s=i[r],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-n;break;case 2402:r=i.length-2,s=t+i[r]-i[r+1];break;default:r=e,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*n-t;break;case 2402:a=1,o=n+i[1]-i[0];break;default:a=e-1,o=t}let l=(n-t)*.5,u=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-n),this._offsetPrev=r*u,this._offsetNext=a*u}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let e=0;e!==s;++e)r[e]=g*a[u+e]+v*a[l+e]+_*a[o+e]+y*a[c+e];return r}}class aY extends aX{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=(n-t)/(i-t),c=1-u;for(let e=0;e!==s;++e)r[e]=a[l+e]*c+a[o+e]*u;return r}}class aZ extends aX{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class aK extends aX{interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this.inTangents,c=this.outTangents;if(!u||!c){let e=(n-t)/(i-t),u=1-e;for(let t=0;t!==s;++t)r[t]=a[l+t]*u+a[o+t]*e;return r}let h=2*s,d=e-1;for(let p=0;p!==s;++p){let s,f,m,g,v,_=a[l+p],y=a[o+p],x=d*h+2*p,b=c[x],S=c[x+1],M=e*h+2*p,T=u[M],w=u[M+1],E=(n-t)/(i-t);for(let e=0;e<8;e++){f=(s=E*E)*E;let e=(v=(g=(m=1-E)*m)*m)*t+3*g*E*b+3*m*s*T+f*i-n;if(1e-10>Math.abs(e))break;let r=3*g*(b-t)+6*m*E*(T-b)+3*s*(i-T);if(1e-10>Math.abs(r))break;E-=e/r,E=Math.max(0,Math.min(1,E))}r[p]=v*_+3*g*E*S+3*m*s*w+f*y}return r}}class aJ{constructor(e,t,n,i){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=aH(t,this.TimeBufferType),this.values=aH(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:aH(e.times,Array),values:aH(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new aZ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new aY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new aq(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new aK(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return ee("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(et("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;0===r&&(et("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){let i=n[t];if("number"==typeof i&&isNaN(i)){et("KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){et("KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&j(i))for(let t=0,n=i.length;t!==n;++t){let n=i[t];if(isNaN(n)){et("KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s<r;++s){let r=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(i)r=!0;else{let e=s*n,i=e-n,a=e+n;for(let s=0;s!==n;++s){let n=t[e+s];if(n!==t[i+s]||n!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];let i=s*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}aJ.prototype.ValueTypeName="",aJ.prototype.TimeBufferType=Float32Array,aJ.prototype.ValueBufferType=Float32Array,aJ.prototype.DefaultInterpolation=2301;class a$ extends aJ{constructor(e,t,n){super(e,t,n)}}a$.prototype.ValueTypeName="bool",a$.prototype.ValueBufferType=Array,a$.prototype.DefaultInterpolation=2300,a$.prototype.InterpolantFactoryMethodLinear=void 0,a$.prototype.InterpolantFactoryMethodSmooth=void 0;class aQ extends aJ{constructor(e,t,n,i){super(e,t,n,i)}}aQ.prototype.ValueTypeName="color";class a0 extends aJ{constructor(e,t,n,i){super(e,t,n,i)}}a0.prototype.ValueTypeName="number";class a1 extends aX{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t),l=e*s;for(let e=l+s;
1l!==e;l+=4)ev.slerpFlat(r,0,a,l-s,a,l,o);return r}}class a2 extends aJ{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new a1(this.times,this.values,this.getValueSize(),e)}}a2.prototype.ValueTypeName="quaternion",a2.prototype.InterpolantFactoryMethodSmooth=void 0;class a3 extends aJ{constructor(e,t,n){super(e,t,n)}}a3.prototype.ValueTypeName="string",a3.prototype.ValueBufferType=Array,a3.prototype.DefaultInterpolation=2300,a3.prototype.InterpolantFactoryMethodLinear=void 0,a3.prototype.InterpolantFactoryMethodSmooth=void 0;class a4 extends aJ{constructor(e,t,n,i){super(e,t,n,i)}}a4.prototype.ValueTypeName="vector";class a5{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=eu(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return a0;case"vector":case"vector2":case"vector3":case"vector4":return a4;case"color":return aQ;case"quaternion":return a2;case"bool":case"boolean":return a$;case"string":return a3}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],n=[];aW(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(n[e]).scale(i));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,i=n.length;e!==i;++e)t.push(aJ.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let r=t.length,a=[];for(let e=0;e<r;e++){let s=[],o=[];s.push((e+r-1)%r,e,(e+1)%r),o.push(0,1,0);let l=aV(s);s=aG(s,1,l),o=aG(o,1,l),i||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new a0(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;Array.isArray(e)||(n=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.name.match(r);if(a&&a.length>1){let e=a[1],t=i[e];t||(i[e]=t=[]),t.push(n)}}let a=[];for(let e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let e=this.tracks[n];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}let a6={enabled:!1,files:{},add:function(e,t){!1===this.enabled||a8(e)||(this.files[e]=t)},get:function(e){if(!1!==this.enabled&&!a8(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function a8(e){try{let t=e.slice(e.indexOf(":")+1),n=new URL(t);return"blob:"===n.protocol}catch(e){return!1}}class a7{constructor(e,t,n){let i;const r=this;let a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,!1===a&&void 0!==r.onStart&&r.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,o),s===o&&(a=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return(e=e.normalize("NFC"),i)?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){let n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}let a9=new a7;class se{constructor(e){this.manager=void 0!==e?e:a9,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}se.DEFAULT_MATERIAL_NAME="__DEFAULT";let st={};
1class sn extends Error{constructor(e,t){super(e),this.response=t}}class si extends se{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=a6.get(`file:${e}`);if(void 0!==r){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(void 0!==st[e])return void st[e].push({onLoad:t,onProgress:n,onError:i});st[e]=[],st[e].push({onLoad:t,onProgress:n,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&ee("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let n=st[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{let i=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=r.byteLength,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}}))}throw new sn(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),n=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{a6.add(`file:${e}`,t);let n=st[e];delete st[e];for(let e=0,i=n.length;e<i;e++){let i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{let n=st[e];if(void 0===n)throw this.manager.itemError(e),t;delete st[e];for(let e=0,i=n.length;e<i;e++){let i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sr extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new si(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):et(t),r.manager.itemError(e)}},n,i)}parse(e){let t=[];for(let n=0;n<e.length;n++){let i=a5.parse(e[n]);t.push(i)}return t}}class sa extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=[],s=new rs,o=new si(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;if(Array.isArray(e))for(let u=0,c=e.length;u<c;++u)!function(u){o.load(e[u],function(e){let n=r.parse(e,!0);a[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(s.minFilter=1006),s.image=a,s.format=n.format,s.needsUpdate=!0,t&&t(s))},n,i)}(u);else o.load(e,function(e){let n=r.parse(e,!0);if(n.isCubemap){let e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)a[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),a[t].format=n.format,a[t].width=n.width,a[t].height=n.height}s.image=a}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=1006),s.format=n.format,s.needsUpdate=!0,t&&t(s)},n,i);return s}}let ss=new WeakMap;class so extends se{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=a6.get(`image:${e}`);if(void 0!==a){if(!0===a.complete)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let e=ss.get(a);void 0===e&&(e=[],ss.set(a,e)),e.push({onLoad:t,onError:i})}return a}let s=X("img");function o(){u(),t&&t(this);let n=ss.get(this)||[];for(let e=0;e<n.length;e++){let t=n[e];t.onLoad&&t.onLoad(this)}ss.delete(this),r.manager.itemEnd(e)}function l(t){u(),i&&i(t),a6.remove(`image:${e}`);let n=ss.get(this)||[];for(let e=0;e<n.length;e++){let i=n[e];i.onError&&i.onError(t)}ss.delete(this),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),a6.add(`image:${e}`,s),r.manager.itemStart(e),s.src=e,s}}class sl extends se{constructor(e){super(e)}load(e,t,n,i){let r=new ru;
1r.colorSpace=D;let a=new so(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;for(let n=0;n<e.length;++n)!function(n){a.load(e[n],function(e){r.images[n]=e,6==++s&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}(n);return r}}class su extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new ia,s=new si(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,function(e){let n;try{n=r.parse(e)}catch(e){void 0!==i?i(e):et(e);return}r._applyTexData(a,n),t&&t(a,n)},n,i),a}createDataTexture(e){let t=new ia;return this._applyTexData(t,this.parse(e)),t}_applyTexData(e,t){void 0!==t.image?e.image=t.image:void 0!==t.data&&(e.image.width=t.width,e.image.height=t.height,e.image.data=t.data),e.wrapS=void 0!==t.wrapS?t.wrapS:1001,e.wrapT=void 0!==t.wrapT?t.wrapT:1001,e.magFilter=void 0!==t.magFilter?t.magFilter:1006,e.minFilter=void 0!==t.minFilter?t.minFilter:1006,e.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.mipmaps&&(e.mipmaps=t.mipmaps,e.minFilter=1008),1===t.mipmapCount&&(e.minFilter=1006),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),e.needsUpdate=!0}}class sc extends se{constructor(e){super(e)}load(e,t,n,i){let r=new eU,a=new so(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class sh extends ta{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tp(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class sd extends sh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ta.DEFAULT_UP),this.updateMatrix(),this.groundColor=new tp(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}let sp=new eV,sf=new e_,sm=new e_;class sg{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new eg(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new eV,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new iE,this._frameExtents=new eg(1,1),this._viewportCount=1,this._viewports=[new eD(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;sf.setFromMatrixPosition(e.matrixWorld),t.position.copy(sf),sm.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sm),t.updateMatrixWorld(),sp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sp,t.coordinateSystem,t.reversedDepth),2001===t.coordinateSystem||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(sp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}let sv=new e_,s_=new ev,sy=new e_;class sx extends ta{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eV,this.projectionMatrix=new eV,this.projectionMatrixInverse=new eV,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(sv,s_,sy),1===sy.x&&1===sy.y&&1===sy.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sv,s_,sy.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(sv,s_,sy),1===sy.x&&1===sy.y&&1===sy.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sv,s_,sy.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}let sb=new e_,sS=new eg,sM=new eg;class sT extends sx{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*el*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*eo*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,945 bytes, line 1
1getEffectiveFOV(){return 2*el*Math.atan(Math.tan(.5*eo*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){sb.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(sb.x,sb.y).multiplyScalar(-e/sb.z),sb.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(sb.x,sb.y).multiplyScalar(-e/sb.z)}getViewSize(e,t){return this.getViewBounds(e,sS,sM),t.subVectors(sM,sS)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*eo*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class sw extends sg{constructor(){super(new sT(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=2*el*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sE extends sh{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ta.DEFAULT_UP),this.updateMatrix(),this.target=new ta,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new sw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class sA extends sg{constructor(){super(new sT(90,1,.5,500)),this.isPointLightShadow=!0}}class sC extends sh{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new sA}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class sR extends sx{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}
1this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class sP extends sg{constructor(){super(new sR(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class sI extends sh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ta.DEFAULT_UP),this.updateMatrix(),this.target=new ta,this.shadow=new sP}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class sL extends sh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sN extends sh{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class sU{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new e_)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){let n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){let n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class sD extends sh{constructor(e=new sU,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}let sO={};class sF extends se{constructor(e){super(e),this.textures={}}load(e,t,n,i){let r=this,a=new si(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):et(t),r.manager.itemError(e)}},n,i)}parse(e){let t=this.createMaterialFromType(e.type);return t.fromJSON(e,this.textures),t}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sF.createMaterialFromType(e)}static createMaterialFromType(e){let t,n={ShadowMaterial:aM,SpriteMaterial:nv,RawS
1haderMaterial:aP,ShaderMaterial:aR,PointsMaterial:i6,MeshPhysicalMaterial:aL,MeshStandardMaterial:aI,MeshPhongMaterial:aN,MeshToonMaterial:aU,MeshNormalMaterial:aD,MeshLambertMaterial:aO,MeshDepthMaterial:aF,MeshDistanceMaterial:aB,MeshBasicMaterial:nG,MeshMatcapMaterial:az,LineDashedMaterial:ak,LineBasicMaterial:iX,Material:ng,...sO}[e];return void 0===n?(en(`MaterialLoader: Unknown material type "${e}". Use .registerMaterial() before starting the deserialization process.`),t=new ng):t=new n,t}static registerMaterial(e,t){sO[e]=t}}class sB{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class sz extends nh{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class sk extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new si(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):et(t),r.manager.itemError(e)}},n,i)}parse(e){let t={},n={};function i(e,i){if(void 0!==t[i])return t[i];let r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];let i=new Uint32Array(e.arrayBuffers[t]).buffer;return n[t]=i,i}(e,r.buffer),s=new nd(W(r.type,a),r.stride);return s.uuid=r.uuid,t[i]=s,s}let r=e.isInstancedBufferGeometry?new sz:new nh,a=e.data.index;if(void 0!==a){let e=W(a.type,a.array);r.setIndex(new t0(e,1))}let s=e.data.attributes;for(let t in s){let n,a=s[t];if(a.isInterleavedBufferAttribute)n=new nf(i(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=W(a.type,a.array);n=new(a.isInstancedBufferAttribute?iu:t0)(e,a.itemSize,a.normalized)}void 0!==a.name&&(n.name=a.name),void 0!==a.usage&&n.setUsage(a.usage),r.setAttribute(t,n)}let o=e.data.morphAttributes;if(o)for(let t in o){let n=o[t],a=[];for(let t=0,r=n.length;t<r;t++){let r,s=n[t];r=s.isInterleavedBufferAttribute?new nf(i(e.data,s.data),s.itemSize,s.offset,s.normalized):new t0(W(s.type,s.array),s.itemSize,s.normalized),void 0!==s.name&&(r.name=s.name),a.push(r)}r.morphAttributes[t]=a}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){let t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}let u=e.data.boundingSphere;return void 0!==u&&(r.boundingSphere=new ni().fromJSON(u)),e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}let sH={};class sV extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=""===this.path?sB.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let s=new si(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){let a=null;try{a=JSON.parse(n)}catch(t){void 0!==i&&i(t),et("ObjectLoader: Can't parse "+e+".",t.message);return}let s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()){void 0!==i&&i(Error("THREE.ObjectLoader: Can't load "+e)),et("ObjectLoader: Can't load "+e);return}r.parse(a,t)},n,i)}async loadAsync(e,t){let n,i=""===this.path?sB.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let r=new si(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);let a=await r.loadAsync(e,t);try{n=JSON.parse(a)}catch(t){throw Error("THREE.ObjectLoader: Can't parse "+e+". "+t.message)}let s=n.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(n)}parse(e,t){let n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){void 0!==t&&t(l)}),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,r,o,s,n),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),void 0!==t){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,r),s=this.parseMaterials(e.materials,a),o=this.parseObject(e.object,i,s,a,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}static registerGeometry(e,t){sH[e]=t}parseShapes(e){let t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){let i=new rK().fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){let n={},i={};if(t.traverse(function(e){e.isBone&&(i[e.uuid]=e)}),void 0!==e)for(let t=0,r=e.length;t<r;t++){let r=new il().fromJSON(e[t],i);n[r.uuid]=r}return n}parseGeometries(e,t){let n={};if(void 0!==e){let i=new sk;for(let r=0,a=e.length;r<a;r++){let a,s=e[r];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(s);break;default:s.type in aS?a=aS[s.type].fromJSON(s,t):s.type in sH?a=sH[s.type].fromJSON(s,t):ee(`ObjectLoader: Unknown geometry type "${s.type}". Use .registerGeometry() before starting the deserialization process.`)}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.userData&&(a.userData=s.userData),n[s.uuid]=a}}return n}parseMaterials(e,t){let n={},i={};if(void 0!==e){let r=new sF;r.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0===n[a.uuid]&&(n[a.uuid]=r.parse(a)),i[a.uuid]=n[a.uuid]}}return i}parseAnimations(e){let t={};if(void 0!==e)for(let n=0;n<e.length;n++){let i=e[n],r=a5.parse(i);t[r.uuid]=r}return t}parseImages(e,t){let n,i=this,r={};function a(e){if("string"==typeof e){var t;return t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e,t=i.manager.resolveURL(t),i.manager.itemStart(t),n.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemError(t),i.manager.itemEnd(t)})}return e.data?{data:W(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(n=new so(new a7(t))).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){let n=e[t],i=n.url;if(Array.isArray(i)){let e=[];for(let t=0,n=i.length;t<n;t++){let n=a(i[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new ia(n.data,n.width,n.height)))}r[n.uuid]=new eP(e)}else{let e=a(n.url);r[n.uuid]=new eP(e)}}}return r}async parseImagesAsync(e){let t,n=this,i={};async function r(e){if("string"==typeof e){let i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e;return await t.loadAsync(i)}return e.data?{data:W(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(t=new so(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){let n=e[t],a=n.url;if(Array.isArray(a)){let e=[];for(let t=0,n=a.length;t<n;t++){let n=a[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new ia(i.data,i.width,i.height)))}i[n.uuid]=new eP(e)}else{let e=await r(n.url);i[n.uuid]=new eP(e)}}}return i}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(ee("ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}let i={};if(void 0!==e)for(let r=0,a=e.length;r<a;r++){let a,s=e[r];void 0===s.image&&ee('ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&ee("ObjectLoader: Undefined image",s.image);let o=t[s.image],l=o.data;Array.isArray(l)?(a=new ru,6===l.length&&(a.needsUpdate=!0)):(a=l&&l.data?new ia:new eU,l&&(a.needsUpdate=!0)),a.source=o,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=n(s.mapping,sG)),void 0!==s.channel&&(a.channel=s.channel),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=n(s.wrap[0],sW),a.wrapT=n(s.wrap[1],sW)),void 0!==s.format&&(a.format=s.format),void 0!==s.internalFormat&&(a.internalFormat=s.internalFormat),void 0!==s.type&&(a.type=s.type),void 0!==s.colorSpace&&(a.colorSpace
1=s.colorSpace),void 0!==s.minFilter&&(a.minFilter=n(s.minFilter,sj)),void 0!==s.magFilter&&(a.magFilter=n(s.magFilter,sj)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.generateMipmaps&&(a.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(a.compareFunction=s.compareFunction),void 0!==s.normalized&&(a.normalized=s.normalized),void 0!==s.userData&&(a.userData=s.userData),i[s.uuid]=a}return i}parseObject(e,t,n,i,r){let a,s,o;function l(e){return void 0===t[e]&&ee("ObjectLoader: Undefined geometry",e),t[e]}function u(e){if(void 0!==e){if(Array.isArray(e)){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];void 0===n[r]&&ee("ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&ee("ObjectLoader: Undefined material",e),n[e]}}function c(e){return void 0===i[e]&&ee("ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":a=new tv,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new tp(e.background):a.background=c(e.background)),void 0!==e.environment&&(a.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new tg(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new tm(e.fog.color,e.fog.density)),""!==e.fog.name&&(a.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&a.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(a.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new sT(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new sR(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new sL(e.color,e.intensity);break;case"DirectionalLight":(a=new sI(e.color,e.intensity)).target=e.target||"";break;case"PointLight":a=new sC(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new sN(e.color,e.intensity,e.width,e.height);break;case"SpotLight":(a=new sE(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay)).target=e.target||"";break;case"HemisphereLight":a=new sd(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new sD(new sU().fromArray(e.sh),e.intensity);break;case"SkinnedMesh":a=new ii(s=l(e.geometry),o=u(e.material)),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":a=new n1(s=l(e.geometry),o=u(e.material));break;case"InstancedMesh":s=l(e.geometry),o=u(e.material);let h=e.count,d=e.instanceMatrix,p=e.instanceColor;(a=new i_(s,o,h)).instanceMatrix=new iu(new Float32Array(d.array),16),void 0!==p&&(a.instanceColor=new iu(new Float32Array(p.array),p.itemSize));break;case"BatchedMesh":s=l(e.geometry),o=u(e.material),(a=new ij(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o)).geometry=s,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(e=>{let t=null,n=null;return void 0!==e.boundingBox&&(t=new tL().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=new ni().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:n}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new ni().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&
1(a.boundingBox=new tL().fromJSON(e.boundingBox));break;case"LOD":a=new nU;break;case"Line":a=new i0(l(e.geometry),u(e.material));break;case"LineLoop":a=new i5(l(e.geometry),u(e.material));break;case"LineSegments":a=new i4(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new rt(l(e.geometry),u(e.material));break;case"Sprite":a=new nP(u(e.material));break;case"Group":a=new ts;break;case"Bone":a=new ir;break;default:a=new ta}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.pivot&&(a.pivot=new e_().fromArray(e.pivot)),void 0!==e.morphTargetDictionary&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),void 0!==e.morphTargetInfluences&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.static&&(a.static=e.static),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){let s=e.children;for(let e=0;e<s.length;e++)a.add(this.parseObject(s[e],t,n,i,r))}if(void 0!==e.animations){let t=e.animations;for(let e=0;e<t.length;e++){let n=t[e];a.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let n=t[e],i=a.getObjectByProperty("uuid",n.object);void 0!==i&&a.addLevel(i,n.distance,n.hysteresis)}}return a}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){let n=t[e.skeleton];void 0===n?ee("ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){let n=t.target,i=e.getObjectByProperty("uuid",n);void 0!==i?t.target=i:t.target=new ta}})}}let sG={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},sW={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},sj={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},sX=new WeakMap;class sq extends se{constructor(e){super(e),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&ee("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&ee("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=a6.get(`image-bitmap:${e}`);if(void 0!==a)return(r.manager.itemStart(e),a.then)?void a.then(n=>{!0===sX.has(a)?(i&&i(sX.get(a)),r.manager.itemError(e)):t&&t(n),r.manager.itemEnd(e)}):void setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){a6.add(`image-bitmap:${e}`,n),t&&t(n),r.manager.itemEnd(e)}).catch(function(t){i&&i(t),sX.set(o,t),a6.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});a6.add(`image-bitmap:${e}`,o),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sY{static getContext(){return void 0===a&&(a=new(window.AudioContext||window.webkitAudioContext)),a}static setContext(e){a=e}}class sZ extends se{constructor(e){super(e)}load(e,t,n,i){let r=this,a=new si(this.manager);function s(t){i?i(t):et(t),r.manager.itemError(e)}
1a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{let i=n.slice(0),a=sY.getContext(),o=e+"#decode";r.manager.itemStart(o),a.decodeAudioData(i,function(e){t(e),r.manager.itemEnd(o)}).catch(function(e){s(e),r.manager.itemEnd(o)})}catch(e){s(e)}},n,i)}}let sK=new eV,sJ=new eV,s$=new eV;class sQ{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new sT,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new sT,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(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){let n,i;t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,s$.copy(e.projectionMatrix);let r=t.eyeSep/2,a=r*t.near/t.focus,s=t.near*Math.tan(eo*t.fov*.5)/t.zoom;sJ.elements[12]=-r,sK.elements[12]=r,n=-s*t.aspect+a,i=s*t.aspect+a,s$.elements[0]=2*t.near/(i-n),s$.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(s$),n=-s*t.aspect-a,i=s*t.aspect-a,s$.elements[0]=2*t.near/(i-n),s$.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(s$)}this.cameraL.matrix.copy(e.matrixWorld).multiply(sJ),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(e.matrixWorld).multiply(sK),this.cameraR.matrixWorldNeedsUpdate=!0}}class s0 extends ta{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new sT(-90,1,e,t);i.layers=this.layers,this.add(i);const r=new sT(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new sT(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new sT(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new sT(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new sT(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,u]=this.children,c=e.getRenderTarget(),h=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let m=!1;m=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,r),e.setRenderTarget(n,1,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,3,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,4,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=f,e.setRenderTarget(n,5,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,u),e.setRenderTarget(c,h,d),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class s1 extends sT{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class s2{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=s3.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function s3(){!1===this._document.hidden&&this.reset()}let s4=new e_,s5=new ev,s6=new e_,s8=new e_,s7=new e_;class s9 extends ta{constructor(){super(),this.type="AudioListener",this.context=sY.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new s2}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update(
1);let t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(s4,s5,s6),s8.set(0,0,-1).applyQuaternion(s5),s7.set(0,1,0).applyQuaternion(s5),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(s4.x,e),t.positionY.linearRampToValueAtTime(s4.y,e),t.positionZ.linearRampToValueAtTime(s4.z,e),t.forwardX.linearRampToValueAtTime(s8.x,e),t.forwardY.linearRampToValueAtTime(s8.y,e),t.forwardZ.linearRampToValueAtTime(s8.z,e),t.upX.linearRampToValueAtTime(s7.x,e),t.upY.linearRampToValueAtTime(s7.y,e),t.upZ.linearRampToValueAtTime(s7.z,e)}else t.setPosition(s4.x,s4.y,s4.z),t.setOrientation(s8.x,s8.y,s8.z,s7.x,s7.y,s7.z)}}class oe extends ta{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void ee("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void ee("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void ee("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(e=0){return!1===this.hasPlaybackControl?void ee("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){return!1===this.hasPlaybackControl?void ee("Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(ee("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){return!1===this.hasPlaybackControl?void ee("Audio: this Audio has no playback control."):(this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return(super.copy(e,t),"buffer"!==e.sourceType)?ee("Audio: Audio source type cannot be copied."):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl
1=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice()),this}clone(e){return new this.constructor(this.listener).copy(this,e)}}let ot=new e_,on=new ev,oi=new e_,or=new e_;class oa extends oe{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(ot,on,oi),or.set(0,0,1).applyQuaternion(on);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(ot.x,e),t.positionY.linearRampToValueAtTime(ot.y,e),t.positionZ.linearRampToValueAtTime(ot.z,e),t.orientationX.linearRampToValueAtTime(or.x,e),t.orientationY.linearRampToValueAtTime(or.y,e),t.orientationZ.linearRampToValueAtTime(or.z,e)}else t.setPosition(ot.x,ot.y,ot.z),t.setOrientation(or.x,or.y,or.z)}}class os{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class oo{constructor(e,t,n){let i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==i;++e)n[r+e]=n[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){s.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n;e!==i;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;
1for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){ev.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){let a=this._workIndex*r;ev.multiplyQuaternionsFlat(e,a,e,t,e,n),ev.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){let a=1-i;for(let s=0;s!==r;++s){let r=t+s;e[r]=e[r]*a+e[n+s]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){let r=t+a;e[r]=e[r]+e[n+a]*i}}}let ol="\\[\\]\\.:\\/",ou=RegExp("["+ol+"]","g"),oc="[^"+ol+"]",oh="[^"+ol.replace("\\.","")+"]",od=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",oc)+/(WCOD+)?/.source.replace("WCOD",oh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oc)+"$"),op=["material","materials","bones","map"];class of{constructor(e,t,n){this.path=t,this.parsedPath=n||of.parseTrackName(t),this.node=of.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new of.Composite(e,t,n):new of(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ou,"")}static parseTrackName(e){let t=od.exec(e);if(null===t)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){let e=n.nodeName.substring(i+1);-1!==op.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){let n=function(e){for(let i=0;i<e.length;i++){let r=e[i];if(r.name===t||r.uuid===t)return r;let a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=of.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void ee("PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void et("PropertyBinding: Can not bind to material as no
1de does not have a material.",this);if(!e.material.materials)return void et("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void et("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void et("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void et("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void et("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void et("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}let a=e[i];if(void 0===a)return void et("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+i+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void et("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void et("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}of.Composite=class{constructor(e,t,n){const i=n||of.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},of.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},of.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},of.prototype.GetterByBindingType=[of.prototype._getValue_direct,of.prototype._getValue_array,of.prototype._getValue_arrayElement,of.prototype._getValue_toArray],of.prototype.SetterByBindingTypeAndVersioning=[[of.prototype._setValue_direct,of.prototype._setValue_direct_setNeedsUpdate,of.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[of.prototype._setValue_array,of.prototype._setValue_array_setNeedsUpdate,of.prototype._setValue_array_setMatrixWorldNeedsUpdate],[of.prototype._setValue_arrayElement,of.prototype._setValue_arrayElement_setNeedsUpdate,of.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[of.prototype._setValue_fromArray,of.prototype._setValue_fromArray_setNeedsUpdate,of.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class om{constructor(){this.isAnimationObjectGroup=!0,this.uuid=eu(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length,s,o=e.length,l=this.nCachedObjects_;for(let u=0,c=arguments.length;u!==c;++u){let c=arguments[u],h=c.uuid,d=t[h];if(void 0===d){d=o++,t[h]=d,e.push(c);for(let e=0;e!==a;++e)r[e].push(new of(c,n[e],i[e]))}else if(d<l){s=e[d];let o=--l,u=e[o];t[u.uuid]=d,e[d]=u,t[h]=o,e[o]=c;for(let e=0;e!==a;++e){let t=r[e],a=t[o],s=t[d];t[d]=a,void 0===s&&(s=new of(c,n[e],i[e])),t[o]=s}}else e[d]!==s&&et("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
1cture when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){let s=arguments[a],o=s.uuid,l=t[o];if(void 0!==l&&l>=r){let a=r++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==i;++e){let t=n[e],i=t[a],r=t[l];t[l]=i,t[a]=r}}}this.nCachedObjects_=r}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u<r){let s=--r,o=e[s],l=--a,c=e[l];t[o.uuid]=u,e[u]=o,t[c.uuid]=s,e[s]=c,e.pop();for(let e=0;e!==i;++e){let t=n[e],i=t[s],r=t[l];t[u]=i,t[s]=r,t.pop()}}else{let r=--a,s=e[r];r>0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==i;++e){let t=n[e];t[u]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=Array(l);i=r.length,n[e]=i,a.push(e),s.push(t),r.push(c);for(let n=u,i=o.length;n!==i;++n){let i=o[n];c[n]=new of(i,e,t)}return c}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){let i=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}class og{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){const t=r[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=2201,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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),!0===n){let n=this._clip.duration,i=e._clip.duration;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,i/n,t),this.warp(n/i,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,r=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);let r=this._startTime;if(null!==r){let i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulate(i,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(null!==n){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(0===t?this.paused=!0:(null!==this._restoreTimeScale&&(t=this._restoreTimeScale),this.timeScale=t),this.stopWarping()))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=2202===n;if(0===e)return -1===r?i:a&&(1&r)==1?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){let n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);let s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this._loopCount=r,this.time=i;
1if(a&&(1&r)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(e?i.endingStart=this.zeroSlopeAtStart?2401:2400:i.endingStart=2402,t?i.endingEnd=this.zeroSlopeAtEnd?2401:2400:i.endingEnd=2402)}_scheduleFading(e,t,n){let i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=t,s[1]=r+e,o[1]=n,this}}let ov=new Float32Array(1);class o_ extends er{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==r;++e){let r=i[e],l=r.name,c=u[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let i=t&&t._propertyBindings[e].binding.parsedPath;c=new oo(of.create(n,l,i),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,a=this._actionsByClip,s=a[r],o=s.knownActions,l=o[o.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,o[u]=l,o.pop(),e._byClipCacheIndex=null;let c=s.actionByRoot,h=(e._localRoot||this._root).uuid;delete c[h],0===o.length&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){let n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,r=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,s=a[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[r],0===Object.keys(s).length&&delete a[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new aY(new Float32Array(2),new Float32Array(2),1,ov)).__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){let i=t||this._root,r=i.uuid,a="string"==typeof e?a5.findByName(i,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==o){let e=o.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let u=new og(this,a,t,n);return this._bindAction(u,l),this._addInactiveAction(u,s,r),u}existingAction(e,t){let n=t||this._root,i=n.uuid,r="string"==typeof e?a5.findByName(n,e):e,a=r?r.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==n;++s)t[s]._update(i,e,r,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){let e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){let i=e[n];this._deactivateAction(i);let r=i._cacheIndex,a=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,a._cacheIndex=r,t[r]=a,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let e in n){let i=n[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}let i=this._bindingsByRootAndName[t];if(void 0!==i)for(let e in i){let t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class oy extends eO{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new ek(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ox{constructor(e){this.value=e}clone(){return new ox(void 0===this.value.clone?this.value:this.value.clone())}}let ob=0;class oS extends er{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:ob++}
1),this.name="",this.usage=35044,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return new this.constructor().copy(this)}}class oM extends nd{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class oT{constructor(e,t,n,i,r,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.normalized=a,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}let ow=new eV;class oE{constructor(e,t,n=0,i=1/0){this.ray=new nV(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new eQ,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):et("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ow.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ow),this}intersectObject(e,t=!0,n=[]){return oC(e,this,n,t),n.sort(oA),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)oC(e[i],this,n,t);return n.sort(oA),n}}function oA(e,t){return e.distance-t.distance}function oC(e,t,n,i){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(r=!1),!0===r&&!0===i){let i=e.children;for(let e=0,r=i.length;e<r;e++)oC(i[e],t,n,!0)}}class oR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,ee("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class oP{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ec(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ec(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class oI{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class oL{static{oL.prototype.isMatrix2=!0}constructor(e,t,n,i){this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}let oN=new eg;class oU{constructor(e=new eg(Infinity,Infinity),t=new eg(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=oN.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,oN).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let oD=new e_,oO=new e_,oF=new e_,oB=new e_,oz=new e_,ok=new e_,oH=new e_;class oV{constructor(e=new e_,t=new e_){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){oD.subVectors(e,this.start),oO.subVectors(this.end,this.start);let n=oO.dot(oO);if(0===n)return 0;let i=oO.dot(oD)/n;return t&&(i=ec(i,0,1)),i}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
1distanceSqToLine3(e,t=ok,n=oH){let i,r,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;oF.subVectors(l,s),oB.subVectors(u,o),oz.subVectors(s,o);let c=oF.dot(oF),h=oB.dot(oB),d=oB.dot(oz);if(c<=a&&h<=a)return t.copy(s),n.copy(o),t.sub(n),t.dot(t);if(c<=a)i=0,r=ec(r=d/h,0,1);else{let e=oF.dot(oz);if(h<=a)r=0,i=ec(-e/c,0,1);else{let t=oF.dot(oB),n=c*h-t*t;i=0!==n?ec((t*d-e*h)/n,0,1):0,(r=(t*i+d)/h)<0?(r=0,i=ec(-e/c,0,1)):r>1&&(r=1,i=ec((t-e)/c,0,1))}}return t.copy(s).addScaledVector(oF,i),n.copy(o).addScaledVector(oB,r),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let oG=new e_;class oW extends ta{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new nh,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){const n=e/32*Math.PI*2,r=t/32*Math.PI*2;i.push(Math.cos(n),Math.sin(n),1,Math.cos(r),Math.sin(r),1)}n.setAttribute("position",new t9(i,3));const r=new iX({fog:!1,toneMapped:!1});this.cone=new i4(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorldNeedsUpdate=!0;let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),oG.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(oG),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let oj=new e_,oX=new eV,oq=new eV;class oY extends i4{constructor(e){const t=function e(t){let n=[];!0===t.isBone&&n.push(t);for(let i=0;i<t.children.length;i++)n.push(...e(t.children[i]));return n}(e),n=new nh,i=[],r=[];for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new t9(i,3)),n.setAttribute("color",new t9(r,3)),super(n,new iX({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const a=new tp(255),s=new tp(65280);this.setColors(a,s)}updateMatrixWorld(e){let t=this.bones,n=this.geometry,i=n.getAttribute("position");oq.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){let r=t[e];r.parent&&r.parent.isBone&&(oX.multiplyMatrices(oq,r.matrixWorld),oj.setFromMatrixPosition(oX),i.setXYZ(n,oj.x,oj.y,oj.z),oX.multiplyMatrices(oq,r.parent.matrixWorld),oj.setFromMatrixPosition(oX),i.setXYZ(n+1,oj.x,oj.y,oj.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){let n=this.geometry.getAttribute("color");for(let i=0;i<n.count;i+=2)n.setXYZ(i,e.r,e.g,e.b),n.setXYZ(i+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oZ extends n1{constructor(e,t,n){super(new am(t,4,2),new nG({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}let oK=new e_,oJ=new tp,o$=new tp;class oQ extends ta{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new ah(t);i.rotateY(.5*Math.PI),this.material=new nG({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=new Float32Array(3*i.getAttribute("position").count);i.setAttribute("color",new t0(r,3)),this.add(new n1(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");oJ.copy(this.light.color),o$.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){let i=e<n/2?oJ:o$;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),e.lookAt(oK.setFromMatrixPosition(this.light.matrixWorld).negate())}}class o0 extends i4{constructor(e=10,t=10,n=4473924,i=8947848){n=new tp(n),i=new tp(i);const r=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,u=0,c=-s;e<=t;e++,c+=a){o.push(-s,0,c,s,0,c),o.push(c,0,-s,c,0,s);const t=e===r?n:i;t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3}const u=new nh;u.setAttribute("position",new t9(o,3)),u.setAttribute("color",new t9(l,3)),super(u,new iX({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class o1 extends i4{constructor(e=10,t=16,n=8,i=64,r=4473924,a=8947848){r=new tp(r),a=new tp(a);const s=[],o=[];if(t>1)for(let n=0;n<t;n++){const i=n/t*(2*Math.PI),l=Math.sin(i)*e,u=Math.cos(i)*e;s.push(0,0,0),s.push(l,0,u);const c=1&n?r:a;o.push(c.r,c.g,c.b),o.push(c.r,c.g,c.b)}for(let t=0;t<n;t++){const l=1&t?r:a,u=e-e/n*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),n=Math.sin(t)*u,r=Math.cos(t)*u;s.push(n,0,r),o.push(l.r,l.g,l.b),n=Math.sin(t=(e+1)/i*(2*Math.PI))*u,r=Math.cos(t)*u,s.push(n,0,r),o.push(l.r,l.g,l.b)}}const l=new nh;l.setAttribute("position",new t9(s,3)),l.setAttribute("color",new t9(o,3)),super(l,new iX({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}let o2=new e_,o3=new e_,o4=new e_;class o5 extends ta{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new nh;i.setAttribute("position",new t9([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new iX({fog:!1,toneMapped:!1});this.lightPlane=new i0(i,r),this.add(this.lightPlane),(i=new nh).setAttribute("position",new t9([0,0,0,0,0,1],3)),this.targetLine=new i0(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),o2.setFromMatrixPosition(this.light.matrixWorld),o3.setFromMatrixPosition(this.light.target.matrixWorld),o4.subVectors(o3,o2),this.lightPlane.lookAt(o3),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(o3),this.targetLine.scale.z
1=o4.length()}}let o6=new e_,o8=new sx;class o7 extends i4{constructor(e){const t=new nh,n=new iX({color:0xffffff,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={};function s(e,t){o(e),o(t)}function o(e){i.push(0,0,0),r.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}s("n1","n2"),s("n2","n4"),s("n4","n3"),s("n3","n1"),s("f1","f2"),s("f2","f4"),s("f4","f3"),s("f3","f1"),s("n1","f1"),s("n2","f2"),s("n3","f3"),s("n4","f4"),s("p","n1"),s("p","n2"),s("p","n3"),s("p","n4"),s("u1","u2"),s("u2","u3"),s("u3","u1"),s("c","t"),s("p","c"),s("cn1","cn2"),s("cn3","cn4"),s("cf1","cf2"),s("cf3","cf4"),t.setAttribute("position",new t9(i,3)),t.setAttribute("color",new t9(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const l=new tp(0xffaa00),u=new tp(0xff0000),c=new tp(43775),h=new tp(0xffffff),d=new tp(3355443);this.setColors(l,u,c,h,d)}setColors(e,t,n,i,r){let a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0,this}update(){let e,t,n=this.geometry,i=this.pointMap;if(o8.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)e=1,t=0;else if(2e3===this.camera.coordinateSystem)e=-1,t=1;else if(2001===this.camera.coordinateSystem)e=0,t=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);o9("c",i,n,o8,0,0,e),o9("t",i,n,o8,0,0,t),o9("n1",i,n,o8,-1,-1,e),o9("n2",i,n,o8,1,-1,e),o9("n3",i,n,o8,-1,1,e),o9("n4",i,n,o8,1,1,e),o9("f1",i,n,o8,-1,-1,t),o9("f2",i,n,o8,1,-1,t),o9("f3",i,n,o8,-1,1,t),o9("f4",i,n,o8,1,1,t),o9("u1",i,n,o8,.7,1.1,e),o9("u2",i,n,o8,-.7,1.1,e),o9("u3",i,n,o8,0,2,e),o9("cf1",i,n,o8,
1-1,0,t),o9("cf2",i,n,o8,1,0,t),o9("cf3",i,n,o8,0,-1,t),o9("cf4",i,n,o8,0,1,t),o9("cn1",i,n,o8,-1,0,e),o9("cn2",i,n,o8,1,0,e),o9("cn3",i,n,o8,0,-1,e),o9("cn4",i,n,o8,0,1,e),n.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function o9(e,t,n,i,r,a,s){o6.set(r,a,s).unproject(i);let o=t[e];if(void 0!==o){let e=n.getAttribute("position");for(let t=0,n=o.length;t<n;t++)e.setXYZ(o[t],o6.x,o6.y,o6.z)}}let le=new tL;class lt extends i4{constructor(e,t=0xffff00){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]),i=new Float32Array(24),r=new nh;r.setIndex(new t0(n,1)),r.setAttribute("position",new t0(i,3)),super(r,new iX({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&le.setFromObject(this.object),le.isEmpty())return;let e=le.min,t=le.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ln extends i4{constructor(e,t=0xffff00){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]),i=new nh;i.setIndex(new t0(n,1)),i.setAttribute("position",new t9([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new iX({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class li extends i0{constructor(e,t=1,n=0xffff00){const i=new nh;i.setAttribute("position",new t9([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new iX({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const r=new nh;r.setAttribute("position",new t9([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new n1(r,new nG({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}let lr=new e_;class la extends ta{constructor(e=new e_(0,0,1),t=new e_(0,0,0),n=1,i=0xffff00,r=.2*n,a=.2*r){super(),this.type="ArrowHelper",void 0===s&&((s=new nh).setAttribute("position",new t9([0,0,0,0,1,0],3)),(o=new ry(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new i0(s,new iX({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new n1(o,new nG({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lr.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lr,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class ls extends i4{constructor(e=1){const t=new nh;t.setAttribute("position",new t9([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new t9([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new iX({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}
1setColors(e,t,n){let i=new tp,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class lo{constructor(){this.type="ShapePath",this.color=new tp,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new rZ,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(e,t){let n=!1,i=t.length;for(let r=0,a=i-1;r<i;a=r++){let i=t[r],s=t[a];i.y>e.y!=s.y>e.y&&e.x<(s.x-i.x)*(e.y-i.y)/(s.y-i.y)+i.x&&(n=!n)}return n}let t=this.userData.style&&this.userData.style.fillRule||"nonzero";"nonzero"!==t&&"evenodd"!==t&&(ee('Fill-rule "'+t+'" is not supported, falling back to "nonzero".'),t="nonzero");let n="nonzero"===t?e=>0!==e:e=>(1&e)!=0,i=[];for(let t of this.subPaths){let n=t.getPoints();if(n.length<3)continue;let r=ar.area(n);if(0===r)continue;let a=new oU;for(let e=0;e<n.length;e++)a.expandByPoint(n[e]);i.push({subPath:t,points:n,boundingBox:a,interiorPoint:function(t,n){let i=n.getCenter(new eg);if(e(i,t))return i;let r=i.y,a=[],s=t.length;for(let e=0;e<s;e++){let n=t[e],i=t[(e+1)%s];if(n.y>r!=i.y>r){let e=n.x+(r-n.y)*(i.x-n.x)/(i.y-n.y);a.push(e)}}return a.length>1&&(a.sort((e,t)=>e-t),i.x=(a[0]+a[1])/2),i}(n,a),absArea:Math.abs(r),winding:r<0?-1:1,container:null,exclude:!1,role:null})}i.sort((e,t)=>t.absArea-e.absArea);for(let t=0;t<i.length;t++){let r=i[t],a=0;for(let n=t-1;n>=0;n--){let t=i[n];
1if(t.boundingBox.containsBox(r.boundingBox)&&e(r.interiorPoint,t.points)){r.container=t.exclude?t.container:t,a=t.winding,r.winding+=a;break}}n(r.winding)===n(a)&&(r.exclude=!0)}for(let e of i)e.exclude||(e.role=null===e.container||"hole"===e.container.role?"outer":"hole");let r=[],a=new Map;for(let e of i){if(e.exclude||"outer"!==e.role)continue;let t=new rK;t.curves=e.subPath.curves,r.push(t),a.set(e,t)}for(let e of i){if(e.exclude||"hole"!==e.role)continue;let t=a.get(e.container);if(!t)continue;let n=new rZ;n.curves=e.subPath.curves,t.holes.push(n)}return r}}class ll extends er{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){void 0===e?ee("Controls: connect() now requires an element."):(null!==this.domElement&&this.disconnect(),this.domElement=e)}disconnect(){}dispose(){}update(){}}function lu(e,t,n,i){let r=function(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}(i);switch(n){case 1021:return e*t;case 1028:case 1029:return e*t/r.components*r.byteLength;case 1030:case 1031:return e*t*2/r.components*r.byteLength;case 1022:return e*t*3/r.components*r.byteLength;case 1023:case 1033:return e*t*4/r.components*r.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8}throw Error(`Unable to determine texture byte length for ${n} format.`)}class lc{static contain(e,t){let n;return(n=e.image&&e.image.width?e.image.width/e.image.height:1)>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let n;return(n=e.image&&e.image.width?e.image.width/e.image.height:1)>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,n,i){return lu(e,t,n,i)}}function lh(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0===t||null===n||null!==e&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){null!==e&&e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ld(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))}
1,update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);(!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version});return}let r=t.get(n);if(void 0===r)t.set(n,function(t,n){let i,r=t.array,a=t.usage,s=r.byteLength,o=e.createBuffer();if(e.bindBuffer(n,o),e.bufferData(n,r,a),t.onUploadCallback(),r instanceof Float32Array)i=e.FLOAT;else if("u">typeof Float16Array&&r instanceof Float16Array)i=e.HALF_FLOAT;else if(r instanceof Uint16Array)i=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)i=e.SHORT;else if(r instanceof Uint32Array)i=e.UNSIGNED_INT;else if(r instanceof Int32Array)i=e.INT;else if(r instanceof Int8Array)i=e.BYTE;else if(r instanceof Uint8Array)i=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)i=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:o,type:i,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,i){let r=n.array,a=n.updateRanges;if(e.bindBuffer(i,t),0===a.length)e.bufferSubData(i,0,r);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],i=a[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):a[++t]=i}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}})),"u">typeof window&&(window.__THREE__?ee("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");let lp={alphahash_fragment:"#ifdef USE_ALPHAHASH\n	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n	const float ALPHA_HASH_SCALE = 0.05;\n	float hash2D( vec2 value ) {\n		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n	}\n	float hash3D( vec3 value ) {\n		return hash2D( vec2( hash2D( value.xy ), value.z ) );\n	}\n	float getAlphaHashThreshold( vec3 position ) {\n		float maxDeriv = max(\n			length( dFdx( position.xyz ) ),\n			length( dFdy( position.xyz ) )\n		);\n		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n		vec2 pixScales = vec2(\n			exp2( floor( log2( pixScale ) ) ),\n			exp2( ceil( log2( pixScale ) ) )\n		);\n		vec2 alpha = vec2(\n			hash3D( floor( pixScales.x * position.xyz ) ),\n			hash3D( floor( pixScales.y * position.xyz ) )\n		);\n		float lerpFactor = fract( log2( pixScale ) );\n		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n		float a = min( lerpFactor, 1.0 - lerpFactor );\n		vec3 cases = vec3(\n			x * x / ( 2.0 * a * ( 1.0 - a ) ),\n			( x - 0.5 * a ) / ( 1.0 - a ),\n			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n		);\n		float threshold = ( x < ( 1.0 - a ) )\n			? ( ( x < a ) ? cases.x : cases.y )\n			: cases.z;\n		return clamp( threshold , 1.0e-6, 1.0 );\n	}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n	#ifdef ALPHA_TO_COVERAGE\n	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n	if ( diffuseColor.a == 0.0 ) discard;\n	#else\n	if ( diffuseColor.a < alphaTest ) discard;\n	#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n	uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_CLEARCOAT ) \n		clearcoatSpecularIndirect *= ambientOcclusion;\n	#endif\n	#if defined( USE_SHEEN ) \n		sheenSpecularIndirect *= ambientOcclusion;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( STANDARD )\n		float dotNV = saturate( dot
1( geometryNormal, geometryViewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n	#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n	#if ! defined( GL_ANGLE_multi_draw )\n	#define gl_DrawID _gl_DrawID\n	uniform int _gl_DrawID;\n	#endif\n	uniform highp sampler2D batchingTexture;\n	uniform highp usampler2D batchingIdTexture;\n	mat4 getBatchingMatrix( const in float i ) {\n		int size = textureSize( batchingTexture, 0 ).x;\n		int j = int( i ) * 4;\n		int x = j % size;\n		int y = j / size;\n		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n		return mat4( v1, v2, v3, v4 );\n	}\n	float getIndirectIndex( const in int i ) {\n		int size = textureSize( batchingIdTexture, 0 ).x;\n		int x = i % size;\n		int y = i / size;\n		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n	}\n#endif\n#ifdef USE_BATCHING_COLOR\n	uniform sampler2D batchingColorTexture;\n	vec4 getBatchingColor( const in float i ) {\n		int size = textureSize( batchingColorTexture, 0 ).x;\n		int j = int( i );\n		int x = j % size;\n		int y = j / size;\n		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n	}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n	vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n	vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n	const mat3 XYZ_TO_REC709 = mat3(\n		 3.2404542, -0.9692660,  0.0556434,\n		-1.5371385,  1.8760108, -0.2040259,\n		-0.4985314,  0.0415560,  1.0572252\n	);\n	vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n		vec3 sqrtF0 = sqrt( fresnel0 );\n		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n	}\n	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n	}\n	float IorToFresnel0( float transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n	}\n	vec3 evalSensitivity( float OPD, vec3 shift ) {\n		float phase = 2.0 * PI * OPD * 1.0e-9;\n		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n		xyz /= 1.0685e-7;\n		vec3 rgb = XYZ_TO_REC709 * xyz;\n		return rgb;\n	}\n	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n		vec3 I;\n		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n		float cosTheta2Sq = 1.0 - sinTheta2Sq;\n		if ( cosTheta2Sq < 0.0 ) {\n			return vec3( 1.0 );\n		}\n		float cosTheta2 = sqrt( cosTheta2Sq );\n		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
1\n		float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n		float T121 = 1.0 - R12;\n		float phi12 = 0.0;\n		if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n		float phi21 = PI - phi12;\n		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n		vec3 phi23 = vec3( 0.0 );\n		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n		vec3 phi = vec3( phi21 ) + phi23;\n		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n		vec3 r123 = sqrt( R123 );\n		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n		vec3 C0 = R12 + Rs;\n		I = C0;\n		vec3 Cm = Rs - T121;\n		for ( int m = 1; m <= 2; ++ m ) {\n			Cm *= r123;\n			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n			I += Cm * Sm;\n		}\n		return max( I, vec3( 0.0 ) );\n	}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vBumpMapUv );\n		vec2 dSTdy = dFdy( vBumpMapUv );\n		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 ) * faceDirection;\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n	vec4 plane;\n	#ifdef ALPHA_TO_COVERAGE\n		float distanceToPlane, distanceGradient;\n		float clipOpacity = 1.0;\n		#pragma unroll_loop_start\n		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n			distanceGradient = fwidth( distanceToPlane ) / 2.0;\n			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n			if ( clipOpacity == 0.0 ) discard;\n		}\n		#pragma unroll_loop_end\n		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n			float unionClipOpacity = 1.0;\n			#pragma unroll_loop_start\n			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n				plane = clippingPlanes[ i ];\n				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n				distanceGradient = fwidth( distanceToPlane ) / 2.0;\n				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n			}\n			#pragma unroll_loop_end\n			clipOpacity *= 1.0 - unionClipOpacity;\n		#endif\n		diffuseColor.a *= clipOpacity;\n		if ( diffuseColor.a == 0.0 ) discard;\n	#else\n		#pragma unroll_loop_start\n		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n		}\n		#pragma unroll_loop_end\n		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n			bool clipped = true;\n			#pragma unroll_loop_start\n			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n				plane = clippingPlanes[ i ];\n				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n			}\n			#pragma unroll_loop_end\n			if ( clipped ) discard;\n		#endif\n	#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n	vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n	diffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n	varying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n	vColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n	vColor *= color;\n#elif defined( USE_COLOR )\n	vColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n	vColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n	const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n	return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n	float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n	float precisionSafeLength( vec3 v ) {\n		float maxComponent = max3( abs( v ) );\n		return length( v / maxComponent ) * maxComponent;\n	}\n#endif\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n	varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\n#define inverseTransformDirection transformDirectionByInverseViewMatrix\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n}\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n	return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n	return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n	#define cubeUV_minMipLevel 4.0\n	#define cubeUV_minTileSize 16.0\n	float getFace( vec3 direction ) {\n		vec3 absDirection = abs( direction );\n		float face = - 1.0;\n		if ( absDirection.x > absDirection.z ) {\n			if ( absDirection.x > absDirection.y )\n				face = direction.x > 0.0 ? 0.0 : 3.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		} else {\n			if ( absDirection.z > absDirection.y )\n				face = direction.z > 0.0 ? 2.0 : 5.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		}\n		return face;\n	}\n	vec2 getUV( vec3 direction, float face ) {\n		vec2 uv;\n		if ( face == 0.0 ) {\n			uv = vec2( direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 1.0 ) {\n			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n		} else if ( face == 2.0 ) {\n			uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n		} else if ( face == 3.0 ) {\n			uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 4.0 ) {\n			uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n		} else {\n			uv = vec2( direction.x, direction.y ) / abs( direction.z );\n		}\n		return 0.5 * ( uv + 1.0 );\n	}\n	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n		float face = getFace( direction );\n		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n		mipInt = max( mipInt, cubeUV_minMipLevel );\n		float faceSize = exp2( mipInt );\n		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n		if ( face > 2.0 ) {\n			uv.y += faceSize;\n			face -= 3.0;\n		}\n		uv.x += face * faceSize;\n		uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n		uv.x *= CUBEUV_TEXEL_WIDTH;\n		uv.y *= CUBEUV_TEXEL_HEIGHT;\n		#ifdef texture2DGradEXT\n			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n		#else\n			return texture2D( envMap, uv ).rgb;\n		#endif\n	}\n	#define cubeUV_r0 1.0\n	#define cubeUV_m0 - 2.0\n	#define cubeUV_r1 0.8\n	#define cubeUV_m1 - 1.0\n	#define cubeUV_r4 0.4\n	#define cubeUV_m4 2.0\n	#define cubeUV_r5 0.305\n	#define cubeUV_m5 3.0\n	#define cubeUV_r6 0.21\n	#define cubeUV_m6 4.0\n	float roughnessToMip( float roughness ) {\n		float mip = 0.0;\n		if ( roughness >= cubeUV_r1 ) {\n			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n		} else if ( roughness >= cubeUV_r4 ) {\n			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n		} else if ( roughness >= cubeUV_r5 ) {\n			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n		} else if ( roughness >= cubeUV_r6 ) {\n			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n		} else {\n			mip = - 2.0 * log2( 1.16 * roughness );		}\n		return mip;\n	}\n	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n		float mipF = fract( mip );\n		float mipInt = floor( mip );\n		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n		if ( mipF == 0.0 ) {\n			return vec4( color0, 1.0 );\n		} else {\n			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n			return vec4( mix( color0, color1, mipF ), 1.0 );\n		}\n	}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n	vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n	mat3 bm = mat3( batchingMatrix );
1\n	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n	transformedNormal = bm * transformedNormal;\n	#ifdef USE_TANGENT\n		transformedTangent = bm * transformedTangent;\n	#endif\n#endif\n#ifdef USE_INSTANCING\n	mat3 im = mat3( instanceMatrix );\n	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n	transformedNormal = im * transformedNormal;\n	#ifdef USE_TANGENT\n		transformedTangent = im * transformedTangent;\n	#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n	transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n		emissiveColor = sRGBTransferEOTF( emissiveColor );\n	#endif\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n	return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n	return 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 sRGBTransferOETF( in vec4 value ) {\n	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vec3 cameraToFrag;\n		if ( isOrthographic ) {\n			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		} else {\n			cameraToFrag = normalize( vWorldPosition - cameraPosition );\n		}\n		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n		#ifdef ENVMAP_BLENDING_MULTIPLY\n			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n		#elif defined( ENVMAP_BLENDING_MIX )\n			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n		#elif defined( ENVMAP_BLENDING_ADD )\n			outgoingLight += envColor.xyz * specularStrength * reflectivity;\n		#endif\n	#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float envMapIntensity;\n	uniform mat3 envMapRotation;\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float reflectivity;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		varying vec3 vWorldPosition;\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		\n		varying vec3 vWorldPosition;\n	#else\n		varying vec3 vReflect;\n		uniform float refractionRatio;\n	#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n	vec3 getIBLIrradiance( const in vec3 normal ) {\n		#ifdef ENVMAP_TYPE_CUBE_UV\n			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n			return PI * envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n		#ifdef ENVMAP_TYPE_CUBE_UV\n			vec3 reflectVec = reflect( - viewDir, normal );
1\n			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n			return envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	#ifdef USE_ANISOTROPY\n		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n			#ifdef ENVMAP_TYPE_CUBE_UV\n				vec3 bentNormal = cross( bitangent, viewDir );\n				bentNormal = normalize( cross( bentNormal, bitangent ) );\n				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n				return getIBLRadiance( viewDir, bentNormal, roughness );\n			#else\n				return vec3( 0.0 );\n			#endif\n		}\n	#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vWorldPosition = worldPosition.xyz;\n	#else\n		vec3 cameraToVertex;\n		if ( isOrthographic ) {\n			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		}
1 else {\n			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n		}\n		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vReflect = reflect( cameraToVertex, worldNormal );\n		#else\n			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n	vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n	varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n	#ifdef FOG_EXP2\n		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n	uniform vec3 fogColor;\n	varying float vFogDepth;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n	uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n	float dotNL = dot( normal, lightDirection );\n	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n	#ifdef USE_GRADIENTMAP\n		return vec3( texture2D( gradientMap, coord ).r );\n	#else\n		vec2 fw = fwidth( coord ) * 0.5;\n		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n	#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n	vec3 diffuseColor;\n	float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Lambert\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n	uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n	float x = normal.x, y = normal.y, z = normal.z;\n	vec3 result = shCoefficients[ 0 ] * 0.886227;\n	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n	return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n	return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n	if ( cutoffDistance > 0.0 ) {\n		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n	}\n	return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n	return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n		light.color = directionalLight.color;\n		light.direction = directionalLight.direction;\n		light.visible = true;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n		vec3 lVector = pointLight.position - geometryPosition;\n		light.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		light.color = pointLight.color;\n		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n		light.visible = ( light.color != vec3( 0.0 ) );\n	}
1\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n		vec3 lVector = spotLight.position - geometryPosition;\n		light.direction = normalize( lVector );\n		float angleCos = dot( light.direction, spotLight.direction );\n		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n		if ( spotAttenuation > 0.0 ) {\n			float lightDistance = length( lVector );\n			light.color = spotLight.color * spotAttenuation;\n			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n			light.visible = ( light.color != vec3( 0.0 ) );\n		} else {\n			light.color = vec3( 0.0 );\n			light.visible = false;\n		}\n	}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n	struct RectAreaLight {\n		vec3 color;\n		vec3 position;\n		vec3 halfWidth;\n		vec3 halfHeight;\n	};\n	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;\n	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n		float dotNL = dot( normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		return irradiance;\n	}\n#endif\n#include <lightprobes_pars_fragment>",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n	vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Toon\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n	vec3 diffuseColor;\n	vec3 specularColor;\n	float specularShininess;\n	float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n	material.ior = ior;\n	#ifdef USE_SPECULAR\n		float specularIntensityFactor = specularIntensity;\n		vec3 specularColorFactor = specularColor;\n		#ifdef USE_SPECULAR_COLORMAP\n			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n		#endif\n		#ifdef USE_SPECULAR_INTENSITYMAP\n			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n		#endif\n		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n	#else\n		float specularIntensityFactor = 1.0;\n		vec3 specularColorFactor = vec3( 1.0 );\n		material.specularF90 = 1.0;\n	#endif\n	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n	material.specularColor = vec3( 0.04 );\n	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n	material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n	material.clearcoat = clearcoat;
1\n	material.clearcoatRoughness = clearcoatRoughness;\n	material.clearcoatF0 = vec3( 0.04 );\n	material.clearcoatF90 = 1.0;\n	#ifdef USE_CLEARCOATMAP\n		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n	#endif\n	#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n	#endif\n	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n	material.clearcoatRoughness += geometryRoughness;\n	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n	material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n	material.iridescence = iridescence;\n	material.iridescenceIOR = iridescenceIOR;\n	#ifdef USE_IRIDESCENCEMAP\n		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n	#endif\n	#ifdef USE_IRIDESCENCE_THICKNESSMAP\n		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n	#else\n		material.iridescenceThickness = iridescenceThicknessMaximum;\n	#endif\n#endif\n#ifdef USE_SHEEN\n	material.sheenColor = sheenColor;\n	#ifdef USE_SHEEN_COLORMAP\n		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n	#endif\n	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n	#endif\n#endif\n#ifdef USE_ANISOTROPY\n	#ifdef USE_ANISOTROPYMAP\n		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n	#else\n		vec2 anisotropyV = anisotropyVector;\n	#endif\n	material.anisotropy = length( anisotropyV );\n	if( material.anisotropy == 0.0 ) {\n		anisotropyV = vec2( 1.0, 0.0 );\n	} else {\n		anisotropyV /= material.anisotropy;\n		material.anisotropy = saturate( material.anisotropy );\n	}\n	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n	vec3 diffuseColor;\n	vec3 diffuseContribution;\n	vec3 specularColor;\n	vec3 specularColorBlended;\n	float roughness;\n	float metalness;\n	float specularF90;\n	float dispersion;\n	#ifdef USE_CLEARCOAT\n		float clearcoat;\n		float clearcoatRoughness;\n		vec3 clearcoatF0;\n		float clearcoatF90;\n	#endif\n	#ifdef USE_IRIDESCENCE\n		float iridescence;\n		float iridescenceIOR;\n		float iridescenceThickness;\n		vec3 iridescenceFresnel;\n		vec3 iridescenceF0;\n		vec3 iridescenceFresnelDielectric;\n		vec3 iridescenceFresnelMetallic;\n	#endif\n	#ifdef USE_SHEEN\n		vec3 sheenColor;\n		float sheenRoughness;\n	#endif\n	#ifdef IOR\n		float ior;\n	#endif\n	#ifdef USE_TRANSMISSION\n		float transmission;\n		float transmissionAlpha;\n		float thickness;\n		float attenuationDistance;\n		vec3 attenuationColor;\n	#endif\n	#ifdef USE_ANISOTROPY\n		float anisotropy;\n		float alphaT;\n		vec3 anisotropyT;\n		vec3 anisotropyB;\n	#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n		float gv = dotNL * length( vec3( alphaT * dotTV, alph
1aB * dotBV, dotNV ) );\n		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n		return 0.5 / max( gv + gl, EPSILON );\n	}\n	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n		float a2 = alphaT * alphaB;\n		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n		highp float v2 = dot( v, v );\n		float w2 = a2 / v2;\n		return RECIPROCAL_PI * a2 * pow2 ( w2 );\n	}\n#endif\n#ifdef USE_CLEARCOAT\n	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n		vec3 f0 = material.clearcoatF0;\n		float f90 = material.clearcoatF90;\n		float roughness = material.clearcoatRoughness;\n		float alpha = pow2( roughness );\n		vec3 halfDir = normalize( lightDir + viewDir );\n		float dotNL = saturate( dot( normal, lightDir ) );\n		float dotNV = saturate( dot( normal, viewDir ) );\n		float dotNH = saturate( dot( normal, halfDir ) );\n		float dotVH = saturate( dot( viewDir, halfDir ) );\n		vec3 F = F_Schlick( f0, f90, dotVH );\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n		return F * ( V * D );\n	}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n	vec3 f0 = material.specularColorBlended;\n	float f90 = material.specularF90;\n	float roughness = material.roughness;\n	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( f0, f90, dotVH );\n	#ifdef USE_IRIDESCENCE\n		F = mix( F, material.iridescenceFresnel, material.iridescence );\n	#endif\n	#ifdef USE_ANISOTROPY\n		float dotTL = dot( material.anisotropyT, lightDir );\n		float dotTV = dot( material.anisotropyT, viewDir );\n		float dotTH = dot( material.anisotropyT, halfDir );\n		float dotBL = dot( material.anisotropyB, lightDir );\n		float dotBV = dot( material.anisotropyB, viewDir );\n		float dotBH = dot( material.anisotropyB, halfDir );\n		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n	#else\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n	#endif\n	return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n	const float LUT_SIZE = 64.0;\n	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n	const float LUT_BIAS = 0.5 / LUT_SIZE;\n	float dotNV = saturate( dot( N, V ) );\n	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n	uv = uv * LUT_SCALE + LUT_BIAS;\n	return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n	float l = length( f );\n	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n	float x = dot( v1, v2 );\n	float y = abs( x );\n	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n	float b = 3.4175940 + ( 4.1616724 + y ) * y;\n	float v = a / b;\n	float theta_sintheta = ( x >
1 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n	return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n	vec3 lightNormal = cross( v1, v2 );\n	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n	vec3 T1, T2;\n	T1 = normalize( V - N * dot( V, N ) );\n	T2 = - cross( N, T1 );\n	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n	vec3 coords[ 4 ];\n	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n	coords[ 0 ] = normalize( coords[ 0 ] );\n	coords[ 1 ] = normalize( coords[ 1 ] );\n	coords[ 2 ] = normalize( coords[ 2 ] );\n	coords[ 3 ] = normalize( coords[ 3 ] );\n	vec3 vectorFormFactor = vec3( 0.0 );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n	return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n	float alpha = pow2( roughness );\n	float invAlpha = 1.0 / alpha;\n	float cos2h = dotNH * dotNH;\n	float sin2h = max( 1.0 - cos2h, 0.0078125 );\n	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float D = D_Charlie( sheenRoughness, dotNH );\n	float V = V_Neubelt( dotNV, dotNL );\n	return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float r2 = roughness * roughness;\n	float rInv = 1.0 / ( roughness + 0.1 );\n	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n	float DG = exp( a * dotNV + b );\n	return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n	return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n	float dotNV = saturate( dot( normal, viewDir ) );\n	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n	#ifdef USE_IRIDESCENCE\n		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n	#else\n		vec3 Fr = specularColor;\n	#endif\n	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n	float Ess = fab.x + fab.y;\n	float Ems = 1.0 - Ess;\n	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n	singleScatter += FssEss;\n	multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
1\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n	float Ess_V = dfgV.x + dfgV.y;\n	float Ess_L = dfgL.x + dfgL.y;\n	float Ems_V = 1.0 - Ess_V;\n	float Ems_L = 1.0 - Ess_L;\n	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n	float compensationFactor = Ems_V * Ems_L;\n	vec3 multiScatter = Fms * compensationFactor;\n	return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n		vec3 normal = geometryNormal;\n		vec3 viewDir = geometryViewDir;\n		vec3 position = geometryPosition;\n		vec3 lightPos = rectAreaLight.position;\n		vec3 halfWidth = rectAreaLight.halfWidth;\n		vec3 halfHeight = rectAreaLight.halfHeight;\n		vec3 lightColor = rectAreaLight.color;\n		float roughness = material.roughness;\n		vec3 rectCoords[ 4 ];\n		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n		vec2 uv = LTC_Uv( normal, viewDir, roughness );\n		vec4 t1 = texture2D( ltc_1, uv );\n		vec4 t2 = texture2D( ltc_2, uv );\n		mat3 mInv = mat3(\n			vec3( t1.x, 0, t1.y ),\n			vec3(    0, 1,    0 ),\n			vec3( t1.z, 0, t1.w )\n		);\n		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n		#ifdef USE_CLEARCOAT\n			vec3 Ncc = geometryClearcoatNormal;\n			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n			mat3 mInvClearcoat = mat3(\n				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n				vec3(             0, 1,             0 ),\n				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n			);\n			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n		#endif\n	}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifdef USE_CLEARCOAT\n		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n		vec3 ccIrradiance = dotNLcc * directLight.color;\n		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n	#endif\n	#ifdef USE_SHEEN\n \n 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n 		irradiance *= sheenEnergyComp;\n \n 	#endif\n	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n	#ifdef USE_SHEEN\n		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n		diffuse *= sheenEnergyComp;\n	#endif\n	reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n	#ifdef USE_CLEARCOAT\n		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n 	#endif\n	vec3 singleScatteringDielectric = vec3( 0.0 );\n	vec3 multiScatteringDielectric = vec3( 0.0 );\n	vec3 singleScatteringMetallic = vec3( 0.0 );\n	vec3 multiScatteringMetallic = vec3( 0.0 );
1\n	#ifdef USE_IRIDESCENCE\n		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n	#else\n		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n	#endif\n	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n	vec3 indirectSpecular = radiance * singleScattering;\n	indirectSpecular += multiScattering * cosineWeightedIrradiance;\n	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n	#ifdef USE_SHEEN\n		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n		indirectSpecular *= sheenEnergyComp;\n		indirectDiffuse *= sheenEnergyComp;\n	#endif\n	reflectedLight.indirectSpecular += indirectSpecular;\n	reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct				RE_Direct_Physical\n#define RE_Direct_RectArea		RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular		RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n	geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n	float dotNVi = saturate( dot( normal, geometryViewDir ) );\n	if ( material.iridescenceThickness == 0.0 ) {\n		material.iridescence = 0.0;\n	} else {\n		material.iridescence = saturate( material.iridescence );\n	}\n	if ( material.iridescence > 0.0 ) {\n		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n	}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		getPointLightInfo( pointLight, geometryPosition, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n		pointLightShadow = pointLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}
1\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	vec4 spotColor;\n	vec3 spotLightCoord;\n	bool inSpotLightMap;\n	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		getSpotLightInfo( spotLight, geometryPosition, directLight );\n		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n		#else\n		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#endif\n		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n		#endif\n		#undef SPOT_LIGHT_MAP_INDEX\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		spotLightShadow = spotLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		getDirectionalLightInfo( directionalLight, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n		directionalLightShadow = directionalLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n	RectAreaLight rectAreaLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n		rectAreaLight = rectAreaLights[ i ];\n		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 iblIrradiance = vec3( 0.0 );\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	#if defined( USE_LIGHT_PROBES )\n		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n	#endif\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n		}\n		#pragma unroll_loop_end\n	#endif\n	#ifdef USE_LIGHT_PROBES_GRID\n		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n	#endif\n#endif\n#if defined( RE_IndirectSpecular )\n	vec3 radiance = vec3( 0.0 );\n	vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n		irradiance += lightMapIrradiance;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n			iblIrradiance += getIBLIrradiance( geometryNormal );\n		#endif\n	#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	#ifdef USE_ANISOTROPY\n		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n	#else\n		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n	#endif\n	#ifdef USE_CLEARCOAT\n		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n	#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n	#if defined( LAMBERT ) || defined( PHONG )\n		irradiance += iblIrradiance;\n	#endif\n	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",lightprobes_pars_fragment:"#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n	vec3 res = probesResolution;\n	vec3 gridRange = probesMax - probesMin;\n	vec3 resMinusOne = res - 1.0;\n	vec3 probeSpacing = gridRange / resMinusOne;\n	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n	uvw = uvw * resMinusOne / res + 0.5 / res;\n	float nz          = res.z;\n	float paddedSlices = nz + 2.0;\n	float atlasDepth  = 7.0 * paddedSlices;\n	float uvZBase     = uvw.z * nz + 1.0;\n	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );\n	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );\n	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );\n	vec3 c0 = s0.xyz;\n	vec3 c1 = vec3( s0.w, s1.xy );\n	vec3 c2 = vec3( s1.zw, s2.x );\n	vec3 c3 = s2.yzw;\n	vec3 c4 = s3.xyz;\n	vec3 c5 = vec3( s3.w, s4.xy );\n	vec3 c6 = vec3( s4.zw, s5.x );\n	vec3 c7 = s5.yzw;\n	vec3 c8 = s6.xyz;\n	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n	vec3 result = c0 * 0.886227;\n	result += c1 * 2.0 * 0.511664 * y;\n	result += c2 * 2.0 * 0.511664 * z;\n	result += c3 * 2.0 * 0.511664 * x;\n	result += c4 * 2.0 * 0.429043 * x * y;\n	result += c5 * 2.0 * 0.429043 * y * z;\n	result += c6 * ( 0.743125 * z * z - 0.247708 );\n	result += c7 * 2.0 * 0.429043 * x * z;\n	result += c8 * 0.429043 * ( x * x - y * y );\n	return max( result, vec3( 0.0 ) );\n}\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n	uniform float logDepthBufFC;\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n	vFragDepth = 1.0 + gl_Position.w;\n	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n	vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n	#endif\n	diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n	uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n	#if defined( USE_POINTS_UV )\n		vec2 uv = vUv;\n	#else\n		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n	#endif\n#endif\n#ifdef USE_MAP\n	diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n	varying vec2 vUv;\n#else\n	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n		uniform mat3 uvTransform;\n	#endif\n#endif\n#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n	metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n	float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n	}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n	vColor *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		#if defined( USE_COLOR_ALPHA )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n		#elif defined( USE_COLOR )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n		#endif\n	}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n	objectNormal *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n	}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n	#ifndef USE_INSTANCING_MORPH\n		uniform float morphTargetBaseInfluence;\n		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n	#endif\n	uniform sampler2DArray morphTargetsTexture;\n	uniform ivec2 morphTargetsTextureSize;\n	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n		int y = texelIndex / morphTargetsTextureSize.x;\n		int x = texelIndex - y * morphTargetsTextureSize.x;\n		ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n		return texelFetch( morphTargetsTexture, morphUV, 0 );\n	}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n	transformed *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n	}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n	vec3 fdx = dFdx( vViewPosition );\n	vec3 fdy = dFdy( vViewPosition );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal );\n	#ifdef DOUBLE_SIDED\n		normal *= faceDirection;\n	#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n	#ifdef USE_TANGENT\n		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn = getTangentFrame( - vViewPosition, normal,\n		#if defined( USE_NORMALMAP )\n			vNormalMapUv\n		#elif defined( USE_CLEARCOAT_NORMALMAP )\n			vClearcoatNormalMapUv\n		#else\n			vUv\n		#endif\n		);\n	#endif\n	#ifdef DOUBLE_SIDED\n		tbn[0] *= faceDirection;\n		tbn[1] *= faceDirection;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	#ifdef USE_TANGENT\n		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n	#endif\n	#ifdef DOUBLE_SIDED\n		tbn2[0] *= faceDirection;\n		tbn2[1] *= faceDirection;\n	#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	#ifdef FLIP_SIDED\n		normal = - normal;\n	#endif\n	#ifdef DOUBLE_SIDED\n		normal = normal * faceDirection;\n	#endif\n	normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	#if defined( USE_PACKED_NORMALMAP )\n		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n	#endif\n	mapN.xy *= normalScale;\n	normal = normalize( tbn * mapN );
1\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n	#ifdef USE_TANGENT\n		vTangent = normalize( transformedTangent );\n		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n		#ifdef FLIP_SIDED\n			vBitangent = - vBitangent;\n		#endif\n	#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n	uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( uv.st );\n		vec2 st1 = dFdy( uv.st );\n		vec3 N = surf_norm;\n		vec3 q1perp = cross( q1, N );\n		vec3 q0perp = cross( N, q0 );\n		vec3 T = q1perp * st0.x + q0perp * st1.x;\n		vec3 B = q1perp * st0.y + q0perp * st1.y;\n		float det = max( dot( T, T ), dot( B, B ) );\n		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n		return mat3( T * scale, B * scale, N );\n	}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n	clearcoatMapN.xy *= clearcoatNormalScale;\n	clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n	uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform sampler2D clearcoatNormalMap;\n	uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n	uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n	return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n	return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n	if( v <= 0.0 )\n		return vec4( 0., 0., 0., 0. );\n	if( v >= 1.0 )\n		return vec4( 1., 1., 1., 1. );\n	float vuf;\n	float af = modf( v * PackFactors.a, vuf );\n	float bf = modf( vuf * ShiftRight8, vuf );\n	float gf = modf( vuf * ShiftRight8, vuf );\n	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n	if( v <= 0.0 )\n		return vec3( 0., 0., 0. );\n	if( v >= 1.0 )\n		return vec3( 1., 1., 1. );\n	float vuf;\n	float bf = modf( v * PackFactors.b, vuf );\n	float gf = modf( vuf * ShiftRight8, vuf );\n	return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n	if( v <= 0.0 )\n		return vec2( 0., 0. );\n	if( v >= 1.0 )\n		return vec2( 1., 1. );\n	float vuf;\n	float gf = modf( v * 256., vuf );\n	return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n	return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n	return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n	vec4 r = vec4( v.x, fract( v.x * 25
15.0 ), v.y, fract( v.y * 255.0 ) );\n	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n	\n		return depth * ( far - near ) - far;\n	#else\n		return depth * ( near - far ) - near;\n	#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n		return ( near * far ) / ( ( near - far ) * depth - near );\n	#else\n		return ( near * far ) / ( ( far - near ) * depth - far );\n	#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n	mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n	mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n	gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n	vec3 dithering( vec3 color ) {\n		float grid_position = rand( gl_FragCoord.xy );\n		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n		return color + dither_shift_RGB;\n	}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n	roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		#else\n			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		#endif\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		#else\n			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		#endif\n		struct SpotLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		#elif defined( SHADOWMAP_TYPE_BASIC )\n			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		#endif\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n	#if defined( SHADOWMAP_TYPE_PCF )\n		float interleavedGradientNoise( vec2 position ) {\n			return fract( 52.9829189 * fract( dot
1( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n		}\n		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n			const float goldenAngle = 2.399963229728653;\n			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n			float theta = float( sampleIndex ) * goldenAngle + phi;\n			return vec2( cos( theta ), sin( theta ) ) * r;\n		}\n	#endif\n	#if defined( SHADOWMAP_TYPE_PCF )\n		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			shadowCoord.z += shadowBias;\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n				float radius = shadowRadius * texelSize.x;\n				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n				shadow = (\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n				) * 0.2;\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#elif defined( SHADOWMAP_TYPE_VSM )\n		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				shadowCoord.z -= shadowBias;\n			#else\n				shadowCoord.z += shadowBias;\n			#endif\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n				float mean = distribution.x;\n				float variance = distribution.y * distribution.y;\n				#ifdef USE_REVERSED_DEPTH_BUFFER\n					float hard_shadow = step( mean, shadowCoord.z );\n				#else\n					float hard_shadow = step( shadowCoord.z, mean );\n				#endif\n				\n				if ( hard_shadow == 1.0 ) {\n					shadow = 1.0;\n				} else {\n					variance = max( variance, 0.0000001 );\n					float d = shadowCoord.z - mean;\n					float p_max = variance / ( variance + d * d );\n					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n					shadow = max( hard_shadow, p_max );\n				}\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#else\n		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				shadowCoord.z -= shadowBias;\n			#else\n				shadowCoord.z += shadowBias;\n			#endif\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n				#ifdef USE_REVERSED_DEPTH_BUFFER\n					shadow = step( depth, shadowCoord.z );\n				#else\n					shadow = step( shadowCoord.z, depth );\n				#endif\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n	#if defined( SHADOWMAP_TYPE_PCF )\n	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		float shadow = 1.0;\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 bd3D = normalize( lightToPosition );\n		vec3 absVec = abs( lightToPosition );\n		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1\n				dp -= shadowBias;\n			#else\n				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n				dp += shadowBias;\n			#endif\n			float texelSize = shadowRadius / shadowMapSize.x;\n			vec3 absDir = abs( bd3D );\n			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n			tangent = normalize( cross( bd3D, tangent ) );\n			vec3 bitangent = cross( bd3D, tangent );\n			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n			vec2 sample0 = vogelDiskSample( 0, 5, phi );\n			vec2 sample1 = vogelDiskSample( 1, 5, phi );\n			vec2 sample2 = vogelDiskSample( 2, 5, phi );\n			vec2 sample3 = vogelDiskSample( 3, 5, phi );\n			vec2 sample4 = vogelDiskSample( 4, 5, phi );\n			shadow = (\n				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n			) * 0.2;\n		}\n		return mix( 1.0, shadow, shadowIntensity );\n	}\n	#elif defined( SHADOWMAP_TYPE_BASIC )\n	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		float shadow = 1.0;\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 absVec = abs( lightToPosition );\n		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n			dp += shadowBias;\n			vec3 bd3D = normalize( lightToPosition );\n			float depth = textureCube( shadowMap, bd3D ).r;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				depth = 1.0 - depth;\n			#endif\n			shadow = step( dp, depth );\n		}\n		return mix( 1.0, shadow, shadowIntensity );\n	}\n	#endif\n	#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		struct SpotLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n	#ifdef HAS_NORMAL\n		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n	#else\n		vec3 shadowWorldNormal = vec3( 0.0 );\n	#endif\n	vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n		}\n		#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n		}
1\n		#pragma unroll_loop_end\n	#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n		shadowWorldPosition = worldPosition;\n		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n		#endif\n		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n		directionalLight = directionalLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n		spotLight = spotLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n	PointLightShadow pointLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n		pointLight = pointLightShadows[ i ];\n		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#endif\n	return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	uniform highp sampler2D boneTexture;\n	mat4 getBoneMatrix( const in float i ) {\n		int size = textureSize( boneTexture, 0 ).x;\n		int j = int( i ) * 4;\n		int x = j % size;\n		int y = j / size;\n		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n		return mat4( v1, v2, v3, v4 );\n	}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n	#ifdef USE_TANGENT\n		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
1\nvec3 LinearToneMapping( vec3 color ) {\n	return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	color = max( vec3( 0.0 ), color - 0.004 );\n	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n	return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n	const mat3 ACESInputMat = mat3(\n		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),\n		vec3( 0.04823, 0.01566, 0.83777 )\n	);\n	const mat3 ACESOutputMat = mat3(\n		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),\n		vec3( -0.07367, -0.00605,  1.07602 )\n	);\n	color *= toneMappingExposure / 0.6;\n	color = ACESInputMat * color;\n	color = RRTAndODTFit( color );\n	color = ACESOutputMat * color;\n	return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n	vec3( 1.6605, - 0.1246, - 0.0182 ),\n	vec3( - 0.5876, 1.1329, - 0.1006 ),\n	vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n	vec3( 0.6274, 0.0691, 0.0164 ),\n	vec3( 0.3293, 0.9195, 0.0880 ),\n	vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n	vec3 x2 = x * x;\n	vec3 x4 = x2 * x2;\n	return + 15.5 * x4 * x2\n		- 40.14 * x4 * x\n		+ 31.96 * x4\n		- 6.868 * x2 * x\n		+ 0.4298 * x2\n		+ 0.1191 * x\n		- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n	const mat3 AgXInsetMatrix = mat3(\n		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n	);
1\n	const mat3 AgXOutsetMatrix = mat3(\n		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n	);\n	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;\n	color *= toneMappingExposure;\n	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n	color = AgXInsetMatrix * color;\n	color = max( color, 1e-10 );	color = log2( color );\n	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n	color = clamp( color, 0.0, 1.0 );\n	color = agxDefaultContrastApprox( color );\n	color = AgXOutsetMatrix * color;\n	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n	color = clamp( color, 0.0, 1.0 );\n	return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n	const float StartCompression = 0.8 - 0.04;\n	const float Desaturation = 0.15;\n	color *= toneMappingExposure;\n	float x = min( color.r, min( color.g, color.b ) );\n	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n	color -= offset;\n	float peak = max( color.r, max( color.g, color.b ) );\n	if ( peak < StartCompression ) return color;\n	float d = 1. - StartCompression;\n	float newPeak = 1. - d * d / ( peak + d - StartCompression );\n	color *= newPeak / peak;\n	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n	return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n	material.transmission = transmission;\n	material.transmissionAlpha = 1.0;\n	material.thickness = thickness;\n	material.attenuationDistance = attenuationDistance;\n	material.attenuationColor = attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n	#endif\n	vec3 pos = vWorldPosition;\n	vec3 v = normalize( cameraPosition - pos );\n	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );\n	vec4 transmitted = getIBLVolumeRefraction(\n		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n		material.attenuationColor, material.attenuationDistance );\n	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n	uniform float transmission;\n	uniform float thickness;\n	uniform float attenuationDistance;\n	uniform vec3 attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		uniform sampler2D transmissionMap;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		uniform sampler2D thicknessMap;\n	#endif\n	uniform vec2 transmissionSamplerSize;\n	uniform sampler2D transmissionSamplerMap;\n	uniform mat4 modelMatrix;\n	uniform mat4 projectionMatrix;\n	varying vec3 vWorldPosition;\n	float w0( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n	}\n	float w1( float a ) {\n		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n	}\n	float w2( float a ){\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n	}\n	float w3( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * a * a );\n	}\n	float g0( float a ) {\n		return w0( a ) + w1( a );\n	}\n	float g1( float a ) {\n		return w2( a ) + w3( a );\n	}\n	float h0( float a ) {\n		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n	}\n	float h1( float a ) {\n		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n	}\n	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n		uv = uv * texelSize.zw + 0.5;\n		vec2 iuv = floor( uv );\n		vec2 fuv = fract( uv );\n		float g0x = g0( fuv.x );\n		float g1x = g1( fuv.x );\n		float h0x = h0( fuv.x );\n		float h1x = h1( fuv.x );\n		float h0y = h0( fuv.y );\n		float h1y = h1( fuv.y );\n		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n	}\n	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n		vec2 fLodSizeInv = 1.0 / fLodSize;\n		vec2 cLodSizeInv = 1.0 / cLodSize;\n		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n		return mix( fSample, cSample, fract( lod ) );\n	}\n	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n		vec3 modelScale;\n		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n		return normalize( refractionVector ) * thickness * modelScale;\n	}\n	float applyIorToRoughness( const in float roughness, const in float ior ) {\n		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n	}\n	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n	}\n	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n		if ( isinf( attenuationDistance ) ) {\n			return vec3( 1.0 );\n		} else {\n			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;\n		}\n	}\n	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n		const in vec3 attenuationColor, const in float attenuationDistance ) {\n		vec4 transmittedLight;\n		vec3 transmittance;\n		#ifdef USE_DISPERSION\n			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n			for ( int i = 0; i < 3; i ++ ) {\n				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n				vec3 refractedRayExit = position + transmissionRay;\n				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n				vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n				refractionCoords += 1.0;\n				refractionCoords /= 2.0;\n				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n				transmittedLight[ i ] = transmissionSample[ i ];\n				transmittedLight.a += transmissionSample.a;\n				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n			}\n			transmittedLight.a /= 3.0;\n		#else\n			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n			vec3 refractedRayExit = position + transmissionRay;\n			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n			vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n			refractionCoords += 1.0;\n			refractionCoords /= 2.0;\n			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n		#endif\n		vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n	}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n	varying vec2 vMapUv;
1\n#endif\n#ifdef USE_ALPHAMAP\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n	uniform mat3 mapTransform;\n	varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform mat3 alphaMapTransform;\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	uniform mat3 lightMapTransform;\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	uniform mat3 aoMapTransform;\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	uniform mat3 bumpMapTransform;\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	uniform mat3 normalMapTransform;\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	uniform mat3 displacementMapTransform;\n	varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	uniform mat3 emissiveMapTransform;\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	uniform mat3 metalnessMapTransform;\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	uniform mat3 roughnessMapTransform;\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	uniform mat3 anisotropyMapTransform;\n	varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	uniform mat3 clearcoatMapTransform;\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform mat3 clearcoatNormalMapTransform;\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform mat3 clearcoatRoughnessMapTransform;\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	uniform mat3 sheenColorMapTransform;\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	uniform mat3 sheenRoughnessMapTransform;\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	uniform mat3 iridescenceMapTransform;\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform mat3 iridescenceThicknessMapTransform;\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	uniform mat3 specularMapTransform;\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	uniform mat3 specularColorMapTransform;\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	uniform mat3 specularIntensityMapTransform;\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
1\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n	vec4 worldPosition = vec4( transformed, 1.0 );\n	#ifdef USE_BATCHING\n		worldPosition = batchingMatrix * worldPosition;\n	#endif\n	#ifdef USE_INSTANCING\n		worldPosition = instanceMatrix * worldPosition;\n	#endif\n	worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n	vec4 texColor = texture2D( t2D, vUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n	uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n	uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n	#elif defined( ENVMAP_TYPE_CUBE_UV )\n		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n	#else\n		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n	gl_FragColor = texColor;\n	gl_FragColor.a *= opacity;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <skinbase_vertex>\n	#include <morphinstance_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n	uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <clipping_planes_fragment>\n	#if DEPTH_PACKING == 3200\n		diffuseColor.a = opacity;\n	#endif\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <logdepthbuf_fragment>\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n	#else\n		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n	#endif\n	#if DEPTH_PACKING == 3200\n		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n	#elif DEPTH_PACKING == 3201\n		gl_FragColor = packDepthToRGBA( fragCoordZ );\n	#elif DEPTH_PACKING == 3202\n		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n	#elif DEPTH_PACKING == 3203\n		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n	#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <skinbase_vertex>\n	#include <morphinstance_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <clipping_planes_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	float dist = length( vWorldPosition - referencePosition );\n	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n	dist = saturate( dist );\n	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vec3 direction = normalize( vWorldDirection );\n	vec2 sampleUV = equirectUv( direction );\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	vLineDistance = scale * lineDistance;\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinbase_vertex>\n		#include <skinnormal_vertex>\n		#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n	#else\n		reflectedLight.indirectDiffuse += vec3( 1.0 );\n	#endif\n	#include <aomap_fragment>\n	reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_lambert_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <mor
1phtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n	vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	vec3 viewDir = normalize( vViewPosition );\n	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n	vec3 y = cross( viewDir, x );\n	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n	#ifdef USE_MATCAP\n		vec4 matcapColor = texture2D( matcap, uv );\n	#else\n		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n	#endif\n	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n	#ifdef OPAQUE\n		gl_FragColor.a = 1.0;\n	#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n	varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n	vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n	#define IOR\n	#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n	uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n	uniform float specularIntensity;\n	uniform vec3 specularColor;\n	#ifdef USE_SPECULAR_COLORMAP\n		uniform sampler2D specularColorMap;\n	#endif\n	#ifdef USE_SPECULAR_INTENSITYMAP\n		uniform sampler2D specularIntensityMap;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT\n	uniform float clearcoat;
1\n	uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n	uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n	uniform float iridescence;\n	uniform float iridescenceIOR;\n	uniform float iridescenceThicknessMinimum;\n	uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n	uniform vec3 sheenColor;\n	uniform float sheenRoughness;\n	#ifdef USE_SHEEN_COLORMAP\n		uniform sampler2D sheenColorMap;\n	#endif\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		uniform sampler2D sheenRoughnessMap;\n	#endif\n#endif\n#ifdef USE_ANISOTROPY\n	uniform vec2 anisotropyVector;\n	#ifdef USE_ANISOTROPYMAP\n		uniform sampler2D anisotropyMap;\n	#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <clearcoat_normal_fragment_begin>\n	#include <clearcoat_normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_physical_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n	#include <transmission_fragment>\n	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n	#ifdef USE_SHEEN\n \n		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n 	#endif\n	#ifdef USE_CLEARCOAT\n		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
1\n	#endif\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_toon_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n	varying vec2 vUv;\n	uniform mat3 uvTransform;\n#endif\nvoid main() {\n	#ifdef USE_POINTS_UV\n		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	#endif\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	gl_PointSize = size;\n	#ifdef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n	#include <logdepthbuf_fragment>\n	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	vec4 mvPosition = modelViewMatrix[ 3 ];\n	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n	#ifndef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) scale *= - mvPosition.z;\n	#endif\n	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n	vec2 rotatedPosition;\n	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n	mvPosition.xy += rotatedPosition;\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n}"},lf={common:{diffuse:{value:new tp(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new eb},alphaMap:{value:null},alphaMapTransform:{value:new eb},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new eb}},envmap:{envMap:{value:null},envMapRotation:{value:new eb},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new eb}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new eb}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new eb},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new eb},normalScale:{value:new eg(1,1)}}
vendor: 6,995 bytes, line 1
1,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new eb},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new eb}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new eb}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new eb}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tp(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new e_},probesMax:{value:new e_},probesResolution:{value:new e_}},points:{diffuse:{value:new tp(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new eb},alphaTest:{value:0},uvTransform:{value:new eb}},sprite:{diffuse:{value:new tp(0xffffff)},opacity:{value:1},center:{value:new eg(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new eb},alphaMap:{value:null},alphaMapTransform:{value:new eb},alphaTest:{value:0}}},lm={basic:{uniforms:aw([lf.common,lf.specularmap,lf.envmap,lf.aomap,lf.lightmap,lf.fog]),vertexShader:lp.meshbasic_vert,fragmentShader:lp.meshbasic_frag},lambert:{uniforms:aw([lf.common,lf.specularmap,lf.envmap,lf.aomap,lf.lightmap,lf.emissivemap,lf.bumpmap,lf.normalmap,lf.displacementmap,lf.fog,lf.lights,{emissive:{value:new tp(0)},envMapIntensity:{value:1}}]),vertexShader:lp.meshlambert_vert,fragmentShader:lp.meshlambert_frag},phong:{uniforms:aw([lf.common,lf.specularmap,lf.envmap,lf.aomap,lf.lightmap,lf.emissivemap,lf.bumpmap,lf.normalmap,lf.displacementmap,lf.fog,lf.lights,{emissive:{value:new tp(0)},specular:{value:new tp(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:lp.meshphong_vert,fragmentShader:lp.meshphong_frag},standard:{uniforms:aw([lf.common,lf.envmap,lf.aomap,lf.lightmap,lf.emissivemap,lf.bumpmap,lf.normalmap,lf.displacementmap,lf.roughnessmap,lf.metalnessmap,lf.fog,lf.lights,{emissive:{value:new tp(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lp.meshphysical_vert,fragmentShader:lp.meshphysical_frag},toon:{uniforms:aw([lf.common,lf.aomap,lf.lightmap,lf.emissivemap,lf.bumpmap,lf.normalmap,lf.displacementmap,lf.gradientmap,lf.fog,lf.lights,{emissive:{value:new tp(0)}}]),vertexShader:lp.meshtoon_vert,fragmentShader:lp.meshtoon_frag},matcap:{uniforms:aw([lf.common,lf.bumpmap,lf.normalmap,lf.displacementmap,lf.fog,{matcap:{value:null}}]),vertexShader:lp.meshmatcap_vert,fragmentShader:lp.meshmatcap_frag},points:{uniforms:aw([lf.points,lf.fog]),vertexShader:lp.points_vert,fragmentShader:lp.points_frag},dashed:{uniforms:aw([lf.common,lf.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lp.linedashed_vert,fragmentShader:lp.linedashed_frag},depth:{uniforms:aw([lf.common,lf.displacementmap]),vertexShader:lp.depth_vert,fragmentShader:lp.depth_frag},normal:{uniforms:aw([lf.common,lf.bumpmap,lf.normalmap,lf.displacementmap,{opacity:{value:1}}]),vertexShader:lp.meshnormal_vert,fragmentShader:lp.meshnormal_frag},sprite:{uniforms:aw([lf.sprite,lf.fog]),vertexShader:lp.sprite_vert,fragmentShader:lp.sprite_frag},background:{uniforms:{uvTransform:{value:new eb},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lp.background_vert,fragmentShader:lp.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new eb}},vertexShader:lp.backgroundCube_vert,fragmentShader:lp.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lp.cube_vert,fragmentShader:lp.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lp.equirect_vert,fragmentShader:lp.equirect_frag},distance:{uniforms:aw([lf.common,lf.displacementmap,{referencePosition:{value:new e_},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lp.distance_vert,fragmentShader:lp.distance_frag},shadow:{uniforms:aw([lf.lights,lf.fog,{color:{value:new tp(0)},opacity:{value:1}}]),vertexShader:lp.shadow_vert,fragmentShader:lp.shadow_frag}};lm.physical={uniforms:aw([lm.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new eb},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new eb},clearcoatNormalScale:{value:new eg(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new eb},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new eb},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new eb},sheen:{value:0},sheenColor:{value:new tp(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new eb},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new eb},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new eb},transmissionSamplerSize:{value:new eg},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new eb},attenuationDistance:{value:0},attenuationColor:{value:new tp(0)},specularColor:{value:new tp(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new eb},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new eb},anisotropyVector:{value:new eg},anisotropyMap:{value:null},anisotropyMapTransform:{value:new eb}}]),vertexShader:lp.meshphysical_vert,fragmentShader:lp.meshphysical_frag};let lg={r:0,b:0,g:0},lv=new eV,l_=new eb;function ly(e,t,n,i,r,a){let s,o,l=new tp(0),u=+(!0!==r),c=null,h=0,d=null;function p(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){let i=e.backgroundBlurriness>0;
1n=t.get(n,i)}return n}function f(t,i){t.getRGB(lg,aA(e)),n.buffers.color.setClear(lg.r,lg.g,lg.b,i,a)}return{getClearColor:function(){return l},setClearColor:function(e,t=1){l.set(e),f(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){f(l,u=e)},render:function(t){let i=!1,r=p(t);null===r?f(l,u):r&&r.isColor&&(f(r,1),i=!0);let s=e.xr.getEnvironmentBlendMode();"additive"===s?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let r=p(n);r&&(r.isCubeTexture||306===r.mapping)?(void 0===o&&((o=new n1(new rm(1,1,1),new aR({name:"BackgroundCubeMaterial",uniforms:aT(lm.backgroundCube.uniforms),vertexShader:lm.backgroundCube.vertexShader,fragmentShader:lm.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=r,o.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.uniforms.backgroundRotation.value.setFromMatrix4(lv.makeRotationFromEuler(n.backgroundRotation)).transpose(),r.isCubeTexture&&!1===r.isRenderTargetTexture&&o.material.uniforms.backgroundRotation.value.premultiply(l_),o.material.toneMapped="srgb"!==ew.getTransfer(r.colorSpace),(c!==r||h!==r.version||d!==e.toneMapping)&&(o.material.needsUpdate=!0,c=r,h=r.version,d=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null)):r&&r.isTexture&&(void 0===s&&((s=new n1(new ad(2,2),new aR({name:"BackgroundMaterial",uniforms:aT(lm.background.uniforms),vertexShader:lm.background.vertexShader,fragmentShader:lm.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=r,s.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,s.material.toneMapped="srgb"!==ew.getTransfer(r.colorSpace),!0===r.matrixAutoUpdate&&r.updateMatrix(),s.material.uniforms.uvTransform.value.copy(r.matrix),(c!==r||h!==r.version||d!==e.toneMapping)&&(s.material.needsUpdate=!0,c=r,h=r.version,d=e.toneMapping),s.layers.enableAll(),t.unshift(s,s.geometry,s.material,0,0,null))},dispose:function(){void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}}}function lx(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=u(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function h(e){d(e,0)}function d(t,n){let i=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==n&&(e.vertexAttribDivisor(t,n),s[t]=n)}function p(){let t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function f(t,n,i,r,a,s,o){!0===o?e.vertexAttribIPointer(t,n,i,a,s):e.vertexAttribPointer(t,n,i,r,a,s)}function m(){g(),s=!0,a!==r&&o((a=r).object)}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,m,g){var v,_,y;let x,b,S,M,T,w,E=!1,A=(v=n,_=m,y=l,x=!0===r.wireframe,void 0===(b=i[_.id])&&(b={},i[_.id]=b),void 0===(M=b[S=!0===v.isInstancedMesh?v.id:0])&&(M={},b[S]=M),void 0===(T=M[y.id])&&(T={}
vendor: 4,615 bytes, line 1
1,M[y.id]=T),void 0===(w=T[x])&&(w=u(e.createVertexArray()),T[x]=w),w);a!==A&&o((a=A).object),(E=function(e,t,n,i){let r=a.attributes,s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=r[t],i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n||n.attribute!==i||i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,m,l,g))&&function(e,t,n,i){let r={},s=t.attributes,o=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(E||s)&&(s=!1,function(n,i,r,a){c();let s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(let i in o){let r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){let i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)h(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,c,i,l*p,(g+s/r.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)h(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,c,i,s*p,s/r.locationSize*e*p,m)}}else if(void 0!==l){let t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),i){let t=i[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)l(t[e].object),delete t[e];delete n[e]}}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;let t=i[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)l(t[e].object),delete t[e];delete n[e]}}delete i[e.id]},releaseStatesOfObject:function(e){for(let t in i){let n=i[t],r=!0===e.isInstancedMesh?e.id:0,a=n[r];if(void 0!==a){for(let e in a){let t=a[e];for(let e in t)l(t[e].object),delete t[e];delete a[e]}delete n[r],0===Object.keys(n).length&&delete i[t]}}},releaseStatesOfProgram:function(e){for(let t in i){let n=i[t];for(let t in n){let i=n[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)l(r[e].object),delete r[e];delete i[e.id]}}},initAttributes:c,enableAttribute:h,disableUnusedAttributes:p}}function lb(e,t,n){let i;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))},this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let s=0;for(let e=0;e<a;e++)s+=r[e];n.update(s,i,1)}}function lS(e,t,n,i){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp",o=a(s);o!==s&&(ee("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control");return!0===n.reversedDepthBuffer&&!1===u&&ee("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),{isWebG
1L2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let r=1016===n&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===n||i.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===n||!!r},precision:s,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function lM(e){let t=this,n=null,i=0,r=!1,a=!1,s=new iS,o=new eb,l={value:null,needsUpdate:!1};function u(e,n,i,r){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){let t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(u,n),u[n+3]=s.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(s,o,c){let h=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(r&&null!==h&&0!==h.length&&(!a||p)){let e=a?0:i,t=4*e,r=f.clippingState||null;l.value=r,r=u(h,o,t,c);for(let e=0;e!==t;++e)r[e]=n[e];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?u(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0)}}l_.set(-1,0,0,0,1,0,0,0,1);let lT=[.125,.215,.35,.446,.526,.582],lw=new sR,lE=new tp,lA=null,lC=0,lR=0,lP=!1,lI=new e_;class lL{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,r={}){let{size:a=256,position:s=lI}=r;lA=this._renderer.getRenderTarget(),lC=this._renderer.getActiveCubeFace(),lR=this._renderer.getActiveMipmapLevel(),lP=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,n,i,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lO(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=lD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lA,lC,lR),this._renderer.xr.enabled=lP,e.scissorTest=!1,lU(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),lA=this._renderer.getRenderTarget(),lC=this._renderer.getActiveCubeFace(),lR=this._renderer.getActiveMipmapLevel(),lP=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:O,depthBuffer:!1},i=lN(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var r,a;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=lN(e,t,n);let{_lodMax:i}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){let t=[],n=[],i=[],r=e,a=e-4+1+lT.length;for(let s=0;s<a;s++){let a=Math.pow(2,r);t.push(a);let o=1/a;s>e-4?o=lT[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];
1d.set(i,18*e),p.set(h,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new nh;m.setAttribute("position",new t0(d,3)),m.setAttribute("uv",new t0(p,2)),m.setAttribute("faceIndex",new t0(f,1)),i.push(new n1(m,null)),r>4&&r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}(i)),this._blurMaterial=(r=i,new aR({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new e_(0,1,0)}},vertexShader:lF(),fragmentShader:`
2
3			precision mediump float;
4			precision mediump int;
5
6			varying vec3 vOutputDirection;
7
8			uniform sampler2D envMap;
9			uniform int samples;
10			uniform float weights[ n ];
11			uniform bool latitudinal;
12			uniform float dTheta;
13			uniform float mipInt;
14			uniform vec3 poleAxis;
15
16			#define ENVMAP_TYPE_CUBE_UV
17			#include <cube_uv_reflection_fragment>
18
19			vec3 getSample( float theta, vec3 axis ) {
20
21				float cosTheta = cos( theta );
22				// Rodrigues' axis-angle rotation
23				vec3 sampleDirection = vOutputDirection * cosTheta
24					+ cross( axis, vOutputDirection ) * sin( theta )
25					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
26
27				return bilinearCubeUV( envMap, sampleDirection, mipInt );
28
29			}
30
31			void main() {
32
33				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
34
35				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
36
37					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
38
39				}
40
41				axis = normalize( axis );
42
43				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
44				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
45
46				for ( int i = 1; i < n; i++ ) {
47
48					if ( i >= samples ) {
49
50						break;
51
52					}
53
54					float theta = dTheta * float( i );
55					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
56					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
57
58				}
59
60			}
61		`,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=i,new aR({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lF(),fragmentShader:`
62
63			precision highp float;
64			precision highp int;
65
66			varying vec3 vOutputDirection;
67
68			uniform sampler2D envMap;
69			uniform float roughness;
70			uniform float mipInt;
71
72			#define ENVMAP_TYPE_CUBE_UV
73			#include <cube_uv_reflection_fragment>
74
75			#define PI 3.14159265359
76
77			// Van der Corput radical inverse
78			float radicalInverse_VdC(uint bits) {
79				bits = (bits << 16u) | (bits >> 16u);
80				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
81				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
82				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
83				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
84				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
85			}
86
87			// Hammersley sequence
88			vec2 hammersley(uint i, uint N) {
89				return vec2(float(i) / float(N), radicalInverse_VdC(i));
90			}
91
92			// GGX VNDF importance sampling (Eric Heitz 2018)
93			// "Sampling the GGX Distribution of Visible Normals"
94			// https://jcgt.org/published/0007/04/01/
95			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
96				float alpha = roughness * roughness;
97
98				// Section 4.1: Orthonormal basis
99				vec3 T1 = vec3(1.0, 0.0, 0.0);
100				vec3 T2 = cross(V, T1);
101
102				// Section 4.2: Parameterization of projected area
103				float r = sqrt(Xi.x);
104				float phi = 2.0 * PI * Xi.y;
105				float t1 = r * cos(phi);
106				float t2 = r * sin(phi);
107				float s = 0.5 * (1.0 + V.z);
108				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
109
110				// Section 4.3: Reprojection onto hemisphere
111				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
112
113				// Section 3.4: Transform back to ellipsoid configuration
114				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
115			}
116
117			void main() {
118				vec3 N = normalize(vOutputDirection);
119				vec3 V = N; // Assume view direction equals normal for pre-filtering
120
121				vec3 prefilteredColor = vec3(0.0);
122				float totalWeight = 0.0;
123
124				// For very low roughness, just sample the environment directly
125				if (roughness < 0.001) {
126					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
127					return;
128				}
129
130				// Tangent space basis for VNDF sampling
131				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
132				vec3 tangent = normalize(cross(up, N));
133				vec3 bitangent = cross(N, tangent);
134
135				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
136					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
137
138					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
139					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
140
141					// Transform H back to world space
142					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
143					vec3 L = normalize(2.0 * dot(V, H) * H - V);
144
145					float NdotL = max(dot(N, L), 0.0);
146
147					if(NdotL > 0.0) {
148						// Sample environment at fixed mip level
149						// VNDF importance sampling handles the distribution filtering
150						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
151
152						// Weight by NdotL for the split-sum approximation
153						// VNDF PDF naturally accounts for the visible microfacet distribution
154						prefilteredColor += sampleColor * NdotL;
155						totalWeight += NdotL;
156					}
157				}
158
159				if (totalWeight > 0.0) {
160					prefilteredColor = prefilteredColor / totalWeight;
161				}
162
163				gl_FragColor = vec4(prefilteredColor, 1.0);
164			}
165		`,blending:0,depthTest:!1,depthWrite:!1}))}return i}_compileMaterial(e){let t=new n1(new nh,e);this._renderer.compile(t,lw)}_sceneToCubeUV(e,t,n,i,r){let a=new sT(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(lE),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new n1(new rm,new nG({name:"PMREM.Backgroun
165d",side:1,depthWrite:!1,depthTest:!1})));let h=this._backgroundBox,d=h.material,p=!1,f=e.background;f?f.isColor&&(d.color.copy(f),e.background=null,p=!0):(d.color.copy(lE),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[t],r.y,r.z)):1===n?(a.up.set(0,0,s[t]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[t],r.z)):(a.up.set(0,s[t],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[t]));let u=this._cubeSize;lU(i,n*u,t>2?u:0,u,u),l.setRenderTarget(i),p&&l.render(h,a),l.render(e,a)}l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let n=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=lO()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=lD());let r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r,r.uniforms.envMap.value=e;let s=this._cubeSize;lU(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,lw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let t=1;t<i;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let i=this._renderer,r=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[n];s.material=a;let o=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-u*u),{_lodMax:h}=this,d=this._sizeLods[n],p=3*d*(n>h-4?n-h+4:0),f=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=h-t,lU(r,p,f,3*d,2*d),i.setRenderTarget(r),i.render(s,lw),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=h-n,lU(e,p,f,3*d,2*d),i.setRenderTarget(e),i.render(s,lw)}_blur(e,t,n,i,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&et("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[i];u.material=l;let c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&ee(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e<f&&(g+=2*n)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:v}=this;c.dTheta.value=d,c.mipInt.value=v-n;let _=this._sizeLods[i],y=4*(this._cubeSize-_);lU(t,3*_*(i>v-4?i-v+4:0),y,3*_,2*_),o.setRenderTarget(t),o.render(u,lw)}}function lN(e,t,n){let i=new eF(e,t,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function lU(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function lD(){return new aR({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lF(),fragmentShader:`
166
167			precision mediump float;
168			precision mediump int;
169
170			varying vec3 vOutputDirection;
171
172			uniform sampler2D envMap;
173
174			#include <common>
175
176			void main() {
177
178				vec3 outputDirection = normalize( vOutputDirection );
179				vec2 uv = equirectUv( outputDirection );
180
181				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
182
183			}
184		`,blending:0,depthTest:!1,depthWrite:!1})}function lO(){return new aR({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lF(),fragmentShader:`
185
186			precision mediump float;
187			precision mediump int;
188
189			uniform float flipEnvMap;
190
191			varying vec3 vOutputDirection;
192
193			uniform samplerCube envMap;
194
195			void main() {
196
197				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
198
199			}
200		`,blending:0,depthTest:!1,depthWrite:!1})}function lF(){return`
201
202		precision mediump float;
203		precision mediump int;
204
205		attribute float faceIndex;
206
207		varying vec3 vOutputDirection;
208
209		// RH coordinate system; PMREM face-indexing convention
210		vec3 getDirection( vec2 uv, float face ) {
211
212			uv = 2.0 * uv - 1.0;
213
214			vec3 direction = vec3( uv, 1.0 );
215
216			if ( face == 0.0 ) {
217
218				direction = direction.zyx; // ( 1, v, u ) pos x
219
220			} else if ( face == 1.0 ) {
221
222				direction = direction.xzy;
223				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
224
225			} else if ( face == 2.0 ) {
226
227				direction.x *= -1.0; // ( -u, v, 1 ) pos z
228
229			} else if ( face == 3.0 ) {
230
231				direction = direction.zyx;
232				direction.xz *= -1.0; // ( -1, v, -u ) neg x
233
234			} else if ( face == 4.0 ) {
235
236				direction = direction.xzy;
237				direction.xy *= -1.0; // ( -u, -1, v ) neg y
238
239			} else if ( face == 5.0 ) {
240
241				direction.z *= -1.0; // ( u, v, -1 ) neg z
242
243			}
244
245			return direction;
246
247		}
248
249		void main() {
250
251			vOutputDirection = getDirection( uv, faceIndex );
252			gl_Position = vec4( position, 1.0 );
253
254		}
255	`}class lB extends eF{constructor(e=1,t={}
255){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1};this.texture=new ru([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
256
257				varying vec3 vWorldDirection;
258
259				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
260
261					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
262
263				}
264
265				void main() {
266
267					vWorldDirection = transformDirection( position, modelMatrix );
268
269					#include <begin_vertex>
270					#include <project_vertex>
271
272				}
273			`,fragmentShader:`
274
275				uniform sampler2D tEquirect;
276
277				varying vec3 vWorldDirection;
278
279				#include <common>
280
281				void main() {
282
283					vec3 direction = normalize( vWorldDirection );
284
285					vec2 sampleUV = equirectUv( direction );
286
287					gl_FragColor = texture2D( tEquirect, sampleUV );
288
289				}
290			`},i=new rm(5,5,5),r=new aR({name:"CubemapFromEquirect",uniforms:aT(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new n1(i,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new s0(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}function lz(e){let t=new WeakMap,n=new WeakMap,i=null;function r(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function a(e){let n=e.target;n.removeEventListener("dispose",a);let i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}function s(e){let t=e.target;t.removeEventListener("dispose",s);let i=n.get(t);void 0!==i&&(n.delete(t),i.dispose())}return{get:function(o,l=!1){return null==o?null:l?function(t){if(t&&t.isTexture){let r=t.mapping,a=303===r||304===r,o=301===r||302===r;if(a||o){let r=n.get(t),l=void 0!==r?r.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===i&&(i=new lL(e)),(r=a?i.fromEquirectangular(t,r):i.fromCubemap(t,r)).texture.pmremVersion=t.pmremVersion,n.set(t,r),r.texture;{if(void 0!==r)return r.texture;let l=t.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===i&&(i=new lL(e)),(r=a?i.fromEquirectangular(t):i.fromCubemap(t)).texture.pmremVersion=t.pmremVersion,n.set(t,r),t.addEventListener("dispose",s),r.texture):null}}}return t}(o):function(n){if(n&&n.isTexture){let i=n.mapping;if(303===i||304===i)if(t.has(n))return r(t.get(n).texture,n.mapping);else{let i=n.image;if(!i||!(i.height>0))return null;{let s=new lB(i.height);return s.fromEquirectangularTexture(e,n),t.set(n,s),n.addEventListener("dispose",a),r(s.texture,n.mapping)}}}return n}(o)},dispose:function(){t=new WeakMap,n=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function lk(e){let t={};
vendor: 4,760 bytes, line 290
290function n(n){if(void 0!==t[n])return t[n];let i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&en("WebGLRenderer: "+e+" extension not supported."),t}}}function lH(e,t,n,i){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){let n=[],i=e.index,r=e.attributes.position,s=0;if(void 0===r)return;if(null!==i){let e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){let i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{let e=r.array;s=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){let e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}let o=new(r.count>=65535?t8:t5)(n,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,n.memory.geometries++),t},update:function(n){let i=n.attributes;for(let n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return a.get(e)}}}function lV(e,t,n){let i,r,a;this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(i,s,r,t*a),n.update(s,i,1)},this.renderInstances=function(t,s,o){0!==o&&(e.drawElementsInstanced(i,s,r,t*a,o),n.update(s,i,o))},this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];n.update(o,i,1)}}function lG(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=n/3*r;break;case e.LINES:t.lines+=n/2*r;break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:et("WebGLInfo: Unknown draw mode:",i)}}}}function lW(e,t,n){let i=new WeakMap,r=new eD;return{update:function(a,s,o){let l=a.morphTargetInfluences,u=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==u?u.length:0,h=i.get(s);if(void 0===h||h.count!==c){void 0!==h&&h.texture.dispose();let e=void 0!==s.morphAttributes.position,n=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],u=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===n&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*c),g=new eB(m,p,f,c);g.type=1015,g.needsUpdate=!0;let v=4*d;for(let t=0;t<c;t++){let i=o[t],s=l[t],c=u[t],h=p*f*4*t;for(let t=0;t<i.count;t++){let o=t*v;!0===e&&(r.fromBufferAttribute(i,t),m[h+o+0]=r.x,m[h+o+1]=r.y,m[h+o+2]=r.z,m[h+o+3]=0),!0===n&&(r.fromBufferAttribute(s,t),m[h+o+4]=r.x,m[h+o+5]=r.y,m[h+o+6]=r.z,m[h+o+7]=0),!0===a&&(r.fromBufferAttribute(c,t),m[h+o+8]=r.x,m[h+o+9]=r.y,m[h+o+10]=r.z,m[h+o+11]=4===c.itemSize?r.w:1)}}h={count:c,texture:g,size:new eg(p,f)},i.set(s,h),s.addEventListener("dispose",function e(){g.dispose(),i.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let n=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",n),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",h.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}}}function lj(e,t,n,i,r){let a=new WeakMap;function s(e){let t=e.target;t.removeEventListener("dispose",s),i.releaseStatesOfObject(t),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(i){let o=r.render.frame,l=i.geometry,u=t.get(i,l);if(a.get(u)!==o&&(t.update(u),a.set(u,o)),i.isInstancedMesh&&(!1===i.hasEventListener("dispose",s)&&i.addEventListener("dispose",s),a.get(i)!==o&&(n.update(i.instanceMatrix,e.ARRAY_BUFFER),null!==i.instanceColor&&n.update(i.instanceColor,e.ARRAY_BUFFER),a.set(i,o))),i.isSkinnedMesh){let e=i.skeleton;
290a.get(e)!==o&&(e.update(),a.set(e,o))}return u},dispose:function(){a=new WeakMap}}}let lX={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function lq(e,t,n,i,r,a){let s,o=new eF(t,n,{type:e,depthBuffer:r,stencilBuffer:a,samples:4*!!i,depthTexture:r?new rd(t,n):void 0}),l=new eF(t,n,{type:1016,depthBuffer:!1,stencilBuffer:!1}),u=new nh;u.setAttribute("position",new t9([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new t9([0,2,0,0,2,0],2));let c=new aP({uniforms:{tDiffuse:{value:null}},vertexShader:`
291			precision highp float;
292
293			uniform mat4 modelViewMatrix;
294			uniform mat4 projectionMatrix;
295
296			attribute vec3 position;
297			attribute vec2 uv;
298
299			varying vec2 vUv;
300
301			void main() {
302				vUv = uv;
303				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
304			}`,fragmentShader:`
305			precision highp float;
306
307			uniform sampler2D tDiffuse;
308
309			varying vec2 vUv;
310
311			#include <tonemapping_pars_fragment>
312			#include <colorspace_pars_fragment>
313
314			void main() {
315				gl_FragColor = texture2D( tDiffuse, vUv );
316
317				#ifdef LINEAR_TONE_MAPPING
318					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
319				#elif defined( REINHARD_TONE_MAPPING )
320					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
321				#elif defined( CINEON_TONE_MAPPING )
322					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
323				#elif defined( ACES_FILMIC_TONE_MAPPING )
324					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
325				#elif defined( AGX_TONE_MAPPING )
326					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
327				#elif defined( NEUTRAL_TONE_MAPPING )
328					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
329				#elif defined( CUSTOM_TONE_MAPPING )
330					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
331				#endif
332
333				#ifdef SRGB_TRANSFER
334					gl_FragColor = sRGBTransferOETF( gl_FragColor );
335				#endif
336			}`,depthTest:!1,depthWrite:!1}),h=new n1(u,c),d=new sR(-1,1,1,-1,0,1),p=null,f=null,m=!1,g=null,v=[],_=!1;this.setSize=function(e,t){o.setSize(e,t),l.setSize(e,t);for(let n=0;n<v.length;n++){let i=v[n];i.setSize&&i.setSize(e,t)}},this.setEffects=function(e){_=(v=e).length>0&&!0===v[0].isRenderPass;let t=o.width,n=o.height;for(let e=0;e<v.length;e++){let i=v[e];i.setSize&&i.setSize(t,n)}},this.begin=function(e,t){if(m||0===e.toneMapping&&0===v.length)return!1;if(g=t,null!==t){let e=t.width,n=t.height;(o.width!==e||o.height!==n)&&this.setSize(e,n)}return!1===_&&e.setRenderTarget(o),s=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return _},this.end=function(e,t){e.toneMapping=s,m=!0;let n=o,i=l;for(let r=0;r<v.length;r++){let a=v[r];if(!1!==a.enabled&&(a.render(e,i,n,t),!1!==a.needsSwap)){let e=n;n=i,i=e}}if(p!==e.outputColorSpace||f!==e.toneMapping){p=e.outputColorSpace,f=e.toneMapping,c.defines={},"srgb"===ew.getTransfer(p)&&(c.defines.SRGB_TRANSFER="");let t=lX[f];t&&(c.defines[t]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(g),e.render(h,d),g=null,m=!1},this.isCompositing=function(){return m},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),l.dispose(),u.dispose(),c.dispose()}}let lY=new eU,lZ=new rd(1,1),lK=new eB,lJ=new ek,l$=new ru,lQ=[],l0=[],l1=new Float32Array(16),l2=new Float32Array(9),l3=new Float32Array(4);function l4(e,t,n){let i=e[0];if(i<=0||i>0)return e;let r=t*n,a=lQ[r];if(void 0===a&&(a=new Float32Array(r),lQ[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function l5(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function l6(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function l8(e,t){let n=l0[t];void 0===n&&(n=new Int32Array(t),l0[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function l7(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function l9(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(l5(n,t))return;e.uniform2fv(this.addr,t),l6(n,t)}}function ue(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(l5(n,t))return;e.uniform3fv(this.addr,t),l6(n,t)}}function ut(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(l5(n,t))return;e.uniform4fv(this.addr,t),l6(n,t)}}function un(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(l5(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),l6(n,t)}else{if(l5(n,i))return;l3.set(i),e.uniformMatrix2fv(this.addr,!1,l3),l6(n,i)}}function ui(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(l5(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),l6(n,t)}else{if(l5(n,i))return;l2.set(i),e.uniformMatrix3fv(this.addr,!1,l2),l6(n,i)}}function ur(e,t){let n=this.cache,i=t.elements;if(void 0===i){if(l5(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),l6(n,t)}else{if(l5(n,i))return;l1.set(i),e.uniformMatrix4fv(this.addr,!1,l1),l6(n,i)}}function ua(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function us(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(l5(n,t))return;e.uniform2iv(this.addr,t),l6(n,t)}}function uo(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(l5(n,t))return;e.uniform3iv(this.addr,t),l6(n,t)}}function ul(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(l5(n,t))return;e.uniform4iv(this.addr,t),l6(n,t)}}function uu(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function uc(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(l5(n,t))return;e.uniform2uiv(this.addr,t),l6(n,t)}}function uh(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(l5(n,t))return;e.uniform3uiv(this.addr,t),l6(n,t)}}function ud(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(l5(n,t))return;e.uniform4uiv(this.addr,t),l6(n,t)}}function up(e,t,n){let i,r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),this.type===e.SAMPLER_2D_SHADOW?(lZ.compareFunction=n.isReversedDepthBuffer()?518:515,i=lZ):i=lY,n.setTexture2D(t||i,a)}function uf(e,t,n){let i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||lJ,r)}function um(e,t,n){let i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||l$,r)}function ug(e,t,n){let i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||lK,r)}function uv(e,t){e.uniform1fv(this.addr,t)}function u_(e,t){let n=l4(t,this.size,2);e.uniform2fv(this.addr,n)}function uy(e,t){let n=l4(t,this.size,3);e.uniform3fv(this.addr,n)}function ux(e,t){let n=l4(t,this.size,4);e.uniform4fv(this.addr,n)}function ub(e,t){let n=l4(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function uS(e,t){let n=l4(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function uM(e,t){let n=l4(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function uT(e,t){e.uniform1iv(this.addr,t)}function uw(e,t){e.uniform2iv(this.addr,t)}function uE(e,t){e.uniform3iv(this.addr,t)}function uA(e,t){e.uniform4iv(this.addr,t)}function uC(e,t){e.uniform1uiv(this.addr,t)}function uR(e,t){e.uniform2uiv(this.addr,t)}function uP(e,t){e.uniform3uiv(this.addr,t)}function uI(e,t){e.uniform4uiv(this.addr,t)}
336function uL(e,t,n){let i,r=this.cache,a=t.length,s=l8(n,a);l5(r,s)||(e.uniform1iv(this.addr,s),l6(r,s)),i=this.type===e.SAMPLER_2D_SHADOW?lZ:lY;for(let e=0;e!==a;++e)n.setTexture2D(t[e]||i,s[e])}function uN(e,t,n){let i=this.cache,r=t.length,a=l8(n,r);l5(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||lJ,a[e])}function uU(e,t,n){let i=this.cache,r=t.length,a=l8(n,r);l5(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||l$,a[e])}function uD(e,t,n){let i=this.cache,r=t.length,a=l8(n,r);l5(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||lK,a[e])}class uO{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return l7;case 35664:return l9;case 35665:return ue;case 35666:return ut;case 35674:return un;case 35675:return ui;case 35676:return ur;case 5124:case 35670:return ua;case 35667:case 35671:return us;case 35668:case 35672:return uo;case 35669:case 35673:return ul;case 5125:return uu;case 36294:return uc;case 36295:return uh;case 36296:return ud;case 35678:case 36198:case 36298:case 36306:case 35682:return up;case 35679:case 36299:case 36307:return uf;case 35680:case 36300:case 36308:case 36293:return um;case 36289:case 36303:case 36311:case 36292:return ug}}(t.type)}}class uF{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return uv;case 35664:return u_;case 35665:return uy;case 35666:return ux;case 35674:return ub;case 35675:return uS;case 35676:return uM;case 5124:case 35670:return uT;case 35667:case 35671:return uw;case 35668:case 35672:return uE;case 35669:case 35673:return uA;case 5125:return uC;case 36294:return uR;case 36295:return uP;case 36296:return uI;case 35678:case 36198:case 36298:case 36306:case 35682:return uL;case 35679:case 36299:case 36307:return uN;case 35680:case 36300:case 36308:case 36293:return uU;case 36289:case 36303:case 36311:case 36292:return uD}}(t.type)}}class uB{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let i=this.seq;for(let r=0,a=i.length;r!==a;++r){let a=i[r];a.setValue(e,t[a.id],n)}}}let uz=/(\w+)(\])?(\[|\.)?/g;function uk(e,t){e.seq.push(t),e.map[t.id]=t}class uH{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i),r=e.getUniformLocation(t,n.name);!function(e,t,n){let i=e.name,r=i.length;for(uz.lastIndex=0;;){let a=uz.exec(i),s=uz.lastIndex,o=a[1],l="]"===a[2],u=a[3];if(l&&(o|=0),void 0===u||"["===u&&s+2===r){uk(n,void 0===u?new uO(o,e,t):new uF(o,e,t));break}{let e=n.map[o];void 0===e&&uk(n,e=new uB(o)),n=e}}}(n,r,this)}const i=[],r=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(t):r.push(t);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){let r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){let i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){let n=[];for(let i=0,r=e.length;i!==r;++i){let r=e[i];r.id in t&&n.push(r)}return n}}function uV(e,t,n){let i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let uG=0,uW=new eb;function uj(e,t,n){let i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){let r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}}let uX={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},uq=new e_;function uY(e){return""!==e}function uZ(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
336IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function uK(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let uJ=/^[ \t]*#include +<([\w\d./]+)>/gm;function u$(e){return e.replace(uJ,u0)}let uQ=new Map;function u0(e,t){let n=lp[t];if(void 0===n){let e=uQ.get(t);if(void 0!==e)n=lp[e],ee('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return u$(n)}let u1=/#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 u2(e){return e.replace(u1,u3)}function u3(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function u4(e){let t=`precision ${e.precision} float;
337	precision ${e.precision} int;
338	precision ${e.precision} sampler2D;
339	precision ${e.precision} samplerCube;
340	precision ${e.precision} sampler3D;
341	precision ${e.precision} sampler2DArray;
342	precision ${e.precision} sampler2DShadow;
343	precision ${e.precision} samplerCubeShadow;
344	precision ${e.precision} sampler2DArrayShadow;
345	precision ${e.precision} isampler2D;
346	precision ${e.precision} isampler3D;
347	precision ${e.precision} isamplerCube;
348	precision ${e.precision} isampler2DArray;
349	precision ${e.precision} usampler2D;
350	precision ${e.precision} usampler3D;
351	precision ${e.precision} usamplerCube;
352	precision ${e.precision} usampler2DArray;
353	`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let u5={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},u6={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},u8={302:"ENVMAP_MODE_REFRACTION"},u7={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function u9(e,t,n,i){var r,a;let s,o,l,u,c=e.getContext(),h=n.defines,d=n.vertexShader,p=n.fragmentShader,f=u5[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC",m=!1===n.envMap?"ENVMAP_TYPE_CUBE":u6[n.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===n.envMap?"ENVMAP_MODE_REFLECTION":u8[n.envMapMode]||"ENVMAP_MODE_REFLECTION",v=!1===n.envMap?"ENVMAP_BLENDING_NONE":u7[n.combine]||"ENVMAP_BLENDING_NONE",_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let n=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/t,maxMip:n}}(n),y=[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(uY).join("\n"),x=function(e){let t=[];for(let n in e){let i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(h),b=c.createProgram(),S=n.glslVersion?"#version "+n.glslVersion+"\n":"";if(n.isRawShaderMaterial)(s=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(uY).join("\n")).length>0&&(s+="\n"),(o=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(uY).join("\n")).length>0&&(o+="\n");else{let e,t,i,l,u;s=[u4(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IR
353IDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(uY).join("\n"),o=[u4(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alph
353aToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+f:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?lp.tonemapping_pars_fragment:"",0!==n.toneMapping?(r="toneMapping",void 0===(e=uX[a=n.toneMapping])?(ee("WebGLProgram: Unsupported toneMapping:",a),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",lp.colorspace_pars_fragment,(t=function(e){ew._getMatrix(uW,ew.workingColorSpace,e);let t=`mat3( ${uW.elements.map(e=>e.toFixed(4))} )`;switch(ew.getTransfer(e)){case"linear":return[t,"LinearTransferOETF"];case"srgb":return[t,"sRGBTransferOETF"];default:return ee("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(n.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
354	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );
355}`),(ew.getLuminanceCoefficients(uq),i=uq.x.toFixed(4),l=uq.y.toFixed(4),u=uq.z.toFixed(4),`float luminance( const in vec3 rgb ) {
356	const vec3 weights = vec3( ${i}, ${l}, ${u} );
357	return dot( weights, rgb );
358}`),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(uY).join("\n")}d=uK(d=uZ(d=u$(d),n),n),p=uK(p=uZ(p=u$(p),n),n),d=u2(d),p=u2(p),!0!==n.isRawShaderMaterial&&(S="#version 300 es\n",s=[y,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+s,o=["#define varying in","300 es"===n.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+o);
vendor: 4,424 bytes, line 358
358let M=S+s+d,T=S+o+p,w=uV(c,c.VERTEX_SHADER,M),E=uV(c,c.FRAGMENT_SHADER,T);function A(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(b)||"",i=c.getShaderInfoLog(w)||"",r=c.getShaderInfoLog(E)||"",a=n.trim(),l=i.trim(),u=r.trim(),h=!0,d=!0;if(!1===c.getProgramParameter(b,c.LINK_STATUS))if(h=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,b,w,E);else{let e=uj(c,w,"vertex"),n=uj(c,E,"fragment");et("WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(b,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+n)}else""!==a?ee("WebGLProgram: Program Info Log:",a):(""===l||""===u)&&(d=!1);d&&(t.diagnostics={runnable:h,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:u,prefix:o}})}c.deleteShader(w),c.deleteShader(E),l=new uH(c,b),u=function(e,t){let n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){let i=e.getActiveAttrib(t,r),a=i.name,s=1;i.type===e.FLOAT_MAT2&&(s=2),i.type===e.FLOAT_MAT3&&(s=3),i.type===e.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return n}(c,b)}c.attachShader(b,w),c.attachShader(b,E),void 0!==n.index0AttributeName?c.bindAttribLocation(b,0,n.index0AttributeName):!0===n.hasPositionAttribute&&c.bindAttribLocation(b,0,"position"),c.linkProgram(b),this.getUniforms=function(){return void 0===l&&A(this),l},this.getAttributes=function(){return void 0===u&&A(this),u};let C=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===C&&(C=c.getProgramParameter(b,37297)),C},this.destroy=function(){i.releaseStatesOfProgram(this),c.deleteProgram(b),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=uG++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=w,this.fragmentShader=E,this}let ce=0;class ct{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let i=this._getShaderCacheForMaterial(e);return!1===i.has(t)&&(i.add(t),t.usedTimes++),!1===i.has(n)&&(i.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new cn(e),t.set(e,n)),n}}class cn{constructor(e){this.id=ce++,this.code=e,this.usedTimes=0}}function ci(e,t,n,i,r,a){let s=new eQ,o=new ct,l=new Set,u=[],c=new Map,h=i.logarithmicDepthBuffer,d=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",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"};function f(e){return(l.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(r,s,u,c,m,g){var v;let _,y,x,b,S=c.fog,M=m.geometry,T=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?c.environment:null,w=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,E=t.get(r.envMap||T,w),A=E&&306===E.mapping?E.image.height:null,C=p[r.type];null!==r.precision&&(d=i.getMaxPrecision(r.precision))!==r.precision&&ee("WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.");let R=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,P=void 0!==R?R.length:0,I=0;if(void 0!==M.morphAttributes.position&&(I=1),void 0!==M.morphAttributes.normal&&(I=2),void 0!==M.morphAttributes.color&&(I=3),C){let e=lm[C];_=e.vertexShader,y=e.fragmentShader}else{_=r.vertexShader,y=r.fragmentShader;let e=o.getVertexShaderStage(r),t=o.getFragmentShaderStage(r);o.update(r,e,t),x=e.id,b=t.id}let L=e.getRenderTarget(),N=e.state.buffers.depth.getReversed(),U=!0===m.isInstancedMesh,D=!0===m.isBatchedMesh,O=!!r.map,F=!!r.matcap,B=!!E,z=!!r.aoMap,k=!!r.lightMap,H=!!r.bumpMap&&
358!1===r.wireframe,V=!!r.normalMap,G=!!r.displacementMap,W=!!r.emissiveMap,j=!!r.metalnessMap,X=!!r.roughnessMap,q=r.anisotropy>0,Y=r.clearcoat>0,Z=r.dispersion>0,K=r.iridescence>0,J=r.sheen>0,$=r.transmission>0,Q=q&&!!r.anisotropyMap,et=Y&&!!r.clearcoatMap,en=Y&&!!r.clearcoatNormalMap,ei=Y&&!!r.clearcoatRoughnessMap,er=K&&!!r.iridescenceMap,ea=K&&!!r.iridescenceThicknessMap,es=J&&!!r.sheenColorMap,eo=J&&!!r.sheenRoughnessMap,el=!!r.specularMap,eu=!!r.specularColorMap,ec=!!r.specularIntensityMap,eh=$&&!!r.transmissionMap,ed=$&&!!r.thicknessMap,ep=!!r.gradientMap,ef=!!r.alphaMap,em=r.alphaTest>0,eg=!!r.alphaHash,ev=!!r.extensions,e_=0;r.toneMapped&&(null===L||!0===L.isXRRenderTarget)&&(e_=e.toneMapping);let ey={shaderID:C,shaderType:r.type,shaderName:r.name,vertexShader:_,fragmentShader:y,defines:r.defines,customVertexShaderID:x,customFragmentShaderID:b,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,batching:D,batchingColor:D&&null!==m._colorsTexture,instancing:U,instancingColor:U&&null!==m.instanceColor,instancingMorph:U&&null!==m.morphTexture,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:ew.workingColorSpace,alphaToCoverage:!!r.alphaToCoverage,map:O,matcap:F,envMap:B,envMapMode:B&&E.mapping,envMapCubeUVHeight:A,aoMap:z,lightMap:k,bumpMap:H,normalMap:V,displacementMap:G,emissiveMap:W,normalMapObjectSpace:V&&1===r.normalMapType,normalMapTangentSpace:V&&0===r.normalMapType,packedNormalMap:V&&0===r.normalMapType&&(1030===(v=r.normalMap.format)||37490===v||36285===v),metalnessMap:j,roughnessMap:X,anisotropy:q,anisotropyMap:Q,clearcoat:Y,clearcoatMap:et,clearcoatNormalMap:en,clearcoatRoughnessMap:ei,dispersion:Z,iridescence:K,iridescenceMap:er,iridescenceThicknessMap:ea,sheen:J,sheenColorMap:es,sheenRoughnessMap:eo,specularMap:el,specularColorMap:eu,specularIntensityMap:ec,transmission:$,transmissionMap:eh,thicknessMap:ed,gradientMap:ep,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:ef,alphaTest:em,alphaHash:eg,combine:r.combine,mapUv:O&&f(r.map.channel),aoMapUv:z&&f(r.aoMap.channel),lightMapUv:k&&f(r.lightMap.channel),bumpMapUv:H&&f(r.bumpMap.channel),normalMapUv:V&&f(r.normalMap.channel),displacementMapUv:G&&f(r.displacementMap.channel),emissiveMapUv:W&&f(r.emissiveMap.channel),metalnessMapUv:j&&f(r.metalnessMap.channel),roughnessMapUv:X&&f(r.roughnessMap.channel),anisotropyMapUv:Q&&f(r.anisotropyMap.channel),clearcoatMapUv:et&&f(r.clearcoatMap.channel),clearcoatNormalMapUv:en&&f(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ei&&f(r.clearcoatRoughnessMap.channel),iridescenceMapUv:er&&f(r.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&f(r.iridescenceThicknessMap.channel),sheenColorMapUv:es&&f(r.sheenColorMap.channel),sheenRoughnessMapUv:eo&&f(r.sheenRoughnessMap.channel),specularMapUv:el&&f(r.specularMap.channel),specularColorMapUv:eu&&f(r.specularColorMap.channel),specularIntensityMapUv:ec&&f(r.specularIntensityMap.channel),transmissionMapUv:eh&&f(r.transmissionMap.channel),thicknessMapUv:ed&&f(r.thicknessMap.channel),alphaMapUv:ef&&f(r.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(V||q),vertexNormals:!!M.attributes.normal,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!M.attributes.uv&&(O||ef),fog:!!S,useFog:!0===r.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===M.attributes.normal&&!1===V&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:N,skinning:!0===m.isSkinnedMesh,hasPositionAttribute:void 0!==M.attributes.position,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:P,morphTextureStride:I,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:e_,decodeVideoTexture:O&&!0===r.map.isVideoTexture&&"srgb"===ew.getTransfer(r.map.colorSpace),decodeVideoTextureEmissive:W&&!0===r.emissiveMap.isVideoTexture&&"srgb"===ew.getTransfer(r.emissiveMap.colorSpace),premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionCl
358ipCullDistance:ev&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ev&&!0===r.extensions.multiDraw||D)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return ey.vertexUv1s=l.has(1),ey.vertexUv2s=l.has(2),ey.vertexUv3s=l.has(3),l.clear(),ey},getProgramCacheKey:function(t){var n,i,r,a;let o=[];if(t.shaderID?o.push(t.shaderID):(o.push(t.customVertexShaderID),o.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)o.push(e),o.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=o,i=t,n.push(i.precision),n.push(i.outputColorSpace),n.push(i.envMapMode),n.push(i.envMapCubeUVHeight),n.push(i.mapUv),n.push(i.alphaMapUv),n.push(i.lightMapUv),n.push(i.aoMapUv),n.push(i.bumpMapUv),n.push(i.normalMapUv),n.push(i.displacementMapUv),n.push(i.emissiveMapUv),n.push(i.metalnessMapUv),n.push(i.roughnessMapUv),n.push(i.anisotropyMapUv),n.push(i.clearcoatMapUv),n.push(i.clearcoatNormalMapUv),n.push(i.clearcoatRoughnessMapUv),n.push(i.iridescenceMapUv),n.push(i.iridescenceThicknessMapUv),n.push(i.sheenColorMapUv),n.push(i.sheenRoughnessMapUv),n.push(i.specularMapUv),n.push(i.specularColorMapUv),n.push(i.specularIntensityMapUv),n.push(i.transmissionMapUv),n.push(i.thicknessMapUv),n.push(i.combine),n.push(i.fogExp2),n.push(i.sizeAttenuation),n.push(i.morphTargetsCount),n.push(i.morphAttributeCount),n.push(i.numDirLights),n.push(i.numPointLights),n.push(i.numSpotLights),n.push(i.numSpotLightMaps),n.push(i.numHemiLights),n.push(i.numRectAreaLights),n.push(i.numDirLightShadows),n.push(i.numPointLightShadows),n.push(i.numSpotLightShadows),n.push(i.numSpotLightShadowsWithMaps),n.push(i.numLightProbes),n.push(i.shadowMapType),n.push(i.toneMapping),n.push(i.numClippingPlanes),n.push(i.numClipIntersection),n.push(i.depthPacking),r=o,a=t,s.disableAll(),a.instancing&&s.enable(0),a.instancingColor&&s.enable(1),a.instancingMorph&&s.enable(2),a.matcap&&s.enable(3),a.envMap&&s.enable(4),a.normalMapObjectSpace&&s.enable(5),a.normalMapTangentSpace&&s.enable(6),a.clearcoat&&s.enable(7),a.iridescence&&s.enable(8),a.alphaTest&&s.enable(9),a.vertexColors&&s.enable(10),a.vertexAlphas&&s.enable(11),a.vertexUv1s&&s.enable(12),a.vertexUv2s&&s.enable(13),a.vertexUv3s&&s.enable(14),a.vertexTangents&&s.enable(15),a.anisotropy&&s.enable(16),a.alphaHash&&s.enable(17),a.batching&&s.enable(18),a.dispersion&&s.enable(19),a.batchingColor&&s.enable(20),a.gradientMap&&s.enable(21),a.packedNormalMap&&s.enable(22),a.vertexNormals&&s.enable(23),r.push(s.mask),s.disableAll(),a.fog&&s.enable(0),a.useFog&&s.enable(1),a.flatShading&&s.enable(2),a.logarithmicDepthBuffer&&s.enable(3),a.reversedDepthBuffer&&s.enable(4),a.skinning&&s.enable(5),a.morphTargets&&s.enable(6),a.morphNormals&&s.enable(7),a.morphColors&&s.enable(8),a.premultipliedAlpha&&s.enable(9),a.shadowMapEnabled&&s.enable(10),a.doubleSided&&s.enable(11),a.flipSided&&s.enable(12),a.useDepthPacking&&s.enable(13),a.dithering&&s.enable(14),a.transmission&&s.enable(15),a.sheen&&s.enable(16),a.opaque&&s.enable(17),a.pointsUvs&&s.enable(18),a.decodeVideoTexture&&s.enable(19),a.decodeVideoTextureEmissive&&s.enable(20),a.alphaToCoverage&&s.enable(21),a.numLightProbeGrids>0&&s.enable(22),a.hasPositionAttribute&&s.enable(23),r.push(s.mask),o.push(e.outputColorSpace)),o.push(t.customProgramCacheKey),o.join()},getUniforms:function(e){let t,n=p[e.type];if(n){let e=lm[n];t=aC.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let i=c.get(n);return void 0!==i?++i.usedTimes:(i=new u9(e,n,t,r),u.push(i),c.set(n,i)),i},releaseProgram:function(e){if(0==--e.usedTimes){let t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),c.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){o.remove(e)},programs:u,dispose:function(){o.dispose()}}}function cr(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ca(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;if(e.material.id!==t.material.id)return e.material.id-t.material.id;if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function cs(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function co(){let e=[],t=0,n=[],i=[],r=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,i,r,s,o,l){let u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:i,material:r,materialVariant:a(n),groupOrder:s,renderOrder:n.renderOrder,z:o,group:l},e[t]=u):(u.id=n.id,u.object=n,u.geometry=i,u.material=r,u.materialVariant=a(n),u.groupOrder=s,u.renderOrder=n.renderOrder,u.z=o,u.group=l),t++,u}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,o,l,u){let c=s(e,t,a,o,l,u);a.transmission>0?i.push(c):!0===a.transparent?r.push(c):n.push(c)},unshift:function(e,t,a,o,l,u){let c=s(e,t,a,o,l,u);a.transmission>0?i.unshift(c):!0===a.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=t,i=e.length;n<i;n++){let t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t,a){n.length>1&&n.sort(e||ca),i.length>1&&i.sort(t||cs),r.length>1&&r.sort(t||cs),a&&(n.reverse(),i.reverse(),r.reverse())}}}function cl(){let e=new WeakMap;return{get:function(t,n){let i,r=e.get(t);return void 0===r?(i=new co,e.set(t,[i])):n>=r.length?(i=new co,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function cu(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new e_,color:new tp};break;case"SpotLight":n={position:new e_,direction:new e_,color:new tp,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new e_,color:new tp,distance:0,decay:0};break;case"HemisphereLight":n={direction:new e_,skyColor:new tp,groundColor:new tp};break;case"RectAreaLight":n={color:new tp,position:new e_,halfWidth:new e_,halfHeight:new e_}}return e[t.id]=n,n}}}let cc=0;function ch(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function cd(e){let t,n=new cu,i=(t={},{get:function(e){let n;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eg};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eg,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new e_);let a=new e_,s=new eV,o=new eV;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;t.sort(ch);for(let e=0,y=t.length;e<y;e++){let y=t[e],x=y.color,b=y.intensity,S=y.distance,M=null;if(y.shadow&&y.shadow.map&&(M=1030===y.shadow.map.texture.format?y.shadow.map.texture:y.shadow.map.depthTexture||y.shadow.map.texture),y.isAmbientLight)a+=x.r*b,s+=x.g*b,o+=x.b*b;else if(y.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(y.sh.coefficients[e],b);_++}else if(y.isDirectionalLight){let e=n.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){let e=y.shadow,t=i.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.n
vendor: 4,744 bytes, line 358
358ormalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=M,r.directionalShadowMatrix[l]=y.shadow.matrix,p++}r.directional[l]=e,l++}else if(y.isSpotLight){let e=n.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=S,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,r.spot[c]=e;let t=y.shadow;if(y.map&&(r.spotLightMap[g]=y.map,g++,t.updateMatrices(y),y.castShadow&&v++),r.spotLightMatrix[c]=t.matrix,y.castShadow){let e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,r.spotShadow[c]=e,r.spotShadowMap[c]=M,m++}c++}else if(y.isRectAreaLight){let e=n.get(y);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*y.width,0,0),e.halfHeight.set(0,.5*y.height,0),r.rectArea[h]=e,h++}else if(y.isPointLight){let e=n.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){let e=y.shadow,t=i.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[u]=t,r.pointShadowMap[u]=M,r.pointShadowMatrix[u]=y.shadow.matrix,f++}r.point[u]=e,u++}else if(y.isHemisphereLight){let e=n.get(y);e.skyColor.copy(y.color).multiplyScalar(b),e.groundColor.copy(y.groundColor).multiplyScalar(b),r.hemi[d]=e,d++}}h>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=lf.LTC_FLOAT_1,r.rectAreaLTC2=lf.LTC_FLOAT_2):(r.rectAreaLTC1=lf.LTC_HALF_1,r.rectAreaLTC2=lf.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let y=r.hash;(y.directionalLength!==l||y.pointLength!==u||y.spotLength!==c||y.rectAreaLength!==h||y.hemiLength!==d||y.numDirectionalShadows!==p||y.numPointShadows!==f||y.numSpotShadows!==m||y.numSpotMaps!==g||y.numLightProbes!==_)&&(r.directional.length=l,r.spot.length=c,r.rectArea.length=h,r.point.length=u,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=_,y.directionalLength=l,y.pointLength=u,y.spotLength=c,y.rectAreaLength=h,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=f,y.numSpotShadows=m,y.numSpotMaps=g,y.numLightProbes=_,r.version=cc++)},setupView:function(e,t){let n=0,i=0,l=0,u=0,c=0,h=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[n];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(h),n++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(h),l++}else if(d.isRectAreaLight){let e=r.rectArea[u];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),o.identity(),s.copy(d.matrixWorld),s.premultiply(h),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(d.isPointLight){let e=r.point[i];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(h),i++}else if(d.isHemisphereLight){let e=r.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(h),c++}}},state:r}}function cp(e){let t=new cd(e),n=[],i=[],r=[],a={lightsArray:n,shadowsArray:i,lightProbeGridArray:r,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:function(e){a.camera=e,n.length=0,i.length=0,r.length=0},state:a,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)},pushLightProbeGrid:function(e){r.push(e)}}}function cf(e){let t=new WeakMap;return{get:function(n,i=0){let r,a=t.get(n);return void 0===a?(r=new cp(e),t.set(n,[r])):i>=a.length?(r=new cp(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}let cm=[new e_(1,0,0),new e_(-1,0,0),new e_(0,1,0),new e_(0,-1,0),new e_(0,0,1),new e_(0,0,-1)],cg=[new e_(0,-1,0),new e_(0,-1,0),new e_(0,0,1),new e_(0,0,-1),new e_(0,-1,0),new e_(0,-1,0)],cv=new eV,c_=new e_,cy=new e_;function cx(e,t,n){let i=new iE,r=new eg,a=new eg,s=new eD,o=new aF,l=new aB,u={},c=n.maxTextureSize,h={0:1,1:0,2:2}
358,d=new aR({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new eg},radius:{value:4}},vertexShader:"void main() {\n	gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n	const float samples = float( VSM_SAMPLES );\n	float mean = 0.0;\n	float squared_mean = 0.0;\n	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n	for ( float i = 0.0; i < samples; i ++ ) {\n		float uvOffset = uvStart + i * uvStride;\n		#ifdef HORIZONTAL_PASS\n			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n			mean += distribution.x;\n			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n		#else\n			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n			mean += depth;\n			squared_mean += depth * depth;\n		#endif\n	}\n	mean = mean / samples;\n	squared_mean = squared_mean / samples;\n	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new nh;f.setAttribute("position",new t0(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new n1(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function _(t,n,i,r){let a=null,s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=a.uuid,t=n.uuid,i=u[e];void 0===i&&(i={},u[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",y)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,3===r?a.side=null!==n.shadowSide?n.shadowSide:n.side:a.side=null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function y(e){for(let t in e.target.removeEventListener("dispose",y),u){let n=u[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(n,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;2===this.type&&(ee("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);let u=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),y=e.state;y.setBlending(0),!0===y.buffers.depth.getReversed()?y.buffers.color.setClear(0,0,0,0):y.buffers.color.setClear(1,1,1,1),y.buffers.depth.setTest(!0),y.setScissorTest(!1);let x=v!==this.type;x&&o.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,h=n.length;u<h;u++){let h=n[u],f=h.shadow;if(void 0===f){ee("WebGLShadowMap:",h,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;r.copy(f.mapSize);let g=f.getFrameExtents();r.multiply(g),a.copy(f.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/g.x),r.x=a.x*g.x,f.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/g.y),r.y=a.y*g.y,f.mapSize.y=a.y));let v=e.state.buffers.depth.getReversed();if(f.camera._reversedDepth=v,null===f.map||!0===x){if(null!==f.map&&(null!==f.map.depthTexture&&(f.map.depthTexture.dispose(),f.map.depthTexture=null),f.map.dispose()),3===this.type){if(h.isPointLight){ee("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}f.map=new eF(r.x,r.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),f.map.texture.name=h.name+".shadowMap",f.map.depthTexture=new rd(r.x,r.y,1015),f.map.depthTexture.name=h.name+".shadowMapDepth",f.map.depthTexture.format=1026,f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003}else h.isPointLight?(f.map=new lB(r.x),f.map.depthTexture=new rp(r.x,1014)):(f.map=new eF(r.x,r.y),f.map.depthTexture=new rd(r.x,r.y,1014)),f.map.depthTexture.name=h.name+".shadowMap",f.map.depthTexture.format=1026,1===this.type?(f.map.depthTexture.compareFunction=v?518:515,f.map.depthTexture.minFilter=1006,f.map.depthTexture.magFilter=1006):(f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003);f.camera.updateProjectionMatrix()}
358let b=f.map.isWebGLCubeRenderTarget?6:1;for(let n=0;n<b;n++){if(f.map.isWebGLCubeRenderTarget)e.setRenderTarget(f.map,n),e.clear();else{0===n&&(e.setRenderTarget(f.map),e.clear());let t=f.getViewport(n);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),y.viewport(s)}if(h.isPointLight){let e=f.camera,t=f.matrix,i=h.distance||e.far;i!==e.far&&(e.far=i,e.updateProjectionMatrix()),c_.setFromMatrixPosition(h.matrixWorld),e.position.copy(c_),cy.copy(e.position),cy.add(cm[n]),e.up.copy(cg[n]),e.lookAt(cy),e.updateMatrixWorld(),t.makeTranslation(-c_.x,-c_.y,-c_.z),cv.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),f._frustum.setFromProjectionMatrix(cv,e.coordinateSystem,e.reversedDepth)}else f.updateMatrices(h);i=f.getFrustum(),function n(r,a,s,o,l){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===l)&&(!r.frustumCulled||i.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,r.matrixWorld);let n=t.update(r),i=r.material;if(Array.isArray(i)){let t=n.groups;for(let u=0,c=t.length;u<c;u++){let c=t[u],h=i[c.materialIndex];if(h&&h.visible){let t=_(r,h,o,l);r.onBeforeShadow(e,r,a,s,n,t,c),e.renderBufferDirect(s,null,n,t,r,c),r.onAfterShadow(e,r,a,s,n,t,c)}}}else if(i.visible){let t=_(r,i,o,l);r.onBeforeShadow(e,r,a,s,n,t,null),e.renderBufferDirect(s,null,n,t,r,null),r.onAfterShadow(e,r,a,s,n,t,null)}}let u=r.children;for(let e=0,t=u.length;e<t;e++)n(u[e],a,s,o,l)}(o,l,f.camera,h,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(n,i){let a=t.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new eF(r.x,r.y,{format:1030,type:1016})),d.uniforms.shadow_pass.value=n.map.depthTexture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,p,m,null)}(f,l),f.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(u,h,f)}}function cb(e,t){let n=new function(){let t=!1,n=new eD,i=null,r=new eD(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),n.set(t,i,a,s),!1===r.equals(n)&&(e.clearColor(t,i,a,s),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,a=null,s=null;return{setReversed:function(e){if(i!==e){let n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=e;let r=s;s=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(t){t?k(e.DEPTH_TEST):H(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=ei[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){s!==t&&(s=t,i&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,r=null,a=null,s=null,i=!1}}},r=new function(){let t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,u=null;return{setTest:function(n){t||(n?k(e.STENCIL_TEST):H(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,s){(i!==t||r!==n||a!==s)&&(e.stencilFunc(t,n,s),i=t,r=n,a=s)},setOp:function(t,n,i){(s!==t||o!==n||l!==i)&&(e.stencilOp(t,n,i),s=t,o=n,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,u=null}}},a=new WeakMap,s=new WeakMap,o={},l={},u={},c=new WeakMap,h=[],d=null,p=!1,f=null,m=null,g=null,v=null,_=null,y=null,x=null,b=new tp(0,0,0),S=0,M=!1,T=null,w=null,E=null,A=null,C=null,R=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),P=!1,I=e.getParameter(e.VERSION);-1!==I.indexOf("WebGL")?P=parseFloat(/^WebGL (\d)/.exec(I)[1])>=1:-1!==I.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(I)[1])>=2);let L=null,N={},U=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),O=new eD().fromArray(U),F=new eD().fromArray(D);function B(t,n,i,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<i;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let z={};function k(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function H(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}z[e.TEXTURE_2D]=B(e.TEXTURE_2D,e.TEXTURE_2D,1),z[e.TEXTURE_CUBE_MAP]=B(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),z[e.TEXTURE_2D_ARRAY]=B(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),z[e.TEXTURE_3D]=B(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),k(e.DEPTH_TEST),i.setFunc(3),j(!1),X(1),k(e.CULL_FACE),W(0);let V={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};V[103]=e.MIN,V[104]=e.MAX;let G={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};
358function W(t,n,i,r,a,s,o,l,u,c){if(0===t){!0===p&&(H(e.BLEND),p=!1);return}if(!1===p&&(k(e.BLEND),p=!0),5!==t){if(t!==f||c!==M){if((100!==m||100!==_)&&(e.blendEquation(e.FUNC_ADD),m=100,_=100),c)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:et("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:et("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:et("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:et("WebGLState: Invalid blending: ",t)}g=null,v=null,y=null,x=null,b.set(0,0,0),S=0,f=t,M=c}return}a=a||n,s=s||i,o=o||r,(n!==m||a!==_)&&(e.blendEquationSeparate(V[n],V[a]),m=n,_=a),(i!==g||r!==v||s!==y||o!==x)&&(e.blendFuncSeparate(G[i],G[r],G[s],G[o]),g=i,v=r,y=s,x=o),(!1===l.equals(b)||u!==S)&&(e.blendColor(l.r,l.g,l.b,u),b.copy(l),S=u),f=t,M=!1}function j(t){T!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),T=t)}function X(t){0!==t?(k(e.CULL_FACE),t!==w&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):H(e.CULL_FACE),w=t}
vendor: 5,748 bytes, line 358
358function q(t,n,r){t?(k(e.POLYGON_OFFSET_FILL),(A!==n||C!==r)&&(A=n,C=r,i.getReversed()&&(n=-n),e.polygonOffset(n,r))):H(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:k,disable:H,bindFramebuffer:function(t,n){return u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n,t===e.DRAW_FRAMEBUFFER&&(u[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(u[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=h,r=!1;if(t){void 0===(i=c.get(n))&&(i=[],c.set(n,i));let a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:W,setMaterial:function(t,a){2===t.side?H(e.CULL_FACE):k(e.CULL_FACE);let s=1===t.side;a&&(s=!s),j(s),1===t.blending&&!1===t.transparent?W(0):W(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),n.setMask(t.colorWrite);let o=t.stencilWrite;r.setTest(o),o&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),q(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?k(e.SAMPLE_ALPHA_TO_COVERAGE):H(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:X,setLineWidth:function(t){t!==E&&(P&&e.lineWidth(t),E=t)},setPolygonOffset:q,setScissorTest:function(t){t?k(e.SCISSOR_TEST):H(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+R-1),L!==t&&(e.activeTexture(t),L=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===L?e.TEXTURE0+R-1:L);let r=N[i];void 0===r&&(r={type:void 0,texture:void 0},N[i]=r),(r.type!==t||r.texture!==n)&&(L!==i&&(e.activeTexture(i),L=i),e.bindTexture(t,n||z[t]),r.type=t,r.texture=n)},unbindTexture:function(){let t=N[L];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){et("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){et("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){et("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){et("WebGLState:",e)}},pixelStorei:function(t,n){l[t]!==n&&(e.pixelStorei(t,n),l[t]=n)},getParameter:function(t){return void 0!==l[t]?l[t]:e.getParameter(t)},updateUBOMapping:function(t,n){let i=s.get(n);void 0===i&&(i=new WeakMap,s.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){let i=s.get(n).get(t);a.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),a.set(n,i))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){et("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){et("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){et("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){et("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){et("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){et("WebGLState:",e)}},scissor:function(t){!1===O.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),O.copy(t))},viewport:function(t){!1===F.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),F.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),o={},l={},L=null,N={},u={},c=new WeakMap,h=[],d=null,p=!1,f=null,m=null,g=null,v=null,_=null,y=null,x=null,b=new tp(0,0,0),S=0,M=!1,T=null,w=null,E=null,A=null,C=null,O.set(0,0,e.canvas.width,e.canvas.height),F.set(0,0,e.canvas.width,e.canvas.height),n.reset(),i.reset(),r.reset()}}}function cS(e,t,n,i,r,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,u="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new eg,h=new WeakMap,d=new Set,p=new WeakMap,f=!1;try{f="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):X("canvas")}
358function g(e,t,n){let i=1,r=W(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===o&&(o=m(n,a));let s=t?m(n,a):o;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),ee("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}else"data"in e&&ee("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function v(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function y(n,i,r,a,s,o=!1){let l;if(null!==n){if(void 0!==e[n])return e[n];ee("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}a&&((l=t.get("EXT_texture_norm16"))||ee("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=i;if(i===e.RED&&(r===e.FLOAT&&(u=e.R32F),r===e.HALF_FLOAT&&(u=e.R16F),r===e.UNSIGNED_BYTE&&(u=e.R8),r===e.UNSIGNED_SHORT&&l&&(u=l.R16_EXT),r===e.SHORT&&l&&(u=l.R16_SNORM_EXT)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.R8UI),r===e.UNSIGNED_SHORT&&(u=e.R16UI),r===e.UNSIGNED_INT&&(u=e.R32UI),r===e.BYTE&&(u=e.R8I),r===e.SHORT&&(u=e.R16I),r===e.INT&&(u=e.R32I)),i===e.RG&&(r===e.FLOAT&&(u=e.RG32F),r===e.HALF_FLOAT&&(u=e.RG16F),r===e.UNSIGNED_BYTE&&(u=e.RG8),r===e.UNSIGNED_SHORT&&l&&(u=l.RG16_EXT),r===e.SHORT&&l&&(u=l.RG16_SNORM_EXT)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RG8UI),r===e.UNSIGNED_SHORT&&(u=e.RG16UI),r===e.UNSIGNED_INT&&(u=e.RG32UI),r===e.BYTE&&(u=e.RG8I),r===e.SHORT&&(u=e.RG16I),r===e.INT&&(u=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RGB8UI),r===e.UNSIGNED_SHORT&&(u=e.RGB16UI),r===e.UNSIGNED_INT&&(u=e.RGB32UI),r===e.BYTE&&(u=e.RGB8I),r===e.SHORT&&(u=e.RGB16I),r===e.INT&&(u=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(u=e.RGBA16UI),r===e.UNSIGNED_INT&&(u=e.RGBA32UI),r===e.BYTE&&(u=e.RGBA8I),r===e.SHORT&&(u=e.RGBA16I),r===e.INT&&(u=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_SHORT&&l&&(u=l.RGB16_EXT),r===e.SHORT&&l&&(u=l.RGB16_SNORM_EXT),r===e.UNSIGNED_INT_5_9_9_9_REV&&(u=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(u=e.R11F_G11F_B10F)),i===e.RGBA){let t=o?"linear":ew.getTransfer(s);r===e.FLOAT&&(u=e.RGBA32F),r===e.HALF_FLOAT&&(u=e.RGBA16F),r===e.UNSIGNED_BYTE&&(u="srgb"===t?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT&&l&&(u=l.RGBA16_EXT),r===e.SHORT&&l&&(u=l.RGBA16_SNORM_EXT),r===e.UNSIGNED_SHORT_4_4_4_4&&(u=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(u=e.RGB5_A1)}return(u===e.R16F||u===e.R32F||u===e.RG16F||u===e.RG32F||u===e.RGBA16F||u===e.RGBA32F)&&t.get("EXT_color_buffer_float"),u}function x(t,n){let i;return t?null===n||1014===n||1020===n?i=e.DEPTH24_STENCIL8:1015===n?i=e.DEPTH32F_STENCIL8:1012===n&&(i=e.DEPTH24_STENCIL8,ee("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||1014===n||1020===n?i=e.DEPTH_COMPONENT24:1015===n?i=e.DEPTH_COMPONENT32F:1012===n&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===v(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener("dispose",S),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let n=e.source,r=p.get(n);if(r){let i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&T(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t),t.isHTMLTexture&&d.delete(t)}function M(t){let n=t.target;n.removeEventListener("dispose",M),function(t){let n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRen
358derbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,n=r.length;t<n;t++){let n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function T(t){let n=i.get(t);e.deleteTexture(n.__webglTexture);let r=t.source,a=p.get(r);delete a[n.__cacheKey],s.memory.textures--}let w=0;function E(t,r){var a;let o,l=i.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,h.get(a)!==o&&(h.set(a,o),a.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)ee("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void N(l,t,r);ee("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(l.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+r)}let A={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},C={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},R={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function P(n,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&ee("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,A[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,A[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,A[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,C[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,C[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||i.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}function I(t,n){let i,r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",S));let a=n.source,o=p.get(a);void 0===o&&(o={},p.set(a,o));let l=((i=[]).push(n.wrapS),i.push(n.wrapT),i.push(n.wrapR||0),i.push(n.magFilter),i.push(n.minFilter),i.push(n.anisotropy),i.push(n.internalFormat),i.push(n.format),i.push(n.type),i.push(n.generateMipmaps),i.push(n.premultiplyAlpha),i.push(n.flipY),i.push(n.unpackAlignment),i.push(n.colorSpace),i.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[l].usedTimes++;let i=o[t.__cacheKey];void 0!==i&&(o[t.__cacheKey].usedTimes--,0===i.usedTimes&&T(n)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return r}function L(e,t,n){return Math.floor(Math.floor(e/n)/t)}function N(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=I(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let h=i.get(c);if(c.version!==h.__version||!0===u){let t;if(n.activeTexture(e.TEXTURE0+o),!1==("u">typeof ImageBitmap&&s.image instanceof ImageBitmap)){let t=ew.getPrimaries(ew.workingColorSpace),i=""===s.colorSpace?null:ew.getPrimaries(s.colorSpace),r=""===s.colorSpace||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,r)}n.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment);let i=g(s.image,!1,r.maxTextureSize);i=G(s,i);let p=a.convert(s.format,s.colorSpace),f=a.convert(s.type),m=y(s.internalFormat,p,f,s.normalized,s.colorSpace,s.isVideoTexture);P(l,s);let S=s.mipmaps,M=!0!==s.isVideoTexture,T=void 0===h.__version||!0===u,w=c.dataReady,E=b(s,i);
vendor: 5,027 bytes, line 358
358if(s.isDepthTexture)m=x(1027===s.format,s.type),T&&(M?n.texStorage2D(e.TEXTURE_2D,1,m,i.width,i.height):n.texImage2D(e.TEXTURE_2D,0,m,i.width,i.height,0,p,f,null));else if(s.isDataTexture)if(S.length>0){M&&T&&n.texStorage2D(e.TEXTURE_2D,E,m,S[0].width,S[0].height);for(let i=0,r=S.length;i<r;i++)t=S[i],M?w&&n.texSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,p,f,t.data):n.texImage2D(e.TEXTURE_2D,i,m,t.width,t.height,0,p,f,t.data);s.generateMipmaps=!1}else M?(T&&n.texStorage2D(e.TEXTURE_2D,E,m,i.width,i.height),w&&function(t,i,r,a){let s=t.updateRanges;if(0===s.length)n.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,r,a,i.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],n=s[e],r=t.start+t.count,a=L(n.start,i.width,4),l=L(t.start,i.width,4);n.start<=r+1&&a===l&&L(n.start+n.count-1,i.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):s[++o]=n}s.length=o+1;let l=n.getParameter(e.UNPACK_ROW_LENGTH),u=n.getParameter(e.UNPACK_SKIP_PIXELS),c=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,i.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),u=Math.ceil(o.count/4),c=l%i.width,h=Math.floor(l/i.width);n.pixelStorei(e.UNPACK_SKIP_PIXELS,c),n.pixelStorei(e.UNPACK_SKIP_ROWS,h),n.texSubImage2D(e.TEXTURE_2D,0,c,h,u,1,r,a,i.data)}t.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,l),n.pixelStorei(e.UNPACK_SKIP_PIXELS,u),n.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(s,i,p,f)):n.texImage2D(e.TEXTURE_2D,0,m,i.width,i.height,0,p,f,i.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){M&&T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,S[0].width,S[0].height,i.depth);for(let r=0,a=S.length;r<a;r++)if(t=S[r],1023!==s.format)if(null!==p)if(M){if(w)if(s.layerUpdates.size>0){let i=lu(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,p,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,i.depth,p,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,m,t.width,t.height,i.depth,0,t.data,0,0);else ee("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?w&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,i.depth,p,f,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,r,m,t.width,t.height,i.depth,0,p,f,t.data)}else{M&&T&&n.texStorage2D(e.TEXTURE_2D,E,m,S[0].width,S[0].height);for(let i=0,r=S.length;i<r;i++)t=S[i],1023!==s.format?null!==p?M?w&&n.compressedTexSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,p,t.data):n.compressedTexImage2D(e.TEXTURE_2D,i,m,t.width,t.height,0,t.data):ee("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?w&&n.texSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,p,f,t.data):n.texImage2D(e.TEXTURE_2D,i,m,t.width,t.height,0,p,f,t.data)}else if(s.isDataArrayTexture)if(M){if(T&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,i.width,i.height,i.depth),w)if(s.layerUpdates.size>0){let t=lu(i.width,i.height,s.format,s.type);for(let r of s.layerUpdates){let a=i.data.subarray(r*t/i.data.BYTES_PER_ELEMENT,(r+1)*t/i.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,i.width,i.height,1,p,f,a)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,i.width,i.height,i.depth,p,f,i.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,i.width,i.height,i.depth,0,p,f,i.data);else if(s.isData3DTexture)M?(T&&n.texStorage3D(e.TEXTURE_3D,E,m,i.width,i.height,i.depth),w&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,i.width,i.height,i.depth,p,f,i.data)):n.texImage3D(e.TEXTURE_3D,0,m,i.width,i.height,i.depth,0,p,f,i.data);else if(s.isFramebufferTexture){if(T)if(M)n.texStorage2D(e.TEXTURE_2D,E,m,i.width,i.height);else{let t=i.width,r=i.height;for(let i=0;i<E;i++)n.texImage2D(e.TEXTURE_2D,i,m,t,r,0,p,f,null),t>>=1,r>>=1}}else if(s.isHTMLTexture){if("texElementImage2D"in e){let t=e.canvas;if(t.hasAttribute("layoutsubtree")||t.setAttribute("layoutsubtree","true"),i.parentNode!==t){t.appendChild(i),d.add(s),t.onpaint=e=>{let t=e.changedElements;for(let e of d)t.includes(e.image)&&(e.needsUpdate=!0)},t.requestPaint();return}if(3===e.texElementImage2D.length)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,i);else{let t=e.RGBA,n=e.RGBA,r=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,t,n,r,i)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(S.length>0){if(M&&T){let t=W(S[0]);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}for(let i=0,r=S.length;i<r;i++)t=S[i],M?w&&n.texSubImage2D(e.TEXTURE_2D,i,0,0,p,f,t):n.texImage2D(e.TEXTURE_2D,i,m,p,f,t);s.generateMipmaps=!1}else if(M){if(T){let t=W(i);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}w&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,f,i)}else n.texImage2D(e.TEXTURE_2D,0,m,p,f,i);
358v(s)&&_(l),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function U(t,r,s,o,u,c){let h=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=y(s.internalFormat,h,d,s.normalized,s.colorSpace),f=i.get(r),m=i.get(s);if(m.__renderTarget=r,!f.__hasExternalTextures){let t=Math.max(1,r.width>>c),i=Math.max(1,r.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,i,r.depth,0,h,d,null):n.texImage2D(u,c,p,t,i,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),V(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,H(r)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function D(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,a),o=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;V(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,H(n),s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,H(n),s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=n.textures;for(let r=0;r<t.length;r++){let s=t[r],o=a.convert(s.format,s.colorSpace),u=a.convert(s.type),c=y(s.internalFormat,o,u,s.normalized,s.colorSpace);V(n)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,H(n),c,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,H(n),c,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,c,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function F(t,r,s){let o=!0===r.isWebGLCubeRenderTarget;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(r.depthTexture&&r.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let u=i.get(r.depthTexture);if(u.__renderTarget=r,u.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),o){if(void 0===u.__webglInit&&(u.__webglInit=!0,r.depthTexture.addEventListener("dispose",S)),void 0===u.__webglTexture){let t;u.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture),P(e.TEXTURE_CUBE_MAP,r.depthTexture);let i=a.convert(r.depthTexture.format),s=a.convert(r.depthTexture.type);1026===r.depthTexture.format?t=e.DEPTH_COMPONENT24:1027===r.depthTexture.format&&(t=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,r.width,r.height,0,i,s,null)}}else E(r.depthTexture,0);let c=u.__webglTexture,h=H(r),d=o?e.TEXTURE_CUBE_MAP_POSITIVE_X+s:e.TEXTURE_2D,p=1027===r.depthTexture.format?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(1026===r.depthTexture.format)V(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else if(1027===r.depthTexture.format)V(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function B(t){let r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){let t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)F(r.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?F(r.__webglFramebuffer[0],t,0):F(r.__webglFramebuffer,t,0)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),D(r.__webglDepthbuffer[i],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let i=t.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),D(r.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let z=[],k=[];function H(e){return Math.min(r.maxSamples,e.samples)}function V(e){let n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function G(e,t){let n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==O&&""!==n&&("srgb"===ew.getTransfer(n)?(1023!==i||1009!==r)&&ee("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):et("WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWi
vendor: 9,160 bytes, line 358
358dth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=w;return e>=r.maxTextures&&ee("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.getTextureUnits=function(){return w},this.setTextureUnits=function(e){w=e},this.setTexture2D=E,this.setTexture2DArray=function(t,r){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?N(a,t,r):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r))},this.setTexture3D=function(t,r){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?N(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=i.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=I(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=i.get(u);if(u.version!==c.__version||!0===l){let t;n.activeTexture(e.TEXTURE0+o);let i=ew.getPrimaries(ew.workingColorSpace),h=""===s.colorSpace?null:ew.getPrimaries(s.colorSpace),d=""===s.colorSpace||i===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)p||f?m[e]=f?s.image[e].image:s.image[e]:m[e]=g(s.image[e],!0,r.maxCubemapSize),m[e]=G(s,m[e]);let x=m[0],S=a.convert(s.format,s.colorSpace),M=a.convert(s.type),T=y(s.internalFormat,S,M,s.normalized,s.colorSpace),w=!0!==s.isVideoTexture,E=void 0===c.__version||!0===l,A=u.dataReady,C=b(s,x);if(P(e.TEXTURE_CUBE_MAP,s),p){w&&E&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,T,x.width,x.height);for(let i=0;i<6;i++){t=m[i].mipmaps;for(let r=0;r<t.length;r++){let a=t[r];1023!==s.format?null!==S?w?A&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,0,0,a.width,a.height,S,a.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,a.width,a.height,0,a.data):ee("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):w?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,0,0,a.width,a.height,S,M,a.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,a.width,a.height,0,S,M,a.data)}}}else{if(t=s.mipmaps,w&&E){t.length>0&&C++;let i=W(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,T,i.width,i.height)}for(let i=0;i<6;i++)if(f){w?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,m[i].width,m[i].height,S,M,m[i].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,m[i].width,m[i].height,0,S,M,m[i].data);for(let r=0;r<t.length;r++){let a=t[r].image[i].image;w?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r+1,0,0,a.width,a.height,S,M,a.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r+1,T,a.width,a.height,0,S,M,a.data)}}else{w?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,S,M,m[i]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,S,M,m[i]);for(let r=0;r<t.length;r++){let a=t[r];w?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r+1,0,0,S,M,a.image[i]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r+1,T,S,M,a.image[i])}}}v(s)&&_(e.TEXTURE_CUBE_MAP),c.__version=u.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,n,r){let a=i.get(t);void 0!==n&&U(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&B(t)},this.setupRenderTarget=function(t){let r=t.texture,o=i.get(t),l=i.get(r);t.addEventListener("dispose",M);let u=t.textures,c=!0===t.isWebGLCubeRenderTarget,h=u.length>1;if(!h&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(h)for(let t=0,n=u.length;t<n;t++){let n=i.get(u[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===V(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<u.length;n++){let i=u[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);let r=a.convert(i.format,i.colorSpace),s=a.convert(i.type),l=y(i.internalFormat,r,s,i.normalized,i.colorSpace,!0===t.isXRRenderTarget),c=H(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),D(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),P(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)U(o.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else U(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);v(r)&&_(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(let r=0,a=u.length;r<a;r++){let a=u[r],s=i.get(a),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(l,s.__webglTexture),P(l,a),U(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,l,0),v(a)&&_(l)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)U(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else U(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);v(r)&&_(i),n.unbindTexture()}t.depthBuffer&&B(t)},this.updateRenderTargetMipmap=function(t){let r=t.textures;for(let a=0,s=r.length;a<s;a++){let s=r[a];if(v(s)){let r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=i.get(s).__webglTexture;n.bindTexture(r,a),_(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===V(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=r.length>1;if(h)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);let d=t.texture.mipmaps;d&&d.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),h){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[n]);let t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===u&&(z.length=0,k.length=0,z.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(z.push(l),k.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,k)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,z))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);let a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&u){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;
358e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}},this.setupDepthRenderbuffer=B,this.setupFrameBufferTexture=U,this.useMultisampledRTT=V,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function cM(e,t){return{convert:function(n,i=""){let r,a=ew.getTransfer(i);if(1009===n)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return e.UNSIGNED_INT_5_9_9_9_REV;if(35899===n)return e.UNSIGNED_INT_10F_11F_11F_REV;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(1012===n)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(1014===n)return e.UNSIGNED_INT;if(1015===n)return e.FLOAT;if(1016===n)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(1023===n)return e.RGBA;if(1026===n)return e.DEPTH_COMPONENT;if(1027===n)return e.DEPTH_STENCIL;if(1028===n)return e.RED;if(1029===n)return e.RED_INTEGER;if(1030===n)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(33776===n||33777===n||33778===n||33779===n)if("srgb"===a){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===n)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===n)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===n)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===n)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===n)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===n||35841===n||35842===n||35843===n){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===n)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===n)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n||37492===n||37496===n||37488===n||37489===n||37490===n||37491===n){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===n||37492===n)return"srgb"===a?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(37488===n)return r.COMPRESSED_R11_EAC;if(37489===n)return r.COMPRESSED_SIGNED_R11_EAC;if(37490===n)return r.COMPRESSED_RG11_EAC;if(37491===n)return r.COMPRESSED_SIGNED_RG11_EAC}if(37808===n||37809===n||37810===n||37811===n||37812===n||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return"srgb"===a?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===n||36494===n||36495===n){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===n)return"srgb"===a?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===n)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===n)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||36284===n||36285===n||36286===n){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;
358if(36283===n)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===n?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}let cT=`
359void main() {
360
361	gl_Position = vec4( position, 1.0 );
362
363}`,cw=`
364uniform sampler2DArray depthColor;
365uniform float depthWidth;
366uniform float depthHeight;
367
368void main() {
369
370	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
371
372	if ( coord.x >= 1.0 ) {
373
374		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
375
376	} else {
377
378		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
379
380	}
381
382}`;class cE{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let n=new rf(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new aR({vertexShader:cT,fragmentShader:cw,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new n1(new ad(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class cA extends er{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null;const f="u">typeof XRWebGLBinding,m=new cE,g={},v=t.getContextAttributes();let _=null,y=null;const x=[],b=[],S=new eg;let M=null;const T=new sT;T.viewport=new eD;const w=new sT;w.viewport=new eD;const E=[T,w],A=new s1;let C=null,R=null;function P(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function I(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",L);for(let e=0;e<x.length;e++){let t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}for(let e in C=null,R=null,m.reset(),g)delete g[e];e.setRenderTarget(_),d=null,h=null,c=null,i=null,y=null,F.stop(),n.isPresenting=!1,e.setPixelRatio(M),e.setSize(S.width,S.height,!1),n.dispatchEvent({type:"sessionend"})}function L(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],i=b.indexOf(n);i>=0&&(b[i]=null,x[i].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],i=b.indexOf(n);if(-1===i){for(let e=0;e<x.length;e++)if(e>=b.length){b.push(n),i=e;break}else if(null===b[e]){b[e]=n,i=e;break}if(-1===i)break}let r=x[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new tl,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new tl,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new tl,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&ee("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&ee("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(i,t)),c},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(null!==(i=u)){if(_=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",I),i.addEventListener("inputsourceschange",L),!0!==v.xrC
382ompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?1027:1026,a=v.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=(c=this.getBinding()).createProjectionLayer(o),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),y=new eF(h.textureWidth,h.textureHeight,{format:1023,type:1009,depthTexture:new rd(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),y=new eF(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}y.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),F.setContext(i),F.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const N=new e_,U=new e_;function D(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,r;if(null===i)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),A.near=w.near=T.near=a,A.far=w.far=T.far=s,(C!==A.near||R!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),C=A.near,R=A.far),A.layers.mask=6|e.layers.mask,T.layers.mask=-5&A.layers.mask,w.layers.mask=-3&A.layers.mask;let o=e.parent,l=A.cameras;D(A,o);for(let e=0;e<l.length;e++)D(l[e],o);2===l.length?function(e,t,n){N.setFromMatrixPosition(t.matrixWorld),U.setFromMatrixPosition(n.matrixWorld);let i=N.distanceTo(U),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],u=(r[9]-1)/r[5],c=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=i/(-c+h),p=-(d*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+d,n=o+d;e.projectionMatrix.makePerspective(s*c-p,s*h+(i-p),l*o/n*t,u*o/n*t,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(A,T,w):A.projectionMatrix.copy(T.projectionMatrix),t=e,n=A,null===(r=o)?t.matrix.copy(n.matrixWorld):(t.matrix.copy(r.matrixWorld),t.matrix.invert(),t.matrix.multiply(n.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(n.projectionMatrix),t.projectionMatrixInverse.copy(n.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*el*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==h||null!==d)return o},this.setFoveation=function(e){o=e,null!==h&&(h.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(A)},this.getCameraTexture=function(e){return g[e]};let O=null;const F=new lh;F.setAnimationLoop(function(t,r){if(u=r.getViewerPose(l||a),p=r,null!==u){let t=u.views;null!==d&&(e.setRenderTargetFramebuffer(y,d.framebuffer),e.setRenderTarget(y));let r=!1;t.length!==A.cameras.length&&(A.cameras.length=0,r=!0);for(let n=0;n<t.length;n++){let i=t[n],a=null;if(null!==d)a=d.getViewport(i);else{let t=c.getViewSubImage(h,i);a=t.viewport,0===n&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let s=E[n];void 0===s&&((s=new sT).layers.enable(n),s.viewport=new eD,E[n]=s),s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(i.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(A.matrix.copy(s.matrix
382),A.matrix.decompose(A.position,A.quaternion,A.scale)),!0===r&&A.cameras.push(s)}let a=i.enabledFeatures;if(a&&a.includes("depth-sensing")&&"gpu-optimized"==i.depthUsage&&f){let e=(c=n.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,i.renderState)}if(a&&a.includes("camera-access")&&f){e.state.unbindTexture(),c=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new rf,g[n]=e);let t=c.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){let t=b[e],n=x[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}O&&O(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){O=e},this.dispose=function(){}}}let cC=new eV,cR=new eb;function cP(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);let r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(cC.makeRotationFromEuler(s)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&e.envMapRotation.value.premultiply(cR),e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,aA(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,u,c,h,d,p,f,m,g,v,_,y,x,b,S,M,T,w,E,A,C,R,P;let I;r.isNodeMaterial?r.uniformsNeedUpdate=!1:r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?(i(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(i(e,r),l=e,(u=r).gradientMap&&(l.gradientMap.value=u.gradientMap)):r.isMeshPhongMaterial?(i(e,r),c=e,h=r,c.specular.value.copy(h.specular),c.shininess.value=Math.max(h.shininess,1e-4),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(i(e,r),d=e,p=r,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),r.isMeshPhysicalMaterial&&(f=e,m=r,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>
3820&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,f.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(i(e,r),v=e,(_=r).matcap&&(v.matcap.value=_.matcap)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),y=e,x=r,I=t.get(x).light,y.referencePosition.value.setFromMatrixPosition(I.matrixWorld),y.nearDistance.value=I.shadow.camera.near,y.farDistance.value=I.shadow.camera.far):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(b=e,S=r,b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,S.map&&(b.map.value=S.map,n(S.map,b.mapTransform)),r.isLineDashedMaterial&&(M=e,T=r,M.dashSize.value=T.dashSize,M.totalSize.value=T.dashSize
382+T.gapSize,M.scale.value=T.scale)):r.isPointsMaterial?(w=e,E=r,A=a,C=s,w.diffuse.value.copy(E.color),w.opacity.value=E.opacity,w.size.value=E.size*A,w.scale.value=.5*C,E.map&&(w.map.value=E.map,n(E.map,w.uvTransform)),E.alphaMap&&(w.alphaMap.value=E.alphaMap,n(E.alphaMap,w.alphaMapTransform)),E.alphaTest>0&&(w.alphaTest.value=E.alphaTest)):r.isSpriteMaterial?(R=e,P=r,R.diffuse.value.copy(P.color),R.opacity.value=P.opacity,R.rotation.value=P.rotation,P.map&&(R.map.value=P.map,n(P.map,R.mapTransform)),P.alphaMap&&(R.alphaMap.value=P.alphaMap,n(P.alphaMap,R.alphaMapTransform)),P.alphaTest>0&&(R.alphaTest.value=P.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function cI(e,t,n,i){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,n,i,r){if(!0===function(e,t,n,i){let r=e.value,a=t+"_"+n;if(void 0===i[a])return"number"==typeof r||"boolean"==typeof r?i[a]=r:ArrayBuffer.isView(r)?i[a]=r.slice():i[a]=r.clone(),!0;{let e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(ArrayBuffer.isView(r))return!0;else if(!1===e.equals(r))return e.copy(r),!0}return!1}(t,n,i,r)){let n=t.__offset,i=t.value;if(Array.isArray(i)){let e=0;for(let n=0;n<i.length;n++){let r=i[n],a=c(r);u(r,t.__data,e),"number"==typeof r||"boolean"==typeof r||r.isMatrix3||ArrayBuffer.isView(r)||(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else u(i,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function u(e,t,n){"number"==typeof e||"boolean"==typeof e?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function c(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?ee("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):ee("WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let n=t.target;n.removeEventListener("dispose",h);let i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){let n=t.program;i.uniformBlockBinding(e,n)},update:function(n,u){var d;let p,f,m,g,v=r[n.id];void 0===v&&(function(e){let t=e.uniforms,n=0;for(let e=0,i=t.length;e<i;e++){let i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){let t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){let i=c(r[e]),a=n%16,s=a%i.boundary,o=a+s;n+=s,0!==o&&16-o<i.storage&&(n+=16-o),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}let i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),(d=n).__bindingPointIndex=p=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return et("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),f=e.createBuffer(),m=d.__size,g=d.usage,e.bindBuffer(e.UNIFORM_BUFFER,f),e.bufferData(e.UNIFORM_BUFFER,m,g),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,p,f),v=f,r[n.id]=v,n.addEventListener("dispose",h));let _=u.program;i.updateUBOMapping(n,_);let y=t.render.frame;a[n.id]!==y&&(function(t){let n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=i.length;e<t;e++){let t=i[e];if(Array.isArray(t))for(let n=0,i=t.length;n<i;n++)l(t[n],e,n,a);else l(t,e,0,a)}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=y)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}cR.set(-1,0,0,0,1,0,0,0,1);let cL=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10
382751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),cN=null;class cU{constructor(e={}){let t,n,i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,_,y,x,b,S,M,T;const{canvas:w=q(),context:E=null,depth:A=!0,stencil:C=!1,alpha:R=!1,antialias:P=!1,premultipliedAlpha:I=!0,preserveDrawingBuffer:L=!1,powerPreference:N="default",failIfMajorPerformanceCaveat:U=!1,reversedDepthBuffer:D=!1,outputBufferType:O=1009}=e;if(this.isWebGLRenderer=!0,null!==E){if("u">typeof WebGLRenderingContext&&E instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=E.getContextAttributes().alpha}else t=R;const F=new Set([1033,1031,1029]),B=new Set([1009,1014,1012,1020,1017,1018]),z=new Uint32Array(4),k=new Int32Array(4),H=new e_;let V=null,G=null;const W=[],j=[];let X=null;this.domElement=w,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const Y=this;let Z=!1,K=null,J=null,Q=null,en=null;this._outputColorSpace="srgb";let ei=0,er=0,ea=null,es=-1,eo=null;const el=new eD,eu=new eD;let ec=null;const eh=new tp(0);let ed=0,ep=w.width,ef=w.height,em=1,eg=null,ev=null;const ey=new eD(0,0,ep,ef),ex=new eD(0,0,ep,ef);let eb=!1;const eS=new iE;let eM=!1,eT=!1;const eE=new eV,eA=new e_,eC=new eD,eR={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eP=!1;function eI(){return null===ea?em:1}let eL=E;function eN(e,t){return w.getContext(e,t)}try{if("setAttribute"in w&&w.setAttribute("data-engine","three.js r185"),w.addEventListener("webglcontextlost",eB,!1),w.addEventListener("webglcontextrestored",ez,!1),w.addEventListener("webglcontextcreationerror",ek,!1),null===eL){const e="webgl2";if(eL=eN(e,{alpha:!0,depth:A,stencil:C,antialias:P,premultipliedAlpha:I,preserveDrawingBuffer:L,powerPreference:N,failIfMajorPerformanceCaveat:U}
382),null===eL)if(eN(e))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(e){throw et("WebGLRenderer: "+e.message),e}function eU(){(n=new lk(eL)).init(),S=new cM(eL,n),i=new lS(eL,n,e,S),r=new cb(eL,n),i.reversedDepthBuffer&&D&&r.buffers.depth.setReversed(!0),J=eL.createFramebuffer(),Q=eL.createFramebuffer(),en=eL.createFramebuffer(),a=new lG(eL),s=new cr,o=new cS(eL,n,r,s,i,S,a),l=new lz(Y),u=new ld(eL),M=new lx(eL,u),c=new lH(eL,u,a,M),h=new lj(eL,c,u,M,a),y=new lW(eL,i,o),g=new lM(s),d=new ci(Y,l,n,i,M,g),p=new cP(Y,s),f=new cl,m=new cf(n),_=new ly(Y,l,r,h,t,I),v=new cx(Y,h,i),T=new cI(eL,a,i,r),x=new lb(eL,n,a),b=new lV(eL,n,a),a.programs=d.programs,Y.capabilities=i,Y.extensions=n,Y.properties=s,Y.renderLists=f,Y.shadowMap=v,Y.state=r,Y.info=a}eU(),1009!==O&&(X=new lq(O,w.width,w.height,P,A,C));const eO=new cA(Y,eL);function eB(e){e.preventDefault(),$("WebGLRenderer: Context Lost."),Z=!0}function ez(){$("WebGLRenderer: Context Restored."),Z=!1;let e=a.autoReset,t=v.enabled,n=v.autoUpdate,i=v.needsUpdate,r=v.type;eU(),a.autoReset=e,v.enabled=t,v.autoUpdate=n,v.needsUpdate=i,v.type=r}function ek(e){et("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eH(e){var t,n;let i,r=e.target;r.removeEventListener("dispose",eH),n=t=r,void 0!==(i=s.get(n).programs)&&(i.forEach(function(e){d.releaseProgram(e)}),n.isShaderMaterial&&d.releaseShaderCache(n)),s.remove(t)}function eG(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eQ(e,t,n),e.side=0,e.needsUpdate=!0,eQ(e,t,n),e.side=2):eQ(e,t,n)}this.xr=eO,this.getContext=function(){return eL},this.getContextAttributes=function(){return eL.getContextAttributes()},this.forceContextLoss=function(){let e=n.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=n.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return em},this.setPixelRatio=function(e){void 0!==e&&(em=e,this.setSize(ep,ef,!1))},this.getSize=function(e){return e.set(ep,ef)},this.setSize=function(e,t,n=!0){eO.isPresenting?ee("WebGLRenderer: Can't change size while VR device is presenting."):(ep=e,ef=t,w.width=Math.floor(e*em),w.height=Math.floor(t*em),!0===n&&(w.style.width=e+"px",w.style.height=t+"px"),null!==X&&X.setSize(w.width,w.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ep*em,ef*em).floor()},this.setDrawingBufferSize=function(e,t,n){ep=e,ef=t,em=n,w.width=Math.floor(e*n),w.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(1009===O)return void et("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){ee("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}X.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(el)},this.getViewport=function(e){return e.copy(ey)},this.setViewport=function(e,t,n,i){e.isVector4?ey.set(e.x,e.y,e.z,e.w):ey.set(e,t,n,i),r.viewport(el.copy(ey).multiplyScalar(em).round())},this.getScissor=function(e){return e.copy(ex)},this.setScissor=function(e,t,n,i){e.isVector4?ex.set(e.x,e.y,e.z,e.w):ex.set(e,t,n,i),r.scissor(eu.copy(ex).multiplyScalar(em).round())},this.getScissorTest=function(){return eb},this.setScissorTest=function(e){r.setScissorTest(eb=e)},this.setOpaqueSort=function(e){eg=e},this.setTransparentSort=function(e){ev=e},this.getClearColor=function(e){return e.copy(_.getClearColor())},this.setClearColor=function(){_.setClearColor(...arguments)},this.getClearAlpha=function(){return _.getClearAlpha()},this.setClearAlpha=function(){_.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==ea){let t=ea.texture.format;e=F.has(t)}if(e){let e=ea.texture.type,t=B.has(e),n=_.getClearColor(),i=_.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(z[0]=r,z[1]=a,z[2]=s,z[3]=i,eL.clearBufferuiv(eL.COLOR,0,z)):(k[0]=r,k[1]=a,k[2]=s,k[3]=i,eL.clearBufferiv(eL.COLOR,0,k))}else i|=eL.COLOR_BUFFER_BIT}t&&(i|=eL.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(i|=eL.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==i&&eL.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(e){e.setRenderer(this),K=e},this.dispose=function(){w.removeEventListener("webglcontextlost",eB,!1),w.removeEventListener("webglcontextrestored",ez,!1),w.removeEventListener("webglcontextcreationerror",ek,!1),_.dispose(),f.dispose(),m.dispose(),s.dispose(),l.dispose(),h.dispose(),M.dispose(),T.dispose(),d.dispose(),eO.dispose(),eO.removeEventListener("sessionstart",ej),eO.removeEventListener("sessionend",eX),eq.stop()},this.renderBufferDirect=function(e,t,a,h,d,f){let m;null===t&&(t=eR);let v=d.isMesh&&0>d.matrixWorld.determinantAffine(),_=function(e,t,n,a,u){!0!==t.isScene&&(t=eR),o.resetTextureUnits();let c=t.fog,h=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?t.environment:null,d=null===ea?Y.outputColorSpace:!0===ea.isXRRenderTarget?ea.texture.colorSpace:ew.workingColorSpace,f=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap,m=l.get(a.envMap||h,f),v=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,_=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),x=!!n.morphAttributes.position,b=!!n.morphAttributes.normal,S=!!n.morphAttributes.color,M=0;a.toneMapped&&(null===ea||!0===ea.isXRRenderTarget)&&(M=Y.toneMapping);let w=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,E=void 0!==w?w.length:0,A=s.get(a),C=G.state.lights;if(!0===eM&&(!0===eT||e!==eo)){let t=e===eo&&a.id===es;g.setState(a,e,t)}let R=!1;a.version===A.__version?A.needsLights&&A.lightsStateVersion!==C.state.ver
382sion||A.outputColorSpace!==d||u.isBatchedMesh&&!1===A.batching?R=!0:u.isBatchedMesh||!0!==A.batching?u.isBatchedMesh&&!0===A.batchingColor&&null===u.colorTexture||u.isBatchedMesh&&!1===A.batchingColor&&null!==u.colorTexture||u.isInstancedMesh&&!1===A.instancing?R=!0:u.isInstancedMesh||!0!==A.instancing?u.isSkinnedMesh&&!1===A.skinning?R=!0:u.isSkinnedMesh||!0!==A.skinning?u.isInstancedMesh&&!0===A.instancingColor&&null===u.instanceColor||u.isInstancedMesh&&!1===A.instancingColor&&null!==u.instanceColor||u.isInstancedMesh&&!0===A.instancingMorph&&null===u.morphTexture||u.isInstancedMesh&&!1===A.instancingMorph&&null!==u.morphTexture||A.envMap!==m||!0===a.fog&&A.fog!==c||void 0!==A.numClippingPlanes&&(A.numClippingPlanes!==g.numPlanes||A.numIntersection!==g.numIntersection)||A.vertexAlphas!==v||A.vertexTangents!==_||A.morphTargets!==x||A.morphNormals!==b||A.morphColors!==S||A.toneMapping!==M||A.morphTargetsCount!==E?R=!0:!!A.lightProbeGrid!=G.state.lightProbeGridArray.length>0&&(R=!0):R=!0:R=!0:R=!0:(R=!0,A.__version=a.version);let P=A.currentProgram;!0===R&&(P=eQ(a,t,u),K&&a.isNodeMaterial&&K.onUpdateProgram(a,P,A));let I=!1,L=!1,N=!1,U=P.getUniforms(),D=A.uniforms;if(r.useProgram(P.program)&&(I=!0,L=!0,N=!0),a.id!==es&&(es=a.id,L=!0),A.needsLights){let e=function(e,t){if(0===e.length)return null;if(1===e.length)return null!==e[0].texture?e[0]:null;H.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(null!==n.texture&&n.boundingBox.containsPoint(H))return n}return null}(G.state.lightProbeGridArray,u);A.lightProbeGrid!==e&&(A.lightProbeGrid=e,L=!0)}if(I||eo!==e){r.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),U.setValue(eL,"projectionMatrix",e.projectionMatrix),U.setValue(eL,"viewMatrix",e.matrixWorldInverse);let t=U.map.cameraPosition;void 0!==t&&t.setValue(eL,eA.setFromMatrixPosition(e.matrixWorld)),i.logarithmicDepthBuffer&&U.setValue(eL,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&U.setValue(eL,"isOrthographic",!0===e.isOrthographicCamera),eo!==e&&(eo=e,L=!0,N=!0)}if(A.needsLights&&(C.state.directionalShadowMap.length>0&&U.setValue(eL,"directionalShadowMap",C.state.directionalShadowMap,o),C.state.spotShadowMap.length>0&&U.setValue(eL,"spotShadowMap",C.state.spotShadowMap,o),C.state.pointShadowMap.length>0&&U.setValue(eL,"pointShadowMap",C.state.pointShadowMap,o)),u.isSkinnedMesh){U.setOptional(eL,u,"bindMatrix"),U.setOptional(eL,u,"bindMatrixInverse");let e=u.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),U.setValue(eL,"boneTexture",e.boneTexture,o))}u.isBatchedMesh&&(U.setOptional(eL,u,"batchingTexture"),U.setValue(eL,"batchingTexture",u._matricesTexture,o),U.setOptional(eL,u,"batchingIdTexture"),U.setValue(eL,"batchingIdTexture",u._indirectTexture,o),U.setOptional(eL,u,"batchingColorTexture"),null!==u._colorsTexture&&U.setValue(eL,"batchingColorTexture",u._colorsTexture,o));let O=n.morphAttributes;if((void 0!==O.position||void 0!==O.normal||void 0!==O.color)&&y.update(u,n,P),(L||A.receiveShadow!==u.receiveShadow)&&(A.receiveShadow=u.receiveShadow,U.setValue(eL,"receiveShadow",u.receiveShadow)),(a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial)&&null===a.envMap&&null!==t.environment&&(D.envMapIntensity.value=t.environmentIntensity),void 0!==D.dfgLUT&&(D.dfgLUT.value=(null===cN&&((cN=new ia(cL,16,16,1030,1016)).name="DFG_LUT",cN.minFilter=1006,cN.magFilter=1006,cN.wrapS=1001,cN.wrapT=1001,cN.generateMipmaps=!1,cN.needsUpdate=!0),cN)),L){var F,B;if(U.setValue(eL,"toneMappingExposure",Y.toneMappingExposure),A.needsLights&&(F=D,B=N,F.ambientLightColor.needsUpdate=B,F.lightProbe.needsUpdate=B,F.directionalLights.needsUpdate=B,F.directionalLightShadows.needsUpdate=B,F.pointLights.needsUpdate=B,F.pointLightShadows.needsUpdate=B,F.spotLights.needsUpdate=B,F.spotLightShadows.needsUpdate=B,F.rectAreaLights.needsUpdate=B,F.hemisphereLights.needsUpdate=B),c&&!0===a.fog&&p.refreshFogUniforms(D,c),p.refreshMaterialUniforms(D,a,em,ef,G.state.transmissionRenderTarget[e.id]),A.needsLights&&A.lightProbeGrid){let e=A.lightProbeGrid;D.probesSH.value=e.texture,D.probesMin.value.copy(e.boundingBox.min),D.probesMax.value.copy(e.boundingBox.max),D.probesResolution.value.copy(e.resolution)}uH.upload(eL,e0(A),D,o)}if(a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(uH.upload(eL,e0(A),D,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&U.setValue(eL,"center",u.center),U.setValue(eL,"modelViewMatrix",u.modelViewMatrix),U.setValue(eL,"normalMatrix",u.normalMatrix),U.setValue(eL,"modelMatrix",u.matrixWorld),void 0!==a.uniformsGroups){let e=a.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];T.update(n,P),T.bind(n,P)}}return P}(e,t,a,h,d);r.setMaterial(h,v);let S=a.index,w=1;if(!0===h.wireframe){if(void 0===(S=c.getWireframeAttribute(a)))return;w=2}let E=a.drawRange,A=a.attributes.position,C=E.start*w,R=(E.start+E.count)*w;null!==f&&(C=Math.max(C,f.start*w),R=Math.min(R,(f.start+f.count)*w)),null!==S?(C=Math.max(C,0),R=Math.min(R,S.count)):null!=A&&(C=Math.max(C,0),R=Math.min(R,A.count));let P=R-C;
382if(P<0||P===1/0)return;M.setup(d,h,_,a,S);let I=x;if(null!==S&&(m=u.get(S),(I=b).setIndex(m)),d.isMesh)!0===h.wireframe?(r.setLineWidth(h.wireframeLinewidth*eI()),I.setMode(eL.LINES)):I.setMode(eL.TRIANGLES);else if(d.isLine){let e=h.linewidth;void 0===e&&(e=1),r.setLineWidth(e*eI()),d.isLineSegments?I.setMode(eL.LINES):d.isLineLoop?I.setMode(eL.LINE_LOOP):I.setMode(eL.LINE_STRIP)}else d.isPoints?I.setMode(eL.POINTS):d.isSprite&&I.setMode(eL.TRIANGLES);if(d.isBatchedMesh)if(n.get("WEBGL_multi_draw"))I.renderMultiDraw(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount);else{let e=d._multiDrawStarts,t=d._multiDrawCounts,n=d._multiDrawCount,i=S?u.get(S).bytesPerElement:1,r=s.get(h).currentProgram.getUniforms();for(let a=0;a<n;a++)r.setValue(eL,"_gl_DrawID",a),I.render(e[a]/i,t[a])}else if(d.isInstancedMesh)I.renderInstances(C,P,d.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);I.renderInstances(C,P,t)}else I.render(C,P)},this.compile=function(e,t,n=null){null===n&&(n=e),(G=m.get(n)).init(t),j.push(G),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(G.pushLight(e),e.castShadow&&G.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(G.pushLight(e),e.castShadow&&G.pushShadow(e))}),G.setupLights();let i=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){let a=t[r];eG(a,n,e),i.add(a)}else eG(t,n,e),i.add(t)}),G=j.pop(),i},this.compileAsync=function(e,t,i=null){let r=this.compile(e,t,i);return new Promise(t=>{function i(){(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)?t(e):setTimeout(i,10)}null!==n.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)})};let eW=null;function ej(){eq.stop()}function eX(){eq.start()}const eq=new lh;function eY(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLightProbeGrid)G.pushLightProbeGrid(e);else if(e.isLight)G.pushLight(e),e.castShadow&&G.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eS.intersectsSprite(e)){i&&eC.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eE);let t=h.update(e),r=e.material;r.visible&&V.push(e,t,r,n,eC.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||eS.intersectsObject(e))){let t=h.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eC.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eC.copy(t.boundingSphere.center)),eC.applyMatrix4(e.matrixWorld).applyMatrix4(eE)),Array.isArray(r)){let i=t.groups;for(let a=0,s=i.length;a<s;a++){let s=i[a],o=r[s.materialIndex];o&&o.visible&&V.push(e,t,o,n,eC.z,s)}}else r.visible&&V.push(e,t,r,n,eC.z,null)}}let r=e.children;for(let e=0,a=r.length;e<a;e++)eY(r[e],t,n,i)}function eZ(e,t,n,i){let{opaque:a,transmissive:s,transparent:o}=e;G.setupLightsView(n),!0===eM&&g.setGlobalState(Y.clippingPlanes,n),i&&r.viewport(el.copy(i)),a.length>0&&eJ(a,t,n),s.length>0&&eJ(s,t,n),o.length>0&&eJ(o,t,n),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eK(e,t,r,a){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;if(void 0===G.state.transmissionRenderTarget[a.id]){let e=n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float");G.state.transmissionRenderTarget[a.id]=new eF(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:Math.max(4,i.samples),stencilBuffer:C,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ew.workingColorSpace})}let s=G.state.transmissionRenderTarget[a.id],l=a.viewport||el;s.setSize(l.z*Y.transmissionResolutionScale,l.w*Y.transmissionResolutionScale);let u=Y.getRenderTarget(),c=Y.getActiveCubeFace(),h=Y.getActiveMipmapLevel();Y.setRenderTarget(s),Y.getClearColor(eh),(ed=Y.getClearAlpha())<1&&Y.setClearColor(0xffffff,.5),Y.clear(),eP&&_.render(r);let d=Y.toneMapping;Y.toneMapping=0;let p=a.viewport;if(void 0!==a.viewport&&(a.viewport=void 0),G.setupLightsView(a),!0===eM&&g.setGlobalState(Y.clippingPlanes,a),eJ(e,r,a),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,i=t.length;n<i;n++){let{object:i,geometry:s,material:o,group:l}=t[n];
382if(2===o.side&&i.layers.test(a.layers)){let t=o.side;o.side=1,o.needsUpdate=!0,e$(i,r,a,s,o,l),o.side=t,o.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s))}Y.setRenderTarget(u,c,h),Y.setClearColor(eh,ed),void 0!==p&&(a.viewport=p),Y.toneMapping=d}function eJ(e,t,n){let i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){let a=e[r],{object:s,geometry:o,group:l}=a,u=a.material;!0===u.allowOverride&&null!==i&&(u=i),s.layers.test(n.layers)&&e$(s,t,n,o,u,l)}}function e$(e,t,n,i,r,a){e.onBeforeRender(Y,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(Y,t,n,i,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,Y.renderBufferDirect(n,t,i,r,e,a),r.side=0,r.needsUpdate=!0,Y.renderBufferDirect(n,t,i,r,e,a),r.side=2):Y.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(Y,t,n,i,r,a)}function eQ(e,t,n){var i;!0!==t.isScene&&(t=eR);let r=s.get(e),a=G.state.lights,o=G.state.shadowsArray,u=a.state.version,c=d.getParameters(e,a.state,o,t,n,G.state.lightProbeGridArray),h=d.getProgramCacheKey(c),p=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let f=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=l.get(e.envMap||r.environment,f),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",eH),r.programs=p=new Map);let m=p.get(h);if(void 0!==m){if(r.currentProgram===m&&r.lightsStateVersion===u)return e1(e,c),m}else c.uniforms=d.getUniforms(e),null!==K&&e.isNodeMaterial&&K.build(e,n,c),e.onBeforeCompile(c,Y),m=d.acquireProgram(c,h),p.set(h,m),r.uniforms=c.uniforms;let v=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(v.clippingPlanes=g.uniform),e1(e,c),r.needsLights=(i=e).isMeshLambertMaterial||i.isMeshToonMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isShadowMaterial||i.isShaderMaterial&&!0===i.lights,r.lightsStateVersion=u,r.needsLights&&(v.ambientLightColor.value=a.state.ambient,v.lightProbe.value=a.state.probe,v.directionalLights.value=a.state.directional,v.directionalLightShadows.value=a.state.directionalShadow,v.spotLights.value=a.state.spot,v.spotLightShadows.value=a.state.spotShadow,v.rectAreaLights.value=a.state.rectArea,v.ltc_1.value=a.state.rectAreaLTC1,v.ltc_2.value=a.state.rectAreaLTC2,v.pointLights.value=a.state.point,v.pointLightShadows.value=a.state.pointShadow,v.hemisphereLights.value=a.state.hemi,v.directionalShadowMatrix.value=a.state.directionalShadowMatrix,v.spotLightMatrix.value=a.state.spotLightMatrix,v.spotLightMap.value=a.state.spotLightMap,v.pointShadowMatrix.value=a.state.pointShadowMatrix),r.lightProbeGrid=G.state.lightProbeGridArray.length>0,r.currentProgram=m,r.uniformsList=null,m}function e0(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=uH.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function e1(e,t){let n=s.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}eq.setAnimationLoop(function(e){eW&&eW(e)}),"u">typeof self&&eq.setContext(self),this.setAnimationLoop=function(e){eW=e,eO.setAnimationLoop(e),null===e?eq.stop():eq.start()},eO.addEventListener("sessionstart",ej),eO.addEventListener("sessionend",eX),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void et("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===Z)return;null!==K&&K.renderStart(e,t);let n=!0===eO.enabled&&!0===eO.isPresenting,i=null!==X&&(null===ea||n)&&X.begin(Y,ea);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eO.enabled&&!0===eO.isPresenting&&(null===X||!1===X.isCompositing(
382))&&(!0===eO.cameraAutoUpdate&&eO.updateCamera(t),t=eO.getCamera()),!0===e.isScene&&e.onBeforeRender(Y,e,t,ea),(G=m.get(e,j.length)).init(t),G.state.textureUnits=o.getTextureUnits(),j.push(G),eE.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eS.setFromProjectionMatrix(eE,2e3,t.reversedDepth),eT=this.localClippingEnabled,eM=g.init(this.clippingPlanes,eT),(V=f.get(e,W.length)).init(),W.push(V),!0===eO.enabled&&!0===eO.isPresenting){let e=Y.xr.getDepthSensingMesh();null!==e&&eY(e,t,-1/0,Y.sortObjects)}eY(e,t,0,Y.sortObjects),V.finish(),!0===Y.sortObjects&&V.sort(eg,ev,t.reversedDepth),(eP=!1===eO.enabled||!1===eO.isPresenting||!1===eO.hasDepthSensing())&&_.addToRenderList(V,e),this.info.render.frame++,!0===this.info.autoReset&&this.info.reset(),!0===eM&&g.beginShadows();let r=G.state.shadowsArray;if(v.render(r,e,t),!0===eM&&g.endShadows(),!1===(i&&X.hasRenderPass())){let n=V.opaque,i=V.transmissive;if(G.setupLights(),t.isArrayCamera){let r=t.cameras;if(i.length>0)for(let t=0,a=r.length;t<a;t++)eK(n,i,e,r[t]);eP&&_.render(e);for(let t=0,n=r.length;t<n;t++){let n=r[t];eZ(V,e,n,n.viewport)}}else i.length>0&&eK(n,i,e,t),eP&&_.render(e),eZ(V,e,t)}null!==ea&&0===er&&(o.updateMultisampleRenderTarget(ea),o.updateRenderTargetMipmap(ea)),i&&X.end(Y),!0===e.isScene&&e.onAfterRender(Y,e,t),M.resetDefaultState(),es=-1,eo=null,j.pop(),j.length>0?(G=j[j.length-1],o.setTextureUnits(G.state.textureUnits),!0===eM&&g.setGlobalState(Y.clippingPlanes,G.state.camera)):G=null,W.pop(),V=W.length>0?W[W.length-1]:null,null!==K&&K.renderEnd()},this.getActiveCubeFace=function(){return ei},this.getActiveMipmapLevel=function(){return er},this.getRenderTarget=function(){return ea},this.setRenderTargetTextures=function(e,t,n){let i=s.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=s.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){ea=e,ei=t,er=n;let i=null,a=!1,l=!1;if(e){let u=s.get(e);if(void 0!==u.__useDefaultFramebuffer){r.bindFramebuffer(eL.FRAMEBUFFER,u.__webglFramebuffer),el.copy(e.viewport),eu.copy(e.scissor),ec=e.scissorTest,r.viewport(el),r.scissor(eu),r.setScissorTest(ec),es=-1;return}if(void 0===u.__webglFramebuffer)o.setupRenderTarget(e);else if(u.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(u.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(l=!0);let h=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(h[t])?h[t][n]:h[t],a=!0):i=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(h)?h[n]:h,el.copy(e.viewport),eu.copy(e.scissor),ec=e.scissorTest}else el.copy(ey).multiplyScalar(em).floor(),eu.copy(ex).multiplyScalar(em).floor(),ec=eb;if(0!==n&&(i=J),r.bindFramebuffer(eL.FRAMEBUFFER,i)&&r.drawBuffers(e,i),r.viewport(el),r.scissor(eu),r.setScissorTest(ec),a){let i=s.get(e.texture);eL.framebufferTexture2D(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(l)for(let i=0;i<e.textures.length;i++){let r=s.get(e.textures[i]);eL.framebufferTextureLayer(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0+i,r.__webglTexture,n,t)}else if(null!==e&&0!==n){let t=s.get(e.texture);eL.framebufferTexture2D(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,t.__webglTexture,n)}es=-1},this.readRenderTargetPixels=function(e,t,n,a,o,l,u,c=0){if(!(e&&e.isWebGLRenderTarget))return void et("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;
382if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h){r.bindFramebuffer(eL.FRAMEBUFFER,h);try{let r=e.textures[c],s=r.format,u=r.type;if(e.textures.length>1&&eL.readBuffer(eL.COLOR_ATTACHMENT0+c),!i.textureFormatReadable(s))return void et("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!i.textureTypeReadable(u))return void et("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&eL.readPixels(t,n,a,o,S.convert(s),S.convert(u),l)}finally{let e=null!==ea?s.get(ea).__webglFramebuffer:null;r.bindFramebuffer(eL.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,a,o,l,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(h=h[u]),h)if(t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o){var d;r.bindFramebuffer(eL.FRAMEBUFFER,h);let u=e.textures[c],p=u.format,f=u.type;if(e.textures.length>1&&eL.readBuffer(eL.COLOR_ATTACHMENT0+c),!i.textureFormatReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!i.textureTypeReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eL.createBuffer();eL.bindBuffer(eL.PIXEL_PACK_BUFFER,m),eL.bufferData(eL.PIXEL_PACK_BUFFER,l.byteLength,eL.STREAM_READ),eL.readPixels(t,n,a,o,S.convert(p),S.convert(f),0);let g=null!==ea?s.get(ea).__webglFramebuffer:null;r.bindFramebuffer(eL.FRAMEBUFFER,g);let v=eL.fenceSync(eL.SYNC_GPU_COMMANDS_COMPLETE,0);return eL.flush(),await (d=eL,new Promise(function(e,t){setTimeout(function n(){switch(d.clientWaitSync(v,d.SYNC_FLUSH_COMMANDS_BIT,0)){case d.WAIT_FAILED:t();break;case d.TIMEOUT_EXPIRED:setTimeout(n,4);break;default:e()}},4)})),eL.bindBuffer(eL.PIXEL_PACK_BUFFER,m),eL.getBufferSubData(eL.PIXEL_PACK_BUFFER,0,l),eL.deleteBuffer(m),eL.deleteSync(v),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,n=0){let i=Math.pow(2,-n),a=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eL.copyTexSubImage2D(eL.TEXTURE_2D,n,0,0,l,u,a,s),r.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,a=0,l=0){let u,c,h,d,p,f,m,g,v,_,y=e.isCompressedTexture?e.mipmaps[l]:e.image;if(null!==n)u=n.max.x-n.min.x,c=n.max.y-n.min.y,h=n.isBox3?n.max.z-n.min.z:1,d=n.min.x,p=n.min.y,f=n.isBox3?n.min.z:0;else{let t=Math.pow(2,-a);u=Math.floor(y.width*t),c=Math.floor(y.height*t),h=e.isDataArrayTexture?y.depth:e.isData3DTexture?Math.floor(y.depth*t):1,d=0,p=0,f=0}null!==i?(m=i.x,g=i.y,v=i.z):(m=0,g=0,v=0);let x=S.convert(t.format),b=S.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),_=eL.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),_=eL.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),_=eL.TEXTURE_2D),r.activeTexture(eL.TEXTURE0),r.pixelStorei(eL.UNPACK_FLIP_Y_WEBGL,t.flipY),r.pixelStorei(eL.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),r.pixelStorei(eL.UNPACK_ALIGNMENT,t.unpackAlignment);let M=r.getParameter(eL.UNPACK_ROW_LENGTH),T=r.getParameter(eL.UNPACK_IMAGE_HEIGHT),w=r.getParameter(eL.UNPACK_SKIP_PIXELS),E=r.getParameter(eL.UNPACK_SKIP_ROWS),A=r.getParameter(eL.UNPACK_SKIP_IMAGES);r.pixelStorei(eL.UNPACK_ROW_LENGTH,y.width),r.pixelStorei(eL.UNPACK_IMAGE_HEIGHT,y.height),r.pixelStorei(eL.UNPACK_SKIP_PIXELS,d),r.pixelStorei(eL.UNPACK_SKIP_ROWS,p),r.pixelStorei(eL.UNPACK_SKIP_IMAGES,f);let C=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=s.get(e),i=s.get(t),o=s.get(n.__renderTarget),_=s.get(i.__renderTarget);r.bindFramebuffer(eL.READ_FRAMEBUFFER,o.__webglFramebuffer),r.bindFramebuffer(eL.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n<h;
382n++)C&&(eL.framebufferTextureLayer(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,s.get(e).__webglTexture,a,f+n),eL.framebufferTextureLayer(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,s.get(t).__webglTexture,l,v+n)),eL.blitFramebuffer(d,p,u,c,m,g,u,c,eL.DEPTH_BUFFER_BIT,eL.NEAREST);r.bindFramebuffer(eL.READ_FRAMEBUFFER,null),r.bindFramebuffer(eL.DRAW_FRAMEBUFFER,null)}else if(0!==a||e.isRenderTargetTexture||s.has(e)){let n=s.get(e),i=s.get(t);r.bindFramebuffer(eL.READ_FRAMEBUFFER,Q),r.bindFramebuffer(eL.DRAW_FRAMEBUFFER,en);for(let e=0;e<h;e++)C?eL.framebufferTextureLayer(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,n.__webglTexture,a,f+e):eL.framebufferTexture2D(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,n.__webglTexture,a),R?eL.framebufferTextureLayer(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,i.__webglTexture,l,v+e):eL.framebufferTexture2D(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,i.__webglTexture,l),0!==a?eL.blitFramebuffer(d,p,u,c,m,g,u,c,eL.COLOR_BUFFER_BIT,eL.NEAREST):R?eL.copyTexSubImage3D(_,l,m,g,v+e,d,p,u,c):eL.copyTexSubImage2D(_,l,m,g,d,p,u,c);r.bindFramebuffer(eL.READ_FRAMEBUFFER,null),r.bindFramebuffer(eL.DRAW_FRAMEBUFFER,null)}else R?e.isDataTexture||e.isData3DTexture?eL.texSubImage3D(_,l,m,g,v,u,c,h,x,b,y.data):t.isCompressedArrayTexture?eL.compressedTexSubImage3D(_,l,m,g,v,u,c,h,x,y.data):eL.texSubImage3D(_,l,m,g,v,u,c,h,x,b,y):e.isDataTexture?eL.texSubImage2D(eL.TEXTURE_2D,l,m,g,u,c,x,b,y.data):e.isCompressedTexture?eL.compressedTexSubImage2D(eL.TEXTURE_2D,l,m,g,y.width,y.height,x,y.data):eL.texSubImage2D(eL.TEXTURE_2D,l,m,g,u,c,x,b,y);r.pixelStorei(eL.UNPACK_ROW_LENGTH,M),r.pixelStorei(eL.UNPACK_IMAGE_HEIGHT,T),r.pixelStorei(eL.UNPACK_SKIP_PIXELS,w),r.pixelStorei(eL.UNPACK_SKIP_ROWS,E),r.pixelStorei(eL.UNPACK_SKIP_IMAGES,A),0===l&&t.generateMipmaps&&eL.generateMipmap(_),r.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){ei=0,er=0,ea=null,r.reset(),M.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ew._getDrawingBufferColorSpace(e),t.unpackColorSpace=ew._getUnpackColorSpace()}}var cD=n(41480);let cO=e=>{let t,n=new Set,i=(e,i)=>{let r="function"==typeof e?e(t):e;if(!Object.is(r,t)){let e=t;t=(null!=i?i:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,a={setState:i,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(i,r,a);return a},{useSyncExternalStoreWithSelector:cF}=cD,cB=(e,t)=>{let n=e?cO(e):cO,i=(e,i=t)=>(function(e,t=e=>e,n){let i=cF(e.subscribe,e.getState,e.getInitialState,t,n);return R.useDebugValue(i),i})(n,e,i);return Object.assign(i,n),i},cz=[];function ck(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let i=e.length;if(t.length!==i)return!1;for(let r=0;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}function cH(e,t=null,n=!1,i={}){for(let r of(null===t&&(t=[e]),cz))if(ck(t,r.keys,r.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(r,"error"))throw r.error;if(Object.prototype.hasOwnProperty.call(r,"response"))return i.lifespan&&i.lifespan>0&&(r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.remove,i.lifespan)),r.response;if(!n)throw r.promise}let r={keys:t,equal:i.equal,remove:()=>{let e=cz.indexOf(r);-1!==e&&cz.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{r.response=e,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(e=>r.error=e)};if(cz.push(r),!n)throw r.promise}var cV=n(15666);function cG(e,t,n){if(!e)return;if(!0===n(e))return e;let i=t?e.return:e.child;for(;i;){let e=cG(i,t,n);if(e)return e;i=t?null:i.sibling}}function cW(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"u">typeof window&&((null==(pO=window.document)?void 0:pO.createElement)||(null==(pF=window.navigator)?void 0:pF.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;let cj=cW(R.createContext(null));class cX extends R.Component{render(){return R.createElement(cj.Provider,{value:this._reactInternals},this.props.children)}}function cq(){let e=R.useContext(cj);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=R.useId();return R.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=cG(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let cY=Symbol.for("react.context"),cZ=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===cY;function cK(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}P.act;let cJ=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),c$="u">typeof window&&((null==(v=window.document)?void 0:v.createElement)||(null==(_=window.navigator)?void 0:_.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function cQ(e){let t=R.useRef(e);return c$(()=>void(t.current=e),[e]),t}function c0({set:e}){return c$(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let c1=((y=class extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),y);function c2(e){var t;let n="u">typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function c3(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let c4={obj:e=>e===Object(e)&&!c4.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:i="reference",strict:r=!0}={}){let a;if(typeof e!=typeof t||!!e!=!!t)return!1;if(c4.str(e)||c4.num(e)||c4.boo(e))return e===t;let s=c4.obj(e);if(s&&"reference"===i)return e===t;let o=c4.arr(e);if(o&&"reference"===n)return e===t;if((o||s)&&e===t)return!0;for(a in e)if(!(a in t))return!1;if(s&&"shallow"===n&&"shallow"===i){for(a in r?t:e)if(!c4.equ(e[a],t[a],{strict:r,objects:"reference"}))return!1}else for(a in r?t:e)if(e[a]!==t[a])return!1;if(c4.und(a)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;
382if(e!==t)return!1}return!0}},c5=["children","key","ref"];function c6(e){let t={};for(let n in e)c5.includes(n)||(t[n]=e[n]);return t}function c8(e,t,n,i){let r=null==e?void 0:e.__r3f;return!r&&(r={root:t,type:n,parent:null,children:[],props:c6(i),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=r)),r}function c7(e,t){if(!t.includes("-")||t in e)return{root:e,key:t,target:e[t]};let n=e,i=t.split("-");for(let r of i){if("object"!=typeof n||null===n){if(void 0!==n)return{root:n,key:i.slice(i.indexOf(r)).join("-"),target:void 0};return{root:e,key:t,target:void 0}}t=r,e=n,n=n[t]}return{root:e,key:t,target:n}}let c9=/-\d+$/;function he(e,t){if(c4.str(t.props.attach)){if(c9.test(t.props.attach)){let n=t.props.attach.replace(c9,""),{root:i,key:r}=c7(e.object,n);Array.isArray(i[r])||(i[r]=[])}let{root:n,key:i}=c7(e.object,t.props.attach);t.previousAttach=n[i],n[i]=t.object}else c4.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function ht(e,t){if(c4.str(t.props.attach)){let{root:n,key:i}=c7(e.object,t.props.attach),r=t.previousAttach;void 0===r?delete n[i]:n[i]=r}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let hn=[...c5,"args","dispose","attach","object","onUpdate","dispose"],hi=new Map,hr=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],ha=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function hs(e,t){var n,i;let r=e.__r3f,a=r&&cK(r).getState(),s=null==r?void 0:r.eventCount;for(let n in t){let s=t[n];if(hn.includes(n))continue;if(r&&ha.test(n)){"function"==typeof s?r.handlers[n]=s:delete r.handlers[n],r.eventCount=Object.keys(r.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=c7(e,n);if(void 0===u&&("object"!=typeof o||null===o))throw Error(`R3F: Cannot set "${n}". Ensure it is an object before setting "${l}".`);if(u instanceof eQ&&s instanceof eQ)u.mask=s.mask;else if(u instanceof tp&&cJ(s))u.set(s);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor)u.copy(s);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s))"function"==typeof u.fromArray?u.fromArray(s):u.set(...s);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s)"function"==typeof u.setScalar?u.setScalar(s):u.set(s);else if(o instanceof aR&&"uniforms"===l&&c4.obj(s)){c4.obj(o.uniforms)||(o.uniforms={});let e=o.uniforms;for(let t in s){let n=s[t],i=e[t];i?Object.assign(i,n):e[t]={...n}}}else o[l]=s,a&&!a.linear&&hr.includes(l)&&null!=(i=o[l])&&i.isTexture&&1023===o[l].format&&1009===o[l].type&&(o[l].colorSpace="srgb")}if(null!=r&&r.parent&&null!=a&&a.internal&&null!=(n=r.object)&&n.isObject3D&&s!==r.eventCount){let e=r.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),r.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return r&&void 0===r.props.attach&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&ho(r),e}function ho(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}let hl=e=>null==e?void 0:e.isObject3D;function hu(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function hc(e,t,n,i){let r=n.get(t);r&&(n.delete(t),0===n.size&&(e.delete(i),r.target.releasePointerCapture(i)))}let hh=e=>!!(null!=e&&e.render),hd=R.createContext(null);function hp(){let e=R.useContext(hd);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function hf(e=e=>e,t){return hp()(e,t)}function hm(e,t=0){let n=hp(),i=n.getState().internal.subscribe,r=cQ(e);return c$(()=>i(r,t,n),[t,i,n]),null}let hg=new WeakMap;function hv(e,t){return function(n,...i){var r;let a;return"function"==typeof n&&(null==n||null==(r=n.prototype)?void 0:r.constructor)===n?(a=hg.get(n))||(a=new n,hg.set(n,a)):a=n,e&&e(a),Promise.all(i.map(e=>new Promise((n,i)=>a.load(e,e=>{var t;let i;hl(null==e?void 0:e.scene)&&Object.assign(e,(t=e.scene,i={nodes:{},materials:{},meshes:{}},t&&t.traverse(e=>{e.name&&(i.nodes[e.name]=e),e.material&&!i.materials[e.material.name]&&(i.materials[e.material.name]=e.material),e.isMesh&&!i.meshes[e.name]&&(i.meshes[e.name]=e)}),i)),n(e)},t,t=>i(Error(`Could not load ${e}: ${null==t?void 0:t.message}`))))))}}function h_(e,t,n,i){let r=Array.isArray(t)?t:[t],a=cH(hv(n,i),[e,...r],!1,{equal:c4.equ});return Array.isArray(t)?a:a[0]}h_.preload=function(e,t,n){let i=Array.isArray(t)?t:[t];cH(hv(n),[e,...i],!0,void 0)},h_.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)cz.splice(0,cz.length);else{let e=cz.find(e=>ck(n,e.keys,e.equal));e&&e.remove()}};var hy={exports:{}},hx={exports:{}};hx.exports;let hb=(E||(E=1,w||(w=1,hx.exports=function(e){function t(e,t,n,i){return new iZ(e,t,n,i)}function n(){}function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do(4098&(t=e).flags)!=0&&(n=t.return),e=t.return;while(e)}return 3===t.tag?n:null}function a(e){if(r(e)!==e)throw Error(i(188))}function s(e){var t=e.alternate;if(!t){if(null===(t=r(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,s=t;;){var o=n.return;if(null===o)break;var l=o.alternate;if(null===l){if(null!==(s=o.return)){n=s;continue}break}if(o.child===l.child){for(l=o.child;l;){if(l===n)return a(o),e;if(l===s)return a(o),t;l=l.sibling}throw Error(i(188))}if(n.return!==s.return)n=o,s=l;else{for(var u=!1,c=o.child;c;){if(c===n){u=!0,n=o,s=l;break}if(c===s){u=!0,s=o,n=l;break}c=c.sibling}if(!u){for(c=l.child;c;){if(c===n){u=!0,n=l,s=o;break}if(c===s){u=!0,s=l,n=o;break}c=c.sibling}if(!u)throw Error(i(189))}}if(n.alternate!==s)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}function o(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=rv&&e[rv]||e["@@iterator"])?e:null}function l(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===r_?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case ra:return"Fragment";case ro:return"Profiler";case rs:return"StrictMode";case rh:return"Suspense";case rd:return"SuspenseList";case rm:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case rr:return"Portal";case ru:return e.displayName||"Context";case rl:return(e._context.displayName||"Context")+".Consumer";case rc:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case rp:return null!==(t=e.displayName||null)?t:l(e.type)||"Memo";case rf:t=e._payload,e=e._init;try{return l(e(t))}catch{}}return null}function u(e){return{current:e}}function c(e){0>sb||(e.current=sx[sb],sx[sb]=null,sb--)}function h(e,t){sx[++sb]=e.current,e.current=t}function d(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function p(e,t,n){var i=e.pendingLanes;if(0===i)return 0;var r=0,a=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var o=0x7ffffff&i;return 0!==o?0!=(i=o&~a)?r=d(i):0!=(s&=o)?r=d(s):n||0!=(n=o&~e)&&(r=d(n)):0!=(o=i&~a)?r=d(o):0!==s?r=d(s):n||0!=(n=i&~e)&&(r=d(n)),0===r?0:0!==t&&t!==r&&(t&a)==0&&((a=r&-r)>=(n=t&-t)||32===a&&(4194048&n)!=0)?t:r}function f(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)==0}function m(){var e=sC;return(0x3c00000&(sC<<=1))==0&&(sC=4194304),e}function g(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}
382function v(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function _(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-sM(t);e.entangledLanes|=t,e.entanglements[i]=0x40000000|e.entanglements[i]|261930&n}function y(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-sM(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}function x(e,t){var n=t&-t;return((n=(42&n)!=0?1:b(n))&(e.suspendedLanes|t))!=0?0:n}function b(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 0x1000000:case 0x2000000:e=128;break;case 0x10000000:e=0x8000000;break;default:e=0}return e}function S(e){return 2<(e&=-e)?8<e?(0x7ffffff&e)!=0?32:0x10000000:8:2}function M(e){if("function"==typeof sB&&sz(e),sH&&"function"==typeof sH.setStrictMode)try{sH.setStrictMode(sk,e)}catch{}}function T(e){if(void 0===a6)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);a6=t&&t[1]||"",a8=-1<e.stack.indexOf(`
383    at`)?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return`
384`+a6+e+a8}function w(e,t){if(!e||sj)return"";sj=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var i=e}Reflect.construct(e,[],n)}
384else{try{n.call()}catch(e){i=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){i=e}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&i&&"string"==typeof e.stack)return[e.stack,i.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=i.DetermineComponentFrameRoot(),s=a[0],o=a[1];if(s&&o){var l=s.split(`
385`),u=o.split(`
386`);for(r=i=0;i<l.length&&!l[i].includes("DetermineComponentFrameRoot");)i++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(i===l.length||r===u.length)for(i=l.length-1,r=u.length-1;1<=i&&0<=r&&l[i]!==u[r];)r--;for(;1<=i&&0<=r;i--,r--)if(l[i]!==u[r]){if(1!==i||1!==r)do if(i--,r--,0>r||l[i]!==u[r]){var c=`
387`+l[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=r);break}}}finally{sj=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?T(n):""}function E(e){try{var t="",n=null;do t+=function(e,t){switch(e.tag){case 26:case 27:case 5:return T(e.type);case 16:return T("Lazy");case 13:return e.child!==t&&null!==t?T("Suspense Fallback"):T("Suspense");case 19:return T("SuspenseList");case 0:case 15:return w(e.type,!1);case 11:return w(e.type.render,!1);case 1:return w(e.type,!0);case 31:return T("Activity");default:return""}}(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
388Error generating stack: `+e.message+`
389`+e.stack}}function A(e,t){if("object"==typeof e&&null!==e){var n=sX.get(e);return void 0!==n?n:(t={value:e,source:t,stack:E(t)},sX.set(e,t),t)}return{value:e,source:t,stack:E(t)}}function C(e,t){sq[sY++]=sK,sq[sY++]=sZ,sZ=e,sK=t}function P(e,t,n){sJ[s$++]=s0,sJ[s$++]=s1,sJ[s$++]=sQ,sQ=e;var i=s0;e=s1;var r=32-sM(i)-1;i&=~(1<<r),n+=1;var a=32-sM(t)+r;if(30<a){var s=r-r%5;a=(i&(1<<s)-1).toString(32),i>>=s,r-=s,s0=1<<32-sM(t)+r|n<<r|i,s1=a+e}else s0=1<<a|n<<r|i,s1=e}function I(e){null!==e.return&&(C(e,1),P(e,1,0))}function L(e){for(;e===sZ;)sZ=sq[--sY],sq[sY]=null,sK=sq[--sY],sq[sY]=null;for(;e===sQ;)sQ=sJ[--s$],sJ[s$]=null,s1=sJ[--s$],sJ[s$]=null,s0=sJ[--s$],sJ[s$]=null}function N(e,t){sJ[s$++]=s0,sJ[s$++]=s1,sJ[s$++]=sQ,s0=t.id,s1=t.overflow,sQ=e}function U(e,t){h(s4,t),h(s3,e),h(s2,null),e=rw(t),c(s2),h(s2,e)}function D(){c(s2),c(s3),c(s4)}function O(e){null!==e.memoizedState&&h(s5,e);var t=s2.current,n=rE(t,e.type);t!==n&&(h(s3,e),h(s2,n))}function F(e){s3.current===e&&(c(s2),c(s3)),s5.current===e&&(c(s5),rF?r2._currentValue=r1:r2._currentValue2=r1)}function B(e){var t=Error(i(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML",""));throw W(A(t,e)),ot}function z(e,t){if(!rk)throw Error(i(175));aG(e.stateNode,e.type,e.memoizedProps,t,e)||B(e,!0)}function k(e){for(s6=e.return;s6;)switch(s6.tag){case 5:case 31:case 13:oe=!1;return;case 27:case 3:oe=!0;return;default:s6=s6.return}}function H(e){if(!rk||e!==s6)return!1;if(!s7)return k(e),s7=!0,!1;var t=e.tag;if(sf?3!==t&&27!==t&&(5!==t||a5(e.type)&&!rL(e.type,e.memoizedProps))&&s8&&B(e):3!==t&&(5!==t||a5(e.type)&&!rL(e.type,e.memoizedProps))&&s8&&B(e),k(e),13===t){if(!rk)throw Error(i(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));s8=aY(e)}else if(31===t){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));s8=aq(e)}else s8=sf&&27===t?aN(e.type,s8):s6?aL(e.stateNode):null;return!0}function V(){rk&&(s8=s6=null,s7=!1)}function G(){var e=s9;return null!==e&&(null===lR?lR=e:lR.push.apply(lR,e),s9=null),e}function W(e){null===s9?s9=[e]:s9.push(e)}function j(e,t,n){rF?(h(on,t._currentValue),t._currentValue=n):(h(on,t._currentValue2),t._currentValue2=n)}function X(e){var t=on.current;rF?e._currentValue=t:e._currentValue2=t,c(on)}function q(e,t,n){for(;null!==e;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==i&&(i.childLanes|=t)):null!==i&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Y(e,t,n,r){var a=e.child;for(null!==a&&(a.return=e);null!==a;){var s=a.dependencies;if(null!==s){var o=a.child;s=s.firstContext;a:for(;null!==s;){var l=s;s=a;for(var u=0;u<t.length;u++)if(l.context===t[u]){s.lanes|=n,null!==(l=s.alternate)&&(l.lanes|=n),q(s.return,n,e),r||(o=null);break a}s=l.next}}else if(18===a.tag){if(null===(o=a.return))throw Error(i(341));o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),q(o,n,e),o=null}else o=a.child;if(null!==o)o.return=a;else for(o=a;null!==o;){if(o===e){o=null;break}if(null!==(a=o.sibling)){a.return=o.return,o=a;break}o=o.return}a=o}}function Z(e,t,n,r){e=null;for(var a=t,s=!1;null!==a;){if(!s){if((524288&a.flags)!=0)s=!0;else if((262144&a.flags)!=0)break}if(10===a.tag){var o=a.alternate;if(null===o)throw Error(i(387));if(null!==(o=o.memoizedProps)){var l=a.type;sV(a.pendingProps.value,o.value)||(null!==e?e.push(l):e=[l])}}else if(a===s5.current){if(null===(o=a.alternate))throw Error(i(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(null!==e?e.push(r2):e=[r2])}a=a.return}null!==e&&Y(t,e,n,r),t.flags|=262144}function K(e){for(e=e.firstContext;null!==e;){var t=e.context;if(!sV(rF?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}
389function J(e){oi=e,or=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function $(e){return ee(oi,e)}function Q(e,t){return null===oi&&J(e),ee(e,t)}function ee(e,t){var n=rF?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},null===or){if(null===e)throw Error(i(308));or=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else or=or.next=t;return n}function et(){return{controller:new oa,data:new Map,refCount:0}}function en(e){e.refCount--,0===e.refCount&&os(oo,function(){e.controller.abort()})}function ei(){}function er(e){e!==oc&&null===e.next&&(null===oc?ou=oc=e:oc=oc.next=e),od=!0,oh||(oh=!0,r4?r5(function(){(6&ld)!=0?sR(sU,es):eo()}):sR(sU,es))}function ea(e,t){if(!op&&od){op=!0;do for(var n=!1,i=ou;null!==i;){if(!t)if(0!==e){var r=i.pendingLanes;if(0===r)var a=0;else{var s=i.suspendedLanes,o=i.pingedLanes;a=0xc000095&(a=(1<<31-sM(42|e)+1)-1&(r&~(s&~o)))?0xc000095&a|1:a?2|a:0}0!==a&&(n=!0,ec(i,a))}else a=lm,(3&(a=p(i,i===lp?a:0,null!==i.cancelPendingCommit||i.timeoutHandle!==rO)))==0||f(i,a)||(n=!0,ec(i,a));i=i.next}while(n);op=!1}}function es(){eo()}function eo(){od=oh=!1;var e=0;0!==of&&rX()&&(e=of);for(var t=sN(),n=null,i=ou;null!==i;){var r=i.next,a=el(i,t);0===a?(i.next=null,null===n?ou=r:n.next=r,null===r&&(oc=n)):(n=i,(0!==e||(3&a)!=0)&&(od=!0)),i=r}0!==lO&&5!==lO||ea(e,!1),0!==of&&(of=0)}function el(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0<a;){var s=31-sM(a),o=1<<s,l=r[s];-1===l?((o&n)==0||(o&i)!=0)&&(r[s]=function(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return -1}}(o,t)):l<=t&&(e.expiredLanes|=o),a&=~o}if(t=lp,n=lm,n=p(e,e===t?n:0,null!==e.cancelPendingCommit||e.timeoutHandle!==rO),i=e.callbackNode,0===n||e===t&&(2===lg||9===lg)||null!==e.cancelPendingCommit)return null!==i&&null!==i&&sP(i),e.callbackNode=null,e.callbackPriority=0;if((3&n)==0||f(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==i&&sP(i),S(n)){case 2:case 8:n=sD;break;case 32:default:n=sO;break;case 0x10000000:n=sF}return n=sR(n,i=eu.bind(null,e)),e.callbackPriority=t,e.callbackNode=n,t}return null!==i&&null!==i&&sP(i),e.callbackPriority=2,e.callbackNode=null,2}function eu(e,t){if(0!==lO&&5!==lO)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ik()&&e.callbackNode!==n)return null;var i=lm;return 0===(i=p(e,e===lp?i:0,null!==e.cancelPendingCommit||e.timeoutHandle!==rO))?null:(i_(e,i,t),el(e,sN()),null!=e.callbackNode&&e.callbackNode===n?eu.bind(null,e):null)}function ec(e,t){if(ik())return null;i_(e,t,!0)}function eh(){if(0===of){var e=ov;0===e&&(e=sE,(261888&(sE<<=1))==0&&(sE=256)),of=e}return of}function ed(){if(0==--og&&null!==om){null!==o_&&(o_.status="fulfilled");var e=om;om=null,ov=0,o_=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ep(){var e=ox.current;return null!==e?e:lp.pooledCache}function ef(e,t){null===t?h(ox,ox.current):h(ox,t.pool)}function em(){var e=ep();return null===e?null:{parent:rF?ol._currentValue:ol._currentValue2,pool:e}}function eg(e,t){if(sV(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!sW.call(t,r)||!sV(e[r],t[r]))return!1}return!0}function ev(e){return"fulfilled"===(e=e.status)||"rejected"===e}function e_(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(ei,ei),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw eb(e=t.reason),e;default:if("string"==typeof t.status)t.then(ei,ei);else{if(null!==(e=lp)&&100<e.shellSuspendCounter)throw Error(i(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw eb(e=t.reason),e}throw ow=t,ob}}function ey(e){try{return(0,e._init)(e._payload)}catch(e){throw null!==e&&"object"==typeof e&&"function"==typeof e.then?(ow=e,ob):e}}function ex(){if(null===ow)throw Error(i(459));var e=ow;return ow=null,e}function eb(e){if(e===ob||e===oM)throw Error(i(483))}function eS(e){var t=oA;return oA+=1,null===oE&&(oE=[]),e_(oE,e,t)}function eM(e,t){e.ref=void 0!==(t=t.props.ref)?t:null}function eT(e,t){throw t.$$typeof===rn?Error(i(525)):Error(i(31,"[object Object]"===(e=Object.prototype.toString.call(t))?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ew(e){function n(t,n){if(e){var i=t.deletions;null===i?(t.deletions=[n],t.flags|=16):i.push(n)}}function r(t,i){if(!e)return null;for(;null!==i;)n(t,i),i=i.sibling;return null}function a(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function s(e,t){return(e=iJ(e,t)).index=0,e.sibling=null,e}function l(t,n,i){return t.index=i,e?null!==(i=t.alternate)?(i=i.index)<n?(t.flags|=0x4000002,n):i:(t.flags|=0x4000002,n):(t.flags|=1048576,n)}function u(t){return e&&null===t.alternate&&(t.flags|=0x4000002),t}function c(e,t,n,i){return null===t||6!==t.tag?(t=i1(n,e.mode,i)).return=e:(t=s(t,n)).return=e,t}function h(e,t,n,i){var r=n.type;return r===ra?p(e,t,n.props.children,i,n.key):(null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===rf&&ey(r)===t.type)?eM(t=s(t,n.props),n):eM(t=iQ(n.t
vendor: 4,844 bytes, line 389
389ype,n.key,n.props,null,e.mode,i),n),t.return=e,t)}function d(e,t,n,i){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=i3(n,e.mode,i)).return=e:(t=s(t,n.children||[])).return=e,t}function p(e,t,n,i,r){return null===t||7!==t.tag?(t=i0(n,e.mode,i,r)).return=e:(t=s(t,n)).return=e,t}function f(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=i1(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ri:return eM(n=iQ(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case rr:return(t=i3(t,e.mode,n)).return=e,t;case rf:return f(e,t=ey(t),n)}if(ry(t)||o(t))return(t=i0(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return f(e,eS(t),n);if(t.$$typeof===ru)return f(e,Q(e,t),n);eT(e,t)}return null}function m(e,t,n,i){var r=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==r?null:c(e,t,""+n,i);if("object"==typeof n&&null!==n){switch(n.$$typeof){case ri:return n.key===r?h(e,t,n,i):null;case rr:return n.key===r?d(e,t,n,i):null;case rf:return m(e,t,n=ey(n),i)}if(ry(n)||o(n))return null!==r?null:p(e,t,n,i,null);if("function"==typeof n.then)return m(e,t,eS(n),i);if(n.$$typeof===ru)return m(e,t,Q(e,n),i);eT(e,n)}return null}function g(e,t,n,i,r){if("string"==typeof i&&""!==i||"number"==typeof i||"bigint"==typeof i)return c(t,e=e.get(n)||null,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case ri:return h(t,e=e.get(null===i.key?n:i.key)||null,i,r);case rr:return d(t,e=e.get(null===i.key?n:i.key)||null,i,r);case rf:return g(e,t,n,i=ey(i),r)}if(ry(i)||o(i))return p(t,e=e.get(n)||null,i,r,null);if("function"==typeof i.then)return g(e,t,n,eS(i),r);if(i.$$typeof===ru)return g(e,t,n,Q(t,i),r);eT(t,i)}return null}return function(c,h,d,p){try{oA=0;var v=function t(c,h,d,p){if("object"==typeof d&&null!==d&&d.type===ra&&null===d.key&&(d=d.props.children),"object"==typeof d&&null!==d){switch(d.$$typeof){case ri:a:{for(var v=d.key;null!==h;){if(h.key===v){if((v=d.type)===ra){if(7===h.tag){r(c,h.sibling),(p=s(h,d.props.children)).return=c,c=p;break a}}else if(h.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===rf&&ey(v)===h.type){r(c,h.sibling),eM(p=s(h,d.props),d),p.return=c,c=p;break a}r(c,h);break}n(c,h),h=h.sibling}d.type===ra?(p=i0(d.props.children,c.mode,p,d.key)).return=c:(eM(p=iQ(d.type,d.key,d.props,null,c.mode,p),d),p.return=c),c=p}return u(c);case rr:a:{for(v=d.key;null!==h;){if(h.key===v)if(4===h.tag&&h.stateNode.containerInfo===d.containerInfo&&h.stateNode.implementation===d.implementation){r(c,h.sibling),(p=s(h,d.children||[])).return=c,c=p;break a}else{r(c,h);break}n(c,h),h=h.sibling}(p=i3(d,c.mode,p)).return=c,c=p}return u(c);case rf:return t(c,h,d=ey(d),p)}if(ry(d))return function(t,i,s,o){for(var u=null,c=null,h=i,d=i=0,p=null;null!==h&&d<s.length;d++){h.index>d?(p=h,h=null):p=h.sibling;var v=m(t,h,s[d],o);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&n(t,h),i=l(v,i,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return r(t,h),s7&&C(t,d),u;if(null===h){for(;d<s.length;d++)null!==(h=f(t,s[d],o))&&(i=l(h,i,d),null===c?u=h:c.sibling=h,c=h);return s7&&C(t,d),u}for(h=a(h);d<s.length;d++)null!==(p=g(h,t,d,s[d],o))&&(e&&null!==p.alternate&&h.delete(null===p.key?d:p.key),i=l(p,i,d),null===c?u=p:c.sibling=p,c=p);return e&&h.forEach(function(e){return n(t,e)}),s7&&C(t,d),u}(c,h,d,p);if(o(d)){if("function"!=typeof(v=o(d)))throw Error(i(150));return function(t,s,o,u){if(null==o)throw Error(i(151));for(var c=null,h=null,d=s,p=s=0,v=null,_=o.next();null!==d&&!_.done;p++,_=o.next()){d.index>p?(v=d,d=null):v=d.sibling;var y=m(t,d,_.value,u);if(null===y){null===d&&(d=v);break}e&&d&&null===y.alternate&&n(t,d),s=l(y,s,p),null===h?c=y:h.sibling=y,h=y,d=v}if(_.done)return r(t,d),s7&&C(t,p),c;if(null===d){for(;!_.done;p++,_=o.next())null!==(_=f(t,_.value,u))&&(s=l(_,s,p),null===h?c=_:h.sibling=_,h=_);return s7&&C(t,p),c}for(d=a(d);!_.done;p++,_=o.next())null!==(_=g(d,t,p,_.value,u))&&(e&&null!==_.alternate&&d.delete(null===_.key?p:_.key),s=l(_,s,p),null===h?c=_:h.sibling=_,h=_);return e&&d.forEach(function(e){return n(t,e)}),s7&&C(t,p),c}(c,h,d=v.call(d),p)}if("function"==typeof d.then)return t(c,h,eS(d),p);if(d.$$typeof===ru)return t(c,h,Q(c,d),p);eT(c,d)}return"string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d?(d=""+d,null!==h&&6===h.tag?(r(c,h.sibling),(p=s(h,d)).return=c):(r(c,h),(p=i1(d,c.mode,p)).return=c),u(c=p)):r(c,h)}(c,h,d,p);return oE=null,v}catch(e){if(e===ob||e===oM)throw e;var _=t(29,e,null,c.mode);return _.lanes=p,_.return=c,_}finally{}}}function eE(){for(var e=oI,t=oL=oI=0;t<e;){var n=oP[t];oP[t++]=null;var i=oP[t];oP[t++]=null;var r=oP[t];oP[t++]=null;var a=oP[t];if(oP[t++]=null,null!==i&&null!==r){var s=i.pending;
389null===s?r.next=r:(r.next=s.next,s.next=r),i.pending=r}0!==a&&eP(n,r,a)}}function eA(e,t,n,i){oP[oI++]=e,oP[oI++]=t,oP[oI++]=n,oP[oI++]=i,oL|=i,e.lanes|=i,null!==(e=e.alternate)&&(e.lanes|=i)}function eC(e,t,n,i){return eA(e,t,n,i),eI(e)}function eR(e,t){return eA(e,null,null,t),eI(e)}function eP(e,t,n){e.lanes|=n;var i=e.alternate;null!==i&&(i.lanes|=n);for(var r=!1,a=e.return;null!==a;)a.childLanes|=n,null!==(i=a.alternate)&&(i.childLanes|=n),22===a.tag&&(null===(e=a.stateNode)||1&e._visibility||(r=!0)),e=a,a=a.return;return 3===e.tag?(a=e.stateNode,r&&null!==t&&(r=31-sM(n),null===(i=(e=a.hiddenUpdates)[r])?e[r]=[t]:i.push(t),t.lane=0x20000000|n),a):null}function eI(e){if(50<lG)throw lG=0,lW=null,Error(i(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}function eL(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eN(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function eU(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function eD(e,t,n){var i=e.updateQueue;if(null===i)return null;if(i=i.shared,(2&ld)!=0){var r=i.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=eI(e),eP(e,null,n),t}return eA(e,i,t,n),eI(e)}function eO(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,(4194048&n)!=0)){var i=t.lanes;
vendor: 4,252 bytes, line 389
389i&=e.pendingLanes,n|=i,t.lanes=n,y(e,n)}}function eF(e,t){var n=e.updateQueue,i=e.alternate;if(null!==i&&n===(i=i.updateQueue)){var r=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===a?r=a=s:a=a.next=s,n=n.next}while(null!==n);null===a?r=a=t:a=a.next=t}else r=a=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:a,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function eB(){if(oU){var e=o_;if(null!==e)throw e}}function ez(e,t,n,i){oU=!1;var r=e.updateQueue;oN=!1;var a=r.firstBaseUpdate,s=r.lastBaseUpdate,o=r.shared.pending;if(null!==o){r.shared.pending=null;var l=o,u=l.next;l.next=null,null===s?a=u:s.next=u,s=l;var c=e.alternate;null!==c&&(o=(c=c.updateQueue).lastBaseUpdate)!==s&&(null===o?c.firstBaseUpdate=u:o.next=u,c.lastBaseUpdate=l)}if(null!==a){var h=r.baseState;for(s=0,c=u=l=null,o=a;;){var d=-0x20000001&o.lane,p=d!==o.lane;if(p?(lm&d)===d:(i&d)===d){0!==d&&d===ov&&(oU=!0),null!==c&&(c=c.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});a:{var f=e,m=o;switch(d=t,m.tag){case 1:if("function"==typeof(f=m.payload)){h=f.call(n,h,d);break a}h=f;break a;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(d="function"==typeof(f=m.payload)?f.call(n,h,d):f))break a;h=rt({},h,d);break a;case 2:oN=!0}}null!==(d=o.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=r.callbacks)?r.callbacks=[d]:p.push(d))}else p={lane:d,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===c?(u=c=p,l=h):c=c.next=p,s|=d;if(null===(o=o.next)){if(null===(o=r.shared.pending))break;o=(p=o).next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}null===c&&(l=h),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,null===a&&(r.shared.lanes=0),lM|=s,e.lanes=s,e.memoizedState=h}}function ek(e,t){if("function"!=typeof e)throw Error(i(191,e));e.call(t)}function eH(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)ek(n[e],t)}function eV(e,t){h(oO,e=lb),h(oD,t),lb=e|t.baseLanes}function eG(){h(oO,lb),h(oD,oD.current)}function eW(){lb=oO.current,c(oD),c(oO)}function ej(e){var t=e.alternate;h(oz,1&oz.current),h(oF,e),null===oB&&(null===t||null!==oD.current||null!==t.memoizedState)&&(oB=e)}function eX(e){h(oz,oz.current),h(oF,e),null===oB&&(oB=e)}function eq(e){22===e.tag?(h(oz,oz.current),h(oF,e),null===oB&&(oB=e)):eY()}function eY(){h(oz,oz.current),h(oF,oF.current)}function eZ(e){c(oF),oB===e&&(oB=null),c(oz)}function eK(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||aE(n)||aA(n)))return t}else if(19===t.tag&&("forwards"===t.memoizedProps.revealOrder||"backwards"===t.memoizedProps.revealOrder||"unstable_legacy-backwards"===t.memoizedProps.revealOrder||"together"===t.memoizedProps.revealOrder)){if((128&t.flags)!=0)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function eJ(){throw Error(i(321))}function e$(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sV(e[n],t[n]))return!1;return!0}function eQ(e,t,n,i,r,a){return ok=a,oH=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,rx.H=null===e||null===e.memoizedState?o$:oQ,oX=!1,a=n(i,r),oX=!1,oj&&(a=e1(t,n,i,r)),e0(e),a}function e0(e){rx.H=oJ;var t=null!==oV&&null!==oV.next;if(ok=0,oG=oV=oH=null,oW=!1,oY=0,oZ=null,t)throw Error(i(300));null===e||o3||null!==(e=e.dependencies)&&K(e)&&(o3=!0)}function e1(e,t,n,r){oH=e;var a=0;do{if(oj&&(oZ=null),oY=0,oj=!1,25<=a)throw Error(i(301));if(a+=1,oG=oV=null,null!=e.updateQueue){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,null!=s.memoCache&&(s.memoCache.index=0)}rx.H=o0,s=t(n,r)}while(oj);return s}function e2(){var e=rx.H,t=e.useState()[0];return t="function"==typeof t.then?e9(t):t,e=e.useState()[0],(null!==oV?oV.memoizedState:null)!==e&&(oH.flags|=1024),t}function e3(){var e=0!==oq;return oq=0,e}function e4(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function e5(e){if(oW){for(e=e.memoizedState;null!==e;){var t=e.queue;
389null!==t&&(t.pending=null),e=e.next}oW=!1}ok=0,oG=oV=oH=null,oj=!1,oY=oq=0,oZ=null}function e6(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===oG?oH.memoizedState=oG=e:oG=oG.next=e,oG}function e8(){if(null===oV){var e=oH.alternate;e=null!==e?e.memoizedState:null}else e=oV.next;var t=null===oG?oH.memoizedState:oG.next;if(null!==t)oG=t,oV=e;else{if(null===e)throw null===oH.alternate?Error(i(467)):Error(i(310));e={memoizedState:(oV=e).memoizedState,baseState:oV.baseState,baseQueue:oV.baseQueue,queue:oV.queue,next:null},null===oG?oH.memoizedState=oG=e:oG=oG.next=e}return oG}function e7(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function e9(e){var t=oY;return oY+=1,null===oZ&&(oZ=[]),e=e_(oZ,e,t),t=oH,(null===oG?t.memoizedState:oG.next)===null&&(rx.H=null===(t=t.alternate)||null===t.memoizedState?o$:oQ),e}function te(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return e9(e);if(e.$$typeof===ru)return $(e)}throw Error(i(438,String(e)))}function tt(e){var t=null,n=oH.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var i=oH.alternate;null!==i&&null!==(i=i.updateQueue)&&null!=(i=i.memoCache)&&(t={data:i.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===n&&(n=e7(),oH.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=rg;return t.index++,n}function tn(e,t){return"function"==typeof t?t(e):t}function ti(e){return tr(e8(),oV,e)}function tr(e,t,n){var r=e.queue;if(null===r)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,s=r.pending;if(null!==s){if(null!==a){var o=a.next;a.next=s.next,s.next=o}t.baseQueue=a=s,r.pending=null}if(s=e.baseState,null===a)e.memoizedState=s;else{t=a.next;var l=o=null,u=null,c=t,h=!1;do{var d=-0x20000001&c.lane;if(d!==c.lane?(lm&d)===d:(ok&d)===d){var p=c.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===ov&&(h=!0);else if((ok&p)===p){c=c.next,p===ov&&(h=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(l=u=d,o=s):u=u.next=d,oH.lanes|=p,lM|=p;d=c.action,oX&&n(s,d),s=c.hasEagerState?c.eagerState:n(s,d)}else p={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(l=u=p,o=s):u=u.next=p,oH.lanes|=d,lM|=d;c=c.next}while(null!==c&&c!==t);if(null===u?o=s:u.next=l,!sV(s,e.memoizedState)&&(o3=!0,h&&null!==(n=o_)))throw n;e.memoizedState=s,e.baseState=o,e.baseQueue=u,r.lastRenderedState=s}return null===a&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ta(e){var t=e8(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,s=t.memoizedState;if(null!==a){n.pending=null;var o=a=a.next;do s=e(s,o.action),o=o.next;while(o!==a);sV(s,t.memoizedState)||(o3=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function ts(e,t,n){var r=oH,a=e8(),s=s7;if(s){if(void 0===n)throw Error(i(407));n=n()}else n=t();var o=!sV((oV||a).memoizedState,n);if(o&&(a.memoizedState=n,o3=!0),a=a.queue,tI(tu.bind(null,r,a,e),[e]),a.getSnapshot!==t||o||null!==oG&&1&oG.memoizedState.tag){if(r.flags|=2048,tE(9,{destroy:void 0},tl.bind(null,r,a,n,t),null),null===lp)throw Error(i(349));s||(127&ok)!=0||to(r,t,n)}return n}function to(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=oH.updateQueue)?(t=e7(),oH.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function tl(e,t,n,i){t.value=n,t.getSnapshot=i,tc(t)&&th(e)}function tu(e,t,n){return n(function(){tc(t)&&th(e)})}function tc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sV(e,n)}catch{return!0}}function th(e){var t=eR(e,2);null!==t&&iv(t,e,2)}function td(e){var t=e6();if("function"==typeof e){var n=e;if(e=n(),oX){M(!0);try{n()}finally{M(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:e},t}function tp(e,t,n,i){return e.baseState=n,tr(e,oV,"function"==typeof i?i:tn)}function tf(e,t,n,r,a){if(t$(e))throw Error(i(485));if(null!==(e=t.action)){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){s.listeners.push(e)}};null!==rx.T?n(!0):s.isTransition=!1,r(s),null===(n=t.pending)?(s.next=t.pending=s,tm(t,s)):(s.next=n.next,t.pending=n.next=s)}}function tm(e,t){var n=t.action,i=t.payload,r=e.state;if(t.isTransition){var a=rx.T,s={};rx.T=s;try{var o=n(r,i),l=rx.S;null!==l&&l(s,o),tg(e,t,o)}catch(n){t_(e,t,n)}finally{null!==a&&null!==s.types&&(a.types=s.types),rx.T=a}}else try{a=n(r,i),tg(e,t,a)}catch(n){t_(e,t,n)}}function tg(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){tv(e,t,n)},function(n){return t_(e,t,n)}):tv(e,t,n)}function tv(e,t,n){t.status="fulfilled",t.value=n,ty(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,tm(e,n)))}function t_(e,t,n){var i=e.pending;if(e.pending=null,null!==i){i=i.next;do t.status="rejected",t.reason=n,ty(t),t=t.next;while(t!==i)}e.action=null}function ty(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tx(e,t){return t}function tb(e,t){if(s7){var n=lp.formState;if(null!==n){a:{var i=oH;if(s7){if(s8){var r=aP(s8,oe);if(r){s8=aL(r),i=aI(r);break a}}B(i)}i=!1}i&&(t=n[0])}}(n=e6()).memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tx,lastRenderedState:t},n.queue=i,n=tZ.bind(null,oH,i),i.dispatch=n,i=td(!1);var a=tJ.bind(null,oH,!1,i.queue);return i=e6(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,n=tf.bind(null,oH,r,a,n),r.dispatch=n,i.memoizedState=e,[t,n,!1]}function tS(e){return tM(e8(),oV,e)}function tM(e,t,n){if(t=tr(e,t,tx)[0],e=ti(tn)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var i=e9(t)}catch(e){throw e===ob?oM:e}else i=t;var r=(t=e8()).queue,a=r.dispatch;return n!==t.memoizedState&&(oH.flags|=2048,tE(9,{destroy:void 0},tT.bind(null,r,n),null)),[i,a,e]}function tT(e,t){e.action=t}function tw(e){var t=e8(),n=oV;if(null!==n)return tM(t,n,e);e8(),t=t.memoizedState;var i=(n=e8()).queue.dispatch;return n.memoizedState=e,[t,i,!1]}function tE(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},null===(t=oH.updateQueue)&&(t=e7(),oH.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function tA(){return e8().memoizedState}function tC(e,t,n,i){var r=e6();oH.flags|=e,r.memoizedState=tE(1|t,{destroy:void 0},n,void 0===i?null:i)}function tR(e,t,n,i){var r=e8();i=void 0===i?null:i;var a=r.memoizedState.inst;null!==oV&&null!==i&&e$(i,oV.memoizedState.deps)?r.memoizedState=tE(t,a,n,i):(oH.flags|=e,r.memoizedState=tE(1|t,a,n,i))}function tP(e,t){tC(8390656,8,e,t)}function tI(e,t){tR(2048,8,e,t)}function tL(e){var t=e8().memoizedState;return function(e){oH.flags|=4;var t=oH.updateQueue;if(null===t)t=e7(),oH.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if((2&ld)!=0)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function tN(e,t){return tR(4,2,e,t)}function tU(e,t){return tR(4,4,e,t)}function tD(e,t){if("function"==typeof t){var n=t(e=e());return function(){"function"==typeof n?n():t(null)}}if(null!=t)return t.current=e=e(),function(){t.current=null}}function tO(e,t,n){n=null!=n?n.concat([e]):null,tR(4,4,tD.bind(null,t,e),n)}function tF(){}function tB(e,t){var n=e8();t=void 0===t?null:t;var i=n.memoizedState;return null!==t&&e$(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function tz(e,t){var n=e8();t=void 0===t?null:t;var i=n.memoizedState;if(null!==t&&e$(t,i[1]))return i[0];if(i=e(),oX){M(!0);try{e()}finally{M(!1)}}return n.memoizedState=[i,t],i}
389function tk(e,t,n){return void 0===n||(0x40000000&ok)!=0&&(261930&lm)==0?e.memoizedState=t:(e.memoizedState=n,e=ig(),oH.lanes|=e,lM|=e,n)}function tH(e,t,n,i){return sV(n,t)?n:null!==oD.current?(sV(e=tk(e,n,i),t)||(o3=!0),e):(42&ok)==0||(0x40000000&ok)!=0&&(261930&lm)==0?(o3=!0,e.memoizedState=n):(e=ig(),oH.lanes|=e,lM|=e,t)}function tV(e,t,n,i,r){var a=rW();rG(0!==a&&8>a?a:8);var s=rx.T,o={};rx.T=o,tJ(e,!1,t,n);try{var l=r(),u=rx.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c,h,d=(c=[],h={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},l.then(function(){h.status="fulfilled",h.value=i;for(var e=0;e<c.length;e++)(0,c[e])(i)},function(e){for(h.status="rejected",h.reason=e,e=0;e<c.length;e++)(0,c[e])(void 0)}),h);tK(e,t,d,im())}else tK(e,t,i,im())}catch(n){tK(e,t,{then:function(){},status:"rejected",reason:n},im())}finally{rG(a),null!==s&&null!==o.types&&(s.types=o.types),rx.T=s}}function tG(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:r1,baseState:r1,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:r1},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tn,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function tW(){return $(r2)}function tj(){return e8().memoizedState}function tX(){return e8().memoizedState}function tq(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=im(),i=eD(t,e=eU(n),n);null!==i&&(iv(i,t,n),eO(i,t,n)),t={cache:et()},e.payload=t;return}t=t.return}}function tY(e,t,n){var i=im();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},t$(e)?tQ(t,n):null!==(n=eC(e,t,n,i))&&(iv(n,e,i),t0(n,t,i))}function tZ(e,t,n){tK(e,t,n,im())}function tK(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(t$(e))tQ(t,r);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,n);if(r.hasEagerState=!0,r.eagerState=o,sV(o,s))return eA(e,t,r,0),null===lp&&eE(),!1}catch{}finally{}if(null!==(n=eC(e,t,r,i)))return iv(n,e,i),t0(n,t,i),!0}return!1}function tJ(e,t,n,r){if(r={lane:2,revertLane:eh(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},t$(e)){if(t)throw Error(i(479))}else null!==(t=eC(e,n,r,2))&&iv(t,e,2)}function t$(e){var t=e.alternate;return e===oH||null!==t&&t===oH}function tQ(e,t){oj=oW=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function t0(e,t,n){if((4194048&n)!=0){var i=t.lanes;i&=e.pendingLanes,t.lanes=n|=i,y(e,n)}}function t1(e,t,n,i){n=null==(n=n(i,t=e.memoizedState))?t:rt({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}function t2(e,t,n,i,r,a,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(i,a,s):!t.prototype||!t.prototype.isPureReactComponent||!eg(n,i)||!eg(r,a)}function t3(e,t,n,i){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,i),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&o1.enqueueReplaceState(t,t.state,null)}function t4(e,t){var n=t;if("ref"in t)for(var i in n={},t)"ref"!==i&&(n[i]=t[i]);if(e=e.defaultProps)for(var r in n===t&&(n=rt({},n)),e)void 0===n[r]&&(n[r]=e[r]);return n}function t5(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function t6(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function t8(e,t,n){return(n=eU(n)).tag=3,n.payload={element:null},n.callback=function(){t5(e,t)},n}function t7(e){return(e=eU(e)).tag=3,e}function t9(e,t,n,i){var r=n.type.getDerivedStateFromError;if("function"==typeof r){var a=i.value;e.payload=function(){return r(a)},e.callback=function(){t6(t,n,i)}}var s=n.stateNode;null!==s&&"function"==typeof s.componentDidCatch&&(e.callback=function(){t6(t,n,i),"function"!=typeof r&&(null===lD?lD=new Set([this]):lD.add(this));var e=i.stack;this.componentDidCatch(i.value,{componentStack:null!==e?e:""})})}function ne(e,t,n,i){t.child=null===e?oR(t,null,n,i):oC(t,e.child,n,i)}function nt(e,t,n,i,r){n=n.render;var a=t.ref;if("ref"in i){var s={};for(var o in i)"ref"!==o&&(s[o]=i[o])}else s=i;return J(t),i=eQ(e,t,n,s,a,r),o=e3(),null===e||o3?(s7&&o&&I(t),t.flags|=1,ne(e,t,i,r),t.child):(e4(e,t,r),nM(e,t,r))}function nn(e,t,n,i,r){if(null===e){var a=n.type;return"function"!=typeof a||iK(a)||void 0!==a.defaultProps||null!==n.compare?((e=iQ(n.type,null,i,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,ni(e,t,a,i,r))}
389if(a=e.child,!nT(e,r)){var s=a.memoizedProps;if((n=null!==(n=n.compare)?n:eg)(s,i)&&e.ref===t.ref)return nM(e,t,r)}return t.flags|=1,(e=iJ(a,i)).ref=t.ref,e.return=t,t.child=e}function ni(e,t,n,i,r){if(null!==e){var a=e.memoizedProps;if(eg(a,i)&&e.ref===t.ref)if(o3=!1,t.pendingProps=i=a,!nT(e,r))return t.lanes=e.lanes,nM(e,t,r);else(131072&e.flags)!=0&&(o3=!0)}return nc(e,t,n,i,r)}function nr(e,t,n,i){var r=i.children,a=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===i.mode){if((128&t.flags)!=0){if(a=null!==a?a.baseLanes|n:n,null!==e){for(i=t.child=e.child,r=0;null!==i;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~a}else i=0,t.child=null;return ns(e,t,a,n,i)}if((0x20000000&n)==0)return i=t.lanes=0x20000000,ns(e,t,null!==a?a.baseLanes|n:n,n,i);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&ef(t,null!==a?a.cachePool:null),null!==a?eV(t,a):eG(),eq(t)}else null!==a?(ef(t,a.cachePool),eV(t,a),eY(),t.memoizedState=null):(null!==e&&ef(t,null),eG(),eY());return ne(e,t,r,n),t.child}function na(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ns(e,t,n,i,r){var a=ep();return t.memoizedState={baseLanes:n,cachePool:a=null===a?null:{parent:rF?ol._currentValue:ol._currentValue2,pool:a}},null!==e&&ef(t,null),eG(),eq(t),null!==e&&Z(e,t,i,!0),t.childLanes=r,null}function no(e,t){return(t=n_({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function nl(e,t,n){return oC(t,e.child,null,n),e=no(t,t.pendingProps),e.flags|=2,eZ(t),t.memoizedState=null,e}function nu(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(i(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function nc(e,t,n,i,r){return J(t),n=eQ(e,t,n,i,void 0,r),i=e3(),null===e||o3?(s7&&i&&I(t),t.flags|=1,ne(e,t,n,r),t.child):(e4(e,t,r),nM(e,t,r))}function nh(e,t,n,i,r,a){return J(t),t.updateQueue=null,n=e1(t,i,n,r),e0(e),i=e3(),null===e||o3?(s7&&i&&I(t),t.flags|=1,ne(e,t,n,a),t.child):(e4(e,t,a),nM(e,t,a))}function nd(e,t,n,i,r){if(J(t),null===t.stateNode){var a=sS,s=n.contextType;"object"==typeof s&&null!==s&&(a=$(s)),t.memoizedState=null!==(a=new n(i,a)).state&&void 0!==a.state?a.state:null,a.updater=o1,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=i,a.state=t.memoizedState,a.refs={},eL(t),s=n.contextType,a.context="object"==typeof s&&null!==s?$(s):sS,a.state=t.memoizedState,"function"==typeof(s=n.getDerivedStateFromProps)&&(t1(t,n,s,i),a.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(s=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),s!==a.state&&o1.enqueueReplaceState(a,a.state,null),ez(t,i,a,r),eB(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),i=!0}else if(null===e){a=t.stateNode;var o=t.memoizedProps,l=t4(n,o);a.props=l;var u=a.context,c=n.contextType;s=sS,"object"==typeof c&&null!==c&&(s=$(c));var h=n.getDerivedStateFromProps;c="function"==typeof h||"function"==typeof a.getSnapshotBeforeUpdate,o=t.pendingProps!==o,c||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o||u!==s)&&t3(t,a,i,s),oN=!1;var d=t.memoizedState;a.state=d,ez(t,i,a,r),eB(),u=t.memoizedState,o||d!==u||oN?("function"==typeof h&&(t1(t,n,h,i),u=t.memoizedState),(l=oN||t2(t,n,l,i,d,u,s))?(c||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),a.props=i,a.state=u,a.context=s,i=l):("function"==typeof a.componentDidMount&&(t.flags|=4194308),i=!1)}else{a=t.stateNode,eN(e,t),c=t4(n,s=t.memoizedProps),a.props=c,h=t.pendingProps,d=a.context,u=n.contextType,l=sS,"object"==typeof u&&null!==u&&(l=$(u)),(u="function"==typeof(o=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==h||d!==l)&&t3(t,a,i,l),oN=!1,d=t.memoizedState,a.state=d,ez(t,i,a,r),eB();var p=t.memoizedState;s!==h||d!==p||oN||null!==e&&null!==e.dependencies&&K(e.dependencies)?("function"==typeof o&&(t1(t,n,o,i),p=t.memoizedState),(c=oN||t2(t,n,c,i,d,p,l)||null!==e&&null!==e.dependencies&&K(e.dependencies))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(i,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(i,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=p),a.props=i,a.state=p,a.context=l,i=c):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),i=!1)}return a=i,nu(e,t),i=(128&t.flags)!=0,a||i?(a=t.stateNode,n=i&&"function"!=typeof n.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&i?(t.child=oC(t,e.child,null,r),t.child=oC(t,null,n,r)):ne(e,t,n,r),t.memoizedState=a.state,e=t.child):e=nM(e,t,r),e}function np(e,t,n,i){return V(),t.flags|=256,ne(e,t,n,i),t.child}function nf(e){return{baseLanes:e,cachePool:em()}}function nm(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=lE),e}function ng(e,t,n){var r,a=t.pendingProps,s=!1,o=(128&t.flags)!=0;if((r=o)||(r=(null===e||null!==e.memoizedState)&&(2&oz.current)!=0),r&&(s=!0,t.flags&=-129),r=(32&t.flags)!=0,t.flags&=-33,null===e){if(s7){if(s?ej(t):eY(),(e=s8)?null!==(e=aV(e,oe))&&(t.memoizedState={dehydrated:e,treeContext:null!==sQ?{id:s0,overflow:s1}:null,retryLane:0x20000000,hydrationErrors:null},(n=i2(e)).return=t,t.child=n,s6=t,s8=null):e=null,null===e)throw B(t);return aA(e)?t.lanes=32:t.lanes=0x20000000,null}var l=a.children;return a=a.fallback,s?(eY(),l=n_({mode:"hidden",children:l},s=t.mode),a=i0(a,s,n,null),l.return=t,a.return=t,l.sibling=a,t.child=l,(a=t.child).memoizedState=nf(n),a.childLanes=nm(e,r,n),t.memoizedState=o4,na(null,a)):(ej(t),nv(t,l))}var u=e.memoizedState;if(null!==u&&null!==(l=u.dehydrated)){if(o)256&t.flags?(ej(t),t.flags&=-257,t=ny(e,t,n)):null!==t.memoizedState?(eY(),t.child=e.child,t.flags|=128,t=null):(eY(),l=a.fallback,s=t.mode,a=n_({mode:"visible",children:a.children},s),l=i0(l,s,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,oC(t,e.child,null,n),(a=t.child).memoizedState=nf(n),a.childLanes=nm(e,r,n),t.memoizedState=o4,t=na(null,a));else if(ej(t),aA(l))r=aC(l).digest,(a=Error(i(419))).stack="",a.digest=r,W({value:a,source:null,stack:null}),t=ny(e,t,n);else if(o3||Z(e,t,n,!1),r=(n&e.childLanes)!=0,o3||r){if(null!==(r=lp)&&0!==(a=x(r,n))&&a!==u.retryLane)throw u.retryLane=a,eR(e,a),iv(r,e,a),o2;aE(l)||iC(),t=ny(e,t,n)}else aE(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,rk&&(s8=aF(l),s6=t,s7=!0,s9=null,oe=!1,null!==e&&N(t,e)),t=nv(t,a.children),t.flags|=4096);return t}return s?(eY(),l=a.fallback,s=t.mode,o=(u=e.child).sibling,(a=iJ(u,{mode:"hidden",children:a.children})).subtreeFlags=0x3e00000&u.subtreeFlags,null!==o?l=iJ(o,l):(l=i0(l,s,n,null),l.flags|=2),l.return=t,a.return=t,a.sibling=l,t.child=a,na(null,a),a=t.child,null===(l=e.child.memoizedState)?l=nf(n):(null!==(s=l.cachePool)?(u=rF?ol._currentValue:ol._currentValue2,s=s.parent!==u?{parent:u,pool:u}
389:s):s=em(),l={baseLanes:l.baseLanes|n,cachePool:s}),a.memoizedState=l,a.childLanes=nm(e,r,n),t.memoizedState=o4,na(e.child,a)):(ej(t),e=(n=e.child).sibling,(n=iJ(n,{mode:"visible",children:a.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function nv(e,t){return(t=n_({mode:"visible",children:t},e.mode)).return=e,e.child=t}function n_(e,n){return(e=t(22,e,null,n)).lanes=0,e}function ny(e,t,n){return oC(t,e.child,null,n),e=nv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nx(e,t,n){e.lanes|=t;var i=e.alternate;null!==i&&(i.lanes|=t),q(e.return,t,n)}function nb(e,t,n,i,r,a){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r,treeForkCount:a}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r,s.treeForkCount=a)}function nS(e,t,n){var i=t.pendingProps,r=i.revealOrder,a=i.tail;i=i.children;var s=oz.current,o=(2&s)!=0;if(o?(s=1&s|2,t.flags|=128):s&=1,h(oz,s),ne(e,t,i,n),i=s7?sK:0,!o&&null!==e&&(128&e.flags)!=0)a:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&nx(e,n,t);else if(19===e.tag)nx(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;null!==n;)null!==(e=n.alternate)&&null===eK(e)&&(r=n),n=n.sibling;null===(n=r)?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),nb(t,!1,r,n,a,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===eK(e)){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}nb(t,!0,n,null,a,i);break;case"together":nb(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function nM(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),lM|=t.lanes,(n&t.childLanes)==0){if(null===e)return null;else if(Z(e,t,n,!1),(n&t.childLanes)==0)return null}if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=iJ(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=iJ(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function nT(e,t){return(e.lanes&t)!=0||!!(null!==(e=e.dependencies)&&K(e))}function nw(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)o3=!0;else{if(!nT(e,n)&&(128&t.flags)==0)return o3=!1,function(e,t,n){switch(t.tag){case 3:U(t,t.stateNode.containerInfo),j(t,ol,e.memoizedState.cache),V();break;case 27:case 5:O(t);break;case 4:U(t,t.stateNode.containerInfo);break;case 10:j(t,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,eX(t),null;break;case 13:var i=t.memoizedState;if(null!==i)return null!==i.dehydrated?(ej(t),t.flags|=128,null):(n&t.child.childLanes)!=0?ng(e,t,n):(ej(t),null!==(e=nM(e,t,n))?e.sibling:null);ej(t);break;case 19:var r=(128&e.flags)!=0;if((i=(n&t.childLanes)!=0)||(Z(e,t,n,!1),i=(n&t.childLanes)!=0),r){if(i)return nS(e,t,n);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),h(oz,oz.current),i)break;return null;case 22:return t.lanes=0,nr(e,t,n,t.pendingProps);case 24:j(t,ol,e.memoizedState.cache)}return nM(e,t,n)}(e,t,n);o3=(131072&e.flags)!=0}else o3=!1,s7&&(1048576&t.flags)!=0&&P(t,sK,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ey(t.elementType),t.type=e,"function"==typeof e)iK(e)?(r=t4(e,r),t.tag=1,t=nd(null,t,e,r,n)):(t.tag=0,t=nc(null,t,e,r,n));else{if(null!=e){var a=e.$$typeof;if(a===rc){t.tag=11,t=nt(null,t,e,r,n);break a}if(a===rp){t.tag=14,t=nn(null,t,e,r,n);break a}}throw Error(i(306,t=l(e)||e,""))}}return t;case 0:return nc(e,t,t.type,t.pendingProps,n);case 1:return a=t4(r=t.type,t.pendingProps),nd(e,t,r,a,n);case 3:a:{if(U(t,t.stateNode.containerInfo),null===e)throw Error(i(387));var s=t.pendingProps;r=(a=t.memoizedState).element,eN(e,t),ez(t,s,null,n);var o=t.memoizedState;if(j(t,ol,s=o.cache),s!==a.cache&&Y(t,[ol],n,!0),eB(),s=o.element,rk&&a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=np(e,t,s,n);break a}else if(s!==r){W(r=A(Error(i(424)),t)),t=np(e,t,s,n);break a}
389else for(rk&&(s8=aD(t.stateNode.containerInfo),s6=t,s7=!0,s9=null,oe=!0),n=oR(t,null,s,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling;else{if(V(),s===r){t=nM(e,t,n);break a}ne(e,t,s,n)}t=t.child}return t;case 26:if(se)return nu(e,t),null===e?(n=si(t.type,null,t.pendingProps,null))?t.memoizedState=n:s7||(t.stateNode=su(t.type,t.pendingProps,s4.current,t)):t.memoizedState=si(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(sf)return O(t),null===e&&sf&&s7&&(r=t.stateNode=sm(t.type,t.pendingProps,s4.current,s2.current,!1),s6=t,oe=!0,s8=aB(t.type,r,s8)),ne(e,t,t.pendingProps.children,n),nu(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&s7&&(a7(t.type,t.pendingProps,s2.current),(a=r=s8)&&(null!==(r=az(r,t.type,t.pendingProps,oe))?(t.stateNode=r,s6=t,s8=aU(r),oe=!1,a=!0):a=!1),a||B(t)),O(t),a=t.type,s=t.pendingProps,o=null!==e?e.memoizedProps:null,r=s.children,rL(a,s)?r=null:null!==o&&rL(a,o)&&(t.flags|=32),null!==t.memoizedState&&(a=eQ(e,t,e2,null,null,n),rF?r2._currentValue=a:r2._currentValue2=a),nu(e,t),ne(e,t,r,n),t.child;case 6:return null===e&&s7&&(a9(t.pendingProps,s2.current),(e=n=s8)&&(null!==(n=ak(n,t.pendingProps,oe))?(t.stateNode=n,s6=t,s8=null,e=!0):e=!1),e||B(t)),null;case 13:return ng(e,t,n);case 4:return U(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=oC(t,null,r,n):ne(e,t,r,n),t.child;case 11:return nt(e,t,t.type,t.pendingProps,n);case 7:return ne(e,t,t.pendingProps,n),t.child;case 8:case 12:return ne(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,j(t,t.type,r.value),ne(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,J(t),r=r(a=$(a)),t.flags|=1,ne(e,t,r,n),t.child;case 14:return nn(e,t,t.type,t.pendingProps,n);case 15:return ni(e,t,t.type,t.pendingProps,n);case 19:return nS(e,t,n);case 31:var u=e,c=t,d=n,p=c.pendingProps,f=(128&c.flags)!=0;if(c.flags&=-129,null===u){if(s7){if("hidden"===p.mode)return u=no(c,p),c.lanes=0x20000000,na(null,u);if(eX(c),(u=s8)?null!==(u=aH(u,oe))&&(c.memoizedState={dehydrated:u,treeContext:null!==sQ?{id:s0,overflow:s1}:null,retryLane:0x20000000,hydrationErrors:null},(d=i2(u)).return=c,c.child=d,s6=c,s8=null):u=null,null===u)throw B(c);return c.lanes=0x20000000,null}return no(c,p)}var m=u.memoizedState;if(null!==m){var g=m.dehydrated;if(eX(c),f)if(256&c.flags)c.flags&=-257,c=nl(u,c,d);else if(null!==c.memoizedState)c.child=u.child,c.flags|=128,c=null;else throw Error(i(558));else if(o3||Z(u,c,d,!1),f=(d&u.childLanes)!=0,o3||f){if(null!==(p=lp)&&0!==(g=x(p,d))&&g!==m.retryLane)throw m.retryLane=g,eR(u,g),iv(p,u,g),o2;iC(),c=nl(u,c,d)}else u=m.treeContext,rk&&(s8=aO(g),s6=c,s7=!0,s9=null,oe=!1,null!==u&&N(c,u)),c=no(c,p),c.flags|=4096;return c}return(u=iJ(u.child,{mode:p.mode,children:p.children})).ref=c.ref,c.child=u,u.return=c,u;case 22:return nr(e,t,n,t.pendingProps);case 24:return J(t),r=$(ol),null===e?(null===(a=ep())&&(a=lp,s=et(),a.pooledCache=s,s.refCount++,null!==s&&(a.pooledCacheLanes|=n),a=s),t.memoizedState={parent:r,cache:a},eL(t),j(t,ol,a)):((e.lanes&n)!=0&&(eN(e,t),ez(t,null,null,n),eB()),a=e.memoizedState,s=t.memoizedState,a.parent!==r?(a={parent:r,cache:r},t.memoizedState=a,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=a),j(t,ol,r)):(j(t,ol,r=s.cache),r!==a.cache&&Y(t,[ol],n,!0))),ne(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function nE(e){e.flags|=4}function nA(e){rz&&(e.flags|=8)}function nC(e,t){if(null!==e&&e.child===t.child)return!1;if((16&t.flags)!=0)return!0;for(e=t.child;null!==e;){if((8218&e.flags)!=0||(8218&e.subtreeFlags)!=0)return!0;e=e.sibling}return!1}function nR(e,t,n,i){if(rB)for(n=t.child;null!==n;){if(5===n.tag||6===n.tag)rP(e,n.stateNode);else if(!(4===n.tag||sf&&27===n.tag)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(rz)for(var r=t.child;null!==r;){if(5===r.tag){var a=r.stateNode;n&&i&&(a=aT(a,r.type,r.memoizedProps)),rP(e,a)}else if(6===r.tag)a=r.stateNode,n&&i&&(a=aw(a,r.memoizedProps)),rP(e,a);else if(4!==r.tag){if(22===r.tag&&null!==r.memoizedState)null!==(a=r.child)&&(a.return=r),nR(e,r,!0,!0);else if(null!==r.child){r.child.return=r,r=r.child;continue}}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}}function nP(e,t){if(rz&&nC(e,t)){var n=(e=t.stateNode).containerInfo,i=ax();(function e(t,n,i,r){var a=!1;if(rz)for(var s=n.child;null!==s;){if(5===s.tag){var o=s.stateNode;
389i&&r&&(o=aT(o,s.type,s.memoizedProps)),ab(t,o)}else if(6===s.tag)o=s.stateNode,i&&r&&(o=aw(o,s.memoizedProps)),ab(t,o);else if(4!==s.tag){if(22===s.tag&&null!==s.memoizedState)null!==(a=s.child)&&(a.return=s),e(t,s,!0,!0),a=!0;else if(null!==s.child){s.child.return=s,s=s.child;continue}}if(s===n)break;for(;null===s.sibling;){if(null===s.return||s.return===n)return a;s=s.return}s.sibling.return=s.return,s=s.sibling}return a})(i,t,!1,!1),e.pendingChildren=i,nE(t),aS(n,i)}}function nI(e,t,n,i){if(rB)e.memoizedProps!==i&&nE(t);else if(rz){var r=e.stateNode,a=e.memoizedProps;if((e=nC(e,t))||a!==i){var s=s2.current;(a=ay(r,n,a,i,!e,null))===r?t.stateNode=r:(nA(t),rI(a,n,i,s)&&nE(t),t.stateNode=a,e&&nR(a,t,!1,!1))}else t.stateNode=r}}function nL(e,t,n,i,r){if((32&e.mode)!=0&&(null===n?rY(t,i):rZ(t,n,i))){if(e.flags|=0x1000000,(0x13ffff40&r)===r||rK(t,i))if(rJ(e.stateNode,t,i))e.flags|=8192;else if(iw())e.flags|=8192;else throw ow=oT,oS}else e.flags&=-0x1000001}function nN(e,t){if(sh(t)){if(e.flags|=0x1000000,!sd(t))if(iw())e.flags|=8192;else throw ow=oT,oS}else e.flags&=-0x1000001}function nU(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?m():0x20000000,e.lanes|=t,lA|=t)}function nD(e,t){if(!s7)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;null!==n;)null!==n.alternate&&(i=n),n=n.sibling;null===i?t||null===e.tail?e.tail=null:e.tail.sibling=null:i.sibling=null}}function nO(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=0x3e00000&r.subtreeFlags,i|=0x3e00000&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function nF(e,t){switch(L(t),t.tag){case 3:X(ol),D();break;case 26:case 27:case 5:F(t);break;case 4:D();break;case 31:null!==t.memoizedState&&eZ(t);break;case 13:eZ(t);break;case 19:c(oz);break;case 10:X(t.type);break;case 22:case 23:eZ(t),eW(),null!==e&&c(ox);break;case 24:X(ol)}}function nB(e,t){try{var n=t.updateQueue,i=null!==n?n.lastEffect:null;if(null!==i){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var a=n.create;n.inst.destroy=i=a()}n=n.next}while(n!==r)}}catch(e){iG(t,t.return,e)}}function nz(e,t,n){try{var i=t.updateQueue,r=null!==i?i.lastEffect:null;if(null!==r){var a=r.next;i=a;do{if((i.tag&e)===e){var s=i.inst,o=s.destroy;if(void 0!==o){s.destroy=void 0,r=t;try{o()}catch(e){iG(r,n,e)}}}i=i.next}while(i!==a)}}catch(e){iG(t,t.return,e)}}function nk(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{eH(t,n)}catch(t){iG(e,e.return,t)}}}function nH(e,t,n){n.props=t4(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){iG(e,t,n)}}function nV(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var i=rT(e.stateNode);break;default:i=e.stateNode}"function"==typeof n?e.refCleanup=n(i):n.current=i}}catch(n){iG(e,t,n)}}function nG(e,t){var n=e.ref,i=e.refCleanup;if(null!==n)if("function"==typeof i)try{i()}catch(n){iG(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){iG(e,t,n)}else n.current=null}function nW(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{ao(i,t,n,e)}catch(t){iG(e,e.return,t)}}function nj(e,t,n){try{al(e.stateNode,e.type,n,t,e)}catch(t){iG(e,e.return,t)}}function nX(e){return 5===e.tag||3===e.tag||!!se&&26===e.tag||!!sf&&27===e.tag&&sy(e.type)||4===e.tag}function nq(e){a:for(;;){for(;null===e.sibling;){if(null===e.return||nX(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(sf&&27===e.tag&&sy(e.type)||2&e.flags||null===e.child||4===e.tag)continue a;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function nY(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?au(n,e,t):ar(n,e);else if(4!==i&&(sf&&27===i&&sy(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(nY(e,t,n),e=e.sibling;null!==e;)nY(e,t,n),e=e.sibling}
389function nZ(e,t,n){e=e.containerInfo;try{aM(e,n)}catch(e){iG(t,t.return,e)}}function nK(e){var t=e.stateNode,n=e.memoizedProps;try{sg(e.type,n,t,e)}catch(t){iG(e,e.return,t)}}function nJ(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:n6(e,n),4&i&&nB(5,n);break;case 1:if(n6(e,n),4&i)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){iG(n,n.return,e)}else{var r=t4(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){iG(n,n.return,e)}}64&i&&nk(n),512&i&&nV(n,n.return);break;case 3:if(n6(e,n),64&i&&null!==(i=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 27:case 5:e=rT(n.child.stateNode);break;case 1:e=n.child.stateNode}try{eH(i,e)}catch(e){iG(n,n.return,e)}}break;case 27:sf&&null===t&&4&i&&nK(n);case 26:case 5:if(n6(e,n),null===t){if(4&i)nW(n);else if(64&i){e=n.type,t=n.memoizedProps,r=n.stateNode;try{aZ(r,e,t,n)}catch(e){iG(n,n.return,e)}}}512&i&&nV(n,n.return);break;case 12:default:n6(e,n);break;case 31:n6(e,n),4&i&&n0(e,n);break;case 13:n6(e,n),4&i&&n1(e,n),64&i&&null!==(i=n.memoizedState)&&null!==(i=i.dehydrated)&&aR(i,n=iq.bind(null,n));break;case 22:if(!(i=null!==n.memoizedState||o5)){t=null!==t&&null!==t.memoizedState||o6,r=o5;var a=o6;o5=i,(o6=t)&&!a?function e(t,n,i){for(i=i&&(8772&n.subtreeFlags)!=0,n=n.child;null!==n;){var r=n.alternate,a=t,s=n,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(a,s,i),nB(4,s);break;case 1:if(e(a,s,i),"function"==typeof(a=(r=s).stateNode).componentDidMount)try{a.componentDidMount()}catch(e){iG(r,r.return,e)}if(null!==(a=(r=s).updateQueue)){var l=r.stateNode;try{var u=a.shared.hiddenCallbacks;if(null!==u)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)ek(u[a],l)}catch(e){iG(r,r.return,e)}}i&&64&o&&nk(s),nV(s,s.return);break;case 27:sf&&nK(s);case 26:case 5:e(a,s,i),i&&null===r&&4&o&&nW(s),nV(s,s.return);break;case 12:default:e(a,s,i);break;case 31:e(a,s,i),i&&4&o&&n0(a,s);break;case 13:e(a,s,i),i&&4&o&&n1(a,s);break;case 22:null===s.memoizedState&&e(a,s,i),nV(s,s.return);case 30:}n=n.sibling}}(e,n,(8772&n.subtreeFlags)!=0):n6(e,n),o5=r,o6=a}case 30:}}function n$(e,t,n){for(n=n.child;null!==n;)nQ(e,t,n),n=n.sibling}function nQ(e,t,n){if(sH&&"function"==typeof sH.onCommitFiberUnmount)try{sH.onCommitFiberUnmount(sk,n)}catch{}switch(n.tag){case 26:if(se){o6||nG(n,t),n$(e,t,n),n.memoizedState?sa(n.memoizedState):n.stateNode&&sl(n.stateNode);break}case 27:if(sf){o6||nG(n,t);var i=le,r=lt;sy(n.type)&&(le=n.stateNode,lt=!1),n$(e,t,n),sv(n.stateNode),le=i,lt=r;break}case 5:o6||nG(n,t);case 6:if(rB){if(i=le,r=lt,le=null,n$(e,t,n),le=i,lt=r,null!==le)if(lt)try{ad(le,n.stateNode)}catch(e){iG(n,t,e)}else try{ah(le,n.stateNode)}catch(e){iG(n,t,e)}}else n$(e,t,n);break;case 18:rB&&null!==le&&(lt?a2(le,n.stateNode):a1(le,n.stateNode));break;case 4:rB?(i=le,r=lt,le=n.stateNode.containerInfo,lt=!0,n$(e,t,n),le=i,lt=r):(rz&&nZ(n.stateNode,n,ax()),n$(e,t,n));break;case 0:case 11:case 14:case 15:nz(2,n,t),o6||nz(4,n,t),n$(e,t,n);break;case 1:o6||(nG(n,t),"function"==typeof(i=n.stateNode).componentWillUnmount&&nH(n,t,i)),n$(e,t,n);break;case 21:default:n$(e,t,n);break;case 22:o6=(i=o6)||null!==n.memoizedState,n$(e,t,n),o6=i}}function n0(e,t){if(rk&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)){e=e.dehydrated;try{aJ(e)}catch(e){iG(t,t.return,e)}}}function n1(e,t){if(rk&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{a$(e)}catch(e){iG(t,t.return,e)}}function n2(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new o7),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new o7),t;default:throw Error(i(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var i=iY.bind(null,e,t);t.then(i,i)}})}function n3(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r],s=e,o=t;if(rB){var l=o;a:for(;null!==l;){switch(l.tag){case 27:if(sf){if(sy(l.type)){le=l.stateNode,lt=!1;break a}break}case 5:le=l.stateNode,lt=!1;break a;case 3:case 4:le=l.stateNode.containerInfo,lt=!0;break a}l=l.return}if(null===le)throw Error(i(160));nQ(s,o,a),le=null,lt=!1}else nQ(s,o,a);null!==(s=a.alternate)&&(s.return=null),a.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)n4(t,e),t=t.sibling}function n4(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:n3(t,e),n5(e),4&r&&(nz(3,e,e.return),nB(3,e),nz(5,e,e.return));break;case 1:n3(t,e),n5(e),512&r&&(o6||null===n||nG(n,n.return)),64&r&&o5&&null!==(e=e.updateQueue)&&null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r));break;case 26:if(se){var a=ln;if(n3(t,e),n5(e),512&r&&(o6||null===n||nG(n,n.return)),4&r){r=null!==n?n.memoizedState:null;var s=e.memoizedState;null===n?null===s?null===e.stateNode?e.stateNode=ss(a,e.type,e.memoizedProps,e):so(a,e.type,e.stateNode):e.stateNode=sr(a,s,e.memoizedProps):r!==s?(null===r?null!==n.stateNode&&sl(n.stateNode):sa(r),null===s?so(a,e.type,e.stateNode):sr(a,s,e.memoizedProps)):null===s&&null!==e.stateNode&&nj(e,e.memoizedProps,n.memoizedProps)}break}case 27:if(sf){n3(t,e),n5(e),512&r&&(o6||null===n||nG(n,n.return)),null!==n&&4&r&&nj(e,e.memoizedProps,n.memoizedProps);break}case 5:if(n3(t,e),n5(e),512&r&&(o6||null===n||nG(n,n.return)),rB){if(32&e.flags){a=e.stateNode;try{ap(a)}catch(t){iG(e,e.return,t)}}4&r&&null!=e.stateNode&&(a=e.memoizedProps,nj(e,a,null!==n?n.memoizedProps:a)),1024&r&&(o8=!0)}else rz&&null!==e.alternate&&(e.alternate.stateNode=e.stateNode);break;case 6:if(n3(t,e),n5(e),4&r&&rB){if(null===e.stateNode)throw Error(i(162));r=e.memoizedProps,n=null!==n?n.memoizedProps:r,a=e.stateNode;try{as(a,n,r)}catch(t){iG(e,e.return,t)}}break;case 3:if(se?(sc(),a=ln,ln=sn(t.containerInfo),n3(t,e),ln=a):n3(t,e),n5(e),4&r){if(rB&&rk&&null!==n&&n.memoizedState.isDehydrated)try{aK(t.containerInfo)}catch(t){iG(e,e.return,t)}if(rz){r=t.containerInfo,n=t.pendingChildren;try{aM(r,n)}catch(t){iG(e,e.return,t)}}}o8&&(o8=!1,function e(t){if(1024&t.subtreeFlags)for(t=t.child;null!==t;){var n=t;e(n),5===n.tag&&1024&n.flags&&r3(n.stateNode),t=t.sibling}}(e));break;case 4:se?(n=ln,ln=sn(e.stateNode.containerInfo),n3(t,e),n5(e),ln=n):(n3(t,e),n5(e)),4&r&&rz&&nZ(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:default:n3(t,e),n5(e);break;case 31:case 19:n3(t,e),n5(e),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,n2(e,r));break;case 13:n3(t,e),n5(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(lI=sN()),4&r&&null!==(r=e.updateQueue)&&(e.updateQueue=null,n2(e,r));break;case 22:a=null!==e.memoizedState;var o=null!==n&&null!==n.memoizedState,l=o5,u=o6;if(o5=l||a,o6=u||o,n3(t,e),o6=u,o5=l,n5(e),8192&r&&((t=e.stateNode)._visibility=a?-2&t._visibility:1|t._visibility,a&&(null===n||o||o5||o6||function e(t){for(t=t.child;null!==t;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:nz(4,n,n.return),e(n);break;case 1:nG(n,n.return);var i=n.stateNode;"function"==typeof i.componentWillUnmount&&nH(n,n.return,i),e(n);break;case 27:sf&&sv(n.stateNode);case 26:case 5:nG(n,n.return),e(n);break;case 22:null===n.memoizedState&&e(n);break;default:e(n)}t=t.sibling}}(e)),rB)){a:if(n=null,rB)for(t=e;;){if(5===t.tag||se&&26===t.tag){if(null===n){o=n=t;try{s=o.stateNode,a?af(s):ag(o.stateNode,o.memoizedProps)}catch(e){iG(o,o.return,e)}}}else if(6===t.tag){if(null===n){o=t;try{var c=o.stateNode;a?am(c):av(c,o.memoizedProps)}catch(e){iG(o,o.return,e)}}}else if(18===t.tag){if(null===n){o=t;try{var h=o.stateNode;a?a3(h):a4(o.stateNode)}catch(e){iG(o,o.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;null===t.sibling;){if(null===t.return||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}}4&r&&null!==(r=e.updateQueue)&&null!==(n=r.retryQueue)&&(r.retryQueue=null,n2(e,n));case 30:case 21:}}function n5(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(nX(r)){n=r;break}r=r.return}if(rB){if(null==n)throw Error(i(160));switch(n.tag){case 27:if(sf){var a=n.stateNode,s=nq(e);nY(e,s,a);break}case 5:var o=n.stateNode;32&n.flags&&(ap(o),n.flags&=-33);var l=nq(e);nY(e,l,o);break;case 3:case 4:var u=n.stateNode.containerInfo,c=nq(e);!function e(t,n,i){var r=t.tag;if(5===r||6===r)t=t.stateNode,n?ac(i,t,n):aa(i,t);else if(4!==r&&(sf&&27===r&&sy(t.type)&&(i=t.stateNode,n=null),null!==(t=t.child)))for(e(t,n,i),t=t.sibling;null!==t;)e(t,n,i),t=t.sibling}(e,c,u);break;default:throw Error(i(161))}}}catch(t){iG(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function n6(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)nJ(e,t.alternate,t),t=t.sibling}function n8(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&en(n))}function n7(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&en(e))}function n9(e,t,n,i){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)ie(e,t,n,i),t=t.sibling}function ie(e,t,n,i){var r=t.flags;switch(t.tag){case 0:case 11:case 15:n9(e,t,n,i),2048&r&&nB(9,t);break;case 1:case 31:case 13:default:n9(e,t,n,i);break;case 3:n9(e,t,n,i),2048&r&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&en(e)));break;case 12:if(2048&r){n9(e,t,n,i),e=t.stateNode;try{var a=t.memoizedProps,s=a.id,o=a.onPostCommit;"function"==typeof o&&o(s,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){iG(t,t.return,e)}}else n9(e,t,n,i);break;case 23:break;case 22:a=t.stateNode,s=t.alternate,null!==t.memoizedState?2&a._visibility?n9(e,t,n,i):it(e,t):2&a._visibility?n9(e,t,n,i):(a._visibility|=2,function e(t,n,i,r,a){for(a=a&&(10256&n.subtreeFlags)!=0,n=n.child;null!==n;){var s=n,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(t,s,i,r,a),nB(8,s);break;case 23:break;case 22:var l=s.stateNode;null!==s.memoizedState?2&l._visibility?e(t,s,i,r,a):it(t,s):(l._visibility|=2,e(t,s,i,r,a)),a&&2048&o&&n8(s.alternate,s);break;case 24:e(t,s,i,r,a),a&&2048&o&&n7(s.alternate,s);break;default:e(t,s,i,r,a)}n=n.sibling}}(e,t,n,i,(10256&t.subtreeFlags)!=0)),2048&r&&n8(s,t);break;case 24:n9(e,t,n,i),2048&r&&n7(t.alternate,t)}}function it(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=t,i=n.flags;switch(n.tag){case 22:it(e,n),2048&i&&n8(n.alternate,n);break;case 24:it(e,n),2048&i&&n7(n.alternate,n);break;default:it(e,n)}t=t.sibling}}function ii(e,t,n){if(e.subtreeFlags&li)for(e=e.child;null!==e;)ir(e,t,n),e=e.sibling}function ir(e,t,n){switch(e.tag){case 26:if(ii(e,t,n),e.flags&li)if(null!==e.memoizedState)sp(n,ln,e.memoizedState,e.memoizedProps);else{var i=e.stateNode,r=e.type;e=e.memoizedProps,((0x13ffff40&t)===t||rK(r,e))&&rQ(n,i,r,e)}break;case 5:ii(e,t,n),e.flags&li&&(i=e.stateNode,r=e.type,e=e.memoizedProps,((0x13ffff40&t)===t||rK(r,e))&&rQ(n,i,r,e));break;case 3:case 4:se?(i=ln,ln=sn(e.stateNode.containerInfo),ii(e,t,n),ln=i):ii(e,t,n);break;case 22:null===e.memoizedState&&(null!==(i=e.alternate)&&null!==i.memoizedState?(i=li,li=0x1000000,ii(e,t,n),li=i):ii(e,t,n));break;default:ii(e,t,n)}}function ia(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(null!==e)}}function is(e){var t=e.deletions;if((16&e.flags)!=0){if(null!==t)for(var n=0;n<t.length;n++){var i=t[n];o9=i,il(i,e)}ia(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)io(e),e=e.sibling}function io(e){switch(e.tag){case 0:case 11:case 15:is(e),2048&e.flags&&nz(9,e,e.return);break;case 3:case 12:default:is(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,function e(t){var n=t.deletions;if((16&t.flags)!=0){if(null!==n)for(var i=0;i<n.length;i++){var r=n[i];o9=r,il(r,t)}ia(t)}for(t=t.child;null!==t;){switch((n=t).tag){case 0:case 11:case 15:nz(8,n,n.return),e(n);break;case 22:2&(i=n.stateNode)._visibility&&(i._visibility&=-3,e(n));break;default:e(n)}t=t.sibling}}(e)):is(e)}}function il(e,t){for(;null!==o9;){var n=o9;switch(n.tag){case 0:case 11:case 15:nz(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var i=n.memoizedState.cachePool.pool;null!=i&&i.refCount++}break;case 24:en(n.memoizedState.cache)}if(null!==(i=n.child))i.return=n,o9=i;else for(n=e;null!==o9;){var r=(i=o9).sibling,a=i.return;if(function e(t){var n=t.alternate;null!==n&&(t.alternate=null,e(n)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&null!==(n=t.stateNode)&&rq(n),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}(i),i===n){o9=null;break}if(null!==r){r.return=a,o9=r;break}o9=a}}}function iu(e){var t=rH(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(i(364));return t}if(null===(e=r8(e)))throw Error(i(362));return e.stateNode.current}function ic(e,t){var n=e.tag;switch(t.$$typeof){case la:if(e.type===t.value)return!0;break;case ls:a:{for(t=t.value,e=[e,0],n=0;n<e.length;){var r=e[n++],a=r.tag,s=e[n++],o=t[s];if(5!==a&&26!==a&&27!==a||!ae(r)){for(;null!=o&&ic(r,o);)o=t[++s];if(s===t.length){t=!0;break a}for(r=r.child;null!==r;)e.push(r,s),r=r.sibling}}t=!1}return t;case lo:if((5===n||26===n||27===n)&&at(e.stateNode,t.value))return!0;break;case lu:if((5===n||6===n||26===n||27===n)&&null!==(e=r9(e))&&0<=e.indexOf(t.value))return!0;break;case ll:if((5===n||26===n||27===n)&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(i(365))}return!1}function ih(e){switch(e.$$typeof){case la:return"<"+(l(e.value)||"Unknown")+">";case ls:return":has("+(ih(e)||"")+")";case lo:return'[role="'+e.value+'"]';
389case lu:return'"'+e.value+'"';case ll:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function id(e,t){var n=[];e=[e,0];for(var i=0;i<e.length;){var r=e[i++],a=r.tag,s=e[i++],o=t[s];if(5!==a&&26!==a&&27!==a||!ae(r)){for(;null!=o&&ic(r,o);)o=t[++s];if(s===t.length)n.push(r);else for(r=r.child;null!==r;)e.push(r,s),r=r.sibling}}return n}function ip(e,t){if(!r6)throw Error(i(363));e=id(e=iu(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var r=e[n++],a=r.tag;if(5===a||26===a||27===a)ae(r)||t.push(r.stateNode);else for(r=r.child;null!==r;)e.push(r),r=r.sibling}return t}function im(){return(2&ld)!=0&&0!==lm?lm&-lm:null!==rx.T?eh():rj()}function ig(){if(0===lE)if((0x20000000&lm)==0||s7){var e=sA;(3932160&(sA<<=1))==0&&(sA=262144),lE=e}else lE=0x20000000;return null!==(e=oF.current)&&(e.flags|=32),lE}function iv(e,t,n){(e===lp&&(2===lg||9===lg)||null!==e.cancelPendingCommit)&&(iM(e,0),ix(e,lm,lE,!1)),v(e,n),((2&ld)==0||e!==lp)&&(e===lp&&((2&ld)==0&&(lT|=n),4===lS&&ix(e,lm,lE,!1)),er(e))}function i_(e,t,n){if((6&ld)!=0)throw Error(i(327));for(var r=!n&&(127&t)==0&&(t&e.expiredLanes)==0||f(e,t),a=r?function(e,t){var n=ld;ld|=2;var r=iE(),a=iA();lp!==e||lm!==t?(lU=null,lN=sN()+500,iM(e,t)):ly=f(e,t);a:for(;;)try{if(0!==lg&&null!==lf){t=lf;var s=lv;s:switch(lg){case 1:lg=0,lv=null,iL(e,t,s,1);break;case 2:case 9:if(ev(s)){lg=0,lv=null,iI(t);break}t=function(){2!==lg&&9!==lg||lp!==e||(lg=7),er(e)},s.then(t,t);break a;case 3:lg=7;break a;case 4:lg=5;break a;case 7:ev(s)?(lg=0,lv=null,iI(t)):(lg=0,lv=null,iL(e,t,s,7));break;case 5:var o=null;switch(lf.tag){case 26:o=lf.memoizedState;case 5:case 27:var l=lf,u=l.type,c=l.pendingProps;if(o?sd(o):rJ(l.stateNode,u,c)){lg=0,lv=null;var h=l.sibling;if(null!==h)lf=h;else{var d=l.return;null!==d?(lf=d,iN(d)):lf=null}break s}}lg=0,lv=null,iL(e,t,s,5);break;case 6:lg=0,lv=null,iL(e,t,s,6);break;case 8:iS(),lS=6;break a;default:throw Error(i(462))}}for(;null!==lf&&!sI();)iP(lf);break}catch(t){iT(e,t)}return or=oi=null,rx.H=r,rx.A=a,ld=n,null!==lf?0:(lp=null,lm=0,eE(),lS)}(e,t):iR(e,t,!0),s=r;;){if(0===a)ly&&!r&&ix(e,t,0,!1);else{if(n=e.current.alternate,s&&!function(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&null!==(n=t.updateQueue)&&null!==(n=n.stores))for(var i=0;i<n.length;i++){var r=n[i],a=r.getSnapshot;r=r.value;try{if(!sV(a(),r))return!1}catch{return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(n)){a=iR(e,t,!1),s=!1;continue}if(2===a){if(s=t,e.errorRecoveryDisabledLanes&s)var o=0;else o=0!=(o=-0x20000001&e.pendingLanes)?o:0x20000000&o?0x20000000:0;if(0!==o){t=o;a:{a=lC;var l=rk&&e.current.memoizedState.isDehydrated;if(l&&(iM(e,o).flags|=256),2!==(o=iR(e,o,!1))){if(lx&&!l){e.errorRecoveryDisabledLanes|=s,lT|=s,a=4;break a}s=lR,lR=a,null!==s&&(null===lR?lR=s:lR.push.apply(lR,s))}a=o}if(s=!1,2!==a)continue}}if(1===a){iM(e,0),ix(e,t,0,!0);break}a:{switch(r=e,s=a){case 0:case 1:throw Error(i(345));case 4:if((4194048&t)!==t)break;case 6:ix(r,t,lE,!l_);break a;case 2:lR=null;break;case 3:case 5:break;default:throw Error(i(329))}if((0x3c00000&t)===t&&10<(a=lI+300-sN())){if(ix(r,t,lE,!l_),0!==p(r,0,!0))break a;lz=t,r.timeoutHandle=rU(iy.bind(null,r,n,lR,lU,lP,t,lE,lT,lA,l_,s,"Throttled",-0,0),a);break a}iy(r,n,lR,lU,lP,t,lE,lT,lA,l_,s,null,-0,0)}}break}er(e)}function iy(e,t,n,i,r,a,s,o,l,u,c,h,d,p){if(e.timeoutHandle=rO,8192&(h=t.subtreeFlags)||(0x1002000&h)==0x1002000){ir(t,a,h=r$());var f=(0x3c00000&a)===a?lI-sN():(4194048&a)===a?lL-sN():0;if(null!==(f=r0(h,f))){lz=a,e.cancelPendingCommit=f(iD.bind(null,e,t,a,n,i,r,s,o,l,c,h,null,d,p)),ix(e,a,s,!u);return}}iD(e,t,a,n,i,r,s,o,l)}function ix(e,t,n,i){t&=~lw,t&=~lT,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var a=31-sM(r),s=1<<a;i[a]=-1,r&=~s}0!==n&&_(e,n,t)}function ib(){return(6&ld)!=0||(ea(0,!1),!1)}function iS(){if(null!==lf){if(0===lg)var e=lf.return;else e=lf,or=oi=null,e5(e),oE=null,oA=0,e=lf;for(;null!==e;)nF(e.alternate,e),e=e.return;lf=null}}function iM(e,t){var n=e.timeoutHandle;n!==rO&&(e.timeoutHandle=rO,rD(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),lz=0,iS(),lp=e,lf=n=iJ(e.current,null),lm=t,lg=0,lv=null,l_=!1,ly=f(e,t),lx=!1,lA=lE=lw=lT=lM=lS=0,lR=lC=null,lP=!1,(8&t)!=0&&(t|=32&t);var i=e.entangledLanes;if(0!==i)for(e=e.entanglements,i&=t;0<i;){var r=31-sM(i),a=1<<r;t|=e[r],i&=~a}return lb=t,eE(),n}function iT(e,t){oH=null,rx.H=oJ,t===ob||t===oM?(t=ex(),lg=3):t===oS?(t=ex(),lg=4):lg=t===o2?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,lv=t,null===lf&&(lS=1,t5(e,A(t,e.current)))}function iw(){var e=oF.current;return null===e||((4194048&lm)===lm?null===oB:((0x3c00000&lm)===lm||(0x20000000&lm)!=0)&&e===oB)}function iE(){var e=rx.H;return rx.H=oJ,null===e?oJ:e}function iA(){var e=rx.A;return rx.A=lr,e}function iC(){lS=4,l_||(4194048&lm)!==lm&&null!==oF.current||(ly=!0),(0x7ffffff&lM)==0&&(0x7ffffff&lT)==0||null===lp||ix(lp,lm,lE,!1)}function iR(e,t,n){var i=ld;ld|=2;var r=iE(),a=iA();(lp!==e||lm!==t)&&(lU=null,iM(e,t)),t=!1;var s=lS;a:for(;;)try{if(0!==lg&&null!==lf){var o=lf,l=lv;switch(lg){case 8:iS(),s=6;break a;case 3:case 2:case 9:case 6:null===oF.current&&(t=!0);var u=lg;if(lg=0,lv=null,iL(e,o,l,u),n&&ly){s=0;break a}break;default:u=lg,lg=0,lv=null,iL(e,o,l,u)}}(function(){for(;null!==lf;)iP(lf)})(),s=lS;break}catch(t){iT(e,t)}return t&&e.shellSuspendCounter++,or=oi=null,ld=i,rx.H=r,rx.A=a,null===lf&&(lp=null,lm=0,eE()),s}function iP(e){var t=nw(e.alternate,e,lb);e.memoizedProps=e.pendingProps,null===t?iN(e):lf=t}function iI(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=nh(n,t,t.pendingProps,t.type,void 0,lm);break;case 11:t=nh(n,t,t.pendingProps,t.type.render,t.ref,lm);break;case 5:e5(t);default:nF(n,t),t=nw(n,t=lf=i$(t,lb),lb)}e.memoizedProps=e.pendingProps,null===t?iN(e):lf=t}function iL(e,t,n,r){or=oi=null,e5(t),oE=null,oA=0;var a=t.return;try{if(function(e,t,n,r,a){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Z(t,n,a,!0),null!==(n=oF.current)){switch(n.tag){case 31:case 13:return null===oB?iC():null===n.alternate&&0===lS&&(lS=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===oT?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),iW(e,r,a)),!1;case 22:return n.flags|=65536,r===oT?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),iW(e,r,a)),!1}throw Error(i(435,n.tag))}return iW(e,r,a),iC(),!1}if(s7)return null!==(t=oF.current)?((65536&t.flags)==0&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ot&&W(A(e=Error(i(422),{cause:r}),n))):(r!==ot&&W(A(t=Error(i(423),{cause:r}),n)),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=A(r,n),a=t8(e.stateNode,r,a),eF(e,a),4!==lS&&(lS=2)),!1;var s=Error(i(520),{cause:r});if(s=A(s,n),null===lC?lC=[s]:lC.push(s),4!==lS&&(lS=2),null===t)return!0;r=A(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=t8(n.stateNode,r,e),eF(n,e),!1;case 1:if(t=n.type,s=n.stateNode,(128&n.flags)==0&&("function"==typeof t.getDerivedStateFromError||null!==s&&"function"==typeof s.componentDidCatch&&(null===lD||!lD.has(s))))return n.flags|=65536,a&=-a,n.lanes|=a,t9(a=t7(a),e,n,r),eF(n,a),!1}n=n.return}while(null!==n);return!1}(e,a,t,n,lm)){lS=1,t5(e,A(n,e.current)),lf=null;return}}catch(t){if(null!==a)throw lf=a,t;lS=1,t5(e,A(n,e.current)),lf=null;return}32768&t.flags?(s7||1===r?e=!0:ly||(0x20000000&lm)!=0?e=!1:(l_=e=!0,(2===r||9===r||3===r||6===r)&&null!==(r=oF.current)&&13===r.tag&&(r.flags|=16384)),iU(t,e)):iN(t)}function iN(e){var t=e;do{if((32768&t.flags)!=0)return void iU(t,l_);e=t.return;var n=function(e,t,n){var r=t.pendingProps;switch(L(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return nO(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),X(ol),D(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(H(t)?nE(t):null===e||e.memoizedState.isDehydrated&&(256&t.flags)==0||(t.flags|=1024,G())),nP(e,t),nO(t),null;case 26:if(se){var a=t.type,s=t.memoizedState;return null===e?(nE(t),null!==s?(nO(t),nN(t,s)):(nO(t),nL(t,a,null,r,n))):s?s!==e.memoizedState?(nE(t),nO(t),nN(t,s)):(nO(t),t.flags&=-0x1000001):(s=e.memoizedProps,rB?s!==r&&nE(t):nI(e,t,a,r),nO(t),nL(t,a,s,r,n
389)),null}case 27:if(sf){if(F(t),n=s4.current,a=t.type,null!==e&&null!=t.stateNode)rB?e.memoizedProps!==r&&nE(t):nI(e,t,a,r);else{if(!r){if(null===t.stateNode)throw Error(i(166));return nO(t),null}e=s2.current,H(t)?z(t,e):(t.stateNode=e=sm(a,r,n,e,!0),nE(t))}return nO(t),null}case 5:if(F(t),a=t.type,null!==e&&null!=t.stateNode)nI(e,t,a,r);else{if(!r){if(null===t.stateNode)throw Error(i(166));return nO(t),null}if(s=s2.current,H(t))z(t,s),aQ(t.stateNode,a,r,s)&&(t.flags|=64);else{var o=rR(a,r,s4.current,s,t);nA(t),nR(o,t,!1,!1),t.stateNode=o,rI(o,a,r,s)&&nE(t)}}return nO(t),nL(t,t.type,null===e?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)n=e.memoizedProps,rB?n!==r&&nE(t):rz&&(n!==r?(e=s4.current,n=s2.current,nA(t),t.stateNode=rN(r,e,n,t)):t.stateNode=e.stateNode);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=s4.current,n=s2.current,H(t)){if(!rk)throw Error(i(176));if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(a=s6))switch(a.tag){case 27:case 5:r=a.memoizedProps}aW(e,n,t,r)||B(t,!0)}else nA(t),t.stateNode=rN(r,e,n,t)}return nO(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=H(t),null!==n){if(null===e){if(!r)throw Error(i(318));if(!rk)throw Error(i(556));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(i(557));aj(e,t)}else V(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;nO(t),e=!1}else n=G(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(eZ(t),t):(eZ(t),null);if((128&t.flags)!=0)throw Error(i(558))}return nO(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(a=H(t),null!==r&&null!==r.dehydrated){if(null===e){if(!a)throw Error(i(318));if(!rk)throw Error(i(344));if(!(a=null!==(a=t.memoizedState)?a.dehydrated:null))throw Error(i(317));aX(a,t)}else V(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;nO(t),a=!1}else a=G(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return 256&t.flags?(eZ(t),t):(eZ(t),null)}return eZ(t),(128&t.flags)!=0?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(r=t.child,a=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(a=r.alternate.memoizedState.cachePool.pool),s=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(s=r.memoizedState.cachePool.pool),s!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),nU(t,t.updateQueue),nO(t),null);case 4:return D(),nP(e,t),null===e&&rV(t.stateNode.containerInfo),nO(t),null;case 10:return X(t.type),nO(t),null;case 19:if(c(oz),null===(r=t.memoizedState))return nO(t),null;if(a=(128&t.flags)!=0,null===(s=r.rendering))if(a)nD(r,!1);else{if(0!==lS||null!==e&&(128&e.flags)!=0)for(e=t.child;null!==e;){if(null!==(s=eK(e))){for(t.flags|=128,nD(r,!1),t.updateQueue=e=s.updateQueue,nU(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)i$(n,e),n=n.sibling;return h(oz,1&oz.current|2),s7&&C(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&sN()>lN&&(t.flags|=128,a=!0,nD(r,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=eK(s))){if(t.flags|=128,a=!0,t.updateQueue=e=e.updateQueue,nU(t,e),nD(r,!0),null===r.tail&&"hidden"===r.tailMode&&!s.alternate&&!s7)return nO(t),null}else 2*sN()-r.renderingStartTime>lN&&0x20000000!==n&&(t.flags|=128,a=!0,nD(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=r.last)?e.sibling=s:t.child=s,r.last=s)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=sN(),e.sibling=null,n=oz.current,h(oz,a?1&n|2:1&n),s7&&C(t,r.treeForkCount),e):(nO(t),null);case 22:case 23:return eZ(t),eW(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(0x20000000&n)!=0&&(128&t.flags)==0&&(nO(t),6&t.subtreeFlags&&(t.flags|=8192)):nO(t),null!==(n=t.updateQueue)&&nU(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&c(ox),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),X(ol),nO(t),null;case 25:case 30:return null}throw Error(i(156,t.tag))}(t.alternate,t,lb);if(null!==n){lf=n;return}if(null!==(t=t.sibling)){lf=t;return}lf=t=e}while(null!==t);0===lS&&(lS=5)}function iU(e,t){do{var n=function(e,t){switch(L(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return X(ol),D(),(65536&(e=t.flags))!=0&&(128&e)==0?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return F(t),null;case 31:if(null!==t.memoizedState){if(eZ(t),null===t.alternate)throw Error(i(340));V()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(eZ(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));V()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return c(oz),null;case 4:return D(),null;case 10:return X(t.type),null;case 22:case 23:return eZ(t),eW(),null!==e&&c(ox),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return X(ol),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,lf=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deleti
389ons=null),!t&&null!==(e=e.sibling)){lf=e;return}lf=e=n}while(null!==e);lS=6,lf=null}function iD(e,t,n,r,a,s,o,l,u){e.cancelPendingCommit=null;do ik();while(0!==lO);if((6&ld)!=0)throw Error(i(327));if(null!==t){if(t===e.current)throw Error(i(177));if(function(e,t,n,i,r,a){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=s&~n;0<n;){var c=31-sM(n),h=1<<c;o[c]=0,l[c]=-1;var d=u[c];if(null!==d)for(u[c]=null,c=0;c<d.length;c++){var p=d[c];null!==p&&(p.lane&=-0x20000001)}n&=~h}0!==i&&_(e,i,0),0!==a&&0===r&&0!==e.tag&&(e.suspendedLanes|=a&~(s&~t))}(e,n,s=t.lanes|t.childLanes|oL,o,l,u),e===lp&&(lf=lp=null,lm=0),lB=t,lF=e,lz=n,lk=s,lH=a,lV=r,(10256&t.subtreeFlags)!=0||(10256&t.flags)!=0?(e.callbackNode=null,e.callbackPriority=0,sR(sO,function(){return iH(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(13878&t.flags)!=0,(13878&t.subtreeFlags)!=0||r){r=rx.T,rx.T=null,a=rW(),rG(2),o=ld,ld|=4;try{!function(e,t){for(rA(e.containerInfo),o9=t;null!==o9;)if(t=(e=o9).child,(1028&e.subtreeFlags)!=0&&null!==t)t.return=e,o9=t;else for(;null!==o9;){var n=(e=o9).alternate;switch(t=e.flags,e.tag){case 0:if((4&t)!=0&&null!==(t=null!==(t=e.updateQueue)?t.events:null))for(var r=0;r<t.length;r++){var a=t[r];a.ref.impl=a.nextImpl}break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if((1024&t)!=0&&null!==n){t=void 0,r=e,a=n.memoizedProps,n=n.memoizedState;var s=r.stateNode;try{var o=t4(r.type,a);t=s.getSnapshotBeforeUpdate(o,n),s.__reactInternalSnapshotBeforeUpdate=t}catch(e){iG(r,r.return,e)}}break;case 3:(1024&t)!=0&&rB&&a_(e.stateNode.containerInfo);break;default:if((1024&t)!=0)throw Error(i(163))}if(null!==(t=e.sibling)){t.return=e.return,o9=t;break}o9=e.return}}(e,t)}finally{ld=o,rG(a),rx.T=r}}lO=1,iO(),iF(),iB()}}function iO(){if(1===lO){lO=0;var e=lF,t=lB,n=(13878&t.flags)!=0;if((13878&t.subtreeFlags)!=0||n){n=rx.T,rx.T=null;var i=rW();rG(2);var r=ld;ld|=4;try{n4(t,e),rC(e.containerInfo)}finally{ld=r,rG(i),rx.T=n}}e.current=t,lO=2}}function iF(){if(2===lO){lO=0;var e=lF,t=lB,n=(8772&t.flags)!=0;if((8772&t.subtreeFlags)!=0||n){n=rx.T,rx.T=null;var i=rW();rG(2);var r=ld;ld|=4;try{nJ(e,t.alternate,t)}finally{ld=r,rG(i),rx.T=n}}lO=3}}function iB(){if(4===lO||3===lO){lO=0,sL();var e=lF,t=lB,n=lz,i=lV;(10256&t.subtreeFlags)!=0||(10256&t.flags)!=0?lO=5:(lO=0,lB=lF=null,iz(e,e.pendingLanes));var r=e.pendingLanes;if(0===r&&(lD=null),S(n),t=t.stateNode,sH&&"function"==typeof sH.onCommitFiberRoot)try{sH.onCommitFiberRoot(sk,t,void 0,(128&t.current.flags)==128)}catch{}if(null!==i){t=rx.T,r=rW(),rG(2),rx.T=null;try{for(var a=e.onRecoverableError,s=0;s<i.length;s++){var o=i[s];a(o.value,{componentStack:o.stack})}}finally{rx.T=t,rG(r)}}(3&lz)!=0&&ik(),er(e),r=e.pendingLanes,(261930&n)!=0&&(42&r)!=0?e===lW?lG++:(lG=0,lW=e):lG=0,rk&&a0(),ea(0,!1)}}function iz(e,t){0==(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,en(t))}function ik(){return iO(),iF(),iB(),iH()}function iH(){if(5!==lO)return!1;var e=lF,t=lk;lk=0;var n=S(lz),r=32>n?32:n;n=rx.T;var a=rW();try{rG(r),rx.T=null,r=lH,lH=null;var s=lF,o=lz;if(lO=0,lB=lF=null,lz=0,(6&ld)!=0)throw Error(i(331));var l=ld;if(ld|=4,io(s.current),ie(s,s.current,o,r),ld=l,ea(0,!1),sH&&"function"==typeof sH.onPostCommitFiberRoot)try{sH.onPostCommitFiberRoot(sk,s)}catch{}return!0}finally{rG(a),rx.T=n,iz(e,t)}}function iV(e,t,n){t=A(n,t),t=t8(e.stateNode,t,2),null!==(e=eD(e,t,2))&&(v(e,2),er(e))}function iG(e,t,n){if(3===e.tag)iV(e,e,n);else for(;null!==t;){if(3===t.tag){iV(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===lD||!lD.has(i))){e=A(n,e),null!==(i=eD(t,n=t7(2),2))&&(t9(n,i,t,e),v(i,2),er(i));break}}t=t.return}}function iW(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new lh;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(lx=!0,r.add(n),e=ij.bind(null,e,t,n),t.then(e,e))}function ij(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,lp===e&&(lm&n)===n&&(4===lS||3===lS&&(0x3c00000&lm)===lm&&300>sN()-lI?(2&ld)==0&&iM(e,0):lw|=n,lA===lm&&(lA=0)),er(e)}function iX(e,t){0===t&&(t=m()),null!==(e=eR(e,t))&&(v(e,t),er(e))}function iq(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),iX(e,n)}function iY(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),iX(e,n)}function iZ(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.t
389ype=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function iK(e){return!(!(e=e.prototype)||!e.isReactComponent)}function iJ(e,n){var i=e.alternate;return null===i?((i=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=0x3e00000&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function i$(e,t){e.flags&=0x3e00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function iQ(e,n,r,a,s,o){var l=0;if(a=e,"function"==typeof e)iK(e)&&(l=1);else if("string"==typeof e)l=se&&sf?st(e,r,s2.current)?26:s_(e)?27:5:se?st(e,r,s2.current)?26:5:sf&&s_(e)?27:5;else a:switch(e){case rm:return(e=t(31,r,n,s)).elementType=rm,e.lanes=o,e;case ra:return i0(r.children,s,o,n);case rs:l=8,s|=24;break;case ro:return(e=t(12,r,n,2|s)).elementType=ro,e.lanes=o,e;case rh:return(e=t(13,r,n,s)).elementType=rh,e.lanes=o,e;case rd:return(e=t(19,r,n,s)).elementType=rd,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ru:l=10;break a;case rl:l=9;break a;case rc:l=11;break a;case rp:l=14;break a;case rf:l=16,a=null;break a}l=29,r=Error(i(130,null===e?"null":typeof e,"")),a=null}return(n=t(l,r,n,s)).elementType=e,n.type=a,n.lanes=o,n}function i0(e,n,i,r){return(e=t(7,e,r,n)).lanes=i,e}function i1(e,n,i){return(e=t(6,e,null,n)).lanes=i,e}function i2(e){var n=t(18,null,null,0);return n.stateNode=e,n}function i3(e,n,i){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function i4(e,t,n,i,r,a,s,o,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=rO,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=g(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=g(0),this.hiddenUpdates=g(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function i5(e,n,i,r,a,s,o,l,u,c,h,d){return e=new i4(e,n,i,o,u,c,h,d,l),n=1,!0===s&&(n|=24),s=t(3,null,null,n),e.current=s,s.stateNode=e,n=et(),n.refCount++,e.pooledCache=n,n.refCount++,s.memoizedState={element:r,isDehydrated:i,cache:n},eL(s),e}function i6(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(i(188)):Error(i(268,e=Object.keys(e).join(",")));return null===(e=null!==(e=s(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:rT(e.stateNode)}function i8(e,t,n,i,r,a){r=sS,null===i.context?i.context=r:i.pendingContext=r,(i=eU(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(i.callback=a),null!==(n=eD(e,i,t))&&(iv(n,e,t),eO(n,e,t))}function i7(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function i9(e,t){i7(e,t),(e=e.alternate)&&i7(e,t)}var re={},rt=Object.assign,rn=Symbol.for("react.element"),ri=Symbol.for("react.transitional.element"),rr=Symbol.for("react.portal"),ra=Symbol.for("react.fragment"),rs=Symbol.for("react.strict_mode"),ro=Symbol.for("react.profiler"),rl=Symbol.for("react.consumer"),ru=Symbol.for("react.context"),rc=Symbol.for("react.forward_ref"),rh=Symbol.for("react.suspense"),rd=Symbol.for("react.suspense_list"),rp=Symbol.for("react.memo"),rf=Symbol.for("react.lazy"),rm=Symbol.for("react.activity"),rg=Symbol.for("react.memo_cache_sentinel"),rv=Symbol.iterator,r_=Symbol.for("react.client.reference"),ry=Array.isArray,rx=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,rb=e.rendererVersion,rS=e.rendererPackageName,rM=e.extraDevToolsConfig,rT=e.getPublicInstance,rw=e.getRootHostContext,rE=e.getChildHostContext,rA=e.prepareForCommit,rC=e.resetAfterCommit,rR=e.createInstance;e.cloneMutableInstance;var rP=e.appendInitialChild,rI=e.finalizeInitialChildren,rL=e.shouldSetTextContent,rN=e.createTextInstance;e.cloneMutableTextInstance;var rU=e.scheduleTimeout,rD=e.cancelTimeout,rO=e.noTimeout,rF=e.isPrimaryRenderer;e.warnsIfNotActing;var rB=e.supportsMutation,rz=e.supportsPersistence,rk=e.supportsHydration,rH=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var rV=e.preparePortalMount;
389e.prepareScopeUpdate,e.getInstanceFromScope;var rG=e.setCurrentUpdatePriority,rW=e.getCurrentUpdatePriority,rj=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var rX=e.shouldAttemptEagerTransition,rq=e.detachDeletedInstance;e.requestPostPaintCallback;var rY=e.maySuspendCommit,rZ=e.maySuspendCommitOnUpdate,rK=e.maySuspendCommitInSyncRender,rJ=e.preloadInstance,r$=e.startSuspendingCommit,rQ=e.suspendInstance;e.suspendOnActiveViewTransition;var r0=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var r1=e.NotPendingTransition,r2=e.HostTransitionContext,r3=e.resetFormInstance;e.bindToConsole;var r4=e.supportsMicrotasks,r5=e.scheduleMicrotask,r6=e.supportsTestSelectors,r8=e.findFiberRoot,r7=e.getBoundingRect,r9=e.getTextContent,ae=e.isHiddenSubtree,at=e.matchAccessibilityRole,an=e.setFocusIfFocusable,ai=e.setupIntersectionObserver,ar=e.appendChild,aa=e.appendChildToContainer,as=e.commitTextUpdate,ao=e.commitMount,al=e.commitUpdate,au=e.insertBefore,ac=e.insertInContainerBefore,ah=e.removeChild,ad=e.removeChildFromContainer,ap=e.resetTextContent,af=e.hideInstance,am=e.hideTextInstance,ag=e.unhideInstance,av=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var a_=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var ay=e.cloneInstance,ax=e.createContainerChildSet,ab=e.appendChildToContainerChildSet,aS=e.finalizeContainerChildren,aM=e.replaceContainerChildren,aT=e.cloneHiddenInstance,aw=e.cloneHiddenTextInstance,aE=e.isSuspenseInstancePending,aA=e.isSuspenseInstanceFallback,aC=e.getSuspenseInstanceFallbackErrorDetails,aR=e.registerSuspenseInstanceRetry,aP=e.canHydrateFormStateMarker,aI=e.isFormStateMarkerMatching,aL=e.getNextHydratableSibling,aN=e.getNextHydratableSiblingAfterSingleton,aU=e.getFirstHydratableChild,aD=e.getFirstHydratableChildWithinContainer,aO=e.getFirstHydratableChildWithinActivityInstance,aF=e.getFirstHydratableChildWithinSuspenseInstance,aB=e.getFirstHydratableChildWithinSingleton,az=e.canHydrateInstance,ak=e.canHydrateTextInstance,aH=e.canHydrateActivityInstance,aV=e.canHydrateSuspenseInstance,aG=e.hydrateInstance,aW=e.hydrateTextInstance,aj=e.hydrateActivityInstance,aX=e.hydrateSuspenseInstance,aq=e.getNextHydratableInstanceAfterActivityInstance,aY=e.getNextHydratableInstanceAfterSuspenseInstance,aZ=e.commitHydratedInstance,aK=e.commitHydratedContainer,aJ=e.commitHydratedActivityInstance,a$=e.commitHydratedSuspenseInstance,aQ=e.finalizeHydratedChildren,a0=e.flushHydrationEvents;e.clearActivityBoundary;var a1=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var a2=e.clearSuspenseBoundaryFromContainer,a3=e.hideDehydratedBoundary,a4=e.unhideDehydratedBoundary,a5=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var a6,a8,a7=e.validateHydratableInstance,a9=e.validateHydratableTextInstance,se=e.supportsResources,st=e.isHostHoistableType,sn=e.getHoistableRoot,si=e.getResource,sr=e.acquireResource,sa=e.releaseResource,ss=e.hydrateHoistable,so=e.mountHoistable,sl=e.unmountHoistable,su=e.createHoistableInstance,sc=e.prepareToCommitHoistables,sh=e.mayResourceSuspendCommit,sd=e.preloadResource,sp=e.suspendResource,sf=e.supportsSingletons,sm=e.resolveSingletonInstance,sg=e.acquireSingletonInstance,sv=e.releaseSingletonInstance,s_=e.isHostSingletonType,sy=e.isSingletonScope,sx=[],sb=-1,sS={},sM=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(sT(e)/sw|0)|0},sT=Math.log,sw=Math.LN2,sE=256,sA=262144,sC=4194304,sR=cV.unstable_scheduleCallback,sP=cV.unstable_cancelCallback,sI=cV.unstable_shouldYield,sL=cV.unstable_requestPaint,sN=cV.unstable_now,sU=cV.unstable_ImmediatePriority,sD=cV.unstable_UserBlockingPriority,sO=cV.unstable_NormalPriority,sF=cV.unstable_IdlePriority,sB=cV.log,sz=cV.unstable_setDisableYieldValue,sk=null,sH=null,sV="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sG="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},sW=Object.prototype.hasOwnProperty,sj=!1,sX=new WeakMap,sq=[],sY=0,sZ=null,sK=0,sJ=[],s$=0,sQ=null,s0=1,s1="",s2=u(null),s3=u(null),s4=u(null),s5=u(null),s6=null,s8=null,s7=!1,s9=null,oe=!1,ot=Error(i(519)),on=u(null),oi=null,or=null,oa="u">typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},os=cV.unstable_scheduleCallback,oo=cV.unstable_NormalPriority,ol={$$typeof:ru,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},ou=null,oc=null,oh=!1,od=!1,op=!1,of=0,om=null,og=0,ov=0,o_=null,oy=rx.S;rx.S=function(e,t){lL=sN(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e){if(null===om){var t=om=[];og=0,ov=eh(),o_={status:"pending",value:void 0,then:function(e){t.push(e)}}}og++,e.then(ed,ed)}(t),null!==oy&&oy(e,t)};var ox=u(null),ob=Error(i(460)),oS=Error(i(474)),oM=Error(i(542)),oT={then:function(){}},ow=null,oE=null,oA=0,oC=ew(!0),oR=ew(!1),oP=[],oI=0,oL=0,oN=!1,oU=!1,oD=u(null),oO=u(0),oF=u(null),oB=null,oz=u(0),ok=0,oH=null,oV=null,oG=null,oW=!1,oj=!1,oX=!1,oq=0,oY=0,oZ=null,oK=0,oJ={readContext:$,use:te,useCallback:eJ,useContext:eJ,useEffect:eJ,useImperativeHandle:eJ,useLayoutEffect:eJ,useInsertionEffect:eJ,useMemo:eJ,useReducer:eJ,useRef:eJ,useState:eJ,useDebugValue:eJ,useDeferredValue:eJ,useTransition:eJ,useSyncExternalStore:eJ,useId:eJ,useHostTransitionStatus:eJ,useFormState:eJ,useActionState:eJ,useOptimistic:eJ,useMemoCache:eJ,useCacheRefresh:eJ};oJ.useEffectEvent=eJ;var o$={readContext:$,use:te,useCallback:function(e,t){return e6().memoizedState=[e,void 0===t?null:t],e},useContext:$,useEffect:tP,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,tC(4194308,4,tD.bind(null,t,e),n)},useLayoutEffect:function(e,t){return tC(4194308,4,e,t)},useInsertionEffect:function(e,t){tC(4,2,e,t)},useMemo:function(e,t){var n=e6();t=void 0===t?null:t;var i=e();if(oX){M(!0);try{e()}finally{M(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=e6();if(void 0!==n){var r=n(t);if(oX){M(!0);try{n(t)}finally{M(!1)}}}else r=t;
389return i.memoizedState=i.baseState=r,i.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},e=e.dispatch=tY.bind(null,oH,e),[i.memoizedState,e]},useRef:function(e){return e6().memoizedState={current:e}},useState:function(e){var t=(e=td(e)).queue,n=tZ.bind(null,oH,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tF,useDeferredValue:function(e,t){return tk(e6(),e,t)},useTransition:function(){var e=td(!1);return e=tV.bind(null,oH,e.queue,!0,!1),e6().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oH,a=e6();if(s7){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===lp)throw Error(i(349));(127&lm)!=0||to(r,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,tP(tu.bind(null,r,s,e),[e]),r.flags|=2048,tE(9,{destroy:void 0},tl.bind(null,r,s,n,t),null),n},useId:function(){var e=e6(),t=lp.identifierPrefix;if(s7){var n=s1,i=s0;t="_"+t+"R_"+(n=(i&~(1<<32-sM(i)-1)).toString(32)+n),0<(n=oq++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=oK++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:tW,useFormState:tb,useActionState:tb,useOptimistic:function(e){var t=e6();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tJ.bind(null,oH,!0,n),n.dispatch=t,[e,t]},useMemoCache:tt,useCacheRefresh:function(){return e6().memoizedState=tq.bind(null,oH)},useEffectEvent:function(e){var t=e6(),n={impl:e};return t.memoizedState=n,function(){if((2&ld)!=0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},oQ={readContext:$,use:te,useCallback:tB,useContext:$,useEffect:tI,useImperativeHandle:tO,useInsertionEffect:tN,useLayoutEffect:tU,useMemo:tz,useReducer:ti,useRef:tA,useState:function(){return ti(tn)},useDebugValue:tF,useDeferredValue:function(e,t){return tH(e8(),oV.memoizedState,e,t)},useTransition:function(){var e=ti(tn)[0],t=e8().memoizedState;return["boolean"==typeof e?e:e9(e),t]},useSyncExternalStore:ts,useId:tj,useHostTransitionStatus:tW,useFormState:tS,useActionState:tS,useOptimistic:function(e,t){return tp(e8(),oV,e,t)},useMemoCache:tt,useCacheRefresh:tX};oQ.useEffectEvent=tL;var o0={readContext:$,use:te,useCallback:tB,useContext:$,useEffect:tI,useImperativeHandle:tO,useInsertionEffect:tN,useLayoutEffect:tU,useMemo:tz,useReducer:ta,useRef:tA,useState:function(){return ta(tn)},useDebugValue:tF,useDeferredValue:function(e,t){var n=e8();return null===oV?tk(n,e,t):tH(n,oV.memoizedState,e,t)},useTransition:function(){var e=ta(tn)[0],t=e8().memoizedState;return["boolean"==typeof e?e:e9(e),t]},useSyncExternalStore:ts,useId:tj,useHostTransitionStatus:tW,useFormState:tw,useActionState:tw,useOptimistic:function(e,t){var n=e8();return null!==oV?tp(n,oV,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:tt,useCacheRefresh:tX};o0.useEffectEvent=tL;var o1={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=im(),r=eU(i);r.payload=t,null!=n&&(r.callback=n),null!==(t=eD(e,r,i))&&(iv(t,e,i),eO(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=im(),r=eU(i);r.tag=1,r.payload=t,null!=n&&(r.callback=n),null!==(t=eD(e,r,i))&&(iv(t,e,i),eO(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=im(),i=eU(n);i.tag=2,null!=t&&(i.callback=t),null!==(t=eD(e,i,n))&&(iv(t,e,n),eO(t,e,n))}},o2=Error(i(461)),o3=!1,o4={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},o5=!1,o6=!1,o8=!1,o7="function"==typeof WeakSet?WeakSet:Set,o9=null,le=null,lt=!1,ln=null,li=8192,lr={getCacheForType:function(e){var t=$(ol),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return $(ol).controller.signal}},la=0,ls=1,lo=2,ll=3,lu=4;if("function"==typeof Symbol&&Symbol.for){var lc=Symbol.for;la=lc("selector.component"),ls=lc("selector.has_pseudo_class"),lo=lc("selector.role"),ll=lc("selector.test_id"),lu=lc("selector.text")}var lh="function"==typeof WeakMap?WeakMap:Map,ld=0,lp=null,lf=null,lm=0,lg=0,lv=null,l_=!1,ly=!1,lx=!1,lb=0,lS=0,lM=0,lT=0,lw=0,lE=0,lA=0,lC=null,lR=null,lP=!1,lI=0,lL=0,lN=1/0,lU=null,lD=null,lO=0,lF=null,lB=null,lz=0,lk=0,lH=null,lV=null,lG=0,lW=null;return re.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var t=eR(e,0x4000000);null!==t&&iv(t,e,0x4000000),i9(e,0x4000000)}},re.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var t=im(),n=eR(e,t=b(t));null!==n&&iv(n,e,t),i9(e,t)}},re.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=d(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-sM(t);e.entanglements[1]|=n,t&=~n}er(e),(6&ld)==0&&(lN=sN()+500,ea(0,!1))}}break;case 31:case 13:null!==(t=eR(e,2))&&iv(t,e,2),ib(),i9(e,2)}},re.batchedUpdates=function(e,t){return e(t)},re.createComponentSelector=function(e){return{$$typeof:la,value:e}},re.createContainer=function(e,t,n,i,r,a,s,o,l,u){return i5(e,t,!1,null,n,i,a,null,s,o,l,u)},re.createHasPseudoClassSelector=function(e){return{$$typeof:ls,value:e}},re.createHydrationContainer=function(e,t,n,i,r,a,s,o,l,u,c,h,d,p){var f;return(e=i5(n,i,!0,e,r,a,o,p,l,u,c,h)).context=sS,n=e.current,(r=eU(i=b(i=im()))).c
389allback=null!=(f=t)?f:null,eD(n,r,i),t=i,e.current.lanes=t,v(e,t),er(e),e},re.createPortal=function(e,t,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:rr,key:null==i?null:""+i,children:e,containerInfo:t,implementation:n}},re.createRoleSelector=function(e){return{$$typeof:lo,value:e}},re.createTestNameSelector=function(e){return{$$typeof:ll,value:e}},re.createTextSelector=function(e){return{$$typeof:lu,value:e}},re.defaultOnCaughtError=function(e){console.error(e)},re.defaultOnRecoverableError=function(e){sG(e)},re.defaultOnUncaughtError=function(e){sG(e)},re.deferredUpdates=function(e){var t=rx.T,n=rW();try{return rG(32),rx.T=null,e()}finally{rG(n),rx.T=t}},re.discreteUpdates=function(e,t,n,i,r){var a=rx.T,s=rW();try{return rG(2),rx.T=null,e(t,n,i,r)}finally{rG(s),rx.T=a,0===ld&&(lN=sN()+500)}},re.findAllNodes=ip,re.findBoundingRects=function(e,t){if(!r6)throw Error(i(363));t=ip(e,t),e=[];for(var n=0;n<t.length;n++)e.push(r7(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var r=n.x,a=r+n.width,s=n.y,o=s+n.height,l=t-1;0<=l;l--)if(t!==l){var u=e[l],c=u.x,h=c+u.width,d=u.y,p=d+u.height;if(r>=c&&s>=d&&a<=h&&o<=p){e.splice(t,1);break}if(r!==c||n.width!==u.width||p<s||d>o){if(!(s!==d||n.height!==u.height||h<r||c>a)){c>r&&(u.width+=c-r,u.x=r),h<a&&(u.width=a-c),e.splice(t,1);break}}else{d>s&&(u.height+=d-s,u.y=s),p<o&&(u.height=o-d),e.splice(t,1);break}}}return e},re.findHostInstance=i6,re.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=s(e))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(4!==t.tag&&null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:rT(e.stateNode)},re.findHostInstanceWithWarning=function(e){return i6(e)},re.flushPassiveEffects=ik,re.flushSyncFromReconciler=function(e){var t=ld;ld|=1;var n=rx.T,i=rW();try{if(rG(2),rx.T=null,e)return e()}finally{rG(i),rx.T=n,(6&(ld=t))==0&&ea(0,!1)}},re.flushSyncWork=ib,re.focusWithin=function(e,t){if(!r6)throw Error(i(363));for(t=Array.from(t=id(e=iu(e),t)),e=0;e<t.length;){var n=t[e++],r=n.tag;if(!ae(n)){if((5===r||26===r||27===r)&&an(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},re.getFindAllNodesFailureDescription=function(e,t){if(!r6)throw Error(i(363));var n=0,r=[];e=[iu(e),0];for(var a=0;a<e.length;){var s=e[a++],o=s.tag,l=e[a++],u=t[l];if((5!==o&&26!==o&&27!==o||!ae(s))&&(ic(s,u)&&(r.push(ih(u)),++l>n&&(n=l)),l<t.length))for(s=s.child;null!==s;)e.push(s,l),s=s.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(ih(t[n]));return`findAllNodes was able to match part of the selector:
390  `+r.join(" > ")+`
391
392No matching component was found for:
393  `+e.join(" > ")}return null},re.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return rT(e.child.stateNode);default:return e.child.stateNode}},re.injectIntoDevTools=function(){var e={bundleType:0,version:rb,rendererPackageName:rS,currentDispatcherRef:rx,reconcilerVersion:"19.2.0"};if(null!==rM&&(e.rendererConfig=rM),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sk=t.inject(e),sH=t}catch{}e=!!t.checkDCE}}return e},re.isAlreadyRendering=function(){return(6&ld)!=0},re.observeVisibleRects=function(e,t,n,r){if(!r6)throw Error(i(363));var a=ai(e=ip(e,t),n,r).disconnect;return{disconnect:function(){a()}}},re.shouldError=function(){return null},re.shouldSuspend=function(){return!1},re.startHostTransition=function(e,t,r,a){if(5!==e.tag)throw Error(i(476));var s=tG(e).queue;tV(e,s,t,r1,null===r?n:function(){var t=tG(e);return null===t.next&&(t=e.alternate.memoizedState),tK(e,t.next.queue,{},im()),r(a)})},re.updateContainer=function(e,t,n,i){var r=t.current,a=im();return i8(r,a,e,t,n,i),a},re.updateContainerSync=function(e,t,n,i){return i8(t.current,2,e,t,n,i),2},re},hx.exports.default=hx.exports,Object.defineProperty(hx.exports,"__esModule",{value:!0})),hy.exports=hx.exports),(pB=hy.exports)&&pB.__esModule&&Object.prototype.hasOwnProperty.call(pB,"default"))?pB.default:pB,hS={},hM=/^three(?=[A-Z])/,hT=e=>`${e[0].toUpperCase()}${e.slice(1)}`,hw=0;function hE(e){if("function"==typeof e){let t=`${hw++}`;return hS[t]=e,t}Object.assign(hS,e)}function hA(e,t){let n=hT(e),i=hS[n];if("primitive"!==e&&!i)throw Error(`R3F: ${n} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function hC(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?he(e.parent,e):hl(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,ho(e)}}
393function hR(e,t,n){let i=t.root.getState();if(e.parent||e.object===i.scene){if(!t.object){var r,a;let e=hS[hT(t.type)];t.object=null!=(r=t.props.object)?r:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(hs(t.object,t.props),t.props.attach)he(e,t);else if(hl(t.object)&&hl(e.object)){let i=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==i){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n<i?i-1:i,0,t.object)):(t.object.parent=e.object,e.object.children.splice(i,0,t.object),t.object.dispatchEvent({type:"added"}),e.object.dispatchEvent({type:"childadded",child:t.object}))}else e.object.add(t.object)}for(let e of t.children)hR(t,e);ho(t)}}function hP(e,t){if(t){if(t.parent===e){let n=e.children.indexOf(t);-1!==n&&e.children.splice(n,1)}t.parent=e,e.children.push(t),hR(e,t)}}function hI(e,t,n){if(!t||!n)return;if(t.parent===e){let n=e.children.indexOf(t);-1!==n&&e.children.splice(n,1)}t.parent=e;let i=e.children.indexOf(n);-1!==i?e.children.splice(i,0,t):e.children.push(t),hR(e,t,n)}function hL(e){if("function"==typeof e.dispose){let t=()=>{try{e.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?t():(0,cV.unstable_scheduleCallback)(cV.unstable_IdlePriority,t)}}function hN(e,t,n){if(!t)return;t.parent=null;let i=e.children.indexOf(t);-1!==i&&e.children.splice(i,1),t.props.attach?ht(e,t):hl(t.object)&&hl(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,i)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(i)}),n.capturedMap.forEach((e,i)=>{hc(n.capturedMap,t,e,i)})}(cK(t),t.object));let r=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];hN(t,n,r)}t.children.length=0,delete t.object.__r3f,r&&"primitive"!==t.type&&"Scene"!==t.object.type&&hL(t.object),void 0===n&&ho(t)}let hU=[],hD=()=>{},hO={},hF=0,hB=(pz={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var i;return hA(e=hT(e)in hS?e:e.replace(hM,""),t),"primitive"===e&&null!=(i=t.object)&&i.__r3f&&delete t.object.__r3f,c8(t.object,n,e,t)},removeChild:hN,appendChild:hP,appendInitialChild:hP,insertBefore:hI,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&hP(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&hN(n,t)},insertInContainerBefore(e,t,n){let i=e.getState().scene.__r3f;t&&n&&i&&hI(i,t,n)},getRootHostContext:()=>hO,getChildHostContext:()=>hO,commitUpdate(e,t,n,i,r){var a,s,o;hA(t,i);let l=!1;if("primitive"===e.type&&n.object!==i.object||(null==(a=i.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)?l=!0:null!=(o=i.args)&&o.some((e,t)=>{var i;return e!==(null==(i=n.args)?void 0:i[t])})&&(l=!0),l)hU.push([e,c6(i),r]);else{let t=function(e,t){let n={};for(let i in t)if(!hn.includes(i)&&!c4.equ(t[i],e.props[i]))for(let e in n[i]=t[i],t)e.startsWith(`${i}-`)&&(n[e]=t[e]);for(let i in e.props){if(hn.includes(i)||t.hasOwnProperty(i))continue;let{root:r,key:a}=c7(e.object,i);if(r.constructor&&0===r.constructor.length){let e=function(e){let t=hi.get(e.constructor);try{t||(t=new e.constructor,hi.set(e.constructor,t))}catch(e){}return t}(r);c4.und(e)||(n[i]=e[a])}else n[i]=0}return n}(e,i),n=e.props.attach;e.props=c6(i),void 0!==n?e.props.attach=n:delete e.props.attach,Object.keys(t).length&&hs(e.object,t)}},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>c8(e.getState().scene,e,"",{}),resetAfterCommit:function(){if(0!==hU.length)try{!function(){for(let[e]of hU){let t=e.parent;if(t)for(let n of(e.props.attach?ht(t,e):hl(e.object)&&hl(t.object)&&t.object.remove(e.object),e.children))n.props.attach?ht(e,n):hl(n.object)&&hl(e.object)&&e.object.remove(n.object);e.isHidden&&hC(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&hL(e.object)}for(let[i,r,a]of hU){i.props=r;let s=i.parent;if(s){let r=hS[hT(i.type)],o=i.object;i.object=null!=(e=i.props.object)?e:new r(...null!=(t=i.props.args
393)?t:[]),i.object.__r3f=i;var e,t,n=i.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(!function(e,t,n){let{internal:i}=e.getState();for(let e=0;e<i.interaction.length;e++)i.interaction[e]===t&&(i.interaction[e]=n);for(let e=0;e<i.initialHits.length;e++)i.initialHits[e]===t&&(i.initialHits[e]=n);i.hovered.forEach((e,r)=>{if(e.eventObject===t||e.object===t){i.hovered.delete(r);let a={...e,eventObject:e.eventObject===t?n:e.eventObject,object:e.object===t?n:e.object};i.hovered.set(hu(a),a)}}),i.capturedMap.forEach(e=>{let i=e.get(t);i&&(e.delete(t),e.set(n,i))})}(cK(i),o,i.object),hs(i.object,i.props),i.props.attach?he(s,i):hl(i.object)&&hl(s.object)&&s.object.add(i.object),i.children))e.props.attach?he(i,e):hl(e.object)&&hl(i.object)&&i.object.add(e.object);ho(i)}}}()}finally{hU.length=0}},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?ht(e.parent,e):hl(e.object)&&(e.object.visible=!1),e.isHidden=!0,ho(e)}},unhideInstance:hC,createTextInstance:hD,hideTextInstance:hD,unhideTextInstance:hD,supportsMicrotasks:!0,scheduleMicrotask:function(e){"function"==typeof queueMicrotask?queueMicrotask(e):"u">typeof Promise?Promise.resolve().then(e).catch(e=>{setTimeout(()=>{throw e})}):setTimeout(e)},scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:R.createContext(null),setCurrentUpdatePriority(e){hF=e},getCurrentUpdatePriority:()=>hF,resolveUpdatePriority(){var e;if(0!==hF)return hF;let t="u">typeof window?null==(e=window.event)?void 0:e.type:void 0;if(void 0===t)return 32;switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch((0,cV.unstable_getCurrentPriorityLevel)()){case cV.unstable_ImmediatePriority:return 2;case cV.unstable_UserBlockingPriority:return 8;case cV.unstable_NormalPriority:case cV.unstable_LowPriority:return 32;case cV.unstable_IdlePriority:return 0x10000000;default:return 32}default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.7.0",applyViewTransitionName(e,t,n){},restoreViewTransitionName(e,t){},cancelViewTransitionName(e,t,n){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,t)=>!1,hasInstanceAffectedParent:(e,t)=>!1,suspendOnActiveViewTransition(e,t){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(e){},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,t)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw Error("Not implemented.")},removeRootViewTransitionClone(e,t){throw Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,t){},commitNewChildToFragmentInstance(e,t){},deleteChildFromFragmentInstance(e,t){},measureClonedInstance:e=>
393null,maySuspendCommitOnUpdate:(e,t,n)=>!1,maySuspendCommitInSyncRender:(e,t)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,t)=>null},(x=hb(pz)).injectIntoDevTools(),x),hz=new Map,hk={objects:"shallow",strict:!1};function hH({store:e,children:t,onCreated:n,rootElement:i}){return c$(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(i)},[]),(0,C.jsx)(hd.Provider,{value:e,children:t})}function hV(e,t){let n=hz.get(e),i=null==n?void 0:n.fiber;if(i){let r=null==n?void 0:n.store.getState();r&&(r.internal.active=!1),hB.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{null==r.events.disconnect||r.events.disconnect(),null==(n=r.gl)||null==(i=n.renderLists)||null==i.dispose||i.dispose(),null==(a=r.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=r.gl)&&s.xr&&r.xr.disconnect();var n,i,a,s,o=r.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}hz.delete(e),t&&t(e)}catch(e){}},500)})}}let hG=new Set,hW=new Set,hj=new Set;function hX(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function hq(e,t){switch(e){case"before":return hX(hG,t);case"after":return hX(hW,t);case"tail":return hX(hj,t)}}function hY(e,t,n){let i=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(i=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),l=t.internal.subscribers;for(let e=0;e<l.length;e++)(u=l[e]).ref.current(u.store.getState(),i,n);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}let hZ=!1,hK=!1;function hJ(e){for(let n of(h=requestAnimationFrame(hJ),hZ=!0,c=0,hq("before",e),hK=!0,hz.values())
393){var t;(d=n.store.getState()).internal.active&&("always"===d.frameloop||d.internal.frames>0)&&!(null!=(t=d.gl.xr)&&t.isPresenting)&&(c+=hY(e,d))}if(hK=!1,hq("after",e),0===c)return hq("tail",e),hZ=!1,cancelAnimationFrame(h)}function h$(e,t=1){var n;if(!e)return hz.forEach(e=>h$(e.store.getState(),t));(null==(n=e.gl.xr)||!n.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(t>1?e.internal.frames=Math.min(60,e.internal.frames+t):hK?e.internal.frames=2:e.internal.frames=1,hZ||(hZ=!0,requestAnimationFrame(hJ)))}function hQ(e,t=!0,n,i){if(t&&hq("before",e),n)hY(e,n,i);else for(let t of hz.values())hY(e,t.store.getState());t&&hq("after",e)}let h0={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function h1(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let i=e.eventObject.__r3f;if(n.hovered.delete(hu(e)),null!=i&&i.eventCount){let n=i.handlers,r={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(r),null==n.onPointerLeave||n.onPointerLeave(r)}}}function i(e,t){for(let n=0;n<t.length;n++){let i=t[n].__r3f;null==i||null==i.handlers.onPointerMissed||i.handlers.onPointerMissed(e)}}return{handlePointer:function(r){switch(r){case"onPointerLeave":case"onPointerCancel":return()=>n([]);case"onLostPointerCapture":return t=>{let{internal:i}=e.getState();"pointerId"in t&&i.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{i.capturedMap.has(t.pointerId)&&(i.capturedMap.delete(t.pointerId),n([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===r,u="onClick"===r||"onContextMenu"===r||"onDoubleClick"===r,c=function(t,n){let i=e.getState(),r=new Set,a=[],s=n?n(i.internal.interaction):i.internal.interaction;for(let e=0;e<s.length;e++){let t=c3(s[e]);t&&(t.raycaster.camera=void 0)}i.previousRoot||null==i.events.compute||i.events.compute(t,i);let o=s.flatMap(function(e){let n=c3(e);if(!n||!n.events.enabled||null===n.raycaster.camera)return[];if(void 0===n.raycaster.camera){var i;null==n.events.compute||n.events.compute(t,n,null==(i=n.previousRoot)?void 0:i.getState()),void 0===n.raycaster.camera&&(n.raycaster.camera=null)}return n.raycaster.camera?n.raycaster.intersectObject(e,!0):[]}).sort((e,t)=>{let n=c3(e.object),i=c3(t.object);return n&&i&&i.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=hu(e);return!r.has(t)&&(r.add(t),!0)});for(let e of(i.events.filter&&(o=i.events.filter(o,i)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&i.internal.capturedMap.has(t.pointerId))for(let e of i.internal.capturedMap.get(t.pointerId).values())r.has(hu(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),h=u?function(t){let{internal:n}=e.getState(),i=t.offsetX-n.initialClick[0],r=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(i*i+r*r))}(a):0;"onPointerDown"===r&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&h<=2&&(i(a,o.interaction),s&&s(a)),l&&n(c),!function(e,t,i,r){if(e.length){let a={stopped:!1};for(let s of e){let o=c3(s.object);if(o||s.object.traverseAncestors(e=>{let t=c3(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:c,internal:h}=o,d=new e_(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=h.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},f=e=>{let n={intersection:s,target:t.target};h.capturedMap.has(e)?h.capturedMap.get(e).set(s.eventObject,n):h.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},m=e=>{let t=h.capturedMap.get(e);t&&hc(h.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:i,unprojectedPoint:d,ray:l.ray,camera:c,stopPropagation(){let i="pointerId"in t&&h.capturedMap.get(t.pointerId);(!i||i.has(s.eventObject))&&(v.stopped=a.stopped=!0,h.hovered.size&&Array.from(h.hovered.values()).find(e=>e.eventObject===s.eventObject)&&n([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(r(v),!0===a.stopped)break}}}}(c,a,h,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let s=n.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=hu(e),n=o.hovered.get(t);n?n.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let n=s[r];n?(!u||o.initialHits.includes(t))&&(i(a,o.interaction.filter(e=>!o.initialHits.includes(e))),n(e)):u&&o.initialHits.includes(t)&&i(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(h0).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:i}=e.getState();null!=(t=i.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>
393{let{set:n,events:i}=e.getState();if(null==i.disconnect||i.disconnect(),n(e=>({events:{...e.events,connected:t}})),i.handlers)for(let e in i.handlers){let n=i.handlers[e],[r,a]=h0[e];t.addEventListener(r,n,{passive:a})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[i]=h0[e];n.connected.removeEventListener(i,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}function h2(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let n=e.getIndex();if(null===n){let t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}let i=n.count-2,r=[];if(n)if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(r),a.clearGroups(),a}}let h3=parseInt("185".replace(/\D+/g,""));function h4(e){if("u">typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let h5="srgb",h6="srgb-linear";class h8 extends se{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new di(e)}),this.register(function(e){return new dr(e)}),this.register(function(e){return new df(e)}),this.register(function(e){return new dm(e)}),this.register(function(e){return new dg(e)}),this.register(function(e){return new ds(e)}),this.register(function(e){return new dl(e)}),this.register(function(e){return new du(e)}),this.register(function(e){return new dc(e)}),this.register(function(e){return new dn(e)}),this.register(function(e){return new dh(e)}),this.register(function(e){return new da(e)}),this.register(function(e){return new dp(e)}),this.register(function(e){return new dd(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new dv(e)}),this.register(function(e){return new d_(e)})}load(e,t,n,i){let r,a=this;if(""!==this.resourcePath)r=this.resourcePath;else if(""!==this.path){let t=sB.extractUrlBase(e);r=sB.resolveURL(t,this.path)}else r=sB.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new si(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{a.parse(n,r,function(n){t(n),a.manager.itemEnd(e)},s)}catch(e){s(e)}},n,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r,a={},s={};if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(h4(new Uint8Array(e.slice(0,4)))===dy){try{a[h9.KHR_BINARY_GLTF]=new dx(e)}catch(e){i&&i(e);return}r=JSON.parse(a[h9.KHR_BINARY_GLTF].content)}else r=JSON.parse(h4(new Uint8Array(e)));else r=e;if(void 0===r.asset||r.asset.version[0]<2){i&&i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let o=new dk(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](o);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){let t=r.extensionsUsed[e],n=r.extensionsRequired||[];
393switch(t){case h9.KHR_MATERIALS_UNLIT:a[t]=new dt;break;case h9.KHR_DRACO_MESH_COMPRESSION:a[t]=new db(r,this.dracoLoader);break;case h9.KHR_TEXTURE_TRANSFORM:a[t]=new dS;break;case h9.KHR_MESH_QUANTIZATION:a[t]=new dM;break;default:n.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}o.setExtensions(a),o.setPlugins(s),o.parse(n,i)}parseAsync(e,t){let n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function h7(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let h9={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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class de{constructor(e){this.parser=e,this.name=h9.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){let i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){let t,n=this.parser,i="light:"+e,r=n.cache.get(i);if(r)return r;let a=n.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],o=new tp(0xffffff);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],h6);let l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new sI(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new sC(o)).distance=l;break;case"spot":(t=new sE(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),t.decay=2,dO(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=n.createUniqueName(s.name||"light_"+e),r=Promise.resolve(t),n.cache.add(i,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class dt{constructor(){this.name=h9.KHR_MATERIALS_UNLIT}getMaterialType(){return nG}extendParams(e,t,n){let i=[];e.color=new tp(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],h6),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,h5))}return Promise.all(i)}}class dn{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class di{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new eg(e,e)}return Promise.all(r)}}class dr{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class da{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class ds{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[];t.sheenColor=new tp(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],h6)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,h5)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class dl{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class du{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let s=a.attenuationColor||[1,1,1];return t.attenuationColor=new tp().setRGB(s[0],s[1],s[2],h6),Promise.all(r)}}class dc{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class dh{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));let s=a.specularColorFactor||[1,1,1];return t.specularColor=new tp().setRGB(s[0],s[1],s[2],h6),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,h5)),Promise.all(r)}}class dd{constructor(e){this.parser=e,this.name=h9.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class dp{constructor(e){this.parser=e,this.name=h9.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?aL:null}extendMaterialParams(e,t){let n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class df{constructor(e){this.parser=e,this.name=h9.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,r.source,a)}}class dm{constructor(e){this.parser=e,this.name=h9.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],s=i.images[a.source],o=n.textureLoader;if(s.uri){let e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class dg{constructor(e){this.parser=e,this.name=h9.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],s=i.images[a.source],o=n.textureLoader;if(s.uri){let e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
393FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class dv{constructor(e){this.name=h9.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(!n.extensions||!n.extensions[this.name])return null;{let e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return i.then(function(t){let n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){let t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class d_{constructor(e){this.name=h9.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;for(let e of t.meshes[n.mesh].primitives)if(e.mode!==dA.TRIANGLES&&e.mode!==dA.TRIANGLE_STRIP&&e.mode!==dA.TRIANGLE_FAN&&void 0!==e.mode)return null;let i=n.extensions[this.name].attributes,r=[],a={};for(let e in i)r.push(this.parser.getDependency("accessor",i[e]).then(t=>(a[e]=t,a[e])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(let e of n){let t=new eV,n=new e_,s=new ev,o=new e_(1,1,1),l=new i_(e.geometry,e.material,i);for(let e=0;e<i;e++)a.TRANSLATION&&n.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&o.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(n,s,o));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new iu(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);ta.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}let dy="glTF";class dx{constructor(e){this.name=h9.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:h4(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==dy)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,i=new DataView(e,12);let r=0;for(;r<n;){const t=i.getUint32(r,!0);r+=4;const n=i.getUint32(r,!0);if(r+=4,0x4e4f534a===n){const n=new Uint8Array(e,12+r,t);this.content=h4(n)}else if(5130562===n){const n=12+r;this.body=e.slice(n,n+t)}r+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class db{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=h9.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(let e in a)s[dL[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let i=dL[t]||t.toLowerCase();if(void 0!==a[t]){let r=n.accessors[e.attributes[t]],a=dC[r.componentType];l[i]=a.name,o[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],i=o[t];void 0!==i&&(n.normalized=i)}t(e)},s,l,h6,n)})})}}class dS{constructor(){this.name=h9.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class dM{constructor(){this.name=h9.KHR_MESH_QUANTIZATION}}class dT extends aX{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=i-t,c=(n-t)/u,h=c*c,d=h*c,p=e*l,f=p-l,m=-2*d+3*h,g=d-h,v=1-m,_=g-h+c;for(let e=0;e!==s;e++){let t=a[f+e+s],n=a[f+e+o]*u,i=a[p+e+s],l=a[p+e]*u;r[e]=v*t+_*n+m*i+g*l}return r}}let dw=new ev;class dE extends dT{interpolate_(e,t,n,i){let r=super.interpolate_(e,t,n,i);return dw.fromArray(r).normalize().toArray(r),r}}let dA={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},dC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},dR={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},dP={33071:1001,33648:1002,10497:1e3},dI={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},dL={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...h3>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},dN={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},dU={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300};
393function dD(e,t,n){for(let i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function dO(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 dF(e){let t="",n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function dB(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let dz=new eV;class dk{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new h7,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;"u">typeof navigator&&void 0!==navigator.userAgent&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"u"<typeof createImageBitmap||n||i&&r<98?this.textureLoader=new sc(this.options.manager):this.textureLoader=new sq(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new si(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){let a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return dD(r,a,i),dO(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){let i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){let i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let i=n.clone(),r=(e,t)=>{let n=this.associations.get(e);for(let[i,a]of(null!=n&&this.associations.set(t,n),e.children.entries()))r(a,t.children[i])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let i=e(t[n]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let i=0;i<t.length;i++){let r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){let n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(!(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");
393if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[h9.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(e,r){n.load(sB.resolveURL(t.uri,i.path),e,void 0,function(){r(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){let t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){let e=dI[i.type],t=dC[i.componentType],n=!0===i.normalized;return Promise.resolve(new t0(new t(i.count*e),e,n))}let r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){let r,a=e[0],s=dI[i.type],o=dC[i.componentType],l=o.BYTES_PER_ELEMENT,u=l*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;if(h&&h!==u){let e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count,u=t.cache.get(n);u||(u=new nd(new o(a,e*h,i.count*h/l),h/l),t.cache.add(n,u)),r=new nf(u,s,c%h/l,d)}else r=new t0(null===a?new o(i.count*s):new o(a,c,i.count*s),s,d);if(void 0!==i.sparse){let t=dI.SCALAR,n=dC[i.sparse.indices.componentType],l=i.sparse.indices.byteOffset||0,u=i.sparse.values.byteOffset||0,c=new n(e[1],l,i.sparse.count*t),h=new o(e[2],u,i.sparse.count*s);null!==a&&(r=new t0(r.array.slice(),r.itemSize,r.normalized));for(let e=0,t=c.length;e<t;e++){let t=c[e];if(r.setX(t,h[e*s]),s>=2&&r.setY(t,h[e*s+1]),s>=3&&r.setZ(t,h[e*s+2]),s>=4&&r.setW(t,h[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})}loadTexture(e){let t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i],a=this.textureLoader;if(r.uri){let e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){let i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let n=(r.samplers||{})[a.sampler]||{};return t.magFilter=dR[n.magFilter]||1006,t.minFilter=dR[n.minFilter]||1008,t.wrapS=dP[n.wrapS]||1e3,t.wrapT=dP[n.wrapT]||1e3,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let r=n.images[e],a=self.URL||self.webkitURL,s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t)});else if(void 0===r.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){let t=new eU(e);t.needsUpdate=!0,n(t)}),t.load(sB.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),dO(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){let r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[h9.KHR_TEXTURE_TRANSFORM]){let e=void 0!==n.extensions?n.extensions[h9.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=r.associations.get(a);a=r.extensions[h9.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&("number"==typeof i&&(i=3001===i?h5:h6),"colorSpace"in a?a.colorSpace
393=i:a.encoding=i===h5?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new i6,ng.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e="LineBasicMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new iX,ng.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return aI}loadMaterial(e){let t,n=this,i=this.json,r=this.extensions,a=i.materials[e],s={},o=a.extensions||{},l=[];if(o[h9.KHR_MATERIALS_UNLIT]){let e=r[h9.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,n))}else{let i=a.pbrMetallicRoughness||{};if(s.color=new tp(1,1,1),s.opacity=1,Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],h6),s.opacity=e[3]}void 0!==i.baseColorTexture&&l.push(n.assignTexture(s,"map",i.baseColorTexture,h5)),s.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,s.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",i.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",i.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===u&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==nG&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new eg(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==nG&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==nG){let e=a.emissiveFactor;s.emissive=new tp().setRGB(e[0],e[1],e[2],h6)}return void 0!==a.emissiveTexture&&t!==nG&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture,h5)),Promise.all(l).then(function(){let i=new t(s);return a.name&&(i.name=a.name),dO(i,a),n.associations.set(i,{materials:e}),a.extensions&&dD(r,i,a),i})}createUniqueName(e){let t=of.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,i=this.primitiveCache,r=[];for(let a=0,s=e.length;a<s;a++){let s=e[a],o=function(e){let t,n=e.extensions&&e.extensions[h9.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+dF(n.attributes):e.indices+":"+dF(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+dF(e.targets[n]);return t}(s),l=i[o];if(l)r.push(l.promise);else{let e;e=s.extensions&&s.extensions[h9.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[h9.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return dH(n,e,t)})}(s):dH(new nh,s,t),i[o]={primitive:s,promise:e},r.push(e)}}return Promise.all(r)}loadMesh(e){let t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var o;let t=void 0===a[e].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new aI({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),o.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(n){let s=n.slice(0,n.length-1),o=n[n.length-1],l=[];for(let n=0,u=o.length;n<u;n++){let u,c=o[n],h=a[n],d=s[n];if(h.mode===dA.TRIANGLES||h.mode===dA.TRIANGLE_STRIP||h.mode===dA.TRIANGLE_FAN||void 0===h.mode)!0===(u=!0===r.isSkinnedMesh?new ii(c,d):new n1(c,d)).isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===dA.TRIANGLE_STRIP?u.geometry=h2(u.geometry,1):h.mode===dA.TRIANGLE_FAN&&(u.geometry=h2(u.geometry,2));else if(h.mode===dA.LINES)u=new i4(c,d);else if(h.mode===dA.LINE_STRIP)u=new i0(c,d);else if(h.mode===dA.LINE_LOOP)u=new i5(c,d);else if(h.mode===dA.POINTS)u=new rt(c,d);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);Object.keys(u.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(u,r),u.name=t.createUniqueName(r.name||"mesh_"+e),dO(u,r),h.extensions&&dD(i,u,h),t.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&dD(i,l[0],r),l[0];let u=new ts;r.extensions&&dD(i,u,r),t.associations.set(u,{meshes:e});for(let e=0,t=l.length;e<t;e++)u.add(l[e]);return u})}loadCamera(e){let t,n=this.json.cameras[e],i=n[n.type];return i?("perspective"===n.type?t=new sT(em.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new sR(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),dO(t,n),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){let n=e.pop(),i=[],r=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){i.push(s);let e=new eV;null!==n&&e.fromArray(n.array,16*a),r.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new il(i,r)})}loadAnimation(e){let t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],s=[],o=[],l=[],u=[];for(let e=0,t=i.channels.length;e<t;
393e++){let t=i.channels[e],n=i.samplers[t.sampler],r=t.target,c=r.node,h=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",c)),s.push(this.getDependency("accessor",h)),o.push(this.getDependency("accessor",d)),l.push(n),u.push(r))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(u)]).then(function(e){let t=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],u=i[e],c=a[e],h=s[e],d=o[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,u,c,h,d);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new a5(r,void 0,l)})}createNodeMesh(e){let t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],n=this._loadNodeShallow(e),i=[],r=t.children||[];for(let e=0,t=r.length;e<t;e++)i.push(this.getDependency("node",r[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([n,Promise.all(i),a]).then(function(e){let t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,dz)});for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",s=[],o=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==r.camera&&s.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===r.isBone?new ir:t.length>1?new ts:1===t.length?t[0]:new ta)!==t[0])for(let e=0,n=t.length;e<n;e++)s.add(t[e]);if(r.name&&(s.userData.name=r.name,s.name=a),dO(s,r),r.extensions&&dD(n,s,r),void 0!==r.matrix){let e=new eV;e.fromArray(r.matrix),s.applyMatrix4(e)}else void 0!==r.translation&&s.position.fromArray(r.translation),void 0!==r.rotation&&s.quaternion.fromArray(r.rotation),void 0!==r.scale&&s.scale.fromArray(r.scale);return i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],i=this,r=new ts;n.name&&(r.name=i.createUniqueName(n.name)),dO(r,n),n.extensions&&dD(t,r,n);let a=n.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(i.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{let t=new Map;for(let[e,n]of i.associations)(e instanceof ng||e instanceof eU)&&t.set(e,n);return e.traverse(e=>{let n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r})}_createAnimationTracks(e,t,n,i,r){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(dN[r.path]===dN.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),dN[r.path]){case dN.weights:a=a0;break;case dN.rotation:a=a2;break;case dN.position:case dN.scale:a=a4;break;default:a=1===n.itemSize?a0:a4}let u=void 0!==i.interpolation?dU[i.interpolation]:2301,c=this._getArrayFromAccessor(n);for(let e=0,n=l.length;e<n;e++){let n=new a(l[e]+"."+dN[r.path],t.array,c,u);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=dB(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof a2?dE:dT)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function dH(e,t,n){let i=t.attributes,r=[];for(let t in i){let a=dL[t]||t.toLowerCase();a in e.attributes||r.push(function(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}(i[t],a))}if(void 0!==t.indices&&!e.index){let i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return dO(e,t),!function(e,t,n){let i=t.attributes,r=new tL;if(void 0===i.POSITION)return;{let e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new e_(t[0],t[1],t[2]),new e_(a[0],a[1],a[2])),e.normalized){let t=dB(dC[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new e_,t=new e_;for(let i=0,r=a.length;i<r;i++){let r=a[i];if(void 0!==r.POSITION){let i=n.json.accessors[r.POSITION],a=i.min,s=i.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),i.normalized){let e=dB(dC[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;let s=new ni;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=s}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);let s=[],o=[],l=[];for(let u=0,c=t.length;u<c;u++){let c=t[u];
393if(i){let t=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;s.push(t)}if(r){let t=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(a){let t=void 0!==c.COLOR_0?n.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){let n=t[0],s=t[1],o=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}var dV=n(61300),dG=n(9897);function dW(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let dj=class extends aL{get progress(){return this.uniforms.uProgress.value}set progress(e){this.uniforms.uProgress.value=e}get time(){return this.uniforms.uTime.value}set time(e){this.uniforms.uTime.value=e}onBeforeCompile(e){function t(e){return"string"!=typeof e?e.join("\n"):e}e.uniforms.uTime=this.uniforms.uTime,e.uniforms.uProgress=this.uniforms.uProgress;let{shader_part:n="color = diffuse;",dependencies:i=""}=this.data.fragment||{},r=`vec4 getDiffuse( ) { vec3 color; ${t(n)} return vec4( color, opacity ); }`;e.fragmentShader=e.fragmentShader.replace("void main() {",`uniform float uProgress;
394 uniform float uTime;
395 ${t(i)}
396
397${r}
398
399 void main() {`),e.fragmentShader=e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );","vec4 diffuseColor = getDiffuse();")}constructor(e,t){super({...e.props,...t}),dW(this,"data",void 0),dW(this,"uniforms",{uTime:{value:0},uProgress:{value:0}}),e.defines&&(this.defines={...this.defines,...e.defines}),this.data=e}};var dX=(b=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),S=new Float32Array([0,0,2,0,0,2]),(M=new nh).setAttribute("position",new t0(b,3)),M.setAttribute("uv",new t0(S,2)),M),dq=class e{static get fullscreenGeometry(){return dX}constructor(e="Pass",t=new tv,n=new sR){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthBlit=!1,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let n=this.screen;null!==n?n.material=t:((n=new n1(e.fullscreenGeometry,t)).frustumCulled=!1,null===this.scene&&(this.scene=new tv),this.scene.add(n),this.screen=n)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=3200){}render(e,t,n,i,r){throw Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(let t of Object.keys(this)){let n=this[t];(n instanceof eF||n instanceof ng||n instanceof eU||n instanceof e)&&this[t].dispose()}null!==this.fullscreenMaterial&&this.fullscreenMaterial.dispose()}},dY=class extends dq{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,i,r){let a=e.state.buffers.stencil;a.setLocked(!1),a.setTest(!1)}},dZ=`#ifdef COLOR_WRITE
400#include <common>
401#include <dithering_pars_fragment>
402#ifdef FRAMEBUFFER_PRECISION_HIGH
403uniform mediump sampler2D inputBuffer;
404#else
405uniform lowp sampler2D inputBuffer;
406#endif
407#endif
408#ifdef DEPTH_WRITE
409#include <packing>
410#ifdef GL_FRAGMENT_PRECISION_HIGH
411uniform highp sampler2D depthBuffer;
412#else
413uniform mediump sampler2D depthBuffer;
414#endif
415float readDepth(const in vec2 uv){
416#if DEPTH_PACKING == 3201
417return unpackRGBAToDepth(texture2D(depthBuffer,uv));
418#else
419return texture2D(depthBuffer,uv).r;
420#endif
421}
422#endif
423#ifdef USE_WEIGHTS
424uniform vec4 channelWeights;
425#endif
426uniform float opacity;varying vec2 vUv;void main(){
427#ifdef COLOR_WRITE
428vec4 texel=texture2D(inputBuffer,vUv);
429#ifdef USE_WEIGHTS
430texel*=channelWeights;
431#endif
432gl_FragColor=opacity*texel;
433#ifdef COLOR_SPACE_CONVERSION
434#include <colorspace_fragment>
435#endif
436#include <dithering_fragment>
437#else
438gl_FragColor=vec4(0.0);
439#endif
440#ifdef DEPTH_WRITE
441gl_FragDepth=readDepth(vUv);
442#endif
443}`,dK="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",dJ=class extends aR{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new ox(null),depthBuffer:new ox(null),channelWeights:new ox(null),opacity:new ox(1)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:dZ,vertexShader:dK}),this.depthFunc=1}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(e){let t=null!==e;this.colorWrite!==t&&(t?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=t,this.needsUpdate=!0),this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){let t=null!==e;this.depthWrite!==t&&(t?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=t,this.depthWrite=t,this.needsUpdate=!0),this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return void 0!==this.defines.COLOR_SPACE_CONVERSION}set colorSpaceConversion(e){this.colorSpaceConversion!==e&&(e?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(e){null!==e?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=e):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},d$=class extends dq{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new dJ,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new eF(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,1009!==n?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":null!==e&&"srgb"===e.outputColorSpace&&(this.renderTarget.texture.colorSpace
443="srgb"))}},dQ=new tp,d0=class extends dq{constructor(e=!0,t=!0,n=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,i,r){let a=this.overrideClearColor,s=this.overrideClearAlpha,o=e.getClearAlpha(),l=null!==a,u=s>=0;l?(e.getClearColor(dQ),e.setClearColor(a,u?s:o)):u&&e.setClearAlpha(s),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(dQ,o):u&&e.setClearAlpha(o)}},d1=class extends dq{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new d0(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,i,r){let a=e.getContext(),s=e.state.buffers,o=this.scene,l=this.camera,u=this.clearPass,c=+!this.inverted;s.color.setMask(!1),s.depth.setMask(!1),s.color.setLocked(!0),s.depth.setLocked(!0),s.stencil.setTest(!0),s.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.stencil.setFunc(a.ALWAYS,c,0xffffffff),s.stencil.setClear(1-c),s.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?u.render(e,null):(u.render(e,t),u.render(e,n))),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.render(o,l),e.setRenderTarget(n)),e.render(o,l),s.color.setLocked(!1),s.depth.setLocked(!1),s.stencil.setLocked(!1),s.stencil.setFunc(a.EQUAL,1,0xffffffff),s.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),s.stencil.setLocked(!0)}},d2=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"u">typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return .001*this._delta}get fixedDelta(){return .001*this._fixedDelta}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return .001*this._elapsed}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==e?e:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(e){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},d3=class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:i=0,frameBufferType:r}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,r,i),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new d$,this.depthTexture=null,this.depthRenderTarget=null,this.passes=[],this.timer=new d2,this.autoRenderToScreen=!0,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples}set multisampling(e){let t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e),this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new eg),n=e.getContext().getContextAttributes().alpha,i=this.inputBuffer.texture.type;for(let r of(1009===i&&"srgb"===e.outputColorSpace&&(this.inputBuffer.texture.colorSpace
443="srgb",this.outputBuffer.texture.colorSpace="srgb",this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height),this.passes))r.initialize(e,n,i)}}replaceRenderer(e,t=!0){let n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}createDepthTexture(){let e=this.inputBuffer,t=new rd;this.depthTexture=t,e.stencilBuffer?(t.format=1027,t.type=1020):t.type=1015;let n=t.clone();return n.name="EffectComposer.StableDepth",this.depthRenderTarget=new eF(e.width,e.height,{depthBuffer:!0,stencilBuffer:e.stencilBuffer,depthTexture:n}),n}blitDepthBuffer(e){let t=this.renderer,n=this.depthRenderTarget,i=t.properties,r=t.getContext();t.setRenderTarget(n);let a=i.get(e).__webglFramebuffer,s=i.get(n).__webglFramebuffer,o=e.stencilBuffer?r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT:r.DEPTH_BUFFER_BIT;r.bindFramebuffer(r.READ_FRAMEBUFFER,a),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,s),r.blitFramebuffer(0,0,e.width,e.height,0,0,n.width,n.height,o,r.NEAREST),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),t.setRenderTarget(null)}deleteDepthTexture(){if(null!==this.depthTexture)for(let e of(this.depthTexture.dispose(),this.depthTexture=null,this.depthRenderTarget.dispose(),this.depthRenderTarget=null,this.inputBuffer.depthTexture=null,this.outputBuffer.depthTexture=null,this.passes))e.setDepthTexture(null)}createBuffer(e,t,n,i){let r=this.renderer,a=null===r?new eg:r.getDrawingBufferSize(new eg),s=new eF(a.width,a.height,{minFilter:1006,magFilter:1006,stencilBuffer:t,depthBuffer:e,type:n});return i>0&&(s.samples=i),1009===n&&null!==r&&"srgb"===r.outputColorSpace&&(s.texture.colorSpace="srgb"),s.texture.name="EffectComposer.Buffer",s.texture.generateMipmaps=!1,s}setMainScene(e){for(let t of this.passes)t.mainScene=e}setMainCamera(e){for(let t of this.passes)t.mainCamera=e}addPass(e,t){let n=this.passes,i=this.renderer,r=i.getDrawingBufferSize(new eg),a=i.getContext().getContextAttributes().alpha,s=this.inputBuffer.texture.type;if(e.renderer=i,e.setSize(r.width,r.height),e.initialize(i,a,s),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){let t=this.createDepthTexture();for(e of n)e.setDepthTexture(t)}else{let t=this.depthRenderTarget.depthTexture;e.setDepthTexture(t)}}removePass(e){let t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture&&!t.reduce((e,t)=>e||t.needsDepthTexture,!1)){let t=this.depthRenderTarget.depthTexture;e.getDepthTexture()===t&&e.setDepthTexture(null),this.deleteDepthTexture()}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){let e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t,n=this.renderer,i=this.copyPass,r=this.inputBuffer,a=this.outputBuffer,s=!1;
443for(let o of(void 0===e&&(this.timer.update(),e=this.timer.getDelta()),this.passes))if(o.enabled){if(r.depthTexture=this.depthTexture,a.depthTexture=null,o.render(n,r,a,e,s),o.needsDepthBlit&&null!==this.depthRenderTarget&&this.blitDepthBuffer(r),o.needsSwap){if(s){i.renderToScreen=o.renderToScreen;let t=n.getContext(),l=n.state.buffers.stencil;l.setFunc(t.NOTEQUAL,1,0xffffffff),i.render(n,r,a,e,s),l.setFunc(t.EQUAL,1,0xffffffff)}t=r,r=a,a=t}o instanceof d1?s=!0:o instanceof dY&&(s=!1)}}setSize(e,t,n){let i=this.renderer,r=i.getSize(new eg);(void 0===e||void 0===t)&&(e=r.width,t=r.height),(r.width!==e||r.height!==t)&&i.setSize(e,t,n);let a=i.getDrawingBufferSize(new eg);for(let e of(this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height),null!==this.depthRenderTarget&&this.depthRenderTarget.setSize(a.width,a.height),this.passes))e.setSize(a.width,a.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(let e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),dq.fullscreenGeometry.dispose()}},d4={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},d5=class{constructor(){this.shaderParts=new Map([[d4.FRAGMENT_HEAD,null],[d4.FRAGMENT_MAIN_UV,null],[d4.FRAGMENT_MAIN_IMAGE,null],[d4.VERTEX_HEAD,null],[d4.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=0,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=O}},d6=!1,d8=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case 2:t=this.materialsFlatShadedDoubleSide;break;case 1:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case 2:t=this.materialsDoubleSide;break;case 1:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof aR))return e.clone();let t=e.uniforms,n=new Map;for(let e in t){let i=t[e].value;i.isRenderTargetTexture&&(t[e].value=null,n.set(e,i))}let i=e.clone();for(let e of n)t[e[0]].value=e[1],i.uniforms[e[0]].value=e[1];return i}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(let n of t)n.uniforms=Object.assign({},e.uniforms),n.side=0;t[2].skinning=!0,this.materialsBackSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=1,n}),this.materialsDoubleSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=2,n}),this.materialsFlatShaded=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n}),this.materialsFlatShadedBackSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=1,n}),this.materialsFlatShadedDoubleSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=2,n})}}render(e,t,n){let i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,d6){let i=this.originalMaterials;for(let r of(this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n),i))r[0].material=r[1];this.meshCount!==i.size&&i.clear()}else{let i=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=i}e.shadowMap.enabled=i}disposeMaterials(){if(null!==this.material)for(let e of this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide))e.dispose()}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return d6}static set workaroundEnabled(e){d6=e}},d7=class extends er{constructor(e=null,t=-1,n=-1,i=1){super(),null!==e&&this.addEventListener("change",()=>e.setSize(this.baseSize.width,this.baseSize.height)),this.baseSize=new eg(1,1),this.preferredSize=new eg(t,n),this.target=this.preferredSize,this.s=i,this.effectiveSize=new eg,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){let e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,i=this.scale;-1!==t.width?n.width=t.width:-1!==t.height?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*i),-1!==t.height?n.height=t.height:-1!==t.width?n.height=Math.round(t.width/
443Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(-1),this.dispatchEvent({type:"change"}))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.baseSize.width!==e||this.baseSize.height!==t)&&(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferredSize.width!==e||this.preferredSize.height!==t)&&(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"})}static get AUTO_SIZE(){return -1}},d9=new Map([[0,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[1,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}"],[2,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[3,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[4,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[5,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[6,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[7,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[8,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[9,null],[10,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[11,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[12,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[13,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[14,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[15,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[16,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[17,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[18,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[19,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[20,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[21,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[22,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[23,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}"],[24,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[25,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[26,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[27,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[28,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[29,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[30,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}"],[31,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[32,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"]]),pe=class extends er{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new ox(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return d9.get(this.blendFunction)}},pt=class extends er{constructor(e,t,{attributes:n=0,blendFunction:i=23,defines:r=new Map,uniforms:a=new Map,extensions:s=null,vertexShader:o=null}={}){super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=o,this.defines=r,this.uniforms=a,this.extensions=s,this.blendMode=new pe(i),this.blendMode.addEventListener("change",e=>
443this.setChanged()),this._inputColorSpace=O,this._outputColorSpace=""}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=3200){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(let e of Object.keys(this)){let t=this[e];(t instanceof eF||t instanceof ng||t instanceof eU||t instanceof dq)&&this[e].dispose()}}},pn=`#ifdef FRAMEBUFFER_PRECISION_HIGH
444uniform mediump sampler2D inputBuffer;
445#else
446uniform lowp sampler2D inputBuffer;
447#endif
448varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;
449#include <colorspace_fragment>
450}`,pi=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],pr=class extends aR{constructor(e=new eD){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ox(null),texelSize:new ox(new eD),scale:new ox(1),kernel:new ox(0)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:pn,vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.setTexelSize(e.x,e.y),this.kernelSize=2}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return pi[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){let n=1/e,i=1/t;this.uniforms.texelSize.value.set(n,i,.5*n,.5*i)}},pa=class extends dq{constructor({kernelSize:e=2,resolutionScale:t=.5,width:n=d7.AUTO_SIZE,height:i=d7.AUTO_SIZE,resolutionX:r=n,resolutionY:a=i}={}){super("KawaseBlurPass"),this.renderTargetA=new eF(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const s=this.resolution=new d7(this,r,a,t);s.addEventListener("change",e=>this.setSize(s.baseWidth,s.baseHeight)),this._blurMaterial=new pr,this._blurMaterial.kernelSize=e,this.copyMaterial=new dJ}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){let a=this.scene,s=this.camera,o=this.renderTargetA,l=this.renderTargetB,u=this.blurMaterial,c=u.kernelSequence,h=t;this.fullscreenMaterial=u;for(let t=0,n=c.length;t<n;++t){let n=(1&t)==0?o:l;u.kernel=c[t],u.inputBuffer=h.texture,e.setRenderTarget(n),e.render(a,s),h=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=h.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(a,s)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t);let i=n.width,r=n.height;this.renderTargetA.setSize(i,r),this.renderTargetB.setSize(i,r),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,1009!==n?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):null!==e&&"srgb"===e.outputColorSpace&&(this.renderTargetA.texture.colorSpace
450="srgb",this.renderTargetB.texture.colorSpace="srgb"))}static get AUTO_SIZE(){return d7.AUTO_SIZE}},ps=`#include <common>
451#ifdef FRAMEBUFFER_PRECISION_HIGH
452uniform mediump sampler2D inputBuffer;
453#else
454uniform lowp sampler2D inputBuffer;
455#endif
456#ifdef RANGE
457uniform vec2 range;
458#elif defined(THRESHOLD)
459uniform float threshold;uniform float smoothing;
460#endif
461varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0;
462#ifdef RANGE
463float low=step(range.x,l);float high=step(l,range.y);mask=low*high;
464#elif defined(THRESHOLD)
465mask=smoothstep(threshold,threshold+smoothing,l);
466#endif
467#ifdef COLOR
468gl_FragColor=texel*mask;
469#else
470gl_FragColor=vec4(l*mask);
471#endif
472}`,po=class extends aR{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:"185".replace(/\D+/g,"")},uniforms:{inputBuffer:new ox(null),threshold:new ox(0),smoothing:new ox(1),range:new ox(null)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:ps,vertexShader:dK}),this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},pl=class extends dq{constructor({renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:i=1,width:r=d7.AUTO_SIZE,height:a=d7.AUTO_SIZE,resolutionX:s=r,resolutionY:o=a}={}){super("LuminancePass"),this.fullscreenMaterial=new po(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new eF(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const l=this.resolution=new d7(this,s,o,i);l.addEventListener("change",e=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&1009!==n&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},pu=`#ifdef FRAMEBUFFER_PRECISION_HIGH
473uniform mediump sampler2D inputBuffer;
474#else
475uniform lowp sampler2D inputBuffer;
476#endif
477#define WEIGHT_INNER 0.125
478#define WEIGHT_OUTER 0.05556
479varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;
480#include <colorspace_fragment>
481}`,pc=class extends aR{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new ox(null),texelSize:new ox(new eg)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:pu,vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;
481vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},ph=`#ifdef FRAMEBUFFER_PRECISION_HIGH
482uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;
483#else
484uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;
485#endif
486uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);
487#include <colorspace_fragment>
488}`,pd=class extends aR{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new ox(null),supportBuffer:new ox(null),texelSize:new ox(new eg),radius:new ox(.85)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:ph,vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},pp=class extends dq{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new eF(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new pc,this.upsamplingMaterial=new pd,this.resolution=new eg}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){let t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){let e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,i=e-1;n<i;++n){let e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,i,r){let{scene:a,camera:s}=this,{downsamplingMaterial:o,upsamplingMaterial:l}=this,{downsamplingMipmaps:u,upsamplingMipmaps:c}=this,h=t;this.fullscreenMaterial=o;for(let t=0,n=u.length;t<n;++t){let n=u[t];o.setSize(h.width,h.height),o.inputBuffer=h.texture,e.setRenderTarget(n),e.render(a,s),h=n}this.fullscreenMaterial=l;for(let t=c.length-1;t>=0;--t){let n=c[t];l.setSize(h.width,h.height),l.inputBuffer=h.texture,l.supportBuffer=u[t].texture,e.setRenderTarget(n),e.render(a,s),h=n}}setSize(e,t){let n=this.resolution;n.set(e,t);let i=n.width,r=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)i=Math.round(.5*i),r=Math.round(.5*r),this.downsamplingMipmaps[e].setSize(i,r),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(i,r)}initialize(e,t,n){if(void 0!==n){let t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(let e of t)e.texture.type=n;if(1009!==n)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(null!==e&&"srgb"===e.outputColorSpace)for(let e of t)e.texture.colorSpace
488="srgb"}}dispose(){for(let e of(super.dispose(),this.downsamplingMipmaps.concat(this.upsamplingMipmaps)))e.dispose()}},pf=`#ifdef FRAMEBUFFER_PRECISION_HIGH
489uniform mediump sampler2D map;
490#else
491uniform lowp sampler2D map;
492#endif
493uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}`,pm=class extends pt{constructor({blendFunction:e=28,luminanceThreshold:t=1,luminanceSmoothing:n=.03,mipmapBlur:i=!0,intensity:r=1,radius:a=.85,levels:s=8,kernelSize:o=3,resolutionScale:l=.5,width:u=d7.AUTO_SIZE,height:c=d7.AUTO_SIZE,resolutionX:h=u,resolutionY:d=c}={}){super("BloomEffect",pf,{blendFunction:e,uniforms:new Map([["map",new ox(null)],["intensity",new ox(r)]])}),this.renderTarget=new eF(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new pa({kernelSize:o}),this.luminancePass=new pl({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new pp,this.mipmapBlurPass.enabled=i,this.mipmapBlurPass.radius=a,this.mipmapBlurPass.levels=s,this.uniforms.get("map").value=i?this.mipmapBlurPass.texture:this.renderTarget.texture;const p=this.resolution=new d7(this,h,d,l);p.addEventListener("change",e=>this.setSize(p.baseWidth,p.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){let i=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,r.renderTarget):this.blurPass.render(e,r.renderTarget,i)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,i)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,null!==e&&"srgb"===e.outputColorSpace&&(this.renderTarget.texture.colorSpace="srgb"))}},pg=class extends dq{constructor(e,t,n=null){super("RenderPass",e,t),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new d0,this.overrideMaterialManager=null===n?null:new d8(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new d8(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}
493isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,i,r){let a=this.scene,s=this.camera,o=this.selection,l=s.layers.mask,u=a.background,c=e.shadowMap.autoUpdate,h=this.renderToScreen?null:t;null!==o&&s.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(a.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(h),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,a,s):e.render(a,s),s.layers.mask=l,a.background=u,e.shadowMap.autoUpdate=c}},pv=class extends pt{constructor({blendFunction:e=30,hue:t=0,saturation:n=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["hue",new ox(new e_)],["saturation",new ox(n)]])}),this.hue=t}get saturation(){return this.uniforms.get("saturation").value}set saturation(e){this.uniforms.get("saturation").value=e}getSaturation(){return this.saturation}setSaturation(e){this.saturation=e}get hue(){return Math.acos((3*this.uniforms.get("hue").value.x-1)/2)}set hue(e){let t=Math.sin(e),n=Math.cos(e);this.uniforms.get("hue").value.set((2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3)}getHue(){return this.hue}setHue(e){this.hue=e}},p_=`#include <packing>
494#ifdef GL_FRAGMENT_PRECISION_HIGH
495uniform highp sampler2D depthBuffer;
496#else
497uniform mediump sampler2D depthBuffer;
498#endif
499#ifdef DOWNSAMPLE_NORMALS
500uniform lowp sampler2D normalBuffer;
501#endif
502varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){
503#if DEPTH_PACKING == 3201
504return unpackRGBAToDepth(texture2D(depthBuffer,uv));
505#else
506return texture2D(depthBuffer,uv).r;
507#endif
508}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[4];d[0]=readDepth(vUv0);d[1]=readDepth(vUv1);d[2]=readDepth(vUv2);d[3]=readDepth(vUv3);int index=findBestDepth(d);
509#ifdef DOWNSAMPLE_NORMALS
510vec3 n[4];n[0]=texture2D(normalBuffer,vUv0).rgb;n[1]=texture2D(normalBuffer,vUv1).rgb;n[2]=texture2D(normalBuffer,vUv2).rgb;n[3]=texture2D(normalBuffer,vUv3).rgb;
511#else
512vec3 n[4];n[0]=vec3(0.0);n[1]=vec3(0.0);n[2]=vec3(0.0);n[3]=vec3(0.0);
513#endif
514gl_FragColor=vec4(n[index],d[index]);}`,py=class extends aR{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new ox(null),normalBuffer:new ox(null),texelSize:new ox(new eg)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:p_,vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"})}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=3200){this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},px=class extends dq{constructor({normalBuffer:e=null,resolutionScale:t=.5,width:n=d7.AUTO_SIZE,height:i=d7.AUTO_SIZE,resolutionX:r=n,resolutionY:a=i}={}){super("DepthDownsamplingPass");const s=new py;s.normalBuffer=e,this.fullscreenMaterial=s,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new eF(1,1,{minFilter:1003,magFilter:1003,depthBuffer:!1,type:1015}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const o=this.resolution=new d7(this,r,a,t);o.addEventListener("change",e=>this.setSize(o.baseWidth,o.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}
514setDepthTexture(e,t=3200){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,i,r){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){let i=e.getContext();if(!(i.getExtension("EXT_color_buffer_float")||i.getExtension("EXT_color_buffer_half_float")))throw Error("Rendering to float texture is not supported.")}},pb=`#include <common>
515#include <packing>
516#include <dithering_pars_fragment>
517#define packFloatToRGBA(v) packDepthToRGBA(v)
518#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
519#ifdef FRAMEBUFFER_PRECISION_HIGH
520uniform mediump sampler2D inputBuffer;
521#else
522uniform lowp sampler2D inputBuffer;
523#endif
524#if DEPTH_PACKING == 3201
525uniform lowp sampler2D depthBuffer;
526#elif defined(GL_FRAGMENT_PRECISION_HIGH)
527uniform highp sampler2D depthBuffer;
528#else
529uniform mediump sampler2D depthBuffer;
530#endif
531uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return 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);}float readDepth(const in vec2 uv){
532#if DEPTH_PACKING == 3201
533float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));
534#else
535float depth=texture2D(depthBuffer,uv).r;
536#endif
537#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)
538float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;
539#elif defined(USE_REVERSED_DEPTH_BUFFER)
540depth=1.0-depth;
541#endif
542return depth;}float getViewZ(const in float depth){
543#ifdef PERSPECTIVE_CAMERA
544return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
545#else
546return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
547#endif
548}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;
549#ifdef ENCODE_OUTPUT
550#include <colorspace_fragment>
551#endif
552#include <dithering_fragment>
553}`,pS=class extends aR{constructor(e,t,n,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:"185".replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ox(null),depthBuffer:new ox(null),resolution:new ox(new eg),texelSize:new ox(new eg),cameraNear:new ox(.3),cameraFar:new ox(1e3),aspect:new ox(1),time:new ox(0)},blending:0,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=3200){this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader=pb.replace(d4.FRAGMENT_HEAD,e.get(d4.FRAGMENT_HEAD)||"").replace(d4.FRAGMENT_MAIN_UV,e.get(d4.FRAGMENT_MAIN_UV)||"").replace(d4.FRAGMENT_MAIN_IMAGE,e.get(d4.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(d4.VERTEX_HEAD,e.get(d4.VERTEX_HEAD)||"").replace(d4.VERTEX_MAIN_SUPPORT,e.get(d4.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){for(let t of(this.extensions={},e))this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof sT?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return d4}};"185".replace(/\D+/g,"");var pM=255/256;function pT(e,t,n){for(let i of t){let t="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),r=RegExp("([^\\.])(\\b"+i+"\\b)","g");for(let e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(r,t))}}
553new Float32Array([255/256/0x1000000,255/256/65536,255/256/256,255/256]),new Float32Array([pM,pM/256,pM/65536,1/0x1000000]);var pw=class extends dq{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new pS(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[],this.setEffects(t),this.skipRendering=!1,this.minTime=1,this.maxTime=1/0,this.timeScale=1}set mainScene(e){for(let t of this.effects)t.mainScene=e}set mainCamera(e){for(let t of(this.fullscreenMaterial.copyCameraSettings(e),this.effects))t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(let e of this.effects)e.removeEventListener("change",this.listener);for(let t of(this.effects=e.sort((e,t)=>t.attributes-e.attributes),this.effects))t.addEventListener("change",this.listener)}updateMaterial(){let e=new d5,t=0;for(let n of this.effects)if(9===n.blendMode.blendFunction)e.attributes|=1&n.getAttributes();else if((e.attributes&n.getAttributes()&2)!=0)throw Error(`Convolution effects cannot be merged (${n.name})`);else!function(e,t,n){let i=t.getFragmentShader(),r=t.getVertexShader(),a=void 0!==i&&/mainImage/.test(i),s=void 0!==i&&/mainUv/.test(i);if(n.attributes|=t.getAttributes(),void 0===i)throw Error(`Missing fragment shader (${t.name})`);if(s&&(2&n.attributes)!=0)throw Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(a||s){let o=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,l=n.shaderParts,u=l.get(d4.FRAGMENT_HEAD)||"",c=l.get(d4.FRAGMENT_MAIN_UV)||"",h=l.get(d4.FRAGMENT_MAIN_IMAGE)||"",d=l.get(d4.VERTEX_HEAD)||"",p=l.get(d4.VERTEX_MAIN_SUPPORT)||"",f=new Set,m=new Set;if(s&&(c+=`	${e}MainUv(UV);
554`,n.uvTransformation=!0),null!==r&&/mainSupport/.test(r)){let t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);for(let i of(p+=`	${e}MainSupport(`,p+=t?"vUv);\n":");\n",r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g)))for(let e of i[1].split(/\s*,\s*/))n.varyings.add(e),f.add(e),m.add(e);for(let e of r.matchAll(o))m.add(e[1])}for(let e of i.matchAll(o))m.add(e[1]);for(let e of t.defines.keys())m.add(e.replace(/\([\w\s,]*\)/g,""));for(let e of t.uniforms.keys())m.add(e);m.delete("while"),m.delete("for"),m.delete("if"),t.uniforms.forEac
554h((t,i)=>n.uniforms.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)),t.defines.forEach((t,i)=>n.defines.set(e+i.charAt(0).toUpperCase()+i.slice(1),t));let g=new Map([["fragment",i],["vertex",r]]);pT(e,m,n.defines),pT(e,m,g),i=g.get("fragment"),r=g.get("vertex");let v=t.blendMode;if(n.blendModes.set(v.blendFunction,v),a){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(h+="srgb"===t.inputColorSpace?"color0 = sRGBTransferOETF(color0);\n	":"color0 = sRGBToLinear(color0);\n	"),""!==t.outputColorSpace?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace),h+=`${e}MainImage(color0, UV, `,(1&n.attributes)!=0&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(i)&&(h+="depth, ",n.readDepth=!0),h+="color1);\n	";let r=e+"BlendOpacity";n.uniforms.set(r,v.opacity),h+=`color0 = blend${v.blendFunction}(color0, color1, ${r});
555
556	`,u+=`uniform float ${r};
557
558`}if(u+=i+"\n",null!==r&&(d+=r+"\n"),l.set(d4.FRAGMENT_HEAD,u),l.set(d4.FRAGMENT_MAIN_UV,c),l.set(d4.FRAGMENT_MAIN_IMAGE,h),l.set(d4.VERTEX_HEAD,d),l.set(d4.VERTEX_MAIN_SUPPORT,p),null!==t.extensions)for(let e of t.extensions)n.extensions.add(e)}else throw Error(`Could not find mainImage or mainUv function (${t.name})`)}("e"+t++,n,e);let n=e.shaderParts.get(d4.FRAGMENT_HEAD),i=e.shaderParts.get(d4.FRAGMENT_MAIN_IMAGE),r=e.shaderParts.get(d4.FRAGMENT_MAIN_UV),a=/\bblend\b/g;for(let t of e.blendModes.values())n+=t.getShaderCode().replace(a,`blend${t.blendFunction}`)+"\n";for(let[t,a]of((1&e.attributes)!=0?(e.readDepth&&(i="float depth = readDepth(UV);\n\n	"+i),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,"srgb"===e.colorSpace&&(i+="color0 = sRGBToLinear(color0);\n	"),e.uvTransformation?(r="vec2 transformedUv = vUv;\n"+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(d4.FRAGMENT_HEAD,n),e.shaderParts.set(d4.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(d4.FRAGMENT_MAIN_UV,r),e.shaderParts))null!==a&&e.shaderParts.set(t,a.trim().replace(/^#/,"\n#"));this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=3200){for(let n of(this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t,this.effects))n.setDepthTexture(e,t)}render(e,t,n,i,r){for(let n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){let r=this.fullscreenMaterial;r.inputBuffer=t.texture,r.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){for(let n of(this.fullscreenMaterial.setSize(e,t),this.effects))n.setSize(e,t)}initialize(e,t,n){for(let i of(this.renderer=e,this.effects))i.initialize(e,t,n);this.updateMaterial(),void 0!==n&&1009!==n&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){for(let e of(super.dispose(),this.effects))e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){"change"===e.type&&this.recompile()}},pE=class extends dq{constructor(e,t,{renderTarget:n,resolutionScale:i=1,width:r=d7.AUTO_SIZE,height:a=d7.AUTO_SIZE,resolutionX:s=r,resolutionY:o=a}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new pg(e,t,new aD);const l=this.renderPass;l.ignoreBackground=!0,l.skipShadowMapUpdate=!0;const u=l.getClearPass();u.overrideClearColor=new tp(7829503),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new eF(1,1,{minFilter:1003,magFilter:1003}),this.renderTarget.texture.name="NormalPass.Target");const c=this.resolution=new d7(this,s,o,i);c.addEventListener("change",e=>this.setSize(c.baseWidth,c.baseHeight))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,i,r){let a=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,a,a)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}};function pA(e,t,n,i){var r;return(r=e+(t-e)*.75)+(n+(i-n)*.75-r)*.875}function pC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pR(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),pA(0,0,0,0),new Float32Array([0,0,0,0]),pA(0,0,0,1),new Float32Array([0,0,0,1]),pA(0,0,1,0),new Float32Array([0,0,1,0]),pA(0,0,1,1),new Float32Array([0,0,1,1]),pA(0,1,0,0),new Float32Array([0,1,0,0]),pA(0,1,0,1),new Float32Array([0,1,0,1]),pA(0,1,1,0),new Float32Array([0,1,1,0]),pA(0,1,1,1),new Float32Array([0,1,1,1]),pA(1,0,0,0),new Float32Array([1,0,0,0]),pA(1,0,0,1),new Float32Array([1,0,0,1]),pA(1,0,1,0),new Float32Array([1,0,1,0]),pA(1,0,1,1),new Float32Array([1,0,1,1]),pA(1,1,0,0),new Float32Array([1,1,0,0]),pA(1,1,0,1),new Float32Array([1,1,0,1]),pA(1,1,1,0),new Float32Array([1,1,1,0]),pA(1,1,1,1),new Float32Array([1,1,1,1]),new eg,new eg;var pP=function e(t,n,i){var r=this;pR(this,e),pC(this,"dot2",function(e,t){return r.x*e+r.y*t}),pC(this,"dot3",function(e,t,n){return r.x*e+r.y*t+r.z*n}),this.x=t,this.y=n,this.z=i},pI=[new pP(1,1,0),new pP(-1,1,0),new pP(1,-1,0),new pP(-1,-1,0),new pP(1,0,1),new pP(-1,0,1),new pP(1,0,-1),new pP(-1,0,-1),new pP(0,1,1),new pP(0,-1,1),new pP(0,1,-1),new pP(0,-1,-1)],pL=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,
558127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],pN=Array(512),pU=Array(512),pD=0;(pD=Math.floor(0))<256&&(pD|=pD<<8);for(var pO,pF,pB,pz,pk,pH=0;pH<256;pH++)pk=1&pH?pL[pH]^255&pD:pL[pH]^pD>>8&255,pN[pH]=pN[pH+256]=pk,pU[pH]=pU[pH+256]=pI[pk%12];function pV(e){var t=function(e){if("number"==typeof e)e=Math.abs(e);else if("string"==typeof e){var t=e;e=0;for(var n=0;n<t.length;n++)e=(e+(n+1)*(t.charCodeAt(n)%96))%0x7fffffff}return 0===e&&(e=311),e}(e);return function(){var e=48271*t%0x7fffffff;return t=e,e/0x7fffffff}}new function e(t){var n=this;pR(this,e),pC(this,"seed",0),pC(this,"init",function(e){n.seed=e,n.value=pV(e)}),pC(this,"value",pV(this.seed)),this.init(t)}(Math.random());new sR(-1,1,1,-1,0,1),new class extends nh{constructor(){super(),this.setAttribute("position",new t9([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new t9([0,2,0,0,2,0],2))}},parseInt("185".replace(/\D+/g,""));let pG=(0,R.createContext)(null),pW=e=>(2&e.getAttributes())==2,pj=(0,R.memo)((0,R.forwardRef)(({children:e,camera:t,scene:n,resolutionScale:i,enabled:r=!0,renderPriority:a=1,autoClear:s=!0,depthBuffer:o,enableNormalPass:l,stencilBuffer:u,multisampling:c=8,frameBufferType:h=1016},d)=>{let{gl:p,scene:f,camera:m,size:g}=hf(),v=n||f,_=t||m,[y,x,b]=(0,R.useMemo)(()=>{let e=new d3(p,{depthBuffer:o,stencilBuffer:u,multisampling:c,frameBufferType:h});e.addPass(new pg(v,_));let t=null,n=null;return l&&((n=new pE(v,_)).enabled=!1,e.addPass(n),void 0!==i&&((t=new px({normalBuffer:n.texture,resolutionScale:i})).enabled=!1,e.addPass(t))),[e,n,t]},[_,p,o,u,c,h,v,l,i]);(0,R.useEffect)(()=>y?.setSize(g.width,g.height),[y,g]),hm((e,t)=>{if(r){let e=p.autoClear;p.autoClear=s,u&&!s&&p.clearStencil(),y.render(t),p.autoClear=e}},r?a:0);let S=(0,R.useRef)(null);(0,R.useLayoutEffect)(()=>{let e=[],t=S.current.__r3f;if(t&&y){let n=t.children;for(let t=0;t<n.length;t++){let i=n[t].object;if(i instanceof pt){let r=[i];if(!pW(i)){let e=null;for(;(e=n[t+1]?.object)instanceof pt&&!pW(e);)r.push(e),t++}let a=new pw(_,...r);e.push(a)}else i instanceof dq&&e.push(i)}for(let t of e)y?.addPass(t);x&&(x.enabled=!0),b&&(b.enabled=!0)}return()=>{for(let t of e)y?.removePass(t);x&&(x.enabled=!1),b&&(b.enabled=!1)}},[y,e,_,x,b]),(0,R.useEffect)(()=>{let e=p.toneMapping;return p.toneMapping=0,()=>{p.toneMapping=e}},[p]);let M=(0,R.useMemo)(()=>({composer:y,normalPass:x,downSamplingPass:b,resolutionScale:i,camera:_,scene:v}),[y,x,b,i,_,v]);return(0,R.useImperativeHandle)(d,()=>y,[y]),(0,C.jsx)(pG.Provider,{value:M,children:(0,C.jsx)("group",{ref:S,children:e})})})),pX=0,pq=new WeakMap,pY=(e,t)=>function({blendFunction:n=t?.blendFunction,opacity:i=t?.opacity,...r}){let a=pq.get(e);if(!a){let t=`@react-three/postprocessing/${e.name}-${pX++}`;hE({[t]:e}),pq.set(e,a=t)}let s=hf(e=>e.camera),o=R.useMemo(()=>[...t?.args??[],...r.args??[{...t,...r}]],[JSON.stringify(r)]);return(0,C.jsx)(a,{camera:s,"blendMode-blendFunction":n,"blendMode-opacity-value":i,...r,args:o})},pZ=pY(pm,{blendFunction:0}),pK=pY(pv),pJ=({bloom:e,hueSaturation:t})=>{let n=[];return(t&&n.push((0,R.createElement)(pK,{hue:0,saturation:0,...t,key:"hueSaturation"})),e&&n.push((0,R.createElement)(pZ,{luminanceThreshold:.9,luminanceSmoothing:.025,intensity:.3,height:300,kernelSize:1,...e,key:"bloom"})),0===n.length)?null:(0,C.jsx)(pj,{enableNormalPass:!1,children:n})};var p$=Uint8Array,pQ=Uint16Array,p0=Uint32Array,p1=new p$([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),p2=new p$([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),p3=new p$([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p4=function(e,t){for(var n=new pQ(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];for(var r=new p0(n[30]),i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return[n,r]},p5=p4(p1,2),p6=p5[0],p8=p5[1];p6[28]=258,p8[258]=28;var p7=p4(p2,0),p9=p7[0];p7[1];for(var fe=new pQ(32768),ft=0;ft<32768;++ft){var fn=(43690&ft)>>>1|(21845&ft)<<1;fn=(61680&(fn=(52428&fn)>>>2|(13107&fn)<<2))>>>4|(3855&fn)<<4,fe[ft]=((65280&fn)>>>8|(255&fn)<<8)>>>1}for(var fi=function(e,t,n){for(var i,r=e.length,a=0,s=new pQ(t);a<r;++a)++s[e[a]-1];var o=new pQ(t);for(a=0;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;if(n){i=new pQ(1<<t);var l=15-t;for(a=0;a<r;
558++a)if(e[a])for(var u=a<<4|e[a],c=t-e[a],h=o[e[a]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)i[fe[h]>>>l]=u}else for(i=new pQ(r),a=0;a<r;++a)e[a]&&(i[a]=fe[o[e[a]-1]++]>>>15-e[a]);return i},fr=new p$(288),ft=0;ft<144;++ft)fr[ft]=8;for(var ft=144;ft<256;++ft)fr[ft]=9;for(var ft=256;ft<280;++ft)fr[ft]=7;for(var ft=280;ft<288;++ft)fr[ft]=8;for(var fa=new p$(32),ft=0;ft<32;++ft)fa[ft]=5;var fs=fi(fr,9,1),fo=fi(fa,5,1),fl=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},fu=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},fc=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},fh=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof pQ?pQ:e instanceof p0?p0:p$)(n-t);return i.set(e.subarray(t,n)),i},fd=function(e,t,n){var i=e.length;if(!i||n&&!n.l&&i<5)return t||new p$(0);var r=!t||n,a=!n||n.i;n||(n={}),t||(t=new p$(3*i));var s=function(e){var n=t.length;if(e>n){var i=new p$(Math.max(2*n,e));i.set(t),t=i}},o=n.f||0,l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,p=n.n,f=8*i;do{if(!c){n.f=o=fu(e,l,1);var m=fu(e,l+1,3);if(l+=3,m)if(1==m)c=fs,h=fo,d=9,p=5;else if(2==m){var g=fu(e,l,31)+257,v=fu(e,l+10,15)+4,_=g+fu(e,l+5,31)+1;l+=14;for(var y=new p$(_),x=new p$(19),b=0;b<v;++b)x[p3[b]]=fu(e,l+3*b,7);l+=3*v;for(var S=fl(x),M=(1<<S)-1,T=fi(x,S,1),b=0;b<_;){var w=T[fu(e,l,M)];l+=15&w;var E=w>>>4;if(E<16)y[b++]=E;else{var A=0,C=0;for(16==E?(C=3+fu(e,l,3),l+=2,A=y[b-1]):17==E?(C=3+fu(e,l,7),l+=3):18==E&&(C=11+fu(e,l,127),l+=7);C--;)y[b++]=A}}var R=y.subarray(0,g),P=y.subarray(g);d=fl(R),p=fl(P),c=fi(R,d,1),h=fi(P,p,1)}else throw"invalid block type";else{var I,E=((I=l)/8|0)+(7&I&&1)+4,L=e[E-4]|e[E-3]<<8,N=E+L;if(N>i){if(a)throw"unexpected EOF";break}r&&s(u+L),t.set(e.subarray(E,N),u),n.b=u+=L,n.p=l=8*N;continue}if(l>f){if(a)throw"unexpected EOF";break}}r&&s(u+131072);for(var U=(1<<d)-1,D=(1<<p)-1,O=l;;O=l){var A=c[fc(e,l)&U],F=A>>>4;if((l+=15&A)>f){if(a)throw"unexpected EOF";break}if(!A)throw"invalid length/literal";if(F<256)t[u++]=F;else if(256==F){O=l,c=null;break}else{var B=F-254;if(F>264){var b=F-257,z=p1[b];B=fu(e,l,(1<<z)-1)+p6[b],l+=z}var k=h[fc(e,l)&D],H=k>>>4;if(!k)throw"invalid distance";l+=15&k;var P=p9[H];if(H>3){var z=p2[H];P+=fc(e,l)&(1<<z)-1,l+=z}if(l>f){if(a)throw"unexpected EOF";break}r&&s(u+131072);for(var V=u+B;u<V;u+=4)t[u]=t[u-P],t[u+1]=t[u+1-P],t[u+2]=t[u+2-P],t[u+3]=t[u+3-P];u=V}}n.l=c,n.p=O,n.b=u,c&&(o=1,n.m=d,n.d=h,n.n=p)}while(!o);return u==t.length?t:fh(t,0,u)},fp=new p$(0),ff=function(e){if((15&e[0])!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function fm(e,t){return fd((ff(e),e.subarray(2,-4)),t)}var fg="u">typeof TextDecoder&&new TextDecoder;try{fg.decode(fp,{stream:!0})}catch(e){}let fv=h3>=152;class f_ extends su{constructor(e){super(e),this.type=1016}parse(e){let t={l:0,c:0,lc:0};function n(e,n,i,r,a){for(;i<e;)n=n<<8|w(r,a),i+=8;t.l=n>>(i-=e)&(1<<e)-1,t.c=n,t.lc=i}let i=Array(59),r={c:0,lc:0};function a(e,t,n,i){e=e<<8|w(n,i),t+=8,r.c=e,r.lc=t}let s={c:0,lc:0};function o(e,t,n,i,o,l,u,c,h,d){if(e==t){i<8&&(a(n,i,o,u),n=r.c,i=r.lc);var p=n>>(i-=8),p=new Uint8Array([p])[0];if(h.value+p>d)return!1;for(var f=c[h.value-1];p-- >0;)c[h.value++]=f}else{if(!(h.value<d))return!1;c[h.value++]=e}s.c=n,s.lc=i}function l(e){var t=65535&e;return t>32767?t-65536:t}let u={a:0,b:0};function c(e,t){var n=l(e),i=l(t),r=n+(1&i)+(i>>1),a=r-i;u.a=r,u.b=a}function h(e,t){var n=65535&t,i=(65535&e)-(n>>1)&65535;u.a=n+i-32768&65535,u.b=i}function d(e,l,u,c,h,d){var p=u.value,f=T(l,u),m=T(l,u);u.value+=4;var g=T(l,u);if(u.value+=4,f<0||f>=65537||m<0||m>=65537)throw"Something wrong with HUF_ENCSIZE";for(var v=Array(65537),_=Array(16384),y=0;y<16384;y++)_[y]={},_[y].len=0,_[y].lit=0,_[y].p=null;var x=c-(u.value-p);if(!function(e,r,a,s,o,l){for(var u=0,c=0;s<=o;s++){if(r.value-r.value>a)return!1;n(6,u,c,e,r);var h=t.l;if(u=t.c,c=t.lc,l[s]=h,63==h){if(r.value-r.value>a)throw"Something wrong with hufUnpackEncTable";n(8,u,c,e,r);var d=t.l+6;if(u=t.c,c=t.lc,s+d>o+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)l[s++]=0;s--}else if(h>=59){var d=h-59+2;if(s+d>o+1)throw"Something wrong with hufUnpackEncTable";for(;d--;)l[s++]=0;s--}}!function(e){for(var t=0;t<=58;++t)i[t]=0;for(var t=0;t<65537;++t)i[e[t]]+=1;for(var n=0,t=58;t>0;--t){var r=n+i[t]>>1;i[t]=n,n=r}for(var t=0;t<65537;++t){var a=e[t];a>0&&(e[t]=a|i[a]++<<6)}}(l)}(e,u,x,f,m,v),g>8*(c-(u.value-p)))throw"Something wrong with hufUncompress";!function(e,t,n,i){for(;t<=n;t++){var r=e[t]>>6,a=63&e[t];if(r>>a)throw"Invalid table entry";if(a>14){var s=i[r>>a-14];
558if(s.len)throw"Invalid table entry";if(s.lit++,s.p){var o=s.p;s.p=Array(s.lit);for(var l=0;l<s.lit-1;++l)s.p[l]=o[l]}else s.p=[,];s.p[s.lit-1]=t}else if(a)for(var u=0,l=1<<14-a;l>0;l--){var s=i[(r<<14-a)+u];if(s.len||s.p)throw"Invalid table entry";s.len=a,s.lit=t,u++}}}(v,f,m,_),function(e,t,n,i,l,u,c,h,d,p){for(var f=0,m=0,g=Math.trunc(l.value+(u+7)/8);l.value<g;)for(a(f,m,n,l),f=r.c,m=r.lc;m>=14;){var v=t[f>>m-14&16383];if(v.len)m-=v.len,o(v.lit,c,f,m,n,i,l,d,p,h),f=s.c,m=s.lc;else{if(!v.p)throw"hufDecode issues";for(_=0;_<v.lit;_++){for(var _,y=63&e[v.p[_]];m<y&&l.value<g;)a(f,m,n,l),f=r.c,m=r.lc;if(m>=y&&e[v.p[_]]>>6==(f>>m-y&(1<<y)-1)){m-=y,o(v.p[_],c,f,m,n,i,l,d,p,h),f=s.c,m=s.lc;break}}if(_==v.lit)throw"hufDecode issues"}}var x=8-u&7;for(f>>=x,m-=x;m>0;){var v=t[f<<14-m&16383];if(v.len)m-=v.len,o(v.lit,c,f,m,n,i,l,d,p,h),f=s.c,m=s.lc;else throw"hufDecode issues"}}(v,_,e,l,u,g,m,d,h,{value:0})}function p(e){for(var t=1;t<e.length;t++){var n=e[t-1]+e[t]-128;e[t]=n}}function f(e,t){for(var n=0,i=Math.floor((e.length+1)/2),r=0,a=e.length-1;!(r>a)&&(t[r++]=e[n++],!(r>a));){;t[r++]=e[i++]}}function m(e){for(var t=e.byteLength,n=[],i=0,r=new DataView(e);t>0;){var a=r.getInt8(i++);if(a<0){var s=-a;t-=s+1;for(var o=0;o<s;o++)n.push(r.getUint8(i++))}else{var s=a;t-=2;for(var l=r.getUint8(i++),o=0;o<s+1;o++)n.push(l)}}return n}function g(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function v(e){var t=new Uint8Array(m(e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size))),n=new Uint8Array(t.length);return p(t),f(t,n),new DataView(n.buffer)}function _(e){var t=fm(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return p(t),f(t,n),new DataView(n.buffer)}function y(e){for(var t=e.viewer,n={value:e.offset.value},i=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),r=new Uint8Array(8192),a=0,s=Array(e.channels),o=0;o<e.channels;o++)s[o]={},s[o].start=a,s[o].end=s[o].start,s[o].nx=e.width,s[o].ny=e.lines,s[o].size=e.type,a+=s[o].nx*s[o].ny*s[o].size;var l=I(t,n),p=I(t,n);if(p>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(l<=p)for(var o=0;o<p-l+1;o++)r[o+l]=E(t,n);var f=new Uint16Array(65536),m=function(e,t){for(var n=0,i=0;i<65536;++i)(0==i||e[i>>3]&1<<(7&i))&&(t[n++]=i);for(var r=n-1;n<65536;)t[n++]=0;return r}(r,f),g=T(t,n);d(e.array,t,n,g,i,a);for(var o=0;o<e.channels;++o)for(var v=s[o],_=0;_<s[o].size;++_)!function(e,t,n,i,r,a,s){for(var o=s<16384,l=n>r?r:n,d=1;d<=l;)d<<=1;for(d>>=1,p=d,d>>=1;d>=1;){for(var p,f,m,g,v,_=0,y=0+a*(r-p),x=a*d,b=a*p,S=i*d,M=i*p;_<=y;_+=b){for(var T=_,w=_+i*(n-p);T<=w;T+=M){var E=T+S,A=T+x,C=A+S;o?(c(e[T+t],e[A+t]),f=u.a,g=u.b,c(e[E+t],e[C+t]),m=u.a,v=u.b,c(f,m),e[T+t]=u.a,e[E+t]=u.b,c(g,v)):(h(e[T+t],e[A+t]),f=u.a,g=u.b,h(e[E+t],e[C+t]),m=u.a,v=u.b,h(f,m),e[T+t]=u.a,e[E+t]=u.b,h(g,v)),e[A+t]=u.a,e[C+t]=u.b}if(n&d){var A=T+x;o?c(e[T+t],e[A+t]):h(e[T+t],e[A+t]),f=u.a,e[A+t]=u.b,e[T+t]=f}}if(r&d)for(var T=_,w=_+i*(n-p);T<=w;T+=M){var E=T+S;o?c(e[T+t],e[E+t]):h(e[T+t],e[E+t]),f=u.a,e[E+t]=u.b,e[T+t]=f}p=d,d>>=1}}(i,v.start+_,v.nx,v.size,v.ny,v.nx*v.size,m);for(var y=a,x=0;x<y;++x)i[x]=f[i[x]];for(var b=0,S=new Uint8Array(i.buffer.byteLength),M=0;M<e.lines;M++)for(var w=0;w<e.channels;w++){var v=s[w],A=v.nx*v.size,C=new Uint8Array(i.buffer,2*v.end,2*A);S.set(C,b),b+=2*A,v.end+=A}return new DataView(S.buffer)}function x(e){var t=fm(e.array.slice(e.offset.value,e.offset.value+e.size));let n=e.lines*e.channels*e.width,i=1==e.type?new Uint16Array(n):new Uint32Array(n),r=0,a=0,s=[,,,,];for(let n=0;n<e.lines;n++)for(let n=0;n<e.channels;n++){let n=0;switch(e.type){case 1:s[0]=r,s[1]=s[0]+e.width,r=s[1]+e.width;for(let r=0;r<e.width;++r)n+=t[s[0]++]<<8|t[s[1]++],i[a]=n,a++;break;case 2:s[0]=r,s[1]=s[0]+e.width,s[2]=s[1]+e.width,r=s[2]+e.width;for(let r=0;r<e.width;++r)n+=t[s[0]++]<<24|t[s[1]++]<<16|t[s[2]++]<<8,i[a]=n,a++}}return new DataView(i.buffer)}function b(e){var t=e.viewer,n={value:e.offset.value},i=new Uint8Array(e.width*e.lines*(e.channels*e.type*2)),r={version:A(t,n),unknownUncompressedSize:A(t,n),unknownCompressedSize:A(t,n),acCompressedSize:A(t,n),dcCompressedSize:A(t,n),rleCompressedSize:A(t,n),rleUncompressedSize:A(t,n),rleRawSize:A(t,n),totalAcUncompressedCount:A(t,n),totalDcUncompressedCount:A(t,n),acCompression:A(t,n)};if(r.version<2)throw"EXRLoader.parse: "+O.compression+" version "+r.ver
558sion+" is unsupported";for(var a=[],s=I(t,n)-2;s>0;){var o=S(t.buffer,n),l=E(t,n),u=l>>2&3,c=new Int8Array([(l>>4)-1])[0],h=E(t,n);a.push({name:o,index:c,type:h,compression:u}),s-=o.length+3}for(var p=O.channels,f=Array(e.channels),g=0;g<e.channels;++g){var v=f[g]={},y=p[g];v.name=y.name,v.compression=0,v.decoded=!1,v.type=y.pixelType,v.pLinear=y.pLinear,v.width=e.width,v.height=e.lines}for(var x={idx:[,,,]},b=0;b<e.channels;++b)for(var v=f[b],g=0;g<a.length;++g){var M=a[g];v.name==M.name&&(v.compression=M.compression,M.index>=0&&(x.idx[M.index]=b),v.offset=b)}if(r.acCompressedSize>0)switch(r.acCompression){case 0:var T=new Uint16Array(r.totalAcUncompressedCount);d(e.array,t,n,r.acCompressedSize,T,r.totalAcUncompressedCount);break;case 1:var w=e.array.slice(n.value,n.value+r.totalAcUncompressedCount),C=fm(w),T=new Uint16Array(C.buffer);n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){var R=new Uint16Array(_({array:e.array,offset:n,size:r.dcCompressedSize}).buffer);n.value+=r.dcCompressedSize}if(r.rleRawSize>0){var w=e.array.slice(n.value,n.value+r.rleCompressedSize),C=fm(w),L=m(C.buffer);n.value+=r.rleCompressedSize}for(var N=0,U=Array(f.length),g=0;g<U.length;++g)U[g]=[];for(var D=0;D<e.lines;++D)for(var F=0;F<f.length;++F)U[F].push(N),N+=f[F].width*e.type*2;!function(e,t,n,i,r,a){var s=new DataView(a.buffer),o=n[e.idx[0]].width,l=n[e.idx[0]].height,u=Math.floor(o/8),c=Math.ceil(o/8),h=Math.ceil(l/8),d=o-(c-1)*8,p=l-(h-1)*8,f={value:0},m=[,,,],g=[,,,],v=[,,,],_=[,,,],y=[,,,];for(let n=0;n<3;++n)y[n]=t[e.idx[n]],m[n]=n<1?0:m[n-1]+c*h,g[n]=new Float32Array(64),v[n]=new Uint16Array(64),_[n]=new Uint16Array(64*c);for(let t=0;t<h;++t){var x,b,S=8;t==h-1&&(S=p);var M=8;for(let e=0;e<c;++e){e==c-1&&(M=d);for(let e=0;e<3;++e){v[e].fill(0),v[e][0]=r[m[e]++],function(e,t,n){for(var i,r=1;r<64;)65280==(i=t[e.value])?r=64:i>>8==255?r+=255&i:(n[r]=i,r++),e.value++}(f,i,v[e]),x=v[e],(b=g[e])[0]=P(x[0]),b[1]=P(x[1]),b[2]=P(x[5]),b[3]=P(x[6]),b[4]=P(x[14]),b[5]=P(x[15]),b[6]=P(x[27]),b[7]=P(x[28]),b[8]=P(x[2]),b[9]=P(x[4]),b[10]=P(x[7]),b[11]=P(x[13]),b[12]=P(x[16]),b[13]=P(x[26]),b[14]=P(x[29]),b[15]=P(x[42]),b[16]=P(x[3]),b[17]=P(x[8]),b[18]=P(x[12]),b[19]=P(x[17]),b[20]=P(x[25]),b[21]=P(x[30]),b[22]=P(x[41]),b[23]=P(x[43]),b[24]=P(x[9]),b[25]=P(x[11]),b[26]=P(x[18]),b[27]=P(x[24]),b[28]=P(x[31]),b[29]=P(x[40]),b[30]=P(x[44]),b[31]=P(x[53]),b[32]=P(x[10]),b[33]=P(x[19]),b[34]=P(x[23]),b[35]=P(x[32]),b[36]=P(x[39]),b[37]=P(x[45]),b[38]=P(x[52]),b[39]=P(x[54]),b[40]=P(x[20]),b[41]=P(x[22]),b[42]=P(x[33]),b[43]=P(x[38]),b[44]=P(x[46]),b[45]=P(x[51]),b[46]=P(x[55]),b[47]=P(x[60]),b[48]=P(x[21]),b[49]=P(x[34]),b[50]=P(x[37]),b[51]=P(x[47]),b[52]=P(x[50]),b[53]=P(x[56]),b[54]=P(x[59]),b[55]=P(x[61]),b[56]=P(x[35]),b[57]=P(x[36]),b[58]=P(x[48]),b[59]=P(x[49]),b[60]=P(x[57]),b[61]=P(x[58]),b[62]=P(x[62]),b[63]=P(x[63]),function(e){let t=.5*Math.cos(3.14159/16),n=.5*Math.cos(3.14159/8),i=.5*Math.cos(3*3.14159/16),r=.5*Math.cos(3*3.14159/8);for(var a=[,,,,],s=[,,,,],o=[,,,,],l=[,,,,],u=0;u<8;++u){var c=8*u;a[0]=n*e[c+2],a[1]=r*e[c+2],a[2]=n*e[c+6],a[3]=r*e[c+6],s[0]=t*e[c+1]+i*e[c+3]+.2777854612564676*e[c+5]+.09754573032714427*e[c+7],s[1]=i*e[c+1]-.09754573032714427*e[c+3]-t*e[c+5]-.2777854612564676*e[c+7],s[2]=.2777854612564676*e[c+1]-t*e[c+3]+.09754573032714427*e[c+5]+i*e[c+7],s[3]=.09754573032714427*e[c+1]-.2777854612564676*e[c+3]+i*e[c+5]-t*e[c+
5587],o[0]=.35355362513961314*(e[c+0]+e[c+4]),o[3]=.35355362513961314*(e[c+0]-e[c+4]),o[1]=a[0]+a[3],o[2]=a[1]-a[2],l[0]=o[0]+o[1],l[1]=o[3]+o[2],l[2]=o[3]-o[2],l[3]=o[0]-o[1],e[c+0]=l[0]+s[0],e[c+1]=l[1]+s[1],e[c+2]=l[2]+s[2],e[c+3]=l[3]+s[3],e[c+4]=l[3]-s[3],e[c+5]=l[2]-s[2],e[c+6]=l[1]-s[1],e[c+7]=l[0]-s[0]}for(var h=0;h<8;++h)a[0]=n*e[16+h],a[1]=r*e[16+h],a[2]=n*e[48+h],a[3]=r*e[48+h],s[0]=t*e[8+h]+i*e[24+h]+.2777854612564676*e[40+h]+.09754573032714427*e[56+h],s[1]=i*e[8+h]-.09754573032714427*e[24+h]-t*e[40+h]-.2777854612564676*e[56+h],s[2]=.2777854612564676*e[8+h]-t*e[24+h]+.09754573032714427*e[40+h]+i*e[56+h],s[3]=.09754573032714427*e[8+h]-.2777854612564676*e[24+h]+i*e[40+h]-t*e[56+h],o[0]=.35355362513961314*(e[h]+e[32+h]),o[3]=.35355362513961314*(e[h]-e[32+h]),o[1]=a[0]+a[3],o[2]=a[1]-a[2],l[0]=o[0]+o[1],l[1]=o[3]+o[2],l[2]=o[3]-o[2],l[3]=o[0]-o[1],e[0+h]=l[0]+s[0],e[8+h]=l[1]+s[1],e[16+h]=l[2]+s[2],e[24+h]=l[3]+s[3],e[32+h]=l[3]-s[3],e[40+h]=l[2]-s[2],e[48+h]=l[1]-s[1],e[56+h]=l[0]-s[0]}(g[e])}for(var T=g,w=0;w<64;++w){var E=T[0][w],A=T[1][w],C=T[2][w];T[0][w]=E+1.5747*C,T[1][w]=E-.1873*A-.4682*C,T[2][w]=E+1.8556*A}for(let t=0;t<3;++t)!function(e,t,n){for(var i,r=0;r<64;++r){t[n+r]=tK.toHalfFloat((i=e[r])<=1?Math.sign(i)*Math.pow(Math.abs(i),2.2):Math.sign(i)*Math.pow(9.025013291561939,Math.abs(i)-1))}}(g[t],_[t],64*e)}let a=0;for(let i=0;i<3;++i){let r=n[e.idx[i]].type;for(let e=8*t;e<8*t+S;++e){a=y[i][e];for(let t=0;t<u;++t){let n=64*t+(7&e)*8;s.setUint16(a+0*r,_[i][n+0],!0),s.setUint16(a+2*r,_[i][n+1],!0),s.setUint16(a+4*r,_[i][n+2],!0),s.setUint16(a+6*r,_[i][n+3],!0),s.setUint16(a+8*r,_[i][n+4],!0),s.setUint16(a+10*r,_[i][n+5],!0),s.setUint16(a+12*r,_[i][n+6],!0),s.setUint16(a+14*r,_[i][n+7],!0),a+=16*r}}if(u!=c)for(let e=8*t;e<8*t+S;++e){let t=y[i][e]+8*u*2*r,n=64*u+(7&e)*8;for(let e=0;e<M;++e)s.setUint16(t+2*e*r,_[i][n+e],!0)}}}for(var R=new Uint16Array(o),s=new DataView(a.buffer),I=0;I<3;++I){n[e.idx[I]].decoded=!0;var L=n[e.idx[I]].type;if(2==n[I].type)for(var N=0;N<l;++N){let e=y[I][N];for(var U=0;U<o;++U)R[U]=s.getUint16(e+2*U*L,!0);for(var U=0;U<o;++U)s.setFloat32(e+2*U*L,P(R[U]),!0)}}}(x,U,f,T,R,i);for(var g=0;g<f.length;++g){var v=f[g];if(!v.decoded)if(2===v.compression)for(var B=0,z=0,D=0;D<e.lines;++D){for(var k=U[g][B],H=0;H<v.width;++H){for(var V=0;V<2*v.type;++V)i[k++]=L[z+V*v.width*v.height];z++}B++}else throw"EXRLoader.parse: unsupported channel compression"}return new DataView(i.buffer)}function S(e,t){for(var n=new Uint8Array(e),i=0;0!=n[t.value+i];)i+=1;var r=new TextDecoder().decode(n.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function M(e,t){var n=e.getInt32(t.value,!0);return t.value=t.value+4,n}function T(e,t){var n=e.getUint32(t.value,!0);return t.value=t.value+4,n}function w(e,t){var n=e[t.value];return t.value=t.value+1,n}function E(e,t){var n=e.getUint8(t.value);return t.value=t.value+1,n}let A=function(e,t){let n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,n};function C(e,t){var n=e.getFloat32(t.value,!0);return t.value+=4,n}function R(e,t){return tK.toHalfFloat(C(e,t))}function P(e){var t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function I(e,t){var n=e.getUint16(t.value,!0);return t.value+=2,n}function L(e,t){return P(I(e,t))}let N=new DataView(e),U=new Uint8Array(e),D={value:0},O=function(e,t,n){let i={};if(0x1312f76!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";i.version=e.getUint8(4);let r=e.getUint8(5);i.spec={singleTile:!!(2&r),longName:!!(4&r),deepFormat:!!(8&r),multiPart:!!(16&r)},n.value=8;for(var a=!0;a;){var s=S(t,n);if(0==s)a=!1;else{var o=S(t,n),l=T(e,n),u=function(e,t,n,i,r){var a,s,o,l,u,c,h;if("string"===i||"stringvector"===i||"iccProfile"===i)return a=new TextDecoder().decode(new Uint8Array(t).slice(n.value,n.value+r)),n.value=n.value+r,a;if("chlist"===i)return function(e,t,n,i){for(var r=n.value,a=[];n.value<r+i-1;){var s=S(t,n),o=M(e,n),l=E(e,n);n.value+=3;
558var u=M(e,n),c=M(e,n);a.push({name:s,pixelType:o,pLinear:l,xSampling:u,ySampling:c})}return n.value+=1,a}(e,t,n,r);if("chromaticities"===i)return s=C(e,n),o=C(e,n),l=C(e,n),u=C(e,n),c=C(e,n),{redX:s,redY:o,greenX:l,greenY:u,blueX:c,blueY:C(e,n),whiteX:C(e,n),whiteY:C(e,n)};if("compression"===i)return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][E(e,n)];if("box2i"===i)return h=T(e,n),{xMin:h,yMin:T(e,n),xMax:T(e,n),yMax:T(e,n)};else if("lineOrder"===i)return["INCREASING_Y"][E(e,n)];else if("float"===i)return C(e,n);else if("v2f"===i)return[C(e,n),C(e,n)];else if("v3f"===i)return[C(e,n),C(e,n),C(e,n)];else if("int"===i)return M(e,n);else if("rational"===i)return[M(e,n),T(e,n)];else if("timecode"===i)return[T(e,n),T(e,n)];else return"preview"===i?(n.value+=r,"skipped"):(n.value+=r,void 0)}(e,t,n,o,l);void 0===u?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${o}'.`):i[s]=u}}if((-5&r)!=0)throw console.error("EXRHeader:",i),"THREE.EXRLoader: provided file is currently unsupported.";return i}(N,e,D),F=function(e,t,n,i,r){let a={size:0,viewer:t,array:n,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:e.channels[0].pixelType,uncompress:null,getter:null,format:null,[fv?"colorSpace":"encoding"]:null};switch(e.compression){case"NO_COMPRESSION":a.lines=1,a.uncompress=g;break;case"RLE_COMPRESSION":a.lines=1,a.uncompress=v;break;case"ZIPS_COMPRESSION":a.lines=1,a.uncompress=_;break;case"ZIP_COMPRESSION":a.lines=16,a.uncompress=_;break;case"PIZ_COMPRESSION":a.lines=32,a.uncompress=y;break;case"PXR24_COMPRESSION":a.lines=16,a.uncompress=x;break;case"DWAA_COMPRESSION":a.lines=32,a.uncompress=b;break;case"DWAB_COMPRESSION":a.lines=256,a.uncompress=b;break;default:throw"EXRLoader.parse: "+e.compression+" is unsupported"}if(a.scanlineBlockSize=a.lines,1==a.type)switch(r){case 1015:a.getter=L,a.inputSize=2;break;case 1016:a.getter=I,a.inputSize=2}else if(2==a.type)switch(r){case 1015:a.getter=C,a.inputSize=4;break;case 1016:a.getter=R,a.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".";a.blockCount=(e.dataWindow.yMax+1)/a.scanlineBlockSize;for(var s=0;s<a.blockCount;s++)A(t,i);a.outputChannels=3==a.channels?4:a.channels;let o=a.width*a.height*a.outputChannels;switch(r){case 1015:a.byteArray=new Float32Array(o),a.channels<a.outputChannels&&a.byteArray.fill(1,0,o);break;case 1016:a.byteArray=new Uint16Array(o),a.channels<a.outputChannels&&a.byteArray.fill(15360,0,o);break;default:console.error("THREE.EXRLoader: unsupported type: ",r)}return a.bytesPerLine=a.width*a.inputSize*a.channels,4==a.outputChannels?a.format=1023:a.format=1028,fv?a.colorSpace="srgb-linear":a.encoding=3e3,a}(O,N,U,D,this.type),B={value:0},z={R:0,G:1,B:2,A:3,Y:0};for(let e=0;e<F.height/F.scanlineBlockSize;e++){let t=T(N,D);F.size=T(N,D),F.lines=t+F.scanlineBlockSize>F.height?F.height-t:F.scanlineBlockSize;
558let n=F.size<F.lines*F.bytesPerLine?F.uncompress(F):g(F);D.value+=F.size;for(let t=0;t<F.scanlineBlockSize;t++){let i=t+e*F.scanlineBlockSize;if(i>=F.height)break;for(let e=0;e<F.channels;e++){let r=z[O.channels[e].name];for(let a=0;a<F.width;a++){B.value=(t*(F.channels*F.width)+e*F.width+a)*F.inputSize;let s=(F.height-1-i)*(F.width*F.outputChannels)+a*F.outputChannels+r;F.byteArray[s]=F.getter(n,B)}}}}return{header:O,width:F.width,height:F.height,data:F.byteArray,format:F.format,[fv?"colorSpace":"encoding"]:F[fv?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){fv?e.colorSpace=n.colorSpace:e.encoding=n.encoding,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,n)},n,i)}}let fy=({map:e,manager:t})=>{let{scene:n,gl:i}=hf(),r=(0,R.useRef)(void 0);return(0,R.useEffect)(()=>{if(i&&e&&n){let a=new lL(i);a.compileEquirectangularShader(),t?.itemStart(e),new f_().load(e,i=>{r.current=a.fromEquirectangular(i).texture,n.environment=r.current,n.traverse(e=>{e instanceof n1&&(e.material.envMap=r.current)}),i.dispose(),a.dispose(),t?.itemEnd(e)})}},[i,e,n,t]),null},fx=({objectref:e})=>{let{invalidate:t}=hf(),n=(0,R.useRef)(new e_),i=(0,R.useRef)(new e_),[r,a]=(0,R.useState)({x:.5,y:.5});return(0,R.useEffect)(()=>{let e=e=>{a({x:e.clientX/window.innerWidth,y:e.clientY/window.innerHeight}),t()};return"u">typeof window&&(window.addEventListener("mousemove",e),window.addEventListener("mouseenter",e)),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseenter",e)}},[t]),hm(()=>{if(e&&e.current){let a=n.current;i.current.set(-.3+.6*r.y,-.3+.6*r.x,0),i.current.sub(a),i.current.lengthSq()>.001&&(a.addScaledVector(i.current,.05),e.current.rotation.setFromVector3(a),t())}}),null},fb=(T=!1,(...e)=>{try{return h_(...e)}catch(e){e instanceof Error&&(T||console.error("fatal",e),T=!0)}return null}),fS=(0,dV.A)("staticServer"),fM=({threeDId:e,progress:t,onLoad:n,damping:i=.05,animation:r="idle"})=>{let{set:a,viewport:s}=hf(),o=(0,R.useRef)(new a7(n)),l=(0,R.useRef)(null),u=`${fS}/functional/3d/${e}`,c=`${u}/model3d.glb`,h=`${u}/model3d.json`,d=`${u}/env.exr`,p=(0,R.useRef)([]),f=(0,R.useRef)(void 0),m=(0,R.useRef)(void 0),g=(0,R.useRef)(void 0),[v,_]=(0,R.useState)([]),[{response:y}]=(0,dG.A)({url:h,afterMount:!0}),x=fb(h8,c,()=>{o.current.itemStart(c)}),{useFollowMouse:b,useEnv:S,postprocessing:M}=y?.data||{},T=(0,R.useCallback)((e,t=1)=>{if(!f.current||!y||!x)return;let n=y?.data.animation,i=n?.idle||"idle";if("number"==typeof e){let{animations:t}=n||{};t&&t.length&&(i=t[e%t.length])}else i="idle"===e&&n?.idle?n?.idle:e;let{animations:r}=x,a=r.find(e=>e.name===i)?.optimize();if(l.current&&clearTimeout(l.current),a||(a=r[0]?.optimize()),g.current){let e=g.current.getClip().name;if(e===a.name)return;e&&g.current.fadeOut(1)}if(a&&m.current){let e=m.current.clipAction(a);e.reset(),e.clampWhenFinished=!0,e.fadeIn(1).play(),e.repetitions=t,e.enabled=!0,g.current=e}},[x,y]);return((0,R.useEffect)(()=>{if(x&&x.cameras.length>0&&x.cameras[0]instanceof sT&&0===v.length){let e=x.cameras[0];e.aspect=s.aspect,e.updateProjectionMatrix(),a({camera:e})}},[x,a,s,v]),(0,R.useEffect)(()=>{if(!y||!x)return;let{scene:e}=x,{data:t}=y;m.current=new o_(e),m.current.addEventListener("finished",e=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{e.action.fadeOut(1),T(0,1/0)},500)});let n=[];e.traverse(e=>{if(e instanceof sx&&n.push(e),e instanceof n1&&t.customShader&&t.customShader[e.material.name]){let n=new dj(t.customShader[e.material.name]);e.material=n,p.current.push(n)}}),n.forEach(e=>e.removeFromParent()),n.length>0&&_(n),o.current.itemEnd(c)},[x,c,y,T]),(0,R.useEffect)(()=>{if(!y||!x)return;let{data:e}=y,t=e.animation?.animations?.map(e=>new Promise((t,n)=>{try{new h8().load(`${u}/${e}_action.glb`,({animations:n})=>{1===n.length&&(n[0].name=e),t(n)},void 0,e=>{n(e)})}catch(e){n(e)}}));t&&Promise.all(t).then(e=>{let t=x.animations.map(e=>e.name);e.forEach(e=>{t.includes(e[0].name)||(x.animations.push(e[0]),t.push(e[0].name))})},e=>{console.error(e)})},[u,x,y]),(0,R.useEffect)(()=>{T(r)}
558,[r,x?.animations.length,T]),hm((e,n)=>{m.current&&m.current.update(n);let r=t;r=(r=r<0?0:r)>1?1:r,p.current.forEach(e=>{e.progress+=(r-e.progress)*i,e.time+=n})}),y&&x)?(0,C.jsxs)(R.Fragment,{children:[S&&(0,C.jsx)(fy,{map:d,manager:o.current}),b&&(0,C.jsx)(fx,{objectref:f}),x&&(0,C.jsx)("primitive",{object:x.scene,ref:f},x.scene.uuid),v.map(e=>(0,C.jsx)("primitive",{object:e},e.uuid)),(0,C.jsx)(pJ,{...M})]}):null};function fT(e,t){let n;return(...i)=>{window.clearTimeout(n),n=window.setTimeout(()=>e(...i),t)}}let fw=["x","y","top","bottom","left","right","width","height"];function fE({ref:e,children:t,fallback:n,resize:i,style:r,gl:a,events:s=h1,eventSource:o,eventPrefix:l,shadows:u,linear:c,flat:h,legacy:d,orthographic:p,frameloop:f,dpr:m,performance:g,raycaster:v,camera:_,scene:y,onPointerMissed:x,onCreated:b,...S}){let M,T,w;R.useMemo(()=>hE(A),[]);let E=(M=cq(),T=function(){let e=cq(),[t]=R.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;cZ(e)&&e!==cj&&!t.has(e)&&t.set(e,R.use(cW(e))),n=n.return}return t}(),w=R.useMemo(()=>Array.from(T.keys()).reduce((e,t)=>n=>R.createElement(e,null,R.createElement(t.Provider,{...n,value:T.get(t)})),e=>R.createElement(cX,{...e})),[T]),R.useMemo(()=>({children:e})=>{let t=cG(M,!0,e=>e.type===R.StrictMode)?R.StrictMode:R.Fragment;return(0,C.jsx)(t,{children:(0,C.jsx)(w,{children:e})})},[M,w])),[P,I]=function({debounce:e,scroll:t,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){var r,a,s;let o=n||("u"<typeof window?class{}:window.ResizeObserver);if(!o)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,R.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,R.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),h=e?"number"==typeof e?e:e.scroll:null,d=e?"number"==typeof e?e:e.resize:null,p=(0,R.useRef)(!1);(0,R.useEffect)(()=>(p.current=!0,()=>void(p.current=!1)));let[f,m,g]=(0,R.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:n,top:r,width:a,height:s,bottom:o,right:l,x:h,y:d}=c.current.element.getBoundingClientRect(),f={left:n,top:r,width:a,height:s,bottom:o,right:l,x:h,y:d};c.current.element instanceof HTMLElement&&i&&(f.height=c.current.element.offsetHeight,f.width=c.current.element.offsetWidth),Object.freeze(f),p.current&&(e=c.current.lastBounds,t=f,!fw.every(n=>e[n]===t[n]))&&u(c.current.lastBounds=f)};return[e,d?fT(e,d):e,h?fT(e,h):e]},[u,i,h,d]);function v(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function _(){c.current.element&&(c.current.resizeObserver=new o(g),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return r=g,a=!!t,(0,R.useEffect)(()=>{if(a)return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)},[r,a]),s=m,(0,R.useEffect)(()=>(window.addEventListener("resize",s),()=>void window.removeEventListener("resize",s)),[s]),(0,R.useEffect)(()=>{v(),_()},[t,g,m]),(0,R.useEffect)(()=>v,[]),[e=>{e&&e!==c.current.element&&(v(),c.current.element=e,c.current.scrollContainers=function e(t){let n=[];if(!t||t===document.body)return n;let{overflow:i,overflowX:r,overflowY:a}=window.getComputedStyle(t);return[i,r,a].some(e=>"auto"===e||"scroll"===e)&&n.push(t),[...n,...e(t.parentElement)]}(e),_())},l,f]}({scroll:!0,debounce:{scroll:50,resize:0},...i}),L=R.useRef(null),N=R.useRef(null);R.useImperativeHandle(e,()=>L.current);let U=cQ(x),[D,F]=R.useState(!1),[B,z]=R.useState(!1);if(D)throw D;
558if(B)throw B;let k=R.useRef(null);c$(()=>{let e=L.current;if(I.width>0&&I.height>0&&e){let n,i,r,x,S,M,T,w,A,P,L,D,B,H,V,G;k.current||(x=null==(r=hz.get(e))?void 0:r.fiber,S=null==r?void 0:r.store,r&&console.warn("R3F.createRoot should only be called once!"),M="function"==typeof reportError?reportError:console.error,B=S||(P=(A=(w=(T=(e,t)=>{let n,i=new e_,r=new e_,a=new e_;function s(e=t().camera,n=r,o=t().size){let{width:l,height:u,top:c,left:h}=o,d=l/u;n.isVector3?a.copy(n):a.set(...n);let p=e.getWorldPosition(i).distanceTo(a);if(e&&e.isOrthographicCamera)return{width:l/e.zoom,height:u/e.zoom,top:c,left:h,factor:1,distance:p,aspect:d};{let t=2*Math.tan(e.fov*Math.PI/180/2)*p,n=l/u*t;return{width:n,height:t,top:c,left:h,factor:l/n,distance:p,aspect:d}}}let o=t=>e(e=>({performance:{...e.performance,current:t}})),l=new eg;return{set:e,get:t,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>h$(t(),e),advance:(e,n)=>hQ(e,n,t()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new oR,pointer:l,mouse:l,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=t();n&&clearTimeout(n),e.performance.current!==e.performance.min&&o(e.performance.min),n=setTimeout(()=>o(t().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:s},setEvents:t=>e(e=>({...e,events:{...e.events,...t}})),setSize:(n,i,a=0,o=0)=>{let l=t().camera,u={width:n,height:i,top:a,left:o};e(e=>({size:u,viewport:{...e.viewport,...s(l,r,u)}}))},setDpr:t=>e(e=>{let n=c2(t);return{viewport:{...e.viewport,dpr:n,initialDpr:e.viewport.initialDpr||n}}}),setFrameloop:(n="always")=>{let i=t().clock;i.stop(),i.elapsedTime=0,"never"!==n&&(i.start(),i.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:R.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,i)=>{let r=t().internal;return r.priority=r.priority+ +(n>0),r.subscribers.push({ref:e,priority:n,store:i}),r.subscribers=r.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let i=t().internal;null!=i&&i.subscribers&&(i.priority=i.priority-(n>0),i.subscribers=i.subscribers.filter(t=>t.ref!==e))}}}}})?cB(T,void 0):cB).getState()).size,L=A.viewport.dpr,D=A.camera,w.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:i,set:r}=w.getState();if(t.width!==P.width||t.height!==P.height||n.dpr!==L){P=t,L=n.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix());n.dpr>0&&i.setPixelRatio(n.dpr);let r="u">typeof HTMLCanvasElement&&i.domElement instanceof HTMLCanvasElement;i.setSize(t.width,t.height,r)}e!==D&&(D=e,r(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),w.subscribe(e=>h$(e)),w),H=x||hB.createContainer(B,1,null,!1,null,"",M,M,M,null),r||hz.set(e,{fiber:H,store:B}),V=!1,G=null,k.current={async configure(t={}){var r,a;let s;G=new Promise(e=>s=e);let{gl:o,size:l,scene:u,events:c,onCreated:h,shadows:d=!1,linear:p=!1,flat:f=!1,legacy:m=!1,orthographic:g=!1,frameloop:v="always",dpr:_=[1,2],performance:y,raycaster:x,camera:b,onPointerMissed:S}=t,M=B.getState(),T=M.gl;if(!M.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"==typeof o?await o(t):o;T=hh(n)?n:new cU({...t,...o}),M.set({gl:T})}let w=M.raycaster;w||M.set({raycaster:w=new oE});let{params:E,...A}=x||{};if(c4.equ(A,w,hk)||hs(w,{...A}),c4.equ(E,w.params,hk)||hs(w,{params:{...w.params,...E}}),!M.camera||M.camera===i&&!c4.equ(i,b,hk)){i=b;let e=null==b?void 0:b.isCamera,t=e?b:g?new sR(0,0,0,0,.1,1e3):new sT(75,0,.1,1e3);!e&&(t.position.z=5,b&&(hs(t,b),!t.manual&&("aspect"in b||"left"in b||"right"in b||"bottom"in b||"top"in b)&&(t.manual=!0,t.updateProjectionMatrix())),M.camera||null!=b&&b.rotation||t.lookAt(0,0,0)),M.set({camera:t}),w.camera=t}if(!M.scene){let e;null!=u&&u.isScene?c8(e=u,B,"",{}):(c8(e=new tv,B,"",{}),u&&hs(e,u)),M.set({scene:e})}c&&!M.events.handlers&&M.set({events:c(B)});let C=function(e,t){if(!t&&"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:i,left:r}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:r}}return!t&&"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,l);if(c4.equ(C,M.size,hk)||M.setSize(C.width,C.height,C.top,C.left),_&&M.viewport.dpr!==c2(_)&&M.setDpr(_),M.frameloop!==v&&M.setFrameloop(v),M.onPointerMissed||M.set({onPointerMissed:S}
558),y&&!c4.equ(y,M.performance,hk)&&M.set(e=>({performance:{...e.performance,...y}})),!M.xr){let e=(e,t)=>{let n=B.getState();"never"!==n.frameloop&&hQ(e,!0,n,t)},t=()=>{let t=B.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||h$(t)},n={connect(){let e=B.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=B.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(r=T.xr)?void 0:r.addEventListener)&&n.connect(),M.set({xr:n})}if(T.shadowMap){let e=T.shadowMap.enabled,t=T.shadowMap.type;T.shadowMap.enabled=!!d,c4.boo(d)?T.shadowMap.type=2:c4.str(d)?T.shadowMap.type=null!=(a=({basic:0,percentage:1,soft:2,variance:3})[d])?a:2:c4.obj(d)&&Object.assign(T.shadowMap,d),(e!==T.shadowMap.enabled||t!==T.shadowMap.type)&&(T.shadowMap.needsUpdate=!0)}return ew.enabled=!m,V||(T.outputColorSpace=p?O:"srgb",T.toneMapping=4*!f),M.legacy!==m&&M.set(()=>({legacy:m})),M.linear!==p&&M.set(()=>({linear:p})),M.flat!==f&&M.set(()=>({flat:f})),!o||c4.fun(o)||hh(o)||c4.equ(o,T,hk)||hs(T,o),n=h,V=!0,s(),this},render(t){return V||G||this.configure(),G.then(()=>{hB.updateContainer((0,C.jsx)(hH,{store:B,children:t,onCreated:n,rootElement:e}),H,null,()=>void 0)}),B},unmount(){hV(e)}}),async function(){await k.current.configure({gl:a,scene:y,events:s,shadows:u,linear:c,flat:h,legacy:d,orthographic:p,frameloop:f,dpr:m,performance:g,raycaster:v,camera:_,size:I,onPointerMissed:(...e)=>null==U.current?void 0:U.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(o?o&&o.hasOwnProperty("current")?o.current:o:N.current),l&&e.setEvents({compute:(e,t)=>{let n=e[l+"X"],i=e[l+"Y"];t.pointer.set(n/t.size.width*2-1,-(2*(i/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==b||b(e)}}),k.current.render((0,C.jsx)(E,{children:(0,C.jsx)(c1,{set:z,children:(0,C.jsx)(R.Suspense,{fallback:(0,C.jsx)(c0,{set:F}),children:null!=t?t:null})})}))}()}}),R.useEffect(()=>{let e=L.current;if(e)return()=>hV(e)},[]);let H=o?"none":"auto";return(0,C.jsx)("div",{ref:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:H,...r},...S,children:(0,C.jsx)("div",{ref:P,style:{width:"100%",height:"100%"},children:(0,C.jsx)("canvas",{ref:L,style:{display:"block"},children:n})})})}function fA(e){return(0,C.jsx)(cX,{children:(0,C.jsx)(fE,{...e})})}class fC extends R.Component{static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?(0,C.jsx)("div",{}):this.props.children}constructor(...e){super(...e),function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"state",{hasError:!1})}}let fR=(0,R.forwardRef)(({children:e,...t},n)=>(0,C.jsx)(fC,{children:(0,C.jsx)(fA,{...t,resize:{debounce:0},ref:n,children:e})})),fP=[1,1.5],fI=({threeDAsset:e,progress:t=0,onLoad:n,className:i,active:r,animation:a})=>(0,C.jsx)(fR,{frameloop:r?"always":"never",className:i,dpr:fP,linear:!0,children:e&&(0,C.jsx)(fM,{threeDId:e,progress:t,onLoad:n,animation:a})})},9897(e,t,n){var i=n(71763),r=n(48412);let a={isLoading:void 0,response:void 0,error:void 0};n.d(t,{},{A:({afterMount:e=!1,returnPromise:t=!1,...n}={})=>{let s=(0,i.useRef)(void 0),o=(0,i.useRef)(!1),l=(0,i.useRef)(n),[u,c]=(0,i.useReducer)((e,t)=>{switch(t.type){case"AXIOS_HOOK_ACTIONS_START":return{...e,isLoading:!0};case"AXIOS_HOOK_ACTIONS_END":return{...e,isLoading:!1,response:t.payload,error:t.error};case"AXIOS_HOOK_ACTIONS_RESET":return a;default:return e}},a),h=(0,i.useCallback)(async(e,n)=>{let i=new AbortController;n?.abort(),s.current=i;try{c({type:"AXIOS_HOOK_ACTIONS_START"});let n=await (0,r.A)({...e,signal:s.current?.signal});return t?c({type:"AXIOS_HOOK_ACTIONS_END"}):c({type:"AXIOS_HOOK_ACTIONS_END",payload:n}),n}catch(e){if(o.current&&r.A.isAxiosError(e)&&(t?c({type:"AXIOS_HOOK_ACTIONS_END"}):c({type:"AXIOS_HOOK_ACTIONS_END",error:e})),t)throw e;return}},[t]),d=(0,i.useCallback)(()=>
558{s.current?.abort(),s.current=new AbortController,c({type:"AXIOS_HOOK_ACTIONS_RESET"})},[]);return(0,i.useEffect)(()=>(e&&!o.current&&(s.current=new AbortController,h(l.current,s.current)),o.current=!0,()=>{o.current=!1,s.current?.abort()}),[e,h]),[u,(0,i.useCallback)(e=>h({...l.current,...e},s.current),[]),d]}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.