cuelo 0.7.2 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +6 -5
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +27 -3
  5. package/.next/react-loadable-manifest.json +13 -3
  6. package/.next/required-server-files.js +2 -2
  7. package/.next/required-server-files.json +2 -2
  8. package/.next/routes-manifest.json +6 -0
  9. package/.next/server/app/_global-error/page.js +3 -3
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/_not-found/page.js +2 -2
  20. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/_not-found.html +1 -1
  22. package/.next/server/app/_not-found.rsc +3 -3
  23. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  24. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  26. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/api/agent/[id]/account/route.js +1 -1
  30. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  31. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  32. package/.next/server/app/api/agent/[id]/route.js +1 -1
  33. package/.next/server/app/api/agent/new/route.js +1 -1
  34. package/.next/server/app/api/agent/running/route.js +1 -1
  35. package/.next/server/app/api/attachments/route.js +2 -2
  36. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  37. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  38. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  39. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  40. package/.next/server/app/api/auth/providers/route.js +1 -1
  41. package/.next/server/app/api/cwd/browse/route.js +1 -1
  42. package/.next/server/app/api/cwd/validate/route.js +1 -1
  43. package/.next/server/app/api/default-cwd/route.js +1 -1
  44. package/.next/server/app/api/display-settings/route.js +1 -1
  45. package/.next/server/app/api/document-text/route.js +2 -2
  46. package/.next/server/app/api/experiments/route.js +1 -1
  47. package/.next/server/app/api/file-index/route.js +1 -1
  48. package/.next/server/app/api/files/[...path]/route.js +1 -1
  49. package/.next/server/app/api/git/diff/route.js +1 -1
  50. package/.next/server/app/api/git/status/route.js +2 -2
  51. package/.next/server/app/api/gpt6/handles/route.js +1 -1
  52. package/.next/server/app/api/gpt6/reply/route.js +1 -1
  53. package/.next/server/app/api/gpt6/token/route.js +1 -1
  54. package/.next/server/app/api/gpt6/web6-session/route.js +1 -1
  55. package/.next/server/app/api/home/route.js +1 -1
  56. package/.next/server/app/api/live/call/[callId]/route.js +1 -1
  57. package/.next/server/app/api/live/character-voice/route.js +1 -1
  58. package/.next/server/app/api/live/events/route.js +2 -2
  59. package/.next/server/app/api/live/offer/route.js +1 -1
  60. package/.next/server/app/api/live/voices/route.js +1 -1
  61. package/.next/server/app/api/lounge/events/route.js +2 -2
  62. package/.next/server/app/api/lounge/route.js +1 -1
  63. package/.next/server/app/api/mcp/route.js +2 -2
  64. package/.next/server/app/api/model-roles/route.js +1 -1
  65. package/.next/server/app/api/models/route.js +1 -1
  66. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  67. package/.next/server/app/api/models-config/discover/route.js +1 -1
  68. package/.next/server/app/api/models-config/route.js +3 -3
  69. package/.next/server/app/api/models-config/test/route.js +1 -1
  70. package/.next/server/app/api/plugins/route.js +1 -1
  71. package/.next/server/app/api/project-trust/route.js +1 -1
  72. package/.next/server/app/api/projects/route.js +2 -2
  73. package/.next/server/app/api/runs/[runId]/route.js +1 -1
  74. package/.next/server/app/api/runs/route.js +1 -1
  75. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  76. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  77. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  79. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  80. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  81. package/.next/server/app/api/sessions/route.js +1 -1
  82. package/.next/server/app/api/sessions/search/route.js +1 -1
  83. package/.next/server/app/api/settings/route.js +1 -1
  84. package/.next/server/app/api/sidecars/[service]/[...path]/route.js +1 -1
  85. package/.next/server/app/api/skills/check/route.js +1 -1
  86. package/.next/server/app/api/skills/install/route.js +2 -2
  87. package/.next/server/app/api/skills/route.js +2 -2
  88. package/.next/server/app/api/skills/search/route.js +1 -1
  89. package/.next/server/app/api/skills/update/route.js +1 -1
  90. package/.next/server/app/api/theme/route.js +1 -1
  91. package/.next/server/app/api/tool-image/route.js +1 -1
  92. package/.next/server/app/api/update-maintenance/route.js +2 -2
  93. package/.next/server/app/api/updates/route.js +1 -1
  94. package/.next/server/app/api/web-access/recovery/route.js +1 -1
  95. package/.next/server/app/api/web-access/route.js +1 -1
  96. package/.next/server/app/api/web6/consults/route.js +1 -1
  97. package/.next/server/app/api/worktrees/route.js +1 -1
  98. package/.next/server/app/favicon.ico/route.js +1 -1
  99. package/.next/server/app/index.html +1 -1
  100. package/.next/server/app/index.rsc +7 -6
  101. package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -4
  102. package/.next/server/app/index.segments/_full.segment.rsc +7 -6
  103. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  104. package/.next/server/app/index.segments/_index.segment.rsc +3 -3
  105. package/.next/server/app/index.segments/_tree.segment.rsc +4 -3
  106. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  107. package/.next/server/app/office-preview/page.js +2 -0
  108. package/.next/server/app/office-preview/page.js.nft.json +1 -0
  109. package/.next/server/app/office-preview/page_client-reference-manifest.js +1 -0
  110. package/.next/server/app/office-preview.html +1 -0
  111. package/.next/server/app/office-preview.meta +16 -0
  112. package/.next/server/app/office-preview.rsc +20 -0
  113. package/.next/server/app/office-preview.segments/_full.segment.rsc +20 -0
  114. package/.next/server/app/office-preview.segments/_head.segment.rsc +6 -0
  115. package/.next/server/app/office-preview.segments/_index.segment.rsc +7 -0
  116. package/.next/server/app/office-preview.segments/_tree.segment.rsc +4 -0
  117. package/.next/server/app/office-preview.segments/office-preview/__PAGE__.segment.rsc +7 -0
  118. package/.next/server/app/office-preview.segments/office-preview.segment.rsc +5 -0
  119. package/.next/server/app/page.js +19 -19
  120. package/.next/server/app/page.js.nft.json +1 -1
  121. package/.next/server/app/page_client-reference-manifest.js +1 -1
  122. package/.next/server/app/recover/page.js +2 -2
  123. package/.next/server/app/recover/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/recover.html +1 -1
  125. package/.next/server/app/recover.rsc +3 -3
  126. package/.next/server/app/recover.segments/_full.segment.rsc +3 -3
  127. package/.next/server/app/recover.segments/_head.segment.rsc +1 -1
  128. package/.next/server/app/recover.segments/_index.segment.rsc +3 -3
  129. package/.next/server/app/recover.segments/_tree.segment.rsc +2 -2
  130. package/.next/server/app/recover.segments/recover/__PAGE__.segment.rsc +1 -1
  131. package/.next/server/app/recover.segments/recover.segment.rsc +1 -1
  132. package/.next/server/app-paths-manifest.json +6 -5
  133. package/.next/server/chunks/205.js +3 -2
  134. package/.next/server/chunks/2607.js +1 -0
  135. package/.next/server/chunks/3602.js +353 -0
  136. package/.next/server/chunks/6429.js +3 -3
  137. package/.next/server/middleware-build-manifest.js +1 -1
  138. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  139. package/.next/server/pages/404.html +1 -1
  140. package/.next/server/pages/500.html +1 -1
  141. package/.next/server/server-reference-manifest.json +1 -1
  142. package/.next/static/_VEUT2T9aZcGJdOeXmxhm/_buildManifest.js +1 -0
  143. package/.next/static/chunks/1937.70e7ce89f87f1119.js +1 -0
  144. package/.next/static/chunks/2992.16b931bb2dfe8845.js +1 -0
  145. package/.next/static/chunks/{3308.34ea31e24088c85f.js → 3308.8b94b38809d1b8b6.js} +1 -1
  146. package/.next/static/chunks/52733464.85a1551044fef357.js +1 -0
  147. package/.next/static/chunks/9304.1f940d490ea5c972.js +1 -0
  148. package/.next/static/chunks/9889-481b318dcf48ee30.js +1 -0
  149. package/.next/static/chunks/app/{layout-fc24ec6959a6cba5.js → layout-27cec017946e8765.js} +1 -1
  150. package/.next/static/chunks/app/office-preview/page-5874dc1ab28d3b1d.js +1 -0
  151. package/.next/static/chunks/app/page-95261aed574d5860.js +22 -0
  152. package/.next/static/chunks/b536a0f1.f7e390612229faa9.js +342 -0
  153. package/.next/static/chunks/bd904a5c.b74776e0b23d0607.js +1 -0
  154. package/.next/static/chunks/f5ef5e1c.14b6095722ff4f0b.js +12 -0
  155. package/.next/static/chunks/{framework-32a7466d5cae4a81.js → framework-e405bc515d75023a.js} +1 -1
  156. package/.next/static/chunks/webpack-d2da69f7c8164141.js +1 -0
  157. package/.next/static/css/001d6e9d9d06b017.css +1 -0
  158. package/.next/static/css/{88929dd0c6d44c84.css → 67b6e19482963224.css} +1 -1
  159. package/.next/static/css/{27f16a2ddaff39eb.css → abd3d00cca9457f7.css} +1 -1
  160. package/.next/trace +106 -106
  161. package/.next/trace-build +1 -1
  162. package/.next/types/app/office-preview/page.ts +87 -0
  163. package/.next/types/routes.d.ts +2 -1
  164. package/.next/types/validator.ts +9 -0
  165. package/README.md +6 -4
  166. package/Tools/CUELO_Setup/files/native-runtime-patch.js +5 -5
  167. package/Tools/OMP_Global_Config/agent/extensions/character-voice.ts +2 -2
  168. package/Tools/OMP_Global_Config/agent/extensions/lib/maker-routing.ts +32 -1
  169. package/Tools/OMP_Global_Config/agent/tools/git-finalizer/index.ts +45 -5
  170. package/Tools/OMP_Global_Config/patches/apply-core-patch.mjs +246 -392
  171. package/install.mjs +6 -2
  172. package/package.json +10 -7
  173. package/public/office3d/ASSETS.md +8 -0
  174. package/.next/static/5vW3pyOv87cK3zk2pchwv/_buildManifest.js +0 -1
  175. package/.next/static/chunks/2619.9aac8983f30c7c8a.js +0 -1
  176. package/.next/static/chunks/52733464.3870f99cc446f9ff.js +0 -1
  177. package/.next/static/chunks/app/page-11dfb512f246679c.js +0 -22
  178. package/.next/static/chunks/webpack-b1a76402d0d0fa1a.js +0 -1
  179. /package/.next/static/{5vW3pyOv87cK3zk2pchwv → _VEUT2T9aZcGJdOeXmxhm}/_ssgManifest.js +0 -0
@@ -0,0 +1,353 @@
1
+ "use strict";exports.id=3602,exports.ids=[3602],exports.modules={13602:(a,b,c)=>{let d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;c.r(b),c.d(b,{default:()=>pJ});var t,u,v,w,x,y,z={};c.r(z),c.d(z,{ACESFilmicToneMapping:()=>aF,AddEquation:()=>Y,AddOperation:()=>aA,AdditiveAnimationBlendMode:()=>b9,AdditiveBlending:()=>T,AgXToneMapping:()=>aH,AlphaFormat:()=>bf,AlwaysCompare:()=>cO,AlwaysDepth:()=>ar,AlwaysStencilFunc:()=>cG,AmbientLight:()=>jP,AnimationAction:()=>kA,AnimationClip:()=>je,AnimationLoader:()=>jn,AnimationMixer:()=>kC,AnimationObjectGroup:()=>kz,AnimationUtils:()=>i$,ArcCurve:()=>hH,ArrayCamera:()=>ka,ArrowHelper:()=>lp,AttachedBindMode:()=>aJ,Audio:()=>kj,AudioAnalyser:()=>kp,AudioContext:()=>j3,AudioListener:()=>ki,AudioLoader:()=>j4,AxesHelper:()=>lq,BackSide:()=>P,BasicDepthPacking:()=>cd,BasicShadowMap:()=>K,BatchedMesh:()=>gX,BezierInterpolant:()=>i3,Bone:()=>gm,BooleanKeyframeTrack:()=>i7,Box2:()=>kS,Box3:()=>eO,Box3Helper:()=>lm,BoxGeometry:()=>ht,BoxHelper:()=>ll,BufferAttribute:()=>e8,BufferGeometry:()=>ft,BufferGeometryLoader:()=>jX,ByteType:()=>a3,Cache:()=>jf,Camera:()=>jD,CameraHelper:()=>li,CanvasTexture:()=>ho,CapsuleGeometry:()=>hu,CatmullRomCurve3:()=>hO,CineonToneMapping:()=>aE,CircleGeometry:()=>hv,ClampToEdgeWrapping:()=>aS,Clock:()=>kN,Color:()=>ev,ColorKeyframeTrack:()=>i8,ColorManagement:()=>dG,Compatibility:()=>c3,CompressedArrayTexture:()=>hl,CompressedCubeTexture:()=>hm,CompressedTexture:()=>hk,CompressedTextureLoader:()=>jo,ConeGeometry:()=>hx,ConstantAlphaFactor:()=>ao,ConstantColorFactor:()=>am,Controls:()=>ls,CubeCamera:()=>j9,CubeDepthTexture:()=>hr,CubeReflectionMapping:()=>aM,CubeRefractionMapping:()=>aN,CubeTexture:()=>hn,CubeTextureLoader:()=>jr,CubeUVReflectionMapping:()=>aQ,CubicBezierCurve:()=>hS,CubicBezierCurve3:()=>hT,CubicInterpolant:()=>i0,CullFaceBack:()=>H,CullFaceFront:()=>I,CullFaceFrontBack:()=>J,CullFaceNone:()=>G,Curve:()=>hF,CurvePath:()=>h$,CustomBlending:()=>W,CustomToneMapping:()=>aG,CylinderGeometry:()=>hw,Cylindrical:()=>kP,Data3DTexture:()=>dW,DataArrayTexture:()=>dU,DataTexture:()=>gn,DataTextureLoader:()=>js,DataUtils:()=>e4,DecrementStencilOp:()=>cv,DecrementWrapStencilOp:()=>cx,DefaultLoadingManager:()=>ji,DepthFormat:()=>bi,DepthStencilFormat:()=>bj,DepthTexture:()=>hq,DetachedBindMode:()=>aK,DirectionalLight:()=>jO,DirectionalLightHelper:()=>lf,DiscreteInterpolant:()=>i2,DodecahedronGeometry:()=>hz,DoubleSide:()=>Q,DstAlphaFactor:()=>ah,DstColorFactor:()=>aj,DynamicCopyUsage:()=>cW,DynamicDrawUsage:()=>cQ,DynamicReadUsage:()=>cT,EdgesGeometry:()=>hE,EllipseCurve:()=>hG,EqualCompare:()=>cJ,EqualDepth:()=>au,EqualStencilFunc:()=>cB,EquirectangularReflectionMapping:()=>aO,EquirectangularRefractionMapping:()=>aP,Euler:()=>d6,EventDispatcher:()=>dk,ExternalTexture:()=>hs,ExtrudeGeometry:()=>im,FileLoader:()=>jm,Float16BufferAttribute:()=>fg,Float32BufferAttribute:()=>fh,FloatType:()=>a8,Fog:()=>ey,FogExp2:()=>ex,FramebufferTexture:()=>hj,FrontSide:()=>O,Frustum:()=>gD,FrustumArray:()=>gF,GLBufferAttribute:()=>kI,GLSL1:()=>cY,GLSL3:()=>cZ,GreaterCompare:()=>cL,GreaterDepth:()=>aw,GreaterEqualCompare:()=>cN,GreaterEqualDepth:()=>av,GreaterEqualStencilFunc:()=>cF,GreaterStencilFunc:()=>cD,GridHelper:()=>la,Group:()=>eo,HTMLTexture:()=>hp,HalfFloatType:()=>a9,HemisphereLight:()=>jv,HemisphereLightHelper:()=>k9,IcosahedronGeometry:()=>ip,ImageBitmapLoader:()=>j2,ImageLoader:()=>jq,ImageUtils:()=>dJ,IncrementStencilOp:()=>cu,IncrementWrapStencilOp:()=>cw,InstancedBufferAttribute:()=>gr,InstancedBufferGeometry:()=>jW,InstancedInterleavedBuffer:()=>kH,InstancedMesh:()=>gz,Int16BufferAttribute:()=>fc,Int32BufferAttribute:()=>fe,Int8BufferAttribute:()=>e9,IntType:()=>a6,InterleavedBuffer:()=>fu,InterleavedBufferAttribute:()=>fw,Interpolant:()=>i_,InterpolateBezier:()=>b4,InterpolateDiscrete:()=>b1,InterpolateLinear:()=>b2,InterpolateSmooth:()=>b3,InterpolationSamplingMode:()=>c2,InterpolationSamplingType:()=>c1,InvertStencilOp:()=>cy,KeepStencilOp:()=>cs,KeyframeTrack:()=>i5,LOD:()=>fU,LatheGeometry:()=>iq,Layers:()=>d7,LessCompare:()=>cI,LessDepth:()=>as,LessEqualCompare:()=>cK,LessEqualDepth:()=>at,LessEqualStencilFunc:()=>cC,LessStencilFunc:()=>cA,Light:()=>ju,LightProbe:()=>jS,LightShadow:()=>jz,Line:()=>g4,Line3:()=>k$,LineBasicMaterial:()=>gY,LineCurve:()=>hU,LineCurve3:()=>hV,LineDashedMaterial:()=>iU,LineLoop:()=>g9,LineSegments:()=>g8,LinearFilter:()=>aZ,LinearInterpolant:()=>i1,LinearMipMapLinearFilter:()=>a1,LinearMipMapNearestFilter:()=>a_,LinearMipmapLinearFilter:()=>a0,LinearMipmapNearestFilter:()=>a$,LinearSRGBColorSpace:()=>cl,LinearToneMapping:()=>aC,LinearTransfer:()=>cm,Loader:()=>jj,LoaderUtils:()=>jV,LoadingManager:()=>jh,LoopOnce:()=>b$,LoopPingPong:()=>b0,LoopRepeat:()=>b_,MOUSE:()=>E,Material:()=>fC,MaterialBlending:()=>X,MaterialLoader:()=>jU,MathUtils:()=>dw,Matrix2:()=>kQ,Matrix3:()=>dC,Matrix4:()=>dY,MaxEquation:()=>aa,Mesh:()=>ga,MeshBasicMaterial:()=>f$,MeshDepthMaterial:()=>iR,MeshDistanceMaterial:()=>iS,MeshLambertMaterial:()=>iQ,MeshMatcapMaterial:()=>iT,MeshNormalMaterial:()=>iP,MeshPhongMaterial:()=>iN,MeshPhysicalMaterial:()=>iM,MeshStandardMaterial:()=>iL,MeshToonMaterial:()=>iO,MinEquation:()=>_,MirroredRepeatWrapping:()=>aT,MixOperation:()=>az,MultiplyBlending:()=>V,MultiplyOperation:()=>ay,NearestFilter:()=>aU,NearestMipMapLinearFilter:()=>aY,NearestMipMapNearestFilter:()=>aW,NearestMipmapLinearFilter:()=>aX,NearestMipmapNearestFilter:()=>aV,NeutralToneMapping:()=>aI,NeverCompare:()=>cH,NeverDepth:()=>aq,NeverStencilFunc:()=>cz,NoBlending:()=>R,NoColorSpace:()=>cj,NoNormalPacking:()=>co,NoToneMapping:()=>aB,NormalAnimationBlendMode:()=>b8,NormalBlending:()=>S,NormalGAPacking:()=>cq,NormalRGPacking:()=>cp,NotEqualCompare:()=>cM,NotEqualDepth:()=>ax,NotEqualStencilFunc:()=>cE,NumberKeyframeTrack:()=>i9,Object3D:()=>en,ObjectLoader:()=>jZ,ObjectSpaceNormalMap:()=>ci,OctahedronGeometry:()=>ir,OneFactor:()=>ac,OneMinusConstantAlphaFactor:()=>ap,OneMinusConstantColorFactor:()=>an,OneMinusDstAlphaFactor:()=>ai,OneMinusDstColorFactor:()=>ak,OneMinusSrcAlphaFactor:()=>ag,OneMinusSrcColorFactor:()=>ae,OrthographicCamera:()=>jM,PCFShadowMap:()=>L,PCFSoftShadowMap:()=>M,PMREMGenerator:()=>lQ,Path:()=>h_,PerspectiveCamera:()=>jH,Plane:()=>fA,PlaneGeometry:()=>is,PlaneHelper:()=>ln,PointLight:()=>jL,PointLightHelper:()=>k5,Points:()=>hf,PointsMaterial:()=>ha,PolarGridHelper:()=>lb,PolyhedronGeometry:()=>hy,PositionalAudio:()=>ko,PropertyBinding:()=>ky,PropertyMixer:()=>kq,QuadraticBezierCurve:()=>hW,QuadraticBezierCurve3:()=>hX,Quaternion:()=>dy,QuaternionKeyframeTrack:()=>jb,QuaternionLinearInterpolant:()=>ja,R11_EAC_Format:()=>bB,RED_GREEN_RGTC2_Format:()=>bY,RED_RGTC1_Format:()=>bW,REVISION:()=>D,RG11_EAC_Format:()=>bD,RGBADepthPacking:()=>ce,RGBAFormat:()=>bh,RGBAIntegerFormat:()=>bp,RGBA_ASTC_10x10_Format:()=>bQ,RGBA_ASTC_10x5_Format:()=>bN,RGBA_ASTC_10x6_Format:()=>bO,RGBA_ASTC_10x8_Format:()=>bP,RGBA_ASTC_12x10_Format:()=>bR,RGBA_ASTC_12x12_Format:()=>bS,RGBA_ASTC_4x4_Format:()=>bF,RGBA_ASTC_5x4_Format:()=>bG,RGBA_ASTC_5x5_Format:()=>bH,RGBA_ASTC_6x5_Format:()=>bI,RGBA_ASTC_6x6_Format:()=>bJ,RGBA_ASTC_8x5_Format:()=>bK,RGBA_ASTC_8x6_Format:()=>bL,RGBA_ASTC_8x8_Format:()=>bM,RGBA_BPTC_Format:()=>bT,RGBA_ETC2_EAC_Format:()=>bA,RGBA_PVRTC_2BPPV1_Format:()=>bx,RGBA_PVRTC_4BPPV1_Format:()=>bw,RGBA_S3TC_DXT1_Format:()=>br,RGBA_S3TC_DXT3_Format:()=>bs,RGBA_S3TC_DXT5_Format:()=>bt,RGBDepthPacking:()=>cf,RGBFormat:()=>bg,RGBIntegerFormat:()=>bo,RGB_BPTC_SIGNED_Format:()=>bU,RGB_BPTC_UNSIGNED_Format:()=>bV,RGB_ETC1_Format:()=>by,RGB_ETC2_Format:()=>bz,RGB_PVRTC_2BPPV1_Format:()=>bv,RGB_PVRTC_4BPPV1_Format:()=>bu,RGB_S3TC_DXT1_Format:()=>bq,RGDepthPacking:()=>cg,RGFormat:()=>bm,RGIntegerFormat:()=>bn,RawShaderMaterial:()=>iK,Ray:()=>fZ,Raycaster:()=>kK,RectAreaLight:()=>jQ,RedFormat:()=>bk,RedIntegerFormat:()=>bl,ReinhardToneMapping:()=>aD,RenderObjectRefreshType:()=>c4,RenderTarget:()=>dS,RenderTarget3D:()=>kD,RepeatWrapping:()=>aR,ReplaceStencilOp:()=>ct,ReverseSubtractEquation:()=>$,RingGeometry:()=>it,SIGNED_R11_EAC_Format:()=>bC,SIGNED_RED_GREEN_RGTC2_Format:()=>bZ,SIGNED_RED_RGTC1_Format:()=>bX,SIGNED_RG11_EAC_Format:()=>bE,SRGBColorSpace:()=>ck,SRGBTransfer:()=>cn,Scene:()=>ez,ShaderChunk:()=>lx,ShaderLib:()=>lz,ShaderMaterial:()=>iJ,ShadowMaterial:()=>iD,Shape:()=>h0,ShapeGeometry:()=>iu,ShapePath:()=>lr,ShapeUtils:()=>ij,ShortType:()=>a4,Skeleton:()=>gq,SkeletonHelper:()=>k4,SkinnedMesh:()=>gl,Source:()=>dN,Sphere:()=>fl,SphereGeometry:()=>iv,Spherical:()=>kO,SphericalHarmonics3:()=>jR,SplineCurve:()=>hY,SpotLight:()=>jJ,SpotLightHelper:()=>k0,Sprite:()=>fQ,SpriteMaterial:()=>fD,SrcAlphaFactor:()=>af,SrcAlphaSaturateFactor:()=>al,SrcColorFactor:()=>ad,StaticCopyUsage:()=>cV,StaticDrawUsage:()=>cP,StaticReadUsage:()=>cS,StereoCamera:()=>j8,StreamCopyUsage:()=>cX,StreamDrawUsage:()=>cR,StreamReadUsage:()=>cU,StringKeyframeTrack:()=>jc,SubtractEquation:()=>Z,SubtractiveBlending:()=>U,TOUCH:()=>F,TangentSpaceNormalMap:()=>ch,TetrahedronGeometry:()=>iw,Texture:()=>dQ,TextureLoader:()=>jt,TextureSource:()=>dL,TextureUtils:()=>lu,Timer:()=>kb,TimestampQuery:()=>c0,TorusGeometry:()=>ix,TorusKnotGeometry:()=>iy,Triangle:()=>eN,TriangleFanDrawMode:()=>cc,TriangleStripDrawMode:()=>cb,TrianglesDrawMode:()=>ca,TubeGeometry:()=>iz,UVMapping:()=>aL,Uint16BufferAttribute:()=>fd,Uint32BufferAttribute:()=>ff,Uint8BufferAttribute:()=>fa,Uint8ClampedBufferAttribute:()=>fb,Uniform:()=>kE,UniformsGroup:()=>kG,UniformsLib:()=>ly,UniformsUtils:()=>iI,UnsignedByteType:()=>a2,UnsignedInt101111Type:()=>be,UnsignedInt248Type:()=>bc,UnsignedInt5999Type:()=>bd,UnsignedIntType:()=>a7,UnsignedShort4444Type:()=>ba,UnsignedShort5551Type:()=>bb,UnsignedShortType:()=>a5,VSMShadowMap:()=>N,Vector2:()=>dx,Vector3:()=>dz,Vector4:()=>dR,VectorKeyframeTrack:()=>jd,VideoFrameTexture:()=>hi,VideoTexture:()=>hh,WebGL3DRenderTarget:()=>dX,WebGLArrayRenderTarget:()=>dV,WebGLCoordinateSystem:()=>c$,WebGLCubeRenderTarget:()=>lW,WebGLRenderTarget:()=>dT,WebGLRenderer:()=>nS,WebGLUtils:()=>nH,WebGPUCoordinateSystem:()=>c_,WebXRController:()=>eq,WireframeGeometry:()=>iA,WrapAroundEnding:()=>b7,ZeroCurvatureEnding:()=>b5,ZeroFactor:()=>ab,ZeroSlopeEnding:()=>b6,ZeroStencilOp:()=>cr,createCanvasElement:()=>c9,error:()=>dh,getConsoleFunction:()=>dd,log:()=>de,setConsoleFunction:()=>dc,warn:()=>dg,warnOnce:()=>di});var A=c(48249),B=c(67484),C=c.n(B);let D="186",E={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},F={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},G=0,H=1,I=2,J=3,K=0,L=1,M=2,N=3,O=0,P=1,Q=2,R=0,S=1,T=2,U=3,V=4,W=5,X=6,Y=100,Z=101,$=102,_=103,aa=104,ab=200,ac=201,ad=202,ae=203,af=204,ag=205,ah=206,ai=207,aj=208,ak=209,al=210,am=211,an=212,ao=213,ap=214,aq=0,ar=1,as=2,at=3,au=4,av=5,aw=6,ax=7,ay=0,az=1,aA=2,aB=0,aC=1,aD=2,aE=3,aF=4,aG=5,aH=6,aI=7,aJ="attached",aK="detached",aL=300,aM=301,aN=302,aO=303,aP=304,aQ=306,aR=1e3,aS=1001,aT=1002,aU=1003,aV=1004,aW=1004,aX=1005,aY=1005,aZ=1006,a$=1007,a_=1007,a0=1008,a1=1008,a2=1009,a3=1010,a4=1011,a5=1012,a6=1013,a7=1014,a8=1015,a9=1016,ba=1017,bb=1018,bc=1020,bd=35902,be=35899,bf=1021,bg=1022,bh=1023,bi=1026,bj=1027,bk=1028,bl=1029,bm=1030,bn=1031,bo=1032,bp=1033,bq=33776,br=33777,bs=33778,bt=33779,bu=35840,bv=35841,bw=35842,bx=35843,by=36196,bz=37492,bA=37496,bB=37488,bC=37489,bD=37490,bE=37491,bF=37808,bG=37809,bH=37810,bI=37811,bJ=37812,bK=37813,bL=37814,bM=37815,bN=37816,bO=37817,bP=37818,bQ=37819,bR=37820,bS=37821,bT=36492,bU=36494,bV=36495,bW=36283,bX=36284,bY=36285,bZ=36286,b$=2200,b_=2201,b0=2202,b1=2300,b2=2301,b3=2302,b4=2303,b5=2400,b6=2401,b7=2402,b8=2500,b9=2501,ca=0,cb=1,cc=2,cd=3200,ce=3201,cf=3202,cg=3203,ch=0,ci=1,cj="",ck="srgb",cl="srgb-linear",cm="linear",cn="srgb",co="",cp="rg",cq="ga",cr=0,cs=7680,ct=7681,cu=7682,cv=7683,cw=34055,cx=34056,cy=5386,cz=512,cA=513,cB=514,cC=515,cD=516,cE=517,cF=518,cG=519,cH=512,cI=513,cJ=514,cK=515,cL=516,cM=517,cN=518,cO=519,cP=35044,cQ=35048,cR=35040,cS=35045,cT=35049,cU=35041,cV=35046,cW=35050,cX=35042,cY="100",cZ="300 es",c$=2e3,c_=2001,c0={COMPUTE:"compute",RENDER:"render"},c1={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},c2={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},c3={TEXTURE_COMPARE:"depthTextureCompare"},c4={NONE:0,SHARED:1,FULL:2},c5={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function c6(a,b){return new c5[a](b)}function c7(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)}function c8(a){return document.createElementNS("http://www.w3.org/1999/xhtml",a)}function c9(){let a=c8("canvas");return a.style.display="block",a}let da={},db=null;function dc(a){db=a}function dd(){return db}function de(...a){let b="THREE."+a.shift();db?db("log",b,...a):console.log(b,...a)}function df(a){let b=a[0];if("string"==typeof b&&b.startsWith("TSL:")){let b=a[1];b&&b.isStackTrace?a[0]+=" "+b.getLocation():a[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return a}function dg(...a){let b="THREE."+(a=df(a)).shift();if(db)db("warn",b,...a);else{let c=a[0];c&&c.isStackTrace?console.warn(c.getError(b)):console.warn(b,...a)}}function dh(...a){let b="THREE."+(a=df(a)).shift();if(db)db("error",b,...a);else{let c=a[0];c&&c.isStackTrace?console.error(c.getError(b)):console.error(b,...a)}}function di(...a){let b=a.join(" ");b in da||(da[b]=!0,dg(...a))}let dj={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class dk{addEventListener(a,b){void 0===this._listeners&&(this._listeners={});let c=this._listeners;void 0===c[a]&&(c[a]=[]),-1===c[a].indexOf(b)&&c[a].push(b)}hasEventListener(a,b){let c=this._listeners;return void 0!==c&&void 0!==c[a]&&-1!==c[a].indexOf(b)}removeEventListener(a,b){let c=this._listeners;if(void 0===c)return;let d=c[a];if(void 0!==d){let a=d.indexOf(b);-1!==a&&d.splice(a,1)}}dispatchEvent(a){let b=this._listeners;if(void 0===b)return;let c=b[a.type];if(void 0!==c){a.target=this;let b=c.slice(0);for(let c=0,d=b.length;c<d;c++)b[c].call(this,a);a.target=null}}}let dl=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],dm=1234567,dn=Math.PI/180,dp=180/Math.PI;function dq(){let a=0xffffffff*Math.random()|0,b=0xffffffff*Math.random()|0,c=0xffffffff*Math.random()|0,d=0xffffffff*Math.random()|0;return(dl[255&a]+dl[a>>8&255]+dl[a>>16&255]+dl[a>>24&255]+"-"+dl[255&b]+dl[b>>8&255]+"-"+dl[b>>16&15|64]+dl[b>>24&255]+"-"+dl[63&c|128]+dl[c>>8&255]+"-"+dl[c>>16&255]+dl[c>>24&255]+dl[255&d]+dl[d>>8&255]+dl[d>>16&255]+dl[d>>24&255]).toLowerCase()}function dr(a,b,c){return Math.max(b,Math.min(c,a))}function ds(a,b){return(a%b+b)%b}function dt(a,b,c){return(1-c)*a+c*b}function du(a,b){switch(b.constructor){case Float32Array:return a;case Uint32Array:return a/0xffffffff;case Uint16Array:return a/65535;case Uint8Array:case Uint8ClampedArray:return a/255;case Int32Array:return Math.max(a/0x7fffffff,-1);case Int16Array:return Math.max(a/32767,-1);case Int8Array:return Math.max(a/127,-1);default:throw Error("THREE.MathUtils: Invalid component type.")}}function dv(a,b){switch(b.constructor){case Float32Array:return a;case Uint32Array:return Math.round(0xffffffff*a);case Uint16Array:return Math.round(65535*a);case Uint8Array:case Uint8ClampedArray:return Math.round(255*a);case Int32Array:return Math.round(0x7fffffff*a);case Int16Array:return Math.round(32767*a);case Int8Array:return Math.round(127*a);default:throw Error("THREE.MathUtils: Invalid component type.")}}let dw={DEG2RAD:dn,RAD2DEG:dp,generateUUID:dq,clamp:dr,euclideanModulo:ds,mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},inverseLerp:function(a,b,c){return a!==b?(c-a)/(b-a):0},lerp:dt,damp:function(a,b,c,d){return dt(a,b,1-Math.exp(-c*d))},pingpong:function(a,b=1){return b-Math.abs(ds(a,2*b)-b)},smoothstep:function(a,b,c){return a<=b?0:a>=c?1:(a=(a-b)/(c-b))*a*(3-2*a)},smootherstep:function(a,b,c){return a<=b?0:a>=c?1:(a=(a-b)/(c-b))*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},seededRandom:function(a){void 0!==a&&(dm=a);let b=dm+=0x6d2b79f5;return b=Math.imul(b^b>>>15,1|b),(((b^=b+Math.imul(b^b>>>7,61|b))^b>>>14)>>>0)/0x100000000},degToRad:function(a){return a*dn},radToDeg:function(a){return a*dp},isPowerOfTwo:function(a){return a>0&&Number.isInteger(a)&&2**Math.round(Math.log2(a))===a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))},setQuaternionFromProperEuler:function(a,b,c,d,e){let f=Math.cos,g=Math.sin,h=f(c/2),i=g(c/2),j=f((b+d)/2),k=g((b+d)/2),l=f((b-d)/2),m=g((b-d)/2),n=f((d-b)/2),o=g((d-b)/2);switch(e){case"XYX":a.set(h*k,i*l,i*m,h*j);break;case"YZY":a.set(i*m,h*k,i*l,h*j);break;case"ZXZ":a.set(i*l,i*m,h*k,h*j);break;case"XZX":a.set(h*k,i*o,i*n,h*j);break;case"YXY":a.set(i*n,h*k,i*o,h*j);break;case"ZYZ":a.set(i*o,i*n,h*k,h*j);break;default:dg("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+e)}},normalize:dv,denormalize:du};class dx{static{dx.prototype.isVector2=!0}constructor(a=0,b=0){this.x=a,this.y=b}get width(){return this.x}set width(a){this.x=a}get height(){return this.y}set height(a){this.y=a}set(a,b){return this.x=a,this.y=b,this}setScalar(a){return this.x=a,this.y=a,this}setX(a){return this.x=a,this}setY(a){return this.y=a,this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("THREE.Vector2: index is out of range: "+a)}return this}getComponent(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("THREE.Vector2: index is out of range: "+a)}}clone(){return new this.constructor(this.x,this.y)}copy(a){return this.x=a.x,this.y=a.y,this}add(a){return this.x+=a.x,this.y+=a.y,this}addScalar(a){return this.x+=a,this.y+=a,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this}addScaledVector(a,b){return this.x+=a.x*b,this.y+=a.y*b,this}sub(a){return this.x-=a.x,this.y-=a.y,this}subScalar(a){return this.x-=a,this.y-=a,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this}multiply(a){return this.x*=a.x,this.y*=a.y,this}multiplyScalar(a){return this.x*=a,this.y*=a,this}divide(a){return this.x/=a.x,this.y/=a.y,this}divideScalar(a){return this.multiplyScalar(1/a)}applyMatrix3(a){let b=this.x,c=this.y,d=a.elements;return this.x=d[0]*b+d[3]*c+d[6],this.y=d[1]*b+d[4]*c+d[7],this}min(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this}max(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this}clamp(a,b){return this.x=dr(this.x,a.x,b.x),this.y=dr(this.y,a.y,b.y),this}clampScalar(a,b){return this.x=dr(this.x,a,b),this.y=dr(this.y,a,b),this}clampLength(a,b){let c=this.length();return this.divideScalar(c||1).multiplyScalar(dr(c,a,b))}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(a){return this.x*a.x+this.y*a.y}cross(a){return this.x*a.y-this.y*a.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(a){let b=Math.sqrt(this.lengthSq()*a.lengthSq());return 0===b?Math.PI/2:Math.acos(dr(this.dot(a)/b,-1,1))}distanceTo(a){return Math.sqrt(this.distanceToSquared(a))}distanceToSquared(a){let b=this.x-a.x,c=this.y-a.y;return b*b+c*c}manhattanDistanceTo(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)}setLength(a){return this.normalize().multiplyScalar(a)}lerp(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this}lerpVectors(a,b,c){return this.x=a.x+(b.x-a.x)*c,this.y=a.y+(b.y-a.y)*c,this}equals(a){return a.x===this.x&&a.y===this.y}fromArray(a,b=0){return this.x=a[b],this.y=a[b+1],this}toArray(a=[],b=0){return a[b]=this.x,a[b+1]=this.y,a}fromBufferAttribute(a,b){return this.x=a.getX(b),this.y=a.getY(b),this}rotateAround(a,b){let c=Math.cos(b),d=Math.sin(b),e=this.x-a.x,f=this.y-a.y;return this.x=e*c-f*d+a.x,this.y=e*d+f*c+a.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class dy{constructor(a=0,b=0,c=0,d=1){this.isQuaternion=!0,this._x=a,this._y=b,this._z=c,this._w=d}static slerpFlat(a,b,c,d,e,f,g){let h=c[d+0],i=c[d+1],j=c[d+2],k=c[d+3],l=e[f+0],m=e[f+1],n=e[f+2],o=e[f+3];if(k!==o||h!==l||i!==m||j!==n){let a=h*l+i*m+j*n+k*o;a<0&&(l=-l,m=-m,n=-n,o=-o,a=-a);let b=1-g;if(a<.9995){let c=Math.acos(a),d=Math.sin(c);h=h*(b=Math.sin(b*c)/d)+l*(g=Math.sin(g*c)/d),i=i*b+m*g,j=j*b+n*g,k=k*b+o*g}else{let a=1/Math.sqrt((h=h*b+l*g)*h+(i=i*b+m*g)*i+(j=j*b+n*g)*j+(k=k*b+o*g)*k);h*=a,i*=a,j*=a,k*=a}}a[b]=h,a[b+1]=i,a[b+2]=j,a[b+3]=k}static multiplyQuaternionsFlat(a,b,c,d,e,f){let g=c[d],h=c[d+1],i=c[d+2],j=c[d+3],k=e[f],l=e[f+1],m=e[f+2],n=e[f+3];return a[b]=g*n+j*k+h*m-i*l,a[b+1]=h*n+j*l+i*k-g*m,a[b+2]=i*n+j*m+g*l-h*k,a[b+3]=j*n-g*k-h*l-i*m,a}get x(){return this._x}set x(a){this._x=a,this._onChangeCallback()}get y(){return this._y}set y(a){this._y=a,this._onChangeCallback()}get z(){return this._z}set z(a){this._z=a,this._onChangeCallback()}get w(){return this._w}set w(a){this._w=a,this._onChangeCallback()}set(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._w=d,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(a){return this._x=a.x,this._y=a.y,this._z=a.z,this._w=a.w,this._onChangeCallback(),this}setFromEuler(a,b=!0){let c=a._x,d=a._y,e=a._z,f=a._order,g=Math.cos,h=Math.sin,i=g(c/2),j=g(d/2),k=g(e/2),l=h(c/2),m=h(d/2),n=h(e/2);switch(f){case"XYZ":this._x=l*j*k+i*m*n,this._y=i*m*k-l*j*n,this._z=i*j*n+l*m*k,this._w=i*j*k-l*m*n;break;case"YXZ":this._x=l*j*k+i*m*n,this._y=i*m*k-l*j*n,this._z=i*j*n-l*m*k,this._w=i*j*k+l*m*n;break;case"ZXY":this._x=l*j*k-i*m*n,this._y=i*m*k+l*j*n,this._z=i*j*n+l*m*k,this._w=i*j*k-l*m*n;break;case"ZYX":this._x=l*j*k-i*m*n,this._y=i*m*k+l*j*n,this._z=i*j*n-l*m*k,this._w=i*j*k+l*m*n;break;case"YZX":this._x=l*j*k+i*m*n,this._y=i*m*k+l*j*n,this._z=i*j*n-l*m*k,this._w=i*j*k-l*m*n;break;case"XZY":this._x=l*j*k-i*m*n,this._y=i*m*k-l*j*n,this._z=i*j*n+l*m*k,this._w=i*j*k+l*m*n;break;default:dg("Quaternion: .setFromEuler() encountered an unknown order: "+f)}return!0===b&&this._onChangeCallback(),this}setFromAxisAngle(a,b){let c=b/2,d=Math.sin(c);return this._x=a.x*d,this._y=a.y*d,this._z=a.z*d,this._w=Math.cos(c),this._onChangeCallback(),this}setFromRotationMatrix(a){let b=a.elements,c=b[0],d=b[4],e=b[8],f=b[1],g=b[5],h=b[9],i=b[2],j=b[6],k=b[10],l=c+g+k;if(l>0){let a=.5/Math.sqrt(l+1);this._w=.25/a,this._x=(j-h)*a,this._y=(e-i)*a,this._z=(f-d)*a}else if(c>g&&c>k){let a=2*Math.sqrt(1+c-g-k);this._w=(j-h)/a,this._x=.25*a,this._y=(d+f)/a,this._z=(e+i)/a}else if(g>k){let a=2*Math.sqrt(1+g-c-k);this._w=(e-i)/a,this._x=(d+f)/a,this._y=.25*a,this._z=(h+j)/a}else{let a=2*Math.sqrt(1+k-c-g);this._w=(f-d)/a,this._x=(e+i)/a,this._y=(h+j)/a,this._z=.25*a}return this._onChangeCallback(),this}setFromUnitVectors(a,b){let c=a.dot(b)+1;return c<1e-8?(c=0,Math.abs(a.x)>Math.abs(a.z)?(this._x=-a.y,this._y=a.x,this._z=0):(this._x=0,this._y=-a.z,this._z=a.y)):(this._x=a.y*b.z-a.z*b.y,this._y=a.z*b.x-a.x*b.z,this._z=a.x*b.y-a.y*b.x),this._w=c,this.normalize()}angleTo(a){return 2*Math.acos(Math.abs(dr(this.dot(a),-1,1)))}rotateTowards(a,b){let c=this.angleTo(a);if(0===c)return this;let d=Math.min(1,b/c);return this.slerp(a,d),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(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._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 a=this.length();return 0===a?(this._x=0,this._y=0,this._z=0,this._w=1):(a=1/a,this._x=this._x*a,this._y=this._y*a,this._z=this._z*a,this._w=this._w*a),this._onChangeCallback(),this}multiply(a){return this.multiplyQuaternions(this,a)}premultiply(a){return this.multiplyQuaternions(a,this)}multiplyQuaternions(a,b){let c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,i=b._z,j=b._w;return this._x=c*j+f*g+d*i-e*h,this._y=d*j+f*h+e*g-c*i,this._z=e*j+f*i+c*h-d*g,this._w=f*j-c*g-d*h-e*i,this._onChangeCallback(),this}slerp(a,b){let c=a._x,d=a._y,e=a._z,f=a._w,g=this.dot(a);g<0&&(c=-c,d=-d,e=-e,f=-f,g=-g);let h=1-b;if(g<.9995){let a=Math.acos(g),i=Math.sin(a);h=Math.sin(h*a)/i,b=Math.sin(b*a)/i,this._x=this._x*h+c*b,this._y=this._y*h+d*b,this._z=this._z*h+e*b,this._w=this._w*h+f*b,this._onChangeCallback()}else this._x=this._x*h+c*b,this._y=this._y*h+d*b,this._z=this._z*h+e*b,this._w=this._w*h+f*b,this.normalize();return this}slerpQuaternions(a,b,c){return this.copy(a).slerp(b,c)}random(){let a=2*Math.PI*Math.random(),b=2*Math.PI*Math.random(),c=Math.random(),d=Math.sqrt(1-c),e=Math.sqrt(c);return this.set(d*Math.sin(a),d*Math.cos(a),e*Math.sin(b),e*Math.cos(b))}equals(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w}fromArray(a,b=0){return this._x=a[b],this._y=a[b+1],this._z=a[b+2],this._w=a[b+3],this._onChangeCallback(),this}toArray(a=[],b=0){return a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._w,a}fromBufferAttribute(a,b){return this._x=a.getX(b),this._y=a.getY(b),this._z=a.getZ(b),this._w=a.getW(b),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(a){return this._onChangeCallback=a,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class dz{static{dz.prototype.isVector3=!0}constructor(a=0,b=0,c=0){this.x=a,this.y=b,this.z=c}set(a,b,c){return void 0===c&&(c=this.z),this.x=a,this.y=b,this.z=c,this}setScalar(a){return this.x=a,this.y=a,this.z=a,this}setX(a){return this.x=a,this}setY(a){return this.y=a,this}setZ(a){return this.z=a,this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("THREE.Vector3: index is out of range: "+a)}return this}getComponent(a){switch(a){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: "+a)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(a){return this.x=a.x,this.y=a.y,this.z=a.z,this}add(a){return this.x+=a.x,this.y+=a.y,this.z+=a.z,this}addScalar(a){return this.x+=a,this.y+=a,this.z+=a,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this}addScaledVector(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this}sub(a){return this.x-=a.x,this.y-=a.y,this.z-=a.z,this}subScalar(a){return this.x-=a,this.y-=a,this.z-=a,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this}multiply(a){return this.x*=a.x,this.y*=a.y,this.z*=a.z,this}multiplyScalar(a){return this.x*=a,this.y*=a,this.z*=a,this}multiplyVectors(a,b){return this.x=a.x*b.x,this.y=a.y*b.y,this.z=a.z*b.z,this}applyEuler(a){return this.applyQuaternion(dB.setFromEuler(a))}applyAxisAngle(a,b){return this.applyQuaternion(dB.setFromAxisAngle(a,b))}applyMatrix3(a){let b=this.x,c=this.y,d=this.z,e=a.elements;return this.x=e[0]*b+e[3]*c+e[6]*d,this.y=e[1]*b+e[4]*c+e[7]*d,this.z=e[2]*b+e[5]*c+e[8]*d,this}applyNormalMatrix(a){return this.applyMatrix3(a).normalize()}applyMatrix4(a){let b=this.x,c=this.y,d=this.z,e=a.elements,f=1/(e[3]*b+e[7]*c+e[11]*d+e[15]);return this.x=(e[0]*b+e[4]*c+e[8]*d+e[12])*f,this.y=(e[1]*b+e[5]*c+e[9]*d+e[13])*f,this.z=(e[2]*b+e[6]*c+e[10]*d+e[14])*f,this}applyQuaternion(a){let b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=a.w,i=2*(f*d-g*c),j=2*(g*b-e*d),k=2*(e*c-f*b);return this.x=b+h*i+f*k-g*j,this.y=c+h*j+g*i-e*k,this.z=d+h*k+e*j-f*i,this}project(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)}unproject(a){return this.applyMatrix4(a.projectionMatrixInverse).applyMatrix4(a.matrixWorld)}transformDirection(a){let b=this.x,c=this.y,d=this.z,e=a.elements;return this.x=e[0]*b+e[4]*c+e[8]*d,this.y=e[1]*b+e[5]*c+e[9]*d,this.z=e[2]*b+e[6]*c+e[10]*d,this.normalize()}divide(a){return this.x/=a.x,this.y/=a.y,this.z/=a.z,this}divideScalar(a){return this.multiplyScalar(1/a)}min(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this}max(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this}clamp(a,b){return this.x=dr(this.x,a.x,b.x),this.y=dr(this.y,a.y,b.y),this.z=dr(this.z,a.z,b.z),this}clampScalar(a,b){return this.x=dr(this.x,a,b),this.y=dr(this.y,a,b),this.z=dr(this.z,a,b),this}clampLength(a,b){let c=this.length();return this.divideScalar(c||1).multiplyScalar(dr(c,a,b))}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(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){return this.normalize().multiplyScalar(a)}lerp(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this}lerpVectors(a,b,c){return this.x=a.x+(b.x-a.x)*c,this.y=a.y+(b.y-a.y)*c,this.z=a.z+(b.z-a.z)*c,this}cross(a){return this.crossVectors(this,a)}crossVectors(a,b){let c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;return this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f,this}projectOnVector(a){let b=a.lengthSq();if(0===b)return this.set(0,0,0);let c=a.dot(this)/b;return this.copy(a).multiplyScalar(c)}projectOnPlane(a){return dA.copy(this).projectOnVector(a),this.sub(dA)}reflect(a){return this.sub(dA.copy(a).multiplyScalar(2*this.dot(a)))}angleTo(a){let b=Math.sqrt(this.lengthSq()*a.lengthSq());return 0===b?Math.PI/2:Math.acos(dr(this.dot(a)/b,-1,1))}distanceTo(a){return Math.sqrt(this.distanceToSquared(a))}distanceToSquared(a){let b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return b*b+c*c+d*d}manhattanDistanceTo(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)}setFromSpherical(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)}setFromSphericalCoords(a,b,c){let d=Math.sin(b)*a;return this.x=d*Math.sin(c),this.y=Math.cos(b)*a,this.z=d*Math.cos(c),this}setFromCylindrical(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)}setFromCylindricalCoords(a,b,c){return this.x=a*Math.sin(b),this.y=c,this.z=a*Math.cos(b),this}setFromMatrixPosition(a){let b=a.elements;return this.x=b[12],this.y=b[13],this.z=b[14],this}setFromMatrixScale(a){let b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length(),d=this.setFromMatrixColumn(a,2).length();return this.x=b,this.y=c,this.z=d,this}setFromMatrixColumn(a,b){return this.fromArray(a.elements,4*b)}setFromMatrix3Column(a,b){return this.fromArray(a.elements,3*b)}setFromEuler(a){return this.x=a._x,this.y=a._y,this.z=a._z,this}setFromColor(a){return this.x=a.r,this.y=a.g,this.z=a.b,this}equals(a){return a.x===this.x&&a.y===this.y&&a.z===this.z}fromArray(a,b=0){return this.x=a[b],this.y=a[b+1],this.z=a[b+2],this}toArray(a=[],b=0){return a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a}fromBufferAttribute(a,b){return this.x=a.getX(b),this.y=a.getY(b),this.z=a.getZ(b),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let a=Math.random()*Math.PI*2,b=2*Math.random()-1,c=Math.sqrt(1-b*b);return this.x=c*Math.cos(a),this.y=b,this.z=c*Math.sin(a),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let dA=new dz,dB=new dy;class dC{static{dC.prototype.isMatrix3=!0}constructor(a,b,c,d,e,f,g,h,i){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==a&&this.set(a,b,c,d,e,f,g,h,i)}set(a,b,c,d,e,f,g,h,i){let j=this.elements;return j[0]=a,j[1]=d,j[2]=g,j[3]=b,j[4]=e,j[5]=h,j[6]=c,j[7]=f,j[8]=i,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(a){let b=this.elements,c=a.elements;return b[0]=c[0],b[1]=c[1],b[2]=c[2],b[3]=c[3],b[4]=c[4],b[5]=c[5],b[6]=c[6],b[7]=c[7],b[8]=c[8],this}extractBasis(a,b,c){return a.setFromMatrix3Column(this,0),b.setFromMatrix3Column(this,1),c.setFromMatrix3Column(this,2),this}setFromMatrix4(a){let b=a.elements;return this.set(b[0],b[4],b[8],b[1],b[5],b[9],b[2],b[6],b[10]),this}multiply(a){return this.multiplyMatrices(this,a)}premultiply(a){return this.multiplyMatrices(a,this)}multiplyMatrices(a,b){let c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[3],h=c[6],i=c[1],j=c[4],k=c[7],l=c[2],m=c[5],n=c[8],o=d[0],p=d[3],q=d[6],r=d[1],s=d[4],t=d[7],u=d[2],v=d[5],w=d[8];return e[0]=f*o+g*r+h*u,e[3]=f*p+g*s+h*v,e[6]=f*q+g*t+h*w,e[1]=i*o+j*r+k*u,e[4]=i*p+j*s+k*v,e[7]=i*q+j*t+k*w,e[2]=l*o+m*r+n*u,e[5]=l*p+m*s+n*v,e[8]=l*q+m*t+n*w,this}multiplyScalar(a){let b=this.elements;return b[0]*=a,b[3]*=a,b[6]*=a,b[1]*=a,b[4]*=a,b[7]*=a,b[2]*=a,b[5]*=a,b[8]*=a,this}determinant(){let a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8];return b*f*j-b*g*i-c*e*j+c*g*h+d*e*i-d*f*h}invert(){let a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8],k=j*f-g*i,l=g*h-j*e,m=i*e-f*h,n=b*k+c*l+d*m;if(0===n)return this.set(0,0,0,0,0,0,0,0,0);let o=1/n;return a[0]=k*o,a[1]=(d*i-j*c)*o,a[2]=(g*c-d*f)*o,a[3]=l*o,a[4]=(j*b-d*h)*o,a[5]=(d*e-g*b)*o,a[6]=m*o,a[7]=(c*h-i*b)*o,a[8]=(f*b-c*e)*o,this}transpose(){let a,b=this.elements;return a=b[1],b[1]=b[3],b[3]=a,a=b[2],b[2]=b[6],b[6]=a,a=b[5],b[5]=b[7],b[7]=a,this}getNormalMatrix(a){return this.setFromMatrix4(a).invert().transpose()}transposeIntoArray(a){let b=this.elements;return a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8],this}setUvTransform(a,b,c,d,e,f,g){let h=Math.cos(e),i=Math.sin(e);return this.set(c*h,c*i,-c*(h*f+i*g)+f+a,-d*i,d*h,-d*(-i*f+h*g)+g+b,0,0,1),this}scale(a,b){return di("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(dD.makeScale(a,b)),this}rotate(a){return di("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(dD.makeRotation(-a)),this}translate(a,b){return di("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(dD.makeTranslation(a,b)),this}makeTranslation(a,b){return a.isVector2?this.set(1,0,a.x,0,1,a.y,0,0,1):this.set(1,0,a,0,1,b,0,0,1),this}makeRotation(a){let b=Math.cos(a),c=Math.sin(a);return this.set(b,-c,0,c,b,0,0,0,1),this}makeScale(a,b){return this.set(a,0,0,0,b,0,0,0,1),this}equals(a){let b=this.elements,c=a.elements;for(let a=0;a<9;a++)if(b[a]!==c[a])return!1;return!0}fromArray(a,b=0){for(let c=0;c<9;c++)this.elements[c]=a[c+b];return this}toArray(a=[],b=0){let c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a}clone(){return new this.constructor().fromArray(this.elements)}}let dD=new dC,dE=new dC().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),dF=new dC().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),dG=(o=[.64,.33,.3,.6,.15,.06],p=[.2126,.7152,.0722],q=[.3127,.329],(n={enabled:!0,workingColorSpace:cl,spaces:{},convert:function(a,b,c){return!1!==this.enabled&&b!==c&&b&&c&&(this.spaces[b].transfer===cn&&(a.r=dH(a.r),a.g=dH(a.g),a.b=dH(a.b)),this.spaces[b].primaries!==this.spaces[c].primaries&&(a.applyMatrix3(this.spaces[b].toXYZ),a.applyMatrix3(this.spaces[c].fromXYZ)),this.spaces[c].transfer===cn&&(a.r=dI(a.r),a.g=dI(a.g),a.b=dI(a.b))),a},workingToColorSpace:function(a,b){return this.convert(a,this.workingColorSpace,b)},colorSpaceToWorking:function(a,b){return this.convert(a,b,this.workingColorSpace)},getPrimaries:function(a){return this.spaces[a].primaries},getTransfer:function(a){return a===cj?cm:this.spaces[a].transfer},getToneMappingMode:function(a){return this.spaces[a].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(a,b=this.workingColorSpace){return a.fromArray(this.spaces[b].luminanceCoefficients)},define:function(a){Object.assign(this.spaces,a)},_getMatrix:function(a,b,c){return a.copy(this.spaces[b].toXYZ).multiply(this.spaces[c].fromXYZ)},_getDrawingBufferColorSpace:function(a){return this.spaces[a].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(a=this.workingColorSpace){return this.spaces[a].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(a,b){return di("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(a,b)},toWorkingColorSpace:function(a,b){return di("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(a,b)}}).define({[cl]:{primaries:o,whitePoint:q,transfer:cm,toXYZ:dE,fromXYZ:dF,luminanceCoefficients:p,workingColorSpaceConfig:{unpackColorSpace:ck},outputColorSpaceConfig:{drawingBufferColorSpace:ck}},[ck]:{primaries:o,whitePoint:q,transfer:cn,toXYZ:dE,fromXYZ:dF,luminanceCoefficients:p,outputColorSpaceConfig:{drawingBufferColorSpace:ck}}}),n);function dH(a){return a<.04045?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}function dI(a){return a<.0031308?12.92*a:1.055*Math.pow(a,.41666)-.055}class dJ{static getDataURL(a,b="image/png"){let c;if(/^data:/i.test(a.src)||"u"<typeof HTMLCanvasElement)return a.src;if(a instanceof HTMLCanvasElement)c=a;else{void 0===d&&(d=c8("canvas")),d.width=a.width,d.height=a.height;let b=d.getContext("2d");a instanceof ImageData?b.putImageData(a,0,0):b.drawImage(a,0,0,a.width,a.height),c=d}return c.toDataURL(b)}static sRGBToLinear(a){if("u">typeof HTMLImageElement&&a instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&a instanceof ImageBitmap){let b=c8("canvas");b.width=a.width,b.height=a.height;let c=b.getContext("2d");c.drawImage(a,0,0,a.width,a.height);let d=c.getImageData(0,0,a.width,a.height),e=d.data;for(let a=0;a<e.length;a++)e[a]=255*dH(e[a]/255);return c.putImageData(d,0,0),b}if(!a.data)return dg("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),a;{let b=a.data.slice(0);for(let a=0;a<b.length;a++)b instanceof Uint8Array||b instanceof Uint8ClampedArray?b[a]=Math.floor(255*dH(b[a]/255)):b[a]=dH(b[a]);return{data:b,width:a.width,height:a.height}}}}let dK=0;class dL{constructor(a=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:dK++}),this.uuid=dq(),this.data=a,this.dataReady=!0,this.version=0}getSize(a){let b=this.data;return"u">typeof HTMLVideoElement&&b instanceof HTMLVideoElement?a.set(b.videoWidth,b.videoHeight,0):"u">typeof VideoFrame&&b instanceof VideoFrame?a.set(b.displayWidth,b.displayHeight,0):null!==b?a.set(b.width,b.height,b.depth||0):a.set(0,0,0),a}set needsUpdate(a){!0===a&&this.version++}toJSON(a){let b=void 0===a||"string"==typeof a;if(!b&&void 0!==a.images[this.uuid])return a.images[this.uuid];let c={uuid:this.uuid,url:""},d=this.data;if(null!==d){let a;if(Array.isArray(d)){a=[];for(let b=0,c=d.length;b<c;b++)d[b].isDataTexture?a.push(dM(d[b].image)):a.push(dM(d[b]))}else a=dM(d);c.url=a}return b||(a.images[this.uuid]=c),c}}function dM(a){return"u">typeof HTMLImageElement&&a instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&a instanceof ImageBitmap?dJ.getDataURL(a):a.data?{data:Array.from(a.data),width:a.width,height:a.height,type:a.data.constructor.name}:(dg("Texture: Unable to serialize Texture."),{})}class dN extends dL{constructor(a=null){di('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.'),super(a),this.isSource=!0}}let dO=0,dP=new dz;class dQ extends dk{constructor(a=dQ.DEFAULT_IMAGE,b=dQ.DEFAULT_MAPPING,c=aS,d=aS,e=aZ,f=a0,g=bh,h=a2,i=dQ.DEFAULT_ANISOTROPY,j=cj){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dO++}),this.uuid=dq(),this.name="",this.source=new dL(a),this.mipmaps=[],this.mapping=b,this.channel=0,this.wrapS=c,this.wrapT=d,this.magFilter=e,this.minFilter=f,this.anisotropy=i,this.format=g,this.internalFormat=null,this.type=h,this.offset=new dx(0,0),this.repeat=new dx(1,1),this.center=new dx(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new dC,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=j,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!a&&!!a.depth&&a.depth>1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(dP).x}get height(){return this.source.getSize(dP).y}get depth(){return this.source.getSize(dP).z}get image(){return this.source.data}set image(a){this.source.data=a}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(a,b){this.updateRanges.push({start:a,count:b})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(a){return this.name=a.name,this.source=a.source,this.mipmaps=a.mipmaps.slice(0),this.mapping=a.mapping,this.channel=a.channel,this.wrapS=a.wrapS,this.wrapT=a.wrapT,this.magFilter=a.magFilter,this.minFilter=a.minFilter,this.anisotropy=a.anisotropy,this.format=a.format,this.internalFormat=a.internalFormat,this.type=a.type,this.normalized=a.normalized,this.offset.copy(a.offset),this.repeat.copy(a.repeat),this.center.copy(a.center),this.rotation=a.rotation,this.matrixAutoUpdate=a.matrixAutoUpdate,this.matrix.copy(a.matrix),this.generateMipmaps=a.generateMipmaps,this.premultiplyAlpha=a.premultiplyAlpha,this.flipY=a.flipY,this.unpackAlignment=a.unpackAlignment,this.colorSpace=a.colorSpace,this.renderTarget=a.renderTarget,this.isRenderTargetTexture=a.isRenderTargetTexture,this.isArrayTexture=a.isArrayTexture,this.userData=JSON.parse(JSON.stringify(a.userData)),this.needsUpdate=!0,this}setValues(a){for(let b in a){let c=a[b];if(void 0===c){dg(`Texture.setValues(): parameter '${b}' has value of undefined.`);continue}let d=this[b];if(void 0===d){dg(`Texture.setValues(): property '${b}' does not exist.`);continue}d&&c&&d.isVector2&&c.isVector2||d&&c&&d.isVector3&&c.isVector3||d&&c&&d.isMatrix3&&c.isMatrix3?d.copy(c):this[b]=c}}toJSON(a){let b=void 0===a||"string"==typeof a;if(!b&&void 0!==a.textures[this.uuid])return a.textures[this.uuid];let c={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(a).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&&(c.userData=this.userData),b||(a.textures[this.uuid]=c),c}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(a){if(this.mapping!==aL)return a;if(a.applyMatrix3(this.matrix),a.x<0||a.x>1)switch(this.wrapS){case aR:a.x=a.x-Math.floor(a.x);break;case aS:a.x=a.x<0?0:1;break;case aT:1===Math.abs(Math.floor(a.x)%2)?a.x=Math.ceil(a.x)-a.x:a.x=a.x-Math.floor(a.x)}if(a.y<0||a.y>1)switch(this.wrapT){case aR:a.y=a.y-Math.floor(a.y);break;case aS:a.y=a.y<0?0:1;break;case aT:1===Math.abs(Math.floor(a.y)%2)?a.y=Math.ceil(a.y)-a.y:a.y=a.y-Math.floor(a.y)}return this.flipY&&(a.y=1-a.y),a}set needsUpdate(a){!0===a&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(a){!0===a&&this.pmremVersion++}}dQ.DEFAULT_IMAGE=null,dQ.DEFAULT_MAPPING=aL,dQ.DEFAULT_ANISOTROPY=1;class dR{static{dR.prototype.isVector4=!0}constructor(a=0,b=0,c=0,d=1){this.x=a,this.y=b,this.z=c,this.w=d}get width(){return this.z}set width(a){this.z=a}get height(){return this.w}set height(a){this.w=a}set(a,b,c,d){return this.x=a,this.y=b,this.z=c,this.w=d,this}setScalar(a){return this.x=a,this.y=a,this.z=a,this.w=a,this}setX(a){return this.x=a,this}setY(a){return this.y=a,this}setZ(a){return this.z=a,this}setW(a){return this.w=a,this}setComponent(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("THREE.Vector4: index is out of range: "+a)}return this}getComponent(a){switch(a){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: "+a)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(a){return this.x=a.x,this.y=a.y,this.z=a.z,this.w=void 0!==a.w?a.w:1,this}add(a){return this.x+=a.x,this.y+=a.y,this.z+=a.z,this.w+=a.w,this}addScalar(a){return this.x+=a,this.y+=a,this.z+=a,this.w+=a,this}addVectors(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this}addScaledVector(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this.w+=a.w*b,this}sub(a){return this.x-=a.x,this.y-=a.y,this.z-=a.z,this.w-=a.w,this}subScalar(a){return this.x-=a,this.y-=a,this.z-=a,this.w-=a,this}subVectors(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this.w=a.w-b.w,this}multiply(a){return this.x*=a.x,this.y*=a.y,this.z*=a.z,this.w*=a.w,this}multiplyScalar(a){return this.x*=a,this.y*=a,this.z*=a,this.w*=a,this}applyMatrix4(a){let b=this.x,c=this.y,d=this.z,e=this.w,f=a.elements;return this.x=f[0]*b+f[4]*c+f[8]*d+f[12]*e,this.y=f[1]*b+f[5]*c+f[9]*d+f[13]*e,this.z=f[2]*b+f[6]*c+f[10]*d+f[14]*e,this.w=f[3]*b+f[7]*c+f[11]*d+f[15]*e,this}divide(a){return this.x/=a.x,this.y/=a.y,this.z/=a.z,this.w/=a.w,this}divideScalar(a){return this.multiplyScalar(1/a)}setAxisAngleFromQuaternion(a){this.w=2*Math.acos(a.w);let b=Math.sqrt(1-a.w*a.w);return b<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b),this}setAxisAngleFromRotationMatrix(a){let b,c,d,e,f=a.elements,g=f[0],h=f[4],i=f[8],j=f[1],k=f[5],l=f[9],m=f[2],n=f[6],o=f[10];if(.01>Math.abs(h-j)&&.01>Math.abs(i-m)&&.01>Math.abs(l-n)){if(.1>Math.abs(h+j)&&.1>Math.abs(i+m)&&.1>Math.abs(l+n)&&.1>Math.abs(g+k+o-3))return this.set(1,0,0,0),this;b=Math.PI;let a=(g+1)/2,f=(k+1)/2,p=(o+1)/2,q=(h+j)/4,r=(i+m)/4,s=(l+n)/4;return a>f&&a>p?a<.01?(c=0,d=.707106781,e=.707106781):(d=q/(c=Math.sqrt(a)),e=r/c):f>p?f<.01?(c=.707106781,d=0,e=.707106781):(c=q/(d=Math.sqrt(f)),e=s/d):p<.01?(c=.707106781,d=.707106781,e=0):(c=r/(e=Math.sqrt(p)),d=s/e),this.set(c,d,e,b),this}let p=Math.sqrt((n-l)*(n-l)+(i-m)*(i-m)+(j-h)*(j-h));return .001>Math.abs(p)&&(p=1),this.x=(n-l)/p,this.y=(i-m)/p,this.z=(j-h)/p,this.w=Math.acos((g+k+o-1)/2),this}setFromMatrixPosition(a){let b=a.elements;return this.x=b[12],this.y=b[13],this.z=b[14],this.w=b[15],this}min(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this.w=Math.min(this.w,a.w),this}max(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this.w=Math.max(this.w,a.w),this}clamp(a,b){return this.x=dr(this.x,a.x,b.x),this.y=dr(this.y,a.y,b.y),this.z=dr(this.z,a.z,b.z),this.w=dr(this.w,a.w,b.w),this}clampScalar(a,b){return this.x=dr(this.x,a,b),this.y=dr(this.y,a,b),this.z=dr(this.z,a,b),this.w=dr(this.w,a,b),this}clampLength(a,b){let c=this.length();return this.divideScalar(c||1).multiplyScalar(dr(c,a,b))}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(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.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(a){return this.normalize().multiplyScalar(a)}lerp(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this.w+=(a.w-this.w)*b,this}lerpVectors(a,b,c){return this.x=a.x+(b.x-a.x)*c,this.y=a.y+(b.y-a.y)*c,this.z=a.z+(b.z-a.z)*c,this.w=a.w+(b.w-a.w)*c,this}equals(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w}fromArray(a,b=0){return this.x=a[b],this.y=a[b+1],this.z=a[b+2],this.w=a[b+3],this}toArray(a=[],b=0){return a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a[b+3]=this.w,a}fromBufferAttribute(a,b){return this.x=a.getX(b),this.y=a.getY(b),this.z=a.getZ(b),this.w=a.getW(b),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 dS extends dk{constructor(a=1,b=1,c={}){super(),c=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:aZ,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},c),this.isRenderTarget=!0,this.width=a,this.height=b,this.depth=c.depth,this.scissor=new dR(0,0,a,b),this.scissorTest=!1,this.viewport=new dR(0,0,a,b),this.textures=[];const d=new dQ({width:a,height:b,depth:c.depth}),e=c.count;for(let a=0;a<e;a++)this.textures[a]=d.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(c),this.depthBuffer=c.depthBuffer,this.stencilBuffer=c.stencilBuffer,this.resolveColorBuffer=c.resolveColorBuffer,this.resolveDepthBuffer=c.resolveDepthBuffer,this.resolveStencilBuffer=c.resolveStencilBuffer,this.storeMultisampledColorBuffer=c.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=c.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=c.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=c.depthTexture,this.samples=c.samples,this.multiview=c.multiview,this.useArrayDepthTexture=c.useArrayDepthTexture}_setTextureOptions(a={}){let b={minFilter:aZ,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==a.mapping&&(b.mapping=a.mapping),void 0!==a.wrapS&&(b.wrapS=a.wrapS),void 0!==a.wrapT&&(b.wrapT=a.wrapT),void 0!==a.wrapR&&(b.wrapR=a.wrapR),void 0!==a.magFilter&&(b.magFilter=a.magFilter),void 0!==a.minFilter&&(b.minFilter=a.minFilter),void 0!==a.format&&(b.format=a.format),void 0!==a.type&&(b.type=a.type),void 0!==a.anisotropy&&(b.anisotropy=a.anisotropy),void 0!==a.colorSpace&&(b.colorSpace=a.colorSpace),void 0!==a.flipY&&(b.flipY=a.flipY),void 0!==a.generateMipmaps&&(b.generateMipmaps=a.generateMipmaps),void 0!==a.internalFormat&&(b.internalFormat=a.internalFormat);for(let a=0;a<this.textures.length;a++)this.textures[a].setValues(b)}get texture(){return this.textures[0]}set texture(a){this.textures[0]=a}set depthTexture(a){null!==this._depthTexture&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),null!==a&&null===a.renderTarget&&(a.renderTarget=this),this._depthTexture=a}get depthTexture(){return this._depthTexture}setSize(a,b,c=1){if(this.width!==a||this.height!==b||this.depth!==c){this.width=a,this.height=b,this.depth=c;for(let d=0,e=this.textures.length;d<e;d++)this.textures[d].image.width=a,this.textures[d].image.height=b,this.textures[d].image.depth=c,!0!==this.textures[d].isData3DTexture&&(this.textures[d].isArrayTexture=this.textures[d].image.depth>1);this.dispose()}this.viewport.set(0,0,a,b),this.scissor.set(0,0,a,b)}clone(){return new this.constructor().copy(this)}copy(a){this.width=a.width,this.height=a.height,this.depth=a.depth,this.scissor.copy(a.scissor),this.scissorTest=a.scissorTest,this.viewport.copy(a.viewport),this.textures.length=0;for(let b=0,c=a.textures.length;b<c;b++){this.textures[b]=a.textures[b].clone(),this.textures[b].isRenderTargetTexture=!0,this.textures[b].renderTarget=this;let c=Object.assign({},a.textures[b].image);this.textures[b].source=new dL(c)}if(this.depthBuffer=a.depthBuffer,this.stencilBuffer=a.stencilBuffer,this.resolveColorBuffer=a.resolveColorBuffer,this.resolveDepthBuffer=a.resolveDepthBuffer,this.resolveStencilBuffer=a.resolveStencilBuffer,this.storeMultisampledColorBuffer=a.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=a.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=a.storeMultisampledStencilBuffer,null!==a.depthTexture)if(a.depthTexture.renderTarget===a){let b=a.depthTexture.clone();b.renderTarget=null,this.depthTexture=b}else this.depthTexture=a.depthTexture;return this.samples=a.samples,this.multiview=a.multiview,this.useArrayDepthTexture=a.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class dT extends dS{constructor(a=1,b=1,c={}){super(a,b,c),this.isWebGLRenderTarget=!0}}class dU extends dQ{constructor(a=null,b=1,c=1,d=1){super(null),this.isDataArrayTexture=!0,this.image={data:a,width:b,height:c,depth:d},this.magFilter=aU,this.minFilter=aU,this.wrapR=aS,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(a){return super.copy(a),this.wrapR=a.wrapR,this}addLayerUpdate(a){this.layerUpdates.add(a)}clearLayerUpdates(){this.layerUpdates.clear()}}class dV extends dT{constructor(a=1,b=1,c=1,d={}){super(a,b,d),this.isWebGLArrayRenderTarget=!0,this.depth=c,this.texture=new dU(null,a,b,c),this._setTextureOptions(d),this.texture.isRenderTargetTexture=!0}}class dW extends dQ{constructor(a=null,b=1,c=1,d=1){super(null),this.isData3DTexture=!0,this.image={data:a,width:b,height:c,depth:d},this.magFilter=aU,this.minFilter=aU,this.wrapR=aS,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(a){return super.copy(a),this.wrapR=a.wrapR,this}}class dX extends dT{constructor(a=1,b=1,c=1,d={}){super(a,b,d),this.isWebGL3DRenderTarget=!0,this.depth=c,this.texture=new dW(null,a,b,c),this._setTextureOptions(d),this.texture.isRenderTargetTexture=!0}}class dY{static{dY.prototype.isMatrix4=!0}constructor(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==a&&this.set(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)}set(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){let q=this.elements;return q[0]=a,q[4]=b,q[8]=c,q[12]=d,q[1]=e,q[5]=f,q[9]=g,q[13]=h,q[2]=i,q[6]=j,q[10]=k,q[14]=l,q[3]=m,q[7]=n,q[11]=o,q[15]=p,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 dY().fromArray(this.elements)}copy(a){let b=this.elements,c=a.elements;return b[0]=c[0],b[1]=c[1],b[2]=c[2],b[3]=c[3],b[4]=c[4],b[5]=c[5],b[6]=c[6],b[7]=c[7],b[8]=c[8],b[9]=c[9],b[10]=c[10],b[11]=c[11],b[12]=c[12],b[13]=c[13],b[14]=c[14],b[15]=c[15],this}copyPosition(a){let b=this.elements,c=a.elements;return b[12]=c[12],b[13]=c[13],b[14]=c[14],this}setFromMatrix3(a){let b=a.elements;return this.set(b[0],b[3],b[6],0,b[1],b[4],b[7],0,b[2],b[5],b[8],0,0,0,0,1),this}extractBasis(a,b,c){return 0===this.determinantAffine()?(a.set(1,0,0),b.set(0,1,0),c.set(0,0,1)):(a.setFromMatrixColumn(this,0),b.setFromMatrixColumn(this,1),c.setFromMatrixColumn(this,2)),this}makeBasis(a,b,c){return this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1),this}extractRotation(a){if(0===a.determinantAffine())return this.identity();let b=this.elements,c=a.elements,d=1/dZ.setFromMatrixColumn(a,0).length(),e=1/dZ.setFromMatrixColumn(a,1).length(),f=1/dZ.setFromMatrixColumn(a,2).length();return b[0]=c[0]*d,b[1]=c[1]*d,b[2]=c[2]*d,b[3]=0,b[4]=c[4]*e,b[5]=c[5]*e,b[6]=c[6]*e,b[7]=0,b[8]=c[8]*f,b[9]=c[9]*f,b[10]=c[10]*f,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromEuler(a){let b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),g=Math.sin(c),h=Math.cos(d),i=Math.sin(d),j=Math.cos(e),k=Math.sin(e);if("XYZ"===a.order){let a=f*j,c=f*k,d=g*j,e=g*k;b[0]=h*j,b[4]=-h*k,b[8]=i,b[1]=c+d*i,b[5]=a-e*i,b[9]=-g*h,b[2]=e-a*i,b[6]=d+c*i,b[10]=f*h}else if("YXZ"===a.order){let a=h*j,c=h*k,d=i*j,e=i*k;b[0]=a+e*g,b[4]=d*g-c,b[8]=f*i,b[1]=f*k,b[5]=f*j,b[9]=-g,b[2]=c*g-d,b[6]=e+a*g,b[10]=f*h}else if("ZXY"===a.order){let a=h*j,c=h*k,d=i*j,e=i*k;b[0]=a-e*g,b[4]=-f*k,b[8]=d+c*g,b[1]=c+d*g,b[5]=f*j,b[9]=e-a*g,b[2]=-f*i,b[6]=g,b[10]=f*h}else if("ZYX"===a.order){let a=f*j,c=f*k,d=g*j,e=g*k;b[0]=h*j,b[4]=d*i-c,b[8]=a*i+e,b[1]=h*k,b[5]=e*i+a,b[9]=c*i-d,b[2]=-i,b[6]=g*h,b[10]=f*h}else if("YZX"===a.order){let a=f*h,c=f*i,d=g*h,e=g*i;b[0]=h*j,b[4]=e-a*k,b[8]=d*k+c,b[1]=k,b[5]=f*j,b[9]=-g*j,b[2]=-i*j,b[6]=c*k+d,b[10]=a-e*k}else if("XZY"===a.order){let a=f*h,c=f*i,d=g*h,e=g*i;b[0]=h*j,b[4]=-k,b[8]=i*j,b[1]=a*k+e,b[5]=f*j,b[9]=c*k-d,b[2]=d*k-c,b[6]=g*j,b[10]=e*k+a}return b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this}makeRotationFromQuaternion(a){return this.compose(d_,a,d0)}lookAt(a,b,c){let d=this.elements;return d3.subVectors(a,b),0===d3.lengthSq()&&(d3.z=1),d3.normalize(),d1.crossVectors(c,d3),0===d1.lengthSq()&&(1===Math.abs(c.z)?d3.x+=1e-4:d3.z+=1e-4,d3.normalize(),d1.crossVectors(c,d3)),d1.normalize(),d2.crossVectors(d3,d1),d[0]=d1.x,d[4]=d2.x,d[8]=d3.x,d[1]=d1.y,d[5]=d2.y,d[9]=d3.y,d[2]=d1.z,d[6]=d2.z,d[10]=d3.z,this}multiply(a){return this.multiplyMatrices(this,a)}premultiply(a){return this.multiplyMatrices(a,this)}multiplyMatrices(a,b){let c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],k=c[5],l=c[9],m=c[13],n=c[2],o=c[6],p=c[10],q=c[14],r=c[3],s=c[7],t=c[11],u=c[15],v=d[0],w=d[4],x=d[8],y=d[12],z=d[1],A=d[5],B=d[9],C=d[13],D=d[2],E=d[6],F=d[10],G=d[14],H=d[3],I=d[7],J=d[11],K=d[15];return e[0]=f*v+g*z+h*D+i*H,e[4]=f*w+g*A+h*E+i*I,e[8]=f*x+g*B+h*F+i*J,e[12]=f*y+g*C+h*G+i*K,e[1]=j*v+k*z+l*D+m*H,e[5]=j*w+k*A+l*E+m*I,e[9]=j*x+k*B+l*F+m*J,e[13]=j*y+k*C+l*G+m*K,e[2]=n*v+o*z+p*D+q*H,e[6]=n*w+o*A+p*E+q*I,e[10]=n*x+o*B+p*F+q*J,e[14]=n*y+o*C+p*G+q*K,e[3]=r*v+s*z+t*D+u*H,e[7]=r*w+s*A+t*E+u*I,e[11]=r*x+s*B+t*F+u*J,e[15]=r*y+s*C+t*G+u*K,this}multiplyScalar(a){let b=this.elements;return b[0]*=a,b[4]*=a,b[8]*=a,b[12]*=a,b[1]*=a,b[5]*=a,b[9]*=a,b[13]*=a,b[2]*=a,b[6]*=a,b[10]*=a,b[14]*=a,b[3]*=a,b[7]*=a,b[11]*=a,b[15]*=a,this}determinant(){let a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],k=a[6],l=a[10],m=a[14],n=a[3],o=a[7],p=a[11],q=a[15],r=h*m-i*l,s=g*m-i*k,t=g*l-h*k,u=f*m-i*j,v=f*l-h*j,w=f*k-g*j;return b*(o*r-p*s+q*t)-c*(n*r-p*u+q*v)+d*(n*s-o*u+q*w)-e*(n*t-o*v+p*w)}determinantAffine(){let a=this.elements,b=a[0],c=a[4],d=a[8],e=a[1],f=a[5],g=a[9],h=a[2],i=a[6],j=a[10];return b*(f*j-g*i)-c*(e*j-g*h)+d*(e*i-f*h)}transpose(){let a,b=this.elements;return a=b[1],b[1]=b[4],b[4]=a,a=b[2],b[2]=b[8],b[8]=a,a=b[6],b[6]=b[9],b[9]=a,a=b[3],b[3]=b[12],b[12]=a,a=b[7],b[7]=b[13],b[13]=a,a=b[11],b[11]=b[14],b[14]=a,this}setPosition(a,b,c){let d=this.elements;return a.isVector3?(d[12]=a.x,d[13]=a.y,d[14]=a.z):(d[12]=a,d[13]=b,d[14]=c),this}invert(){let a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8],k=a[9],l=a[10],m=a[11],n=a[12],o=a[13],p=a[14],q=a[15],r=b*g-c*f,s=b*h-d*f,t=b*i-e*f,u=c*h-d*g,v=c*i-e*g,w=d*i-e*h,x=j*o-k*n,y=j*p-l*n,z=j*q-m*n,A=k*p-l*o,B=k*q-m*o,C=l*q-m*p,D=r*C-s*B+t*A+u*z-v*y+w*x;if(0===D)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let E=1/D;return a[0]=(g*C-h*B+i*A)*E,a[1]=(d*B-c*C-e*A)*E,a[2]=(o*w-p*v+q*u)*E,a[3]=(l*v-k*w-m*u)*E,a[4]=(h*z-f*C-i*y)*E,a[5]=(b*C-d*z+e*y)*E,a[6]=(p*t-n*w-q*s)*E,a[7]=(j*w-l*t+m*s)*E,a[8]=(f*B-g*z+i*x)*E,a[9]=(c*z-b*B-e*x)*E,a[10]=(n*v-o*t+q*r)*E,a[11]=(k*t-j*v-m*r)*E,a[12]=(g*y-f*A-h*x)*E,a[13]=(b*A-c*y+d*x)*E,a[14]=(o*s-n*u-p*r)*E,a[15]=(j*u-k*s+l*r)*E,this}scale(a){let b=this.elements,c=a.x,d=a.y,e=a.z;return b[0]*=c,b[4]*=d,b[8]*=e,b[1]*=c,b[5]*=d,b[9]*=e,b[2]*=c,b[6]*=d,b[10]*=e,b[3]*=c,b[7]*=d,b[11]*=e,this}getMaxScaleOnAxis(){let a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))}makeTranslation(a,b,c){return a.isVector3?this.set(1,0,0,a.x,0,1,0,a.y,0,0,1,a.z,0,0,0,1):this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1),this}makeRotationX(a){let b=Math.cos(a),c=Math.sin(a);return this.set(1,0,0,0,0,b,-c,0,0,c,b,0,0,0,0,1),this}makeRotationY(a){let b=Math.cos(a),c=Math.sin(a);return this.set(b,0,c,0,0,1,0,0,-c,0,b,0,0,0,0,1),this}makeRotationZ(a){let b=Math.cos(a),c=Math.sin(a);return this.set(b,-c,0,0,c,b,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(a,b){let c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;return this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1),this}makeScale(a,b,c){return this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1),this}makeShear(a,b,c,d,e,f){return this.set(1,c,e,0,a,1,f,0,b,d,1,0,0,0,0,1),this}compose(a,b,c){let d=this.elements,e=b._x,f=b._y,g=b._z,h=b._w,i=e+e,j=f+f,k=g+g,l=e*i,m=e*j,n=e*k,o=f*j,p=f*k,q=g*k,r=h*i,s=h*j,t=h*k,u=c.x,v=c.y,w=c.z;return d[0]=(1-(o+q))*u,d[1]=(m+t)*u,d[2]=(n-s)*u,d[3]=0,d[4]=(m-t)*v,d[5]=(1-(l+q))*v,d[6]=(p+r)*v,d[7]=0,d[8]=(n+s)*w,d[9]=(p-r)*w,d[10]=(1-(l+o))*w,d[11]=0,d[12]=a.x,d[13]=a.y,d[14]=a.z,d[15]=1,this}decompose(a,b,c){let d=this.elements;a.x=d[12],a.y=d[13],a.z=d[14];let e=this.determinantAffine();if(0===e)return c.set(1,1,1),b.identity(),this;let f=dZ.set(d[0],d[1],d[2]).length(),g=dZ.set(d[4],d[5],d[6]).length(),h=dZ.set(d[8],d[9],d[10]).length();e<0&&(f=-f),d$.copy(this);let i=1/f,j=1/g,k=1/h;return d$.elements[0]*=i,d$.elements[1]*=i,d$.elements[2]*=i,d$.elements[4]*=j,d$.elements[5]*=j,d$.elements[6]*=j,d$.elements[8]*=k,d$.elements[9]*=k,d$.elements[10]*=k,b.setFromRotationMatrix(d$),c.x=f,c.y=g,c.z=h,this}makePerspective(a,b,c,d,e,f,g=c$,h=!1){let i,j,k=this.elements;if(h)i=e/(f-e),j=f*e/(f-e);else if(g===c$)i=-(f+e)/(f-e),j=-2*f*e/(f-e);else if(g===c_)i=-f/(f-e),j=-f*e/(f-e);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+g);return k[0]=2*e/(b-a),k[4]=0,k[8]=(b+a)/(b-a),k[12]=0,k[1]=0,k[5]=2*e/(c-d),k[9]=(c+d)/(c-d),k[13]=0,k[2]=0,k[6]=0,k[10]=i,k[14]=j,k[3]=0,k[7]=0,k[11]=-1,k[15]=0,this}makeOrthographic(a,b,c,d,e,f,g=c$,h=!1){let i,j,k=this.elements;if(h)i=1/(f-e),j=f/(f-e);else if(g===c$)i=-2/(f-e),j=-(f+e)/(f-e);else if(g===c_)i=-1/(f-e),j=-e/(f-e);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+g);return k[0]=2/(b-a),k[4]=0,k[8]=0,k[12]=-(b+a)/(b-a),k[1]=0,k[5]=2/(c-d),k[9]=0,k[13]=-(c+d)/(c-d),k[2]=0,k[6]=0,k[10]=i,k[14]=j,k[3]=0,k[7]=0,k[11]=0,k[15]=1,this}equals(a){let b=this.elements,c=a.elements;for(let a=0;a<16;a++)if(b[a]!==c[a])return!1;return!0}fromArray(a,b=0){for(let c=0;c<16;c++)this.elements[c]=a[c+b];return this}toArray(a=[],b=0){let c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a[b+9]=c[9],a[b+10]=c[10],a[b+11]=c[11],a[b+12]=c[12],a[b+13]=c[13],a[b+14]=c[14],a[b+15]=c[15],a}}let dZ=new dz,d$=new dY,d_=new dz(0,0,0),d0=new dz(1,1,1),d1=new dz,d2=new dz,d3=new dz,d4=new dY,d5=new dy;class d6{constructor(a=0,b=0,c=0,d=d6.DEFAULT_ORDER){this.isEuler=!0,this._x=a,this._y=b,this._z=c,this._order=d}get x(){return this._x}set x(a){this._x=a,this._onChangeCallback()}get y(){return this._y}set y(a){this._y=a,this._onChangeCallback()}get z(){return this._z}set z(a){this._z=a,this._onChangeCallback()}get order(){return this._order}set order(a){this._order=a,this._onChangeCallback()}set(a,b,c,d=this._order){return this._x=a,this._y=b,this._z=c,this._order=d,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(a){return this._x=a._x,this._y=a._y,this._z=a._z,this._order=a._order,this._onChangeCallback(),this}setFromRotationMatrix(a,b=this._order,c=!0){let d=a.elements,e=d[0],f=d[4],g=d[8],h=d[1],i=d[5],j=d[9],k=d[2],l=d[6],m=d[10];switch(b){case"XYZ":this._y=Math.asin(dr(g,-1,1)),.9999999>Math.abs(g)?(this._x=Math.atan2(-j,m),this._z=Math.atan2(-f,e)):(this._x=Math.atan2(l,i),this._z=0);break;case"YXZ":this._x=Math.asin(-dr(j,-1,1)),.9999999>Math.abs(j)?(this._y=Math.atan2(g,m),this._z=Math.atan2(h,i)):(this._y=Math.atan2(-k,e),this._z=0);break;case"ZXY":this._x=Math.asin(dr(l,-1,1)),.9999999>Math.abs(l)?(this._y=Math.atan2(-k,m),this._z=Math.atan2(-f,i)):(this._y=0,this._z=Math.atan2(h,e));break;case"ZYX":this._y=Math.asin(-dr(k,-1,1)),.9999999>Math.abs(k)?(this._x=Math.atan2(l,m),this._z=Math.atan2(h,e)):(this._x=0,this._z=Math.atan2(-f,i));break;case"YZX":this._z=Math.asin(dr(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-j,i),this._y=Math.atan2(-k,e)):(this._x=0,this._y=Math.atan2(g,m));break;case"XZY":this._z=Math.asin(-dr(f,-1,1)),.9999999>Math.abs(f)?(this._x=Math.atan2(l,i),this._y=Math.atan2(g,e)):(this._x=Math.atan2(-j,m),this._y=0);break;default:dg("Euler: .setFromRotationMatrix() encountered an unknown order: "+b)}return this._order=b,!0===c&&this._onChangeCallback(),this}setFromQuaternion(a,b,c){return d4.makeRotationFromQuaternion(a),this.setFromRotationMatrix(d4,b,c)}setFromVector3(a,b=this._order){return this.set(a.x,a.y,a.z,b)}reorder(a){return d5.setFromEuler(this),this.setFromQuaternion(d5,a)}equals(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order}fromArray(a){return this._x=a[0],this._y=a[1],this._z=a[2],void 0!==a[3]&&(this._order=a[3]),this._onChangeCallback(),this}toArray(a=[],b=0){return a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._order,a}_onChange(a){return this._onChangeCallback=a,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}d6.DEFAULT_ORDER="XYZ";class d7{constructor(){this.mask=1}set(a){this.mask=1<<a>>>0}enable(a){this.mask|=1<<a}enableAll(){this.mask=-1}toggle(a){this.mask^=1<<a}disable(a){this.mask&=~(1<<a)}disableAll(){this.mask=0}test(a){return(this.mask&a.mask)!=0}isEnabled(a){return(this.mask&1<<a)!=0}}let d8=0,d9=new dz,ea=new dy,eb=new dY,ec=new dz,ed=new dz,ee=new dz,ef=new dy,eg=new dz(1,0,0),eh=new dz(0,1,0),ei=new dz(0,0,1),ej={type:"added"},ek={type:"removed"},el={type:"childadded",child:null},em={type:"childremoved",child:null};class en extends dk{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:d8++}),this.uuid=dq(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=en.DEFAULT_UP.clone();const a=new dz,b=new d6,c=new dy,d=new dz(1,1,1);b._onChange(function(){c.setFromEuler(b,!1)}),c._onChange(function(){b.setFromQuaternion(c,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:a},rotation:{configurable:!0,enumerable:!0,value:b},quaternion:{configurable:!0,enumerable:!0,value:c},scale:{configurable:!0,enumerable:!0,value:d},modelViewMatrix:{value:new dY},normalMatrix:{value:new dC}}),this.matrix=new dY,this.matrixWorld=new dY,this.matrixAutoUpdate=en.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=en.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new d7,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(a){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(a),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(a){return this.quaternion.premultiply(a),this}setRotationFromAxisAngle(a,b){this.quaternion.setFromAxisAngle(a,b)}setRotationFromEuler(a){this.quaternion.setFromEuler(a,!0)}setRotationFromMatrix(a){this.quaternion.setFromRotationMatrix(a)}setRotationFromQuaternion(a){this.quaternion.copy(a)}rotateOnAxis(a,b){return ea.setFromAxisAngle(a,b),this.quaternion.multiply(ea),this}rotateOnWorldAxis(a,b){return ea.setFromAxisAngle(a,b),this.quaternion.premultiply(ea),this}rotateX(a){return this.rotateOnAxis(eg,a)}rotateY(a){return this.rotateOnAxis(eh,a)}rotateZ(a){return this.rotateOnAxis(ei,a)}translateOnAxis(a,b){return d9.copy(a).applyQuaternion(this.quaternion),this.position.add(d9.multiplyScalar(b)),this}translateX(a){return this.translateOnAxis(eg,a)}translateY(a){return this.translateOnAxis(eh,a)}translateZ(a){return this.translateOnAxis(ei,a)}localToWorld(a){return this.updateWorldMatrix(!0,!1),a.applyMatrix4(this.matrixWorld)}worldToLocal(a){return this.updateWorldMatrix(!0,!1),a.applyMatrix4(eb.copy(this.matrixWorld).invert())}lookAt(a,b,c){a.isVector3?ec.copy(a):ec.set(a,b,c);let d=this.parent;this.updateWorldMatrix(!0,!1),ed.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?eb.lookAt(ed,ec,this.up):eb.lookAt(ec,ed,this.up),this.quaternion.setFromRotationMatrix(eb),d&&(eb.extractRotation(d.matrixWorld),ea.setFromRotationMatrix(eb),this.quaternion.premultiply(ea.invert()))}add(a){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.add(arguments[a]);return this}return a===this?dh("Object3D.add: object can't be added as a child of itself.",a):a&&a.isObject3D?(a.removeFromParent(),a.parent=this,this.children.push(a),a.dispatchEvent(ej),el.child=a,this.dispatchEvent(el),el.child=null):dh("Object3D.add: object not an instance of THREE.Object3D.",a),this}remove(a){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.remove(arguments[a]);return this}let b=this.children.indexOf(a);return -1!==b&&(a.parent=null,this.children.splice(b,1),a.dispatchEvent(ek),em.child=a,this.dispatchEvent(em),em.child=null),this}removeFromParent(){let a=this.parent;return null!==a&&a.remove(this),this}clear(){return this.remove(...this.children)}attach(a){return this.updateWorldMatrix(!0,!1),eb.copy(this.matrixWorld).invert(),null!==a.parent&&(a.parent.updateWorldMatrix(!0,!1),eb.multiply(a.parent.matrixWorld)),a.applyMatrix4(eb),a.removeFromParent(),a.parent=this,this.children.push(a),a.updateWorldMatrix(!1,!0),a.dispatchEvent(ej),el.child=a,this.dispatchEvent(el),el.child=null,this}getObjectById(a){return this.getObjectByProperty("id",a)}getObjectByName(a){return this.getObjectByProperty("name",a)}getObjectByProperty(a,b){if(this[a]===b)return this;for(let c=0,d=this.children.length;c<d;c++){let d=this.children[c].getObjectByProperty(a,b);if(void 0!==d)return d}}getObjectsByProperty(a,b,c=[]){this[a]===b&&c.push(this);let d=this.children;for(let e=0,f=d.length;e<f;e++)d[e].getObjectsByProperty(a,b,c);return c}getWorldPosition(a){return this.updateWorldMatrix(!0,!1),a.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(a){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ed,a,ee),a}getWorldScale(a){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ed,ef,a),a}getWorldDirection(a){this.updateWorldMatrix(!0,!1);let b=this.matrixWorld.elements;return a.set(b[8],b[9],b[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(a){a(this);let b=this.children;for(let c=0,d=b.length;c<d;c++)b[c].traverse(a)}traverseVisible(a){if(!1===this.visible)return;a(this);let b=this.children;for(let c=0,d=b.length;c<d;c++)b[c].traverseVisible(a)}traverseAncestors(a){let b=this.parent;null!==b&&(a(b),b.traverseAncestors(a))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let a=this.pivot;if(null!==a){let b=a.x,c=a.y,d=a.z,e=this.matrix.elements;e[12]+=b-e[0]*b-e[4]*c-e[8]*d,e[13]+=c-e[1]*b-e[5]*c-e[9]*d,e[14]+=d-e[2]*b-e[6]*c-e[10]*d}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(a){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||a)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,a=!0);let b=this.children;for(let c=0,d=b.length;c<d;c++)b[c].updateMatrixWorld(a)}updateWorldMatrix(a,b,c=!1){let d=this.parent;if(!0===a&&null!==d&&d.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||c)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,c=!0),!0===b){let a=this.children;for(let b=0,d=a.length;b<d;b++)a[b].updateWorldMatrix(!1,!0,c)}}toJSON(a){let b=void 0===a||"string"==typeof a,c={};b&&(a={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},c.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let d={};function e(b,c){return void 0===b[c.uuid]&&(b[c.uuid]=c.toJSON(a)),c.uuid}if(d.uuid=this.uuid,d.type=this.type,d.name=this.name,d.castShadow=this.castShadow,d.receiveShadow=this.receiveShadow,d.visible=this.visible,d.frustumCulled=this.frustumCulled,d.renderOrder=this.renderOrder,d.static=this.static,d.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(d.userData=this.userData),d.layers=this.layers.mask,d.matrix=this.matrix.toArray(),d.up=this.up.toArray(),null!==this.pivot&&(d.pivot=this.pivot.toArray()),void 0!==this.morphTargetDictionary&&(d.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(d.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(d.type="InstancedMesh",d.count=this.count,d.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(d.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(d.type="BatchedMesh",d.perObjectFrustumCulled=this.perObjectFrustumCulled,d.sortObjects=this.sortObjects,d.drawRanges=this._drawRanges,d.reservedRanges=this._reservedRanges,d.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),d.instanceInfo=this._instanceInfo.map(a=>({...a})),d.availableInstanceIds=this._availableInstanceIds.slice(),d.availableGeometryIds=this._availableGeometryIds.slice(),d.nextIndexStart=this._nextIndexStart,d.nextVertexStart=this._nextVertexStart,d.geometryCount=this._geometryCount,d.maxInstanceCount=this._maxInstanceCount,d.maxVertexCount=this._maxVertexCount,d.maxIndexCount=this._maxIndexCount,d.geometryInitialized=this._geometryInitialized,d.matricesTexture=this._matricesTexture.toJSON(a),d.indirectTexture=this._indirectTexture.toJSON(a),null!==this._colorsTexture&&(d.colorsTexture=this._colorsTexture.toJSON(a)),null!==this.boundingSphere&&(d.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(d.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?d.background=this.background.toJSON():this.background.isTexture&&(d.background=this.background.toJSON(a).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(d.environment=this.environment.toJSON(a).uuid);else if(this.isMesh||this.isLine||this.isPoints){d.geometry=e(a.geometries,this.geometry);let b=this.geometry.parameters;if(void 0!==b&&void 0!==b.shapes){let c=b.shapes;if(Array.isArray(c))for(let b=0,d=c.length;b<d;b++){let d=c[b];e(a.shapes,d)}else e(a.shapes,c)}}if(this.isSkinnedMesh&&(d.bindMode=this.bindMode,d.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(e(a.skeletons,this.skeleton),d.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let b=[];for(let c=0,d=this.material.length;c<d;c++)b.push(e(a.materials,this.material[c]));d.material=b}else d.material=e(a.materials,this.material);if(this.children.length>0){d.children=[];for(let b=0;b<this.children.length;b++)d.children.push(this.children[b].toJSON(a).object)}if(this.animations.length>0){d.animations=[];for(let b=0;b<this.animations.length;b++){let c=this.animations[b];d.animations.push(e(a.animations,c))}}if(b){let b=f(a.geometries),d=f(a.materials),e=f(a.textures),g=f(a.images),h=f(a.shapes),i=f(a.skeletons),j=f(a.animations),k=f(a.nodes);b.length>0&&(c.geometries=b),d.length>0&&(c.materials=d),e.length>0&&(c.textures=e),g.length>0&&(c.images=g),h.length>0&&(c.shapes=h),i.length>0&&(c.skeletons=i),j.length>0&&(c.animations=j),k.length>0&&(c.nodes=k)}return c.object=d,c;function f(a){let b=[];for(let c in a){let d=a[c];delete d.metadata,b.push(d)}return b}}clone(a){return new this.constructor().copy(this,a)}copy(a,b=!0){if(this.name=a.name,this.up.copy(a.up),this.position.copy(a.position),this.rotation.order=a.rotation.order,this.quaternion.copy(a.quaternion),this.scale.copy(a.scale),this.pivot=null!==a.pivot?a.pivot.clone():null,this.matrix.copy(a.matrix),this.matrixWorld.copy(a.matrixWorld),this.matrixAutoUpdate=a.matrixAutoUpdate,this.matrixWorldAutoUpdate=a.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate,this.layers.mask=a.layers.mask,this.visible=a.visible,this.castShadow=a.castShadow,this.receiveShadow=a.receiveShadow,this.frustumCulled=a.frustumCulled,this.renderOrder=a.renderOrder,this.static=a.static,this.animations=a.animations.slice(),this.userData=JSON.parse(JSON.stringify(a.userData)),!0===b)for(let b=0;b<a.children.length;b++){let c=a.children[b];this.add(c.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}en.DEFAULT_UP=new dz(0,1,0),en.DEFAULT_MATRIX_AUTO_UPDATE=!0,en.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class eo extends en{constructor(){super(),this.isGroup=!0,this.type="Group"}}let ep={type:"move"};class eq{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new eo,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 eo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new dz,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new dz),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new eo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new dz,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new dz,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(a){return null!==this._targetRay&&this._targetRay.dispatchEvent(a),null!==this._grip&&this._grip.dispatchEvent(a),null!==this._hand&&this._hand.dispatchEvent(a),this}connect(a){if(a&&a.hand){let b=this._hand;if(b)for(let c of a.hand.values())this._getHandJoint(b,c)}return this.dispatchEvent({type:"connected",data:a}),this}disconnect(a){return this.dispatchEvent({type:"disconnected",data:a}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(a,b,c){let d=null,e=null,f=null,g=this._targetRay,h=this._grip,i=this._hand;if(a&&"visible-blurred"!==b.session.visibilityState){if(i&&a.hand){for(let d of(f=!0,a.hand.values())){let a=b.getJointPose(d,c),e=this._getHandJoint(i,d);null!==a&&(e.matrix.fromArray(a.transform.matrix),e.matrix.decompose(e.position,e.rotation,e.scale),e.matrixWorldNeedsUpdate=!0,e.jointRadius=a.radius),e.visible=null!==a}let d=i.joints["index-finger-tip"],e=i.joints["thumb-tip"],g=d.position.distanceTo(e.position);i.inputState.pinching&&g>.025?(i.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:a.handedness,target:this})):!i.inputState.pinching&&g<=.015&&(i.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:a.handedness,target:this}))}else null!==h&&a.gripSpace&&null!==(e=b.getPose(a.gripSpace,c))&&(h.matrix.fromArray(e.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,e.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(e.linearVelocity)):h.hasLinearVelocity=!1,e.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(e.angularVelocity)):h.hasAngularVelocity=!1,h.eventsEnabled&&h.dispatchEvent({type:"gripUpdated",data:a,target:this}));null!==g&&(null===(d=b.getPose(a.targetRaySpace,c))&&null!==e&&(d=e),null!==d&&(g.matrix.fromArray(d.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,d.linearVelocity?(g.hasLinearVelocity=!0,g.linearVelocity.copy(d.linearVelocity)):g.hasLinearVelocity=!1,d.angularVelocity?(g.hasAngularVelocity=!0,g.angularVelocity.copy(d.angularVelocity)):g.hasAngularVelocity=!1,this.dispatchEvent(ep)))}return null!==g&&(g.visible=null!==d),null!==h&&(h.visible=null!==e),null!==i&&(i.visible=null!==f),this}_getHandJoint(a,b){if(void 0===a.joints[b.jointName]){let c=new eo;c.matrixAutoUpdate=!1,c.visible=!1,a.joints[b.jointName]=c,a.add(c)}return a.joints[b.jointName]}}let er={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},es={h:0,s:0,l:0},et={h:0,s:0,l:0};function eu(a,b,c){return(c<0&&(c+=1),c>1&&(c-=1),c<1/6)?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*6*(2/3-c):a}class ev{constructor(a,b,c){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(a,b,c)}set(a,b,c){return void 0===b&&void 0===c?a&&a.isColor?this.copy(a):"number"==typeof a?this.setHex(a):"string"==typeof a&&this.setStyle(a):this.setRGB(a,b,c),this}setScalar(a){return this.r=a,this.g=a,this.b=a,this}setHex(a,b=ck){return a=Math.floor(a),this.r=(a>>16&255)/255,this.g=(a>>8&255)/255,this.b=(255&a)/255,dG.colorSpaceToWorking(this,b),this}setRGB(a,b,c,d=dG.workingColorSpace){return this.r=a,this.g=b,this.b=c,dG.colorSpaceToWorking(this,d),this}setHSL(a,b,c,d=dG.workingColorSpace){if(a=ds(a,1),b=dr(b,0,1),c=dr(c,0,1),0===b)this.r=this.g=this.b=c;else{let d=c<=.5?c*(1+b):c+b-c*b,e=2*c-d;this.r=eu(e,d,a+1/3),this.g=eu(e,d,a),this.b=eu(e,d,a-1/3)}return dG.colorSpaceToWorking(this,d),this}setStyle(a,b=ck){let c;function d(b){void 0!==b&&1>parseFloat(b)&&dg("Color: Alpha component of "+a+" will be ignored.")}if(c=/^(\w+)\(([^\)]*)\)/.exec(a)){let e,f=c[1],g=c[2];switch(f){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(g))return d(e[4]),this.setRGB(Math.min(255,parseInt(e[1],10))/255,Math.min(255,parseInt(e[2],10))/255,Math.min(255,parseInt(e[3],10))/255,b);if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(g))return d(e[4]),this.setRGB(Math.min(100,parseInt(e[1],10))/100,Math.min(100,parseInt(e[2],10))/100,Math.min(100,parseInt(e[3],10))/100,b);break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(g))return d(e[4]),this.setHSL(parseFloat(e[1])/360,parseFloat(e[2])/100,parseFloat(e[3])/100,b);break;default:dg("Color: Unknown color model "+a)}}else if(c=/^\#([A-Fa-f\d]+)$/.exec(a)){let d=c[1],e=d.length;if(3===e)return this.setRGB(parseInt(d.charAt(0),16)/15,parseInt(d.charAt(1),16)/15,parseInt(d.charAt(2),16)/15,b);if(6===e)return this.setHex(parseInt(d,16),b);dg("Color: Invalid hex color "+a)}else if(a&&a.length>0)return this.setColorName(a,b);return this}setColorName(a,b=ck){let c=er[a.toLowerCase()];return void 0!==c?this.setHex(c,b):dg("Color: Unknown color "+a),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(a){return this.r=a.r,this.g=a.g,this.b=a.b,this}copySRGBToLinear(a){return this.r=dH(a.r),this.g=dH(a.g),this.b=dH(a.b),this}copyLinearToSRGB(a){return this.r=dI(a.r),this.g=dI(a.g),this.b=dI(a.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(a=ck){return dG.workingToColorSpace(ew.copy(this),a),65536*Math.round(dr(255*ew.r,0,255))+256*Math.round(dr(255*ew.g,0,255))+Math.round(dr(255*ew.b,0,255))}getHexString(a=ck){return("000000"+this.getHex(a).toString(16)).slice(-6)}getHSL(a,b=dG.workingColorSpace){let c,d;dG.workingToColorSpace(ew.copy(this),b);let e=ew.r,f=ew.g,g=ew.b,h=Math.max(e,f,g),i=Math.min(e,f,g),j=(i+h)/2;if(i===h)c=0,d=0;else{let a=h-i;switch(d=j<=.5?a/(h+i):a/(2-h-i),h){case e:c=(f-g)/a+6*(f<g);break;case f:c=(g-e)/a+2;break;case g:c=(e-f)/a+4}c/=6}return a.h=c,a.s=d,a.l=j,a}getRGB(a,b=dG.workingColorSpace){return dG.workingToColorSpace(ew.copy(this),b),a.r=ew.r,a.g=ew.g,a.b=ew.b,a}getStyle(a=ck){dG.workingToColorSpace(ew.copy(this),a);let b=ew.r,c=ew.g,d=ew.b;return a!==ck?`color(${a} ${b.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(3)})`:`rgb(${Math.round(255*b)},${Math.round(255*c)},${Math.round(255*d)})`}offsetHSL(a,b,c){return this.getHSL(es),this.setHSL(es.h+a,es.s+b,es.l+c)}add(a){return this.r+=a.r,this.g+=a.g,this.b+=a.b,this}addColors(a,b){return this.r=a.r+b.r,this.g=a.g+b.g,this.b=a.b+b.b,this}addScalar(a){return this.r+=a,this.g+=a,this.b+=a,this}sub(a){return this.r=Math.max(0,this.r-a.r),this.g=Math.max(0,this.g-a.g),this.b=Math.max(0,this.b-a.b),this}multiply(a){return this.r*=a.r,this.g*=a.g,this.b*=a.b,this}multiplyScalar(a){return this.r*=a,this.g*=a,this.b*=a,this}lerp(a,b){return this.r+=(a.r-this.r)*b,this.g+=(a.g-this.g)*b,this.b+=(a.b-this.b)*b,this}lerpColors(a,b,c){return this.r=a.r+(b.r-a.r)*c,this.g=a.g+(b.g-a.g)*c,this.b=a.b+(b.b-a.b)*c,this}lerpHSL(a,b){this.getHSL(es),a.getHSL(et);let c=dt(es.h,et.h,b),d=dt(es.s,et.s,b),e=dt(es.l,et.l,b);return this.setHSL(c,d,e),this}setFromVector3(a){return this.r=a.x,this.g=a.y,this.b=a.z,this}applyMatrix3(a){let b=this.r,c=this.g,d=this.b,e=a.elements;return this.r=e[0]*b+e[3]*c+e[6]*d,this.g=e[1]*b+e[4]*c+e[7]*d,this.b=e[2]*b+e[5]*c+e[8]*d,this}equals(a){return a.r===this.r&&a.g===this.g&&a.b===this.b}fromArray(a,b=0){return this.r=a[b],this.g=a[b+1],this.b=a[b+2],this}toArray(a=[],b=0){return a[b]=this.r,a[b+1]=this.g,a[b+2]=this.b,a}fromBufferAttribute(a,b){return this.r=a.getX(b),this.g=a.getY(b),this.b=a.getZ(b),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let ew=new ev;ev.NAMES=er;class ex{constructor(a,b=25e-5){this.isFogExp2=!0,this.name="",this.color=new ev(a),this.density=b}clone(){return new ex(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ey{constructor(a,b=1,c=1e3){this.isFog=!0,this.name="",this.color=new ev(a),this.near=b,this.far=c}clone(){return new ey(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class ez extends en{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 d6,this.environmentIntensity=1,this.environmentRotation=new d6,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(a,b){return super.copy(a,b),null!==a.background&&(this.background=a.background.clone()),null!==a.environment&&(this.environment=a.environment.clone()),null!==a.fog&&(this.fog=a.fog.clone()),this.backgroundBlurriness=a.backgroundBlurriness,this.backgroundIntensity=a.backgroundIntensity,this.backgroundRotation.copy(a.backgroundRotation),this.environmentIntensity=a.environmentIntensity,this.environmentRotation.copy(a.environmentRotation),null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone()),this.matrixAutoUpdate=a.matrixAutoUpdate,this}toJSON(a){let b=super.toJSON(a);return null!==this.fog&&(b.object.fog=this.fog.toJSON()),b.object.backgroundBlurriness=this.backgroundBlurriness,b.object.backgroundIntensity=this.backgroundIntensity,b.object.backgroundRotation=this.backgroundRotation.toArray(),b.object.environmentIntensity=this.environmentIntensity,b.object.environmentRotation=this.environmentRotation.toArray(),b}}let eA=new dz,eB=new dz,eC=new dz,eD=new dz,eE=new dz,eF=new dz,eG=new dz,eH=new dz,eI=new dz,eJ=new dz,eK=new dR,eL=new dR,eM=new dR;class eN{constructor(a=new dz,b=new dz,c=new dz){this.a=a,this.b=b,this.c=c}static getNormal(a,b,c,d){d.subVectors(c,b),eA.subVectors(a,b),d.cross(eA);let e=d.lengthSq();return e>0?d.multiplyScalar(1/Math.sqrt(e)):d.set(0,0,0)}static getBarycoord(a,b,c,d,e){eA.subVectors(d,b),eB.subVectors(c,b),eC.subVectors(a,b);let f=eA.dot(eA),g=eA.dot(eB),h=eA.dot(eC),i=eB.dot(eB),j=eB.dot(eC),k=f*i-g*g;if(0===k)return e.set(0,0,0),null;let l=1/k,m=(i*h-g*j)*l,n=(f*j-g*h)*l;return e.set(1-m-n,n,m)}static containsPoint(a,b,c,d){return null!==this.getBarycoord(a,b,c,d,eD)&&eD.x>=0&&eD.y>=0&&eD.x+eD.y<=1}static getInterpolation(a,b,c,d,e,f,g,h){return null===this.getBarycoord(a,b,c,d,eD)?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(e,eD.x),h.addScaledVector(f,eD.y),h.addScaledVector(g,eD.z),h)}static getInterpolatedAttribute(a,b,c,d,e,f){return eK.setScalar(0),eL.setScalar(0),eM.setScalar(0),eK.fromBufferAttribute(a,b),eL.fromBufferAttribute(a,c),eM.fromBufferAttribute(a,d),f.setScalar(0),f.addScaledVector(eK,e.x),f.addScaledVector(eL,e.y),f.addScaledVector(eM,e.z),f}static isFrontFacing(a,b,c,d){return eA.subVectors(c,b),eB.subVectors(a,b),0>eA.cross(eB).dot(d)}set(a,b,c){return this.a.copy(a),this.b.copy(b),this.c.copy(c),this}setFromPointsAndIndices(a,b,c,d){return this.a.copy(a[b]),this.b.copy(a[c]),this.c.copy(a[d]),this}setFromAttributeAndIndices(a,b,c,d){return this.a.fromBufferAttribute(a,b),this.b.fromBufferAttribute(a,c),this.c.fromBufferAttribute(a,d),this}clone(){return new this.constructor().copy(this)}copy(a){return this.a.copy(a.a),this.b.copy(a.b),this.c.copy(a.c),this}getArea(){return eA.subVectors(this.c,this.b),eB.subVectors(this.a,this.b),.5*eA.cross(eB).length()}getMidpoint(a){return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(a){return eN.getNormal(this.a,this.b,this.c,a)}getPlane(a){return a.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(a,b){return eN.getBarycoord(a,this.a,this.b,this.c,b)}getInterpolation(a,b,c,d,e){return eN.getInterpolation(a,this.a,this.b,this.c,b,c,d,e)}containsPoint(a){return eN.containsPoint(a,this.a,this.b,this.c)}isFrontFacing(a){return eN.isFrontFacing(this.a,this.b,this.c,a)}intersectsBox(a){return a.intersectsTriangle(this)}closestPointToPoint(a,b){let c,d,e=this.a,f=this.b,g=this.c;eE.subVectors(f,e),eF.subVectors(g,e),eH.subVectors(a,e);let h=eE.dot(eH),i=eF.dot(eH);if(h<=0&&i<=0)return b.copy(e);eI.subVectors(a,f);let j=eE.dot(eI),k=eF.dot(eI);if(j>=0&&k<=j)return b.copy(f);let l=h*k-j*i;if(l<=0&&h>=0&&j<=0)return c=h/(h-j),b.copy(e).addScaledVector(eE,c);eJ.subVectors(a,g);let m=eE.dot(eJ),n=eF.dot(eJ);if(n>=0&&m<=n)return b.copy(g);let o=m*i-h*n;if(o<=0&&i>=0&&n<=0)return d=i/(i-n),b.copy(e).addScaledVector(eF,d);let p=j*n-m*k;if(p<=0&&k-j>=0&&m-n>=0)return eG.subVectors(g,f),d=(k-j)/(k-j+(m-n)),b.copy(f).addScaledVector(eG,d);let q=1/(p+o+l);return c=o*q,d=l*q,b.copy(e).addScaledVector(eE,c).addScaledVector(eF,d)}equals(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}}class eO{constructor(a=new dz(Infinity,Infinity,Infinity),b=new dz(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=a,this.max=b}set(a,b){return this.min.copy(a),this.max.copy(b),this}setFromArray(a){this.makeEmpty();for(let b=0,c=a.length;b<c;b+=3)this.expandByPoint(eQ.fromArray(a,b));return this}setFromBufferAttribute(a){this.makeEmpty();for(let b=0,c=a.count;b<c;b++)this.expandByPoint(eQ.fromBufferAttribute(a,b));return this}setFromPoints(a){this.makeEmpty();for(let b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this}setFromCenterAndSize(a,b){let c=eQ.copy(b).multiplyScalar(.5);return this.min.copy(a).sub(c),this.max.copy(a).add(c),this}setFromObject(a,b=!1){return this.makeEmpty(),this.expandByObject(a,b)}clone(){return new this.constructor().copy(this)}copy(a){return this.min.copy(a.min),this.max.copy(a.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(a){return this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(a){return this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)}expandByPoint(a){return this.min.min(a),this.max.max(a),this}expandByVector(a){return this.min.sub(a),this.max.add(a),this}expandByScalar(a){return this.min.addScalar(-a),this.max.addScalar(a),this}expandByObject(a,b=!1){a.updateWorldMatrix(!1,!1);let c=a.geometry;if(void 0!==c){let d=c.getAttribute("position");if(!0===b&&void 0!==d&&!0!==a.isInstancedMesh)for(let b=0,c=d.count;b<c;b++)!0===a.isMesh?a.getVertexPosition(b,eQ):eQ.fromBufferAttribute(d,b),eQ.applyMatrix4(a.matrixWorld),this.expandByPoint(eQ);else void 0!==a.boundingBox?(null===a.boundingBox&&a.computeBoundingBox(),eR.copy(a.boundingBox)):(null===c.boundingBox&&c.computeBoundingBox(),eR.copy(c.boundingBox)),eR.applyMatrix4(a.matrixWorld),this.union(eR)}let d=a.children;for(let a=0,c=d.length;a<c;a++)this.expandByObject(d[a],b);return this}containsPoint(a){return a.x>=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y&&a.z>=this.min.z&&a.z<=this.max.z}containsBox(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z}getParameter(a,b){return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(a){return a.max.x>=this.min.x&&a.min.x<=this.max.x&&a.max.y>=this.min.y&&a.min.y<=this.max.y&&a.max.z>=this.min.z&&a.min.z<=this.max.z}intersectsSphere(a){return this.clampPoint(a.center,eQ),eQ.distanceToSquared(a.center)<=a.radius*a.radius}intersectsPlane(a){let b,c;return a.normal.x>0?(b=a.normal.x*this.min.x,c=a.normal.x*this.max.x):(b=a.normal.x*this.max.x,c=a.normal.x*this.min.x),a.normal.y>0?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y),a.normal.z>0?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z),b<=-a.constant&&c>=-a.constant}intersectsTriangle(a){if(this.isEmpty())return!1;this.getCenter(eY),eZ.subVectors(this.max,eY),eS.subVectors(a.a,eY),eT.subVectors(a.b,eY),eU.subVectors(a.c,eY),eV.subVectors(eT,eS),eW.subVectors(eU,eT),eX.subVectors(eS,eU);let b=[0,-eV.z,eV.y,0,-eW.z,eW.y,0,-eX.z,eX.y,eV.z,0,-eV.x,eW.z,0,-eW.x,eX.z,0,-eX.x,-eV.y,eV.x,0,-eW.y,eW.x,0,-eX.y,eX.x,0];return!!e0(b,eS,eT,eU,eZ)&&!!e0(b=[1,0,0,0,1,0,0,0,1],eS,eT,eU,eZ)&&(e$.crossVectors(eV,eW),e0(b=[e$.x,e$.y,e$.z],eS,eT,eU,eZ))}clampPoint(a,b){return b.copy(a).clamp(this.min,this.max)}distanceToPoint(a){return this.clampPoint(a,eQ).distanceTo(a)}getBoundingSphere(a){return this.isEmpty()?a.makeEmpty():(this.getCenter(a.center),a.radius=.5*this.getSize(eQ).length()),a}intersect(a){return this.min.max(a.min),this.max.min(a.max),this.isEmpty()&&this.makeEmpty(),this}union(a){return this.min.min(a.min),this.max.max(a.max),this}applyMatrix4(a){return this.isEmpty()||(eP[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(a),eP[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(a),eP[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(a),eP[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(a),eP[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(a),eP[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(a),eP[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(a),eP[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(a),this.setFromPoints(eP)),this}translate(a){return this.min.add(a),this.max.add(a),this}equals(a){return a.min.equals(this.min)&&a.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(a){return this.min.fromArray(a.min),this.max.fromArray(a.max),this}}let eP=[new dz,new dz,new dz,new dz,new dz,new dz,new dz,new dz],eQ=new dz,eR=new eO,eS=new dz,eT=new dz,eU=new dz,eV=new dz,eW=new dz,eX=new dz,eY=new dz,eZ=new dz,e$=new dz,e_=new dz;function e0(a,b,c,d,e){for(let f=0,g=a.length-3;f<=g;f+=3){e_.fromArray(a,f);let g=e.x*Math.abs(e_.x)+e.y*Math.abs(e_.y)+e.z*Math.abs(e_.z),h=b.dot(e_),i=c.dot(e_),j=d.dot(e_);if(Math.max(-Math.max(h,i,j),Math.min(h,i,j))>g)return!1}return!0}let e1=function(){let a=new ArrayBuffer(4),b=new Float32Array(a),c=new Uint32Array(a),d=new Uint32Array(512),e=new Uint32Array(512);for(let a=0;a<256;++a){let b=a-127;b<-27?(d[a]=0,d[256|a]=32768,e[a]=24,e[256|a]=24):b<-14?(d[a]=1024>>-b-14,d[256|a]=1024>>-b-14|32768,e[a]=-b-1,e[256|a]=-b-1):b<=15?(d[a]=b+15<<10,d[256|a]=b+15<<10|32768,e[a]=13,e[256|a]=13):b<128?(d[a]=31744,d[256|a]=64512,e[a]=24,e[256|a]=24):(d[a]=31744,d[256|a]=64512,e[a]=13,e[256|a]=13)}let f=new Uint32Array(2048),g=new Uint32Array(64),h=new Uint32Array(64);for(let a=1;a<1024;++a){let b=a<<13,c=0;for(;(8388608&b)==0;)b<<=1,c-=8388608;b&=-8388609,c+=0x38800000,f[a]=b|c}for(let a=1024;a<2048;++a)f[a]=0x38000000+(a-1024<<13);for(let a=1;a<31;++a)g[a]=a<<23;g[31]=0x47800000,g[32]=0x80000000;for(let a=33;a<63;++a)g[a]=0x80000000+(a-32<<23);g[63]=0xc7800000;for(let a=1;a<64;++a)32!==a&&(h[a]=1024);return{floatView:b,uint32View:c,baseTable:d,shiftTable:e,mantissaTable:f,exponentTable:g,offsetTable:h}}();function e2(a){Math.abs(a)>65504&&dg("DataUtils.toHalfFloat(): Value out of range."),a=dr(a,-65504,65504),e1.floatView[0]=a;let b=e1.uint32View[0],c=b>>23&511;return e1.baseTable[c]+((8388607&b)>>e1.shiftTable[c])}function e3(a){let b=a>>10;return e1.uint32View[0]=e1.mantissaTable[e1.offsetTable[b]+(1023&a)]+e1.exponentTable[b],e1.floatView[0]}class e4{static toHalfFloat(a){return e2(a)}static fromHalfFloat(a){return e3(a)}}let e5=new dz,e6=new dx,e7=0;class e8 extends dk{constructor(a,b,c=!1){if(super(),Array.isArray(a))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:e7++}),this.name="",this.array=a,this.itemSize=b,this.count=void 0!==a?a.length/b:0,this.normalized=c,this.usage=cP,this.updateRanges=[],this.gpuType=a8,this.version=0}onUploadCallback(){}set needsUpdate(a){!0===a&&this.version++}setUsage(a){return this.usage=a,this}addUpdateRange(a,b){this.updateRanges.push({start:a,count:b})}clearUpdateRanges(){this.updateRanges.length=0}copy(a){return this.name=a.name,this.array=new a.array.constructor(a.array),this.itemSize=a.itemSize,this.count=a.count,this.normalized=a.normalized,this.usage=a.usage,this.gpuType=a.gpuType,this}copyAt(a,b,c){a*=this.itemSize,c*=b.itemSize;for(let d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this}copyArray(a){return this.array.set(a),this}applyMatrix3(a){if(2===this.itemSize)for(let b=0,c=this.count;b<c;b++)e6.fromBufferAttribute(this,b),e6.applyMatrix3(a),this.setXY(b,e6.x,e6.y);else if(3===this.itemSize)for(let b=0,c=this.count;b<c;b++)e5.fromBufferAttribute(this,b),e5.applyMatrix3(a),this.setXYZ(b,e5.x,e5.y,e5.z);return this}applyMatrix4(a){for(let b=0,c=this.count;b<c;b++)e5.fromBufferAttribute(this,b),e5.applyMatrix4(a),this.setXYZ(b,e5.x,e5.y,e5.z);return this}applyNormalMatrix(a){for(let b=0,c=this.count;b<c;b++)e5.fromBufferAttribute(this,b),e5.applyNormalMatrix(a),this.setXYZ(b,e5.x,e5.y,e5.z);return this}transformDirection(a){for(let b=0,c=this.count;b<c;b++)e5.fromBufferAttribute(this,b),e5.transformDirection(a),this.setXYZ(b,e5.x,e5.y,e5.z);return this}set(a,b=0){return this.array.set(a,b),this}getComponent(a,b){let c=this.array[a*this.itemSize+b];return this.normalized&&(c=du(c,this.array)),c}setComponent(a,b,c){return this.normalized&&(c=dv(c,this.array)),this.array[a*this.itemSize+b]=c,this}getX(a){let b=this.array[a*this.itemSize];return this.normalized&&(b=du(b,this.array)),b}setX(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize]=b,this}getY(a){let b=this.array[a*this.itemSize+1];return this.normalized&&(b=du(b,this.array)),b}setY(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+1]=b,this}getZ(a){let b=this.array[a*this.itemSize+2];return this.normalized&&(b=du(b,this.array)),b}setZ(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+2]=b,this}getW(a){let b=this.array[a*this.itemSize+3];return this.normalized&&(b=du(b,this.array)),b}setW(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+3]=b,this}setXY(a,b,c){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array)),this.array[a+0]=b,this.array[a+1]=c,this}setXYZ(a,b,c,d){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array)),this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this}setXYZW(a,b,c,d,e){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array),e=dv(e,this.array)),this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this.array[a+3]=e,this}onUpload(a){return this.onUploadCallback=a,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let a={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return a.name=this.name,a.usage=this.usage,a.gpuType=this.gpuType,a}dispose(){this.dispatchEvent({type:"dispose"})}}class e9 extends e8{constructor(a,b,c){super(new Int8Array(a),b,c)}}class fa extends e8{constructor(a,b,c){super(new Uint8Array(a),b,c)}}class fb extends e8{constructor(a,b,c){super(new Uint8ClampedArray(a),b,c)}}class fc extends e8{constructor(a,b,c){super(new Int16Array(a),b,c)}}class fd extends e8{constructor(a,b,c){super(new Uint16Array(a),b,c)}}class fe extends e8{constructor(a,b,c){super(new Int32Array(a),b,c)}}class ff extends e8{constructor(a,b,c){super(new Uint32Array(a),b,c)}}class fg extends e8{constructor(a,b,c){super(new Uint16Array(a),b,c),this.isFloat16BufferAttribute=!0}getX(a){let b=e3(this.array[a*this.itemSize]);return this.normalized&&(b=du(b,this.array)),b}setX(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize]=e2(b),this}getY(a){let b=e3(this.array[a*this.itemSize+1]);return this.normalized&&(b=du(b,this.array)),b}setY(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+1]=e2(b),this}getZ(a){let b=e3(this.array[a*this.itemSize+2]);return this.normalized&&(b=du(b,this.array)),b}setZ(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+2]=e2(b),this}getW(a){let b=e3(this.array[a*this.itemSize+3]);return this.normalized&&(b=du(b,this.array)),b}setW(a,b){return this.normalized&&(b=dv(b,this.array)),this.array[a*this.itemSize+3]=e2(b),this}setXY(a,b,c){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array)),this.array[a+0]=e2(b),this.array[a+1]=e2(c),this}setXYZ(a,b,c,d){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array)),this.array[a+0]=e2(b),this.array[a+1]=e2(c),this.array[a+2]=e2(d),this}setXYZW(a,b,c,d,e){return a*=this.itemSize,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array),e=dv(e,this.array)),this.array[a+0]=e2(b),this.array[a+1]=e2(c),this.array[a+2]=e2(d),this.array[a+3]=e2(e),this}}class fh extends e8{constructor(a,b,c){super(new Float32Array(a),b,c)}}let fi=new eO,fj=new dz,fk=new dz;class fl{constructor(a=new dz,b=-1){this.isSphere=!0,this.center=a,this.radius=b}set(a,b){return this.center.copy(a),this.radius=b,this}setFromPoints(a,b){let c=this.center;void 0!==b?c.copy(b):fi.setFromPoints(a).getCenter(c);let d=0;for(let b=0,e=a.length;b<e;b++)d=Math.max(d,c.distanceToSquared(a[b]));return this.radius=Math.sqrt(d),this}copy(a){return this.center.copy(a.center),this.radius=a.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(a){return a.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(a){return a.distanceTo(this.center)-this.radius}intersectsSphere(a){let b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b}intersectsBox(a){return a.intersectsSphere(this)}intersectsPlane(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius}clampPoint(a,b){let c=this.center.distanceToSquared(a);return b.copy(a),c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center)),b}getBoundingBox(a){return this.isEmpty()?a.makeEmpty():(a.set(this.center,this.center),a.expandByScalar(this.radius)),a}applyMatrix4(a){return this.center.applyMatrix4(a),this.radius=this.radius*a.getMaxScaleOnAxis(),this}translate(a){return this.center.add(a),this}expandByPoint(a){if(this.isEmpty())return this.center.copy(a),this.radius=0,this;fj.subVectors(a,this.center);let b=fj.lengthSq();if(b>this.radius*this.radius){let a=Math.sqrt(b),c=(a-this.radius)*.5;this.center.addScaledVector(fj,c/a),this.radius+=c}return this}union(a){return a.isEmpty()||(this.isEmpty()?this.copy(a):!0===this.center.equals(a.center)?this.radius=Math.max(this.radius,a.radius):(fk.subVectors(a.center,this.center).setLength(a.radius),this.expandByPoint(fj.copy(a.center).add(fk)),this.expandByPoint(fj.copy(a.center).sub(fk)))),this}equals(a){return a.center.equals(this.center)&&a.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(a){return this.radius=a.radius,this.center.fromArray(a.center),this}}let fm=0,fn=new dY,fo=new en,fp=new dz,fq=new eO,fr=new eO,fs=new dz;class ft extends dk{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fm++}),this.uuid=dq(),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(a){return Array.isArray(a)?this.index=new(!function(a){for(let b=a.length-1;b>=0;--b)if(a[b]>=65535)return!0;return!1}(a)?fd:ff)(a,1):this.index=a,this}setIndirect(a,b=0){return this.indirect=a,this.indirectOffset=b,this}getIndirect(){return this.indirect}getAttribute(a){return this.attributes[a]}setAttribute(a,b){return this.attributes[a]=b,this}deleteAttribute(a){return delete this.attributes[a],this}hasAttribute(a){return void 0!==this.attributes[a]}addGroup(a,b,c=0){this.groups.push({start:a,count:b,materialIndex:c})}clearGroups(){this.groups=[]}setDrawRange(a,b){this.drawRange.start=a,this.drawRange.count=b}applyMatrix4(a){let b=this.attributes.position;void 0!==b&&(b.applyMatrix4(a),b.needsUpdate=!0);let c=this.attributes.normal;if(void 0!==c){let b=new dC().getNormalMatrix(a);c.applyNormalMatrix(b),c.needsUpdate=!0}let d=this.attributes.tangent;return void 0!==d&&(d.transformDirection(a),d.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(a){return fn.makeRotationFromQuaternion(a),this.applyMatrix4(fn),this}rotateX(a){return fn.makeRotationX(a),this.applyMatrix4(fn),this}rotateY(a){return fn.makeRotationY(a),this.applyMatrix4(fn),this}rotateZ(a){return fn.makeRotationZ(a),this.applyMatrix4(fn),this}translate(a,b,c){return fn.makeTranslation(a,b,c),this.applyMatrix4(fn),this}scale(a,b,c){return fn.makeScale(a,b,c),this.applyMatrix4(fn),this}lookAt(a){return fo.lookAt(a),fo.updateMatrix(),this.applyMatrix4(fo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fp).negate(),this.translate(fp.x,fp.y,fp.z),this}setFromPoints(a){let b=this.getAttribute("position");if(void 0===b){let b=[];for(let c=0,d=a.length;c<d;c++){let d=a[c];b.push(d.x,d.y,d.z||0)}this.setAttribute("position",new fh(b,3))}else{let c=Math.min(a.length,b.count);for(let d=0;d<c;d++){let c=a[d];b.setXYZ(d,c.x,c.y,c.z||0)}a.length>b.count&&dg("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),b.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new eO);let a=this.attributes.position,b=this.morphAttributes.position;if(a&&a.isGLBufferAttribute){dh("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new dz(-1/0,-1/0,-1/0),new dz(Infinity,Infinity,Infinity));return}if(void 0!==a){if(this.boundingBox.setFromBufferAttribute(a),b)for(let a=0,c=b.length;a<c;a++){let c=b[a];fq.setFromBufferAttribute(c),this.morphTargetsRelative?(fs.addVectors(this.boundingBox.min,fq.min),this.boundingBox.expandByPoint(fs),fs.addVectors(this.boundingBox.max,fq.max),this.boundingBox.expandByPoint(fs)):(this.boundingBox.expandByPoint(fq.min),this.boundingBox.expandByPoint(fq.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&dh('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 fl);let a=this.attributes.position,b=this.morphAttributes.position;if(a&&a.isGLBufferAttribute){dh("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new dz,1/0);return}if(a){let c=this.boundingSphere.center;if(fq.setFromBufferAttribute(a),b)for(let a=0,c=b.length;a<c;a++){let c=b[a];fr.setFromBufferAttribute(c),this.morphTargetsRelative?(fs.addVectors(fq.min,fr.min),fq.expandByPoint(fs),fs.addVectors(fq.max,fr.max),fq.expandByPoint(fs)):(fq.expandByPoint(fr.min),fq.expandByPoint(fr.max))}fq.getCenter(c);let d=0;for(let b=0,e=a.count;b<e;b++)fs.fromBufferAttribute(a,b),d=Math.max(d,c.distanceToSquared(fs));if(b)for(let e=0,f=b.length;e<f;e++){let f=b[e],g=this.morphTargetsRelative;for(let b=0,e=f.count;b<e;b++)fs.fromBufferAttribute(f,b),g&&(fp.fromBufferAttribute(a,b),fs.add(fp)),d=Math.max(d,c.distanceToSquared(fs))}this.boundingSphere.radius=Math.sqrt(d),isNaN(this.boundingSphere.radius)&&dh('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let a=this.index,b=this.attributes;if(null===a||void 0===b.position||void 0===b.normal||void 0===b.uv)return void dh("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let c=b.position,d=b.normal,e=b.uv,f=this.getAttribute("tangent");(void 0===f||f.count!==c.count)&&(f=new e8(new Float32Array(4*c.count),4),this.setAttribute("tangent",f));let g=[],h=[];for(let a=0;a<c.count;a++)g[a]=new dz,h[a]=new dz;let i=new dz,j=new dz,k=new dz,l=new dx,m=new dx,n=new dx,o=new dz,p=new dz,q=this.groups;0===q.length&&(q=[{start:0,count:a.count}]);for(let b=0,d=q.length;b<d;++b){let d=q[b],f=d.start,r=d.count;for(let b=f,d=f+r;b<d;b+=3)!function(a,b,d){i.fromBufferAttribute(c,a),j.fromBufferAttribute(c,b),k.fromBufferAttribute(c,d),l.fromBufferAttribute(e,a),m.fromBufferAttribute(e,b),n.fromBufferAttribute(e,d),j.sub(i),k.sub(i),m.sub(l),n.sub(l);let f=1/(m.x*n.y-n.x*m.y);isFinite(f)&&(o.copy(j).multiplyScalar(n.y).addScaledVector(k,-m.y).multiplyScalar(f),p.copy(k).multiplyScalar(m.x).addScaledVector(j,-n.x).multiplyScalar(f),g[a].add(o),g[b].add(o),g[d].add(o),h[a].add(p),h[b].add(p),h[d].add(p))}(a.getX(b+0),a.getX(b+1),a.getX(b+2))}let r=new dz,s=new dz,t=new dz,u=new dz;function v(a){t.fromBufferAttribute(d,a),u.copy(t);let b=g[a];r.copy(b),r.sub(t.multiplyScalar(t.dot(b))).normalize(),s.crossVectors(u,b);let c=s.dot(h[a]);f.setXYZW(a,r.x,r.y,r.z,c<0?-1:1)}for(let b=0,c=q.length;b<c;++b){let c=q[b],d=c.start,e=c.count;for(let b=d,c=d+e;b<c;b+=3)v(a.getX(b+0)),v(a.getX(b+1)),v(a.getX(b+2))}this._transformed=!0}computeVertexNormals(){let a=this.index,b=this.getAttribute("position");if(void 0!==b){let c=this.getAttribute("normal");if(void 0===c||c.count!==b.count)c=new e8(new Float32Array(3*b.count),3),this.setAttribute("normal",c);else for(let a=0,b=c.count;a<b;a++)c.setXYZ(a,0,0,0);let d=new dz,e=new dz,f=new dz,g=new dz,h=new dz,i=new dz,j=new dz,k=new dz;if(a)for(let l=0,m=a.count;l<m;l+=3){let m=a.getX(l+0),n=a.getX(l+1),o=a.getX(l+2);d.fromBufferAttribute(b,m),e.fromBufferAttribute(b,n),f.fromBufferAttribute(b,o),j.subVectors(f,e),k.subVectors(d,e),j.cross(k),g.fromBufferAttribute(c,m),h.fromBufferAttribute(c,n),i.fromBufferAttribute(c,o),g.add(j),h.add(j),i.add(j),c.setXYZ(m,g.x,g.y,g.z),c.setXYZ(n,h.x,h.y,h.z),c.setXYZ(o,i.x,i.y,i.z)}else for(let a=0,g=b.count;a<g;a+=3)d.fromBufferAttribute(b,a+0),e.fromBufferAttribute(b,a+1),f.fromBufferAttribute(b,a+2),j.subVectors(f,e),k.subVectors(d,e),j.cross(k),c.setXYZ(a+0,j.x,j.y,j.z),c.setXYZ(a+1,j.x,j.y,j.z),c.setXYZ(a+2,j.x,j.y,j.z);this.normalizeNormals(),c.needsUpdate=!0}}normalizeNormals(){let a=this.attributes.normal;for(let b=0,c=a.count;b<c;b++)fs.fromBufferAttribute(a,b),fs.normalize(),a.setXYZ(b,fs.x,fs.y,fs.z)}toNonIndexed(){function a(a,b){let c=a.array,d=a.itemSize,e=a.normalized,f=new c.constructor(b.length*d),g=0,h=0;for(let e=0,i=b.length;e<i;e++){g=a.isInterleavedBufferAttribute?b[e]*a.data.stride+a.offset:b[e]*d;for(let a=0;a<d;a++)f[h++]=c[g++]}return new e8(f,d,e)}if(null===this.index)return dg("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let b=new ft,c=this.index.array,d=this.attributes;for(let e in d){let f=a(d[e],c);b.setAttribute(e,f)}let e=this.morphAttributes;for(let d in e){let f=[],g=e[d];for(let b=0,d=g.length;b<d;b++){let d=a(g[b],c);f.push(d)}b.morphAttributes[d]=f}b.morphTargetsRelative=this.morphTargetsRelative;let f=this.groups;for(let a=0,c=f.length;a<c;a++){let c=f[a];b.addGroup(c.start,c.count,c.materialIndex)}return b}toJSON(){let a={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(a.uuid=this.uuid,a.type=void 0!==this.parameters&&!0===this._transformed?"BufferGeometry":this.type,a.name=this.name,Object.keys(this.userData).length>0&&(a.userData=this.userData),void 0!==this.parameters&&!0!==this._transformed){let b=this.parameters;for(let c in b)void 0!==b[c]&&(a[c]=b[c]);return a}a.data={attributes:{}};let b=this.index;null!==b&&(a.data.index={type:b.array.constructor.name,array:Array.prototype.slice.call(b.array)});let c=this.attributes;for(let b in c){let d=c[b];a.data.attributes[b]=d.toJSON(a.data)}let d={},e=!1;for(let b in this.morphAttributes){let c=this.morphAttributes[b],f=[];for(let b=0,d=c.length;b<d;b++){let d=c[b];f.push(d.toJSON(a.data))}f.length>0&&(d[b]=f,e=!0)}e&&(a.data.morphAttributes=d,a.data.morphTargetsRelative=this.morphTargetsRelative);let f=this.groups;f.length>0&&(a.data.groups=JSON.parse(JSON.stringify(f)));let g=this.boundingSphere;return null!==g&&(a.data.boundingSphere=g.toJSON()),a}clone(){return new this.constructor().copy(this)}copy(a){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let b={};this.name=a.name;let c=a.index;null!==c&&this.setIndex(c.clone());let d=a.attributes;for(let a in d){let c=d[a];this.setAttribute(a,c.clone(b))}let e=a.morphAttributes;for(let a in e){let c=[],d=e[a];for(let a=0,e=d.length;a<e;a++)c.push(d[a].clone(b));this.morphAttributes[a]=c}this.morphTargetsRelative=a.morphTargetsRelative;let f=a.groups;for(let a=0,b=f.length;a<b;a++){let b=f[a];this.addGroup(b.start,b.count,b.materialIndex)}let g=a.boundingBox;null!==g&&(this.boundingBox=g.clone());let h=a.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.drawRange.start=a.drawRange.start,this.drawRange.count=a.drawRange.count,this.userData=a.userData,this._transformed=a._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class fu{constructor(a,b){this.isInterleavedBuffer=!0,this.array=a,this.stride=b,this.count=void 0!==a?a.length/b:0,this.usage=cP,this.updateRanges=[],this.version=0,this.uuid=dq()}onUploadCallback(){}set needsUpdate(a){!0===a&&this.version++}setUsage(a){return this.usage=a,this}addUpdateRange(a,b){this.updateRanges.push({start:a,count:b})}clearUpdateRanges(){this.updateRanges.length=0}copy(a){return this.array=new a.array.constructor(a.array),this.count=a.count,this.stride=a.stride,this.usage=a.usage,this}copyAt(a,b,c){a*=this.stride,c*=b.stride;for(let d=0,e=this.stride;d<e;d++)this.array[a+d]=b.array[c+d];return this}set(a,b=0){return this.array.set(a,b),this}clone(a){void 0===a.arrayBuffers&&(a.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=dq()),void 0===a.arrayBuffers[this.array.buffer._uuid]&&(a.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let b=new this.array.constructor(a.arrayBuffers[this.array.buffer._uuid]),c=new this.constructor(b,this.stride);return c.setUsage(this.usage),c}onUpload(a){return this.onUploadCallback=a,this}toJSON(a){void 0===a.arrayBuffers&&(a.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=dq()),void 0===a.arrayBuffers[this.array.buffer._uuid]&&(a.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer)));let b={uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride};return b.usage=this.usage,b}}let fv=new dz;class fw{constructor(a,b,c,d=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=a,this.itemSize=b,this.offset=c,this.normalized=d}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(a){this.data.needsUpdate=a}applyMatrix4(a){for(let b=0,c=this.data.count;b<c;b++)fv.fromBufferAttribute(this,b),fv.applyMatrix4(a),this.setXYZ(b,fv.x,fv.y,fv.z);return this}applyNormalMatrix(a){for(let b=0,c=this.count;b<c;b++)fv.fromBufferAttribute(this,b),fv.applyNormalMatrix(a),this.setXYZ(b,fv.x,fv.y,fv.z);return this}transformDirection(a){for(let b=0,c=this.count;b<c;b++)fv.fromBufferAttribute(this,b),fv.transformDirection(a),this.setXYZ(b,fv.x,fv.y,fv.z);return this}getComponent(a,b){let c=this.array[a*this.data.stride+this.offset+b];return this.normalized&&(c=du(c,this.array)),c}setComponent(a,b,c){return this.normalized&&(c=dv(c,this.array)),this.data.array[a*this.data.stride+this.offset+b]=c,this}setX(a,b){return this.normalized&&(b=dv(b,this.array)),this.data.array[a*this.data.stride+this.offset]=b,this}setY(a,b){return this.normalized&&(b=dv(b,this.array)),this.data.array[a*this.data.stride+this.offset+1]=b,this}setZ(a,b){return this.normalized&&(b=dv(b,this.array)),this.data.array[a*this.data.stride+this.offset+2]=b,this}setW(a,b){return this.normalized&&(b=dv(b,this.array)),this.data.array[a*this.data.stride+this.offset+3]=b,this}getX(a){let b=this.data.array[a*this.data.stride+this.offset];return this.normalized&&(b=du(b,this.array)),b}getY(a){let b=this.data.array[a*this.data.stride+this.offset+1];return this.normalized&&(b=du(b,this.array)),b}getZ(a){let b=this.data.array[a*this.data.stride+this.offset+2];return this.normalized&&(b=du(b,this.array)),b}getW(a){let b=this.data.array[a*this.data.stride+this.offset+3];return this.normalized&&(b=du(b,this.array)),b}setXY(a,b,c){return a=a*this.data.stride+this.offset,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array)),this.data.array[a+0]=b,this.data.array[a+1]=c,this}setXYZ(a,b,c,d){return a=a*this.data.stride+this.offset,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array)),this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this}setXYZW(a,b,c,d,e){return a=a*this.data.stride+this.offset,this.normalized&&(b=dv(b,this.array),c=dv(c,this.array),d=dv(d,this.array),e=dv(e,this.array)),this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this.data.array[a+3]=e,this}clone(a){if(void 0!==a)return void 0===a.interleavedBuffers&&(a.interleavedBuffers={}),void 0===a.interleavedBuffers[this.data.uuid]&&(a.interleavedBuffers[this.data.uuid]=this.data.clone(a)),new fw(a.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{de("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let a=[];for(let b=0;b<this.count;b++){let c=b*this.data.stride+this.offset;for(let b=0;b<this.itemSize;b++)a.push(this.data.array[c+b])}return new e8(new this.array.constructor(a),this.itemSize,this.normalized)}}toJSON(a){if(void 0!==a)return void 0===a.interleavedBuffers&&(a.interleavedBuffers={}),void 0===a.interleavedBuffers[this.data.uuid]&&(a.interleavedBuffers[this.data.uuid]=this.data.toJSON(a)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{de("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let a=[];for(let b=0;b<this.count;b++){let c=b*this.data.stride+this.offset;for(let b=0;b<this.itemSize;b++)a.push(this.data.array[c+b])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:a,normalized:this.normalized}}}}let fx=new dz,fy=new dz,fz=new dC;class fA{constructor(a=new dz(1,0,0),b=0){this.isPlane=!0,this.normal=a,this.constant=b}set(a,b){return this.normal.copy(a),this.constant=b,this}setComponents(a,b,c,d){return this.normal.set(a,b,c),this.constant=d,this}setFromNormalAndCoplanarPoint(a,b){return this.normal.copy(a),this.constant=-b.dot(this.normal),this}setFromCoplanarPoints(a,b,c){let d=fx.subVectors(c,b).cross(fy.subVectors(a,b)).normalize();return this.setFromNormalAndCoplanarPoint(d,a),this}copy(a){return this.normal.copy(a.normal),this.constant=a.constant,this}normalize(){let a=1/this.normal.length();return this.normal.multiplyScalar(a),this.constant*=a,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(a){return this.normal.dot(a)+this.constant}distanceToSphere(a){return this.distanceToPoint(a.center)-a.radius}projectPoint(a,b){return b.copy(a).addScaledVector(this.normal,-this.distanceToPoint(a))}intersectLine(a,b,c=!0){let d=a.delta(fx),e=this.normal.dot(d);if(0===e)return 0===this.distanceToPoint(a.start)?b.copy(a.start):null;let f=-(a.start.dot(this.normal)+this.constant)/e;return!0===c&&(f<0||f>1)?null:b.copy(a.start).addScaledVector(d,f)}intersectsLine(a){let b=this.distanceToPoint(a.start),c=this.distanceToPoint(a.end);return b<0&&c>0||c<0&&b>0}intersectsBox(a){return a.intersectsPlane(this)}intersectsSphere(a){return a.intersectsPlane(this)}coplanarPoint(a){return a.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(a,b){let c=b||fz.getNormalMatrix(a),d=this.coplanarPoint(fx).applyMatrix4(a),e=this.normal.applyMatrix3(c).normalize();return this.constant=-d.dot(e),this}translate(a){return this.constant-=a.dot(this.normal),this}equals(a){return a.normal.equals(this.normal)&&a.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(a){return this.normal.fromArray(a.normal),this.constant=a.constant,this}}let fB=0;class fC extends dk{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fB++}),this.uuid=dq(),this.name="",this.type="Material",this.blending=S,this.side=O,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=af,this.blendDst=ag,this.blendEquation=Y,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ev(0,0,0),this.blendAlpha=0,this.depthFunc=at,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=cG,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=cs,this.stencilZFail=cs,this.stencilZPass=cs,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(a){this._alphaTest>0!=a>0&&this.version++,this._alphaTest=a}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(a){if(void 0!==a)for(let b in a){let c=a[b];if(void 0===c){dg(`Material: parameter '${b}' has value of undefined.`);continue}let d=this[b];if(void 0===d){dg(`Material: '${b}' is not a property of THREE.${this.type}.`);continue}d&&d.isColor?d.set(c):d&&d.isVector2&&c&&c.isVector2||d&&d.isEuler&&c&&c.isEuler||d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]=c}}toJSON(a){let b=void 0===a||"string"==typeof a;b&&(a={textures:{},images:{}});let c={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function d(a){let b=[];for(let c in a){let d=a[c];delete d.metadata,b.push(d)}return b}if(c.uuid=this.uuid,c.type=this.type,c.blending=this.blending,c.side=this.side,c.shadowSide=this.shadowSide,c.vertexColors=this.vertexColors,c.opacity=this.opacity,c.transparent=this.transparent,c.blendSrc=this.blendSrc,c.blendDst=this.blendDst,c.blendEquation=this.blendEquation,c.blendSrcAlpha=this.blendSrcAlpha,c.blendDstAlpha=this.blendDstAlpha,c.blendEquationAlpha=this.blendEquationAlpha,c.blendColor=this.blendColor.getHex(),c.blendAlpha=this.blendAlpha,c.depthFunc=this.depthFunc,c.depthTest=this.depthTest,c.depthWrite=this.depthWrite,c.colorWrite=this.colorWrite,c.clipIntersection=this.clipIntersection,c.clipShadows=this.clipShadows,c.stencilWriteMask=this.stencilWriteMask,c.stencilFunc=this.stencilFunc,c.stencilRef=this.stencilRef,c.stencilFuncMask=this.stencilFuncMask,c.stencilFail=this.stencilFail,c.stencilZFail=this.stencilZFail,c.stencilZPass=this.stencilZPass,c.stencilWrite=this.stencilWrite,c.polygonOffset=this.polygonOffset,c.polygonOffsetFactor=this.polygonOffsetFactor,c.polygonOffsetUnits=this.polygonOffsetUnits,c.dithering=this.dithering,c.alphaTest=this.alphaTest,c.alphaHash=this.alphaHash,c.alphaToCoverage=this.alphaToCoverage,c.premultipliedAlpha=this.premultipliedAlpha,c.forceSinglePass=this.forceSinglePass,c.allowOverride=this.allowOverride,c.visible=this.visible,c.toneMapped=this.toneMapped,c.name=this.name,this.color&&this.color.isColor&&(c.color=this.color.getHex()),void 0!==this.roughness&&(c.roughness=this.roughness),void 0!==this.metalness&&(c.metalness=this.metalness),void 0!==this.sheen&&(c.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(c.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(c.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(c.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&(c.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(c.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(c.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(c.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(c.shininess=this.shininess),void 0!==this.clearcoat&&(c.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(c.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(c.clearcoatMap=this.clearcoatMap.toJSON(a).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(c.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(a).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(c.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(a).uuid,c.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(c.sheenColorMap=this.sheenColorMap.toJSON(a).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(c.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(a).uuid),void 0!==this.dispersion&&(c.dispersion=this.dispersion),void 0!==this.retroreflectivity&&(c.retroreflectivity=this.retroreflectivity),void 0!==this.iridescence&&(c.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(c.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(c.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(c.iridescenceMap=this.iridescenceMap.toJSON(a).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(c.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(a).uuid),void 0!==this.anisotropy&&(c.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(c.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(c.anisotropyMap=this.anisotropyMap.toJSON(a).uuid),this.map&&this.map.isTexture&&(c.map=this.map.toJSON(a).uuid),this.matcap&&this.matcap.isTexture&&(c.matcap=this.matcap.toJSON(a).uuid),this.alphaMap&&this.alphaMap.isTexture&&(c.alphaMap=this.alphaMap.toJSON(a).uuid),this.lightMap&&this.lightMap.isTexture&&(c.lightMap=this.lightMap.toJSON(a).uuid,c.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(c.aoMap=this.aoMap.toJSON(a).uuid,c.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(c.bumpMap=this.bumpMap.toJSON(a).uuid,c.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(c.normalMap=this.normalMap.toJSON(a).uuid,c.normalMapType=this.normalMapType,c.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(c.displacementMap=this.displacementMap.toJSON(a).uuid,c.displacementScale=this.displacementScale,c.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(c.roughnessMap=this.roughnessMap.toJSON(a).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(c.metalnessMap=this.metalnessMap.toJSON(a).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(c.emissiveMap=this.emissiveMap.toJSON(a).uuid),this.specularMap&&this.specularMap.isTexture&&(c.specularMap=this.specularMap.toJSON(a).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(c.specularIntensityMap=this.specularIntensityMap.toJSON(a).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(c.specularColorMap=this.specularColorMap.toJSON(a).uuid),this.envMap&&this.envMap.isTexture&&(c.envMap=this.envMap.toJSON(a).uuid,void 0!==this.combine&&(c.combine=this.combine)),void 0!==this.envMapRotation&&(c.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(c.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(c.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(c.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(c.gradientMap=this.gradientMap.toJSON(a).uuid),void 0!==this.transmission&&(c.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(c.transmissionMap=this.transmissionMap.toJSON(a).uuid),void 0!==this.thickness&&(c.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(c.thicknessMap=this.thicknessMap.toJSON(a).uuid),void 0!==this.attenuationDistance&&(c.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(c.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(c.size=this.size),void 0!==this.sizeAttenuation&&(c.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(c.clippingPlanes=this.clippingPlanes.map(a=>a.toJSON())),void 0!==this.rotation&&(c.rotation=this.rotation),void 0!==this.depthPacking&&(c.depthPacking=this.depthPacking),void 0!==this.linewidth&&(c.linewidth=this.linewidth),void 0!==this.linecap&&(c.linecap=this.linecap),void 0!==this.linejoin&&(c.linejoin=this.linejoin),void 0!==this.dashSize&&(c.dashSize=this.dashSize),void 0!==this.gapSize&&(c.gapSize=this.gapSize),void 0!==this.scale&&(c.scale=this.scale),void 0!==this.wireframe&&(c.wireframe=this.wireframe),void 0!==this.wireframeLinewidth&&(c.wireframeLinewidth=this.wireframeLinewidth),void 0!==this.wireframeLinecap&&(c.wireframeLinecap=this.wireframeLinecap),void 0!==this.wireframeLinejoin&&(c.wireframeLinejoin=this.wireframeLinejoin),void 0!==this.flatShading&&(c.flatShading=this.flatShading),void 0!==this.fog&&(c.fog=this.fog),Object.keys(this.userData).length>0&&(c.userData=this.userData),b){let b=d(a.textures),e=d(a.images);b.length>0&&(c.textures=b),e.length>0&&(c.images=e)}return c}fromJSON(a,b){if(void 0!==a.uuid&&(this.uuid=a.uuid),void 0!==a.name&&(this.name=a.name),void 0!==a.color&&void 0!==this.color&&this.color.setHex(a.color),void 0!==a.roughness&&(this.roughness=a.roughness),void 0!==a.metalness&&(this.metalness=a.metalness),void 0!==a.sheen&&(this.sheen=a.sheen),void 0!==a.sheenColor&&(this.sheenColor=new ev().setHex(a.sheenColor)),void 0!==a.sheenRoughness&&(this.sheenRoughness=a.sheenRoughness),void 0!==a.emissive&&void 0!==this.emissive&&this.emissive.setHex(a.emissive),void 0!==a.specular&&void 0!==this.specular&&this.specular.setHex(a.specular),void 0!==a.specularIntensity&&(this.specularIntensity=a.specularIntensity),void 0!==a.specularColor&&void 0!==this.specularColor&&this.specularColor.setHex(a.specularColor),void 0!==a.shininess&&(this.shininess=a.shininess),void 0!==a.clearcoat&&(this.clearcoat=a.clearcoat),void 0!==a.clearcoatRoughness&&(this.clearcoatRoughness=a.clearcoatRoughness),void 0!==a.dispersion&&(this.dispersion=a.dispersion),void 0!==a.retroreflectivity&&(this.retroreflectivity=a.retroreflectivity),void 0!==a.iridescence&&(this.iridescence=a.iridescence),void 0!==a.iridescenceIOR&&(this.iridescenceIOR=a.iridescenceIOR),void 0!==a.iridescenceThicknessRange&&(this.iridescenceThicknessRange=a.iridescenceThicknessRange),void 0!==a.transmission&&(this.transmission=a.transmission),void 0!==a.thickness&&(this.thickness=a.thickness),void 0!==a.attenuationDistance&&(this.attenuationDistance=a.attenuationDistance),void 0!==a.attenuationColor&&void 0!==this.attenuationColor&&this.attenuationColor.setHex(a.attenuationColor),void 0!==a.anisotropy&&(this.anisotropy=a.anisotropy),void 0!==a.anisotropyRotation&&(this.anisotropyRotation=a.anisotropyRotation),void 0!==a.fog&&(this.fog=a.fog),void 0!==a.flatShading&&(this.flatShading=a.flatShading),void 0!==a.blending&&(this.blending=a.blending),void 0!==a.combine&&(this.combine=a.combine),void 0!==a.side&&(this.side=a.side),void 0!==a.shadowSide&&(this.shadowSide=a.shadowSide),void 0!==a.opacity&&(this.opacity=a.opacity),void 0!==a.transparent&&(this.transparent=a.transparent),void 0!==a.alphaTest&&(this.alphaTest=a.alphaTest),void 0!==a.alphaHash&&(this.alphaHash=a.alphaHash),void 0!==a.depthFunc&&(this.depthFunc=a.depthFunc),void 0!==a.depthTest&&(this.depthTest=a.depthTest),void 0!==a.depthWrite&&(this.depthWrite=a.depthWrite),void 0!==a.colorWrite&&(this.colorWrite=a.colorWrite),void 0!==a.clippingPlanes&&(this.clippingPlanes=a.clippingPlanes.map(a=>new fA().fromJSON(a))),void 0!==a.clipIntersection&&(this.clipIntersection=a.clipIntersection),void 0!==a.clipShadows&&(this.clipShadows=a.clipShadows),void 0!==a.depthPacking&&(this.depthPacking=a.depthPacking),void 0!==a.blendSrc&&(this.blendSrc=a.blendSrc),void 0!==a.blendDst&&(this.blendDst=a.blendDst),void 0!==a.blendEquation&&(this.blendEquation=a.blendEquation),void 0!==a.blendSrcAlpha&&(this.blendSrcAlpha=a.blendSrcAlpha),void 0!==a.blendDstAlpha&&(this.blendDstAlpha=a.blendDstAlpha),void 0!==a.blendEquationAlpha&&(this.blendEquationAlpha=a.blendEquationAlpha),void 0!==a.blendColor&&void 0!==this.blendColor&&this.blendColor.setHex(a.blendColor),void 0!==a.blendAlpha&&(this.blendAlpha=a.blendAlpha),void 0!==a.stencilWriteMask&&(this.stencilWriteMask=a.stencilWriteMask),void 0!==a.stencilFunc&&(this.stencilFunc=a.stencilFunc),void 0!==a.stencilRef&&(this.stencilRef=a.stencilRef),void 0!==a.stencilFuncMask&&(this.stencilFuncMask=a.stencilFuncMask),void 0!==a.stencilFail&&(this.stencilFail=a.stencilFail),void 0!==a.stencilZFail&&(this.stencilZFail=a.stencilZFail),void 0!==a.stencilZPass&&(this.stencilZPass=a.stencilZPass),void 0!==a.stencilWrite&&(this.stencilWrite=a.stencilWrite),void 0!==a.wireframe&&(this.wireframe=a.wireframe),void 0!==a.wireframeLinewidth&&(this.wireframeLinewidth=a.wireframeLinewidth),void 0!==a.wireframeLinecap&&(this.wireframeLinecap=a.wireframeLinecap),void 0!==a.wireframeLinejoin&&(this.wireframeLinejoin=a.wireframeLinejoin),void 0!==a.rotation&&(this.rotation=a.rotation),void 0!==a.linewidth&&(this.linewidth=a.linewidth),void 0!==a.linecap&&(this.linecap=a.linecap),void 0!==a.linejoin&&(this.linejoin=a.linejoin),void 0!==a.dashSize&&(this.dashSize=a.dashSize),void 0!==a.gapSize&&(this.gapSize=a.gapSize),void 0!==a.scale&&(this.scale=a.scale),void 0!==a.polygonOffset&&(this.polygonOffset=a.polygonOffset),void 0!==a.polygonOffsetFactor&&(this.polygonOffsetFactor=a.polygonOffsetFactor),void 0!==a.polygonOffsetUnits&&(this.polygonOffsetUnits=a.polygonOffsetUnits),void 0!==a.dithering&&(this.dithering=a.dithering),void 0!==a.alphaToCoverage&&(this.alphaToCoverage=a.alphaToCoverage),void 0!==a.premultipliedAlpha&&(this.premultipliedAlpha=a.premultipliedAlpha),void 0!==a.forceSinglePass&&(this.forceSinglePass=a.forceSinglePass),void 0!==a.allowOverride&&(this.allowOverride=a.allowOverride),void 0!==a.visible&&(this.visible=a.visible),void 0!==a.toneMapped&&(this.toneMapped=a.toneMapped),void 0!==a.userData&&(this.userData=a.userData),void 0!==a.vertexColors&&("number"==typeof a.vertexColors?this.vertexColors=a.vertexColors>0:this.vertexColors=a.vertexColors),void 0!==a.size&&(this.size=a.size),void 0!==a.sizeAttenuation&&(this.sizeAttenuation=a.sizeAttenuation),void 0!==a.map&&(this.map=b[a.map]||null),void 0!==a.matcap&&(this.matcap=b[a.matcap]||null),void 0!==a.alphaMap&&(this.alphaMap=b[a.alphaMap]||null),void 0!==a.bumpMap&&(this.bumpMap=b[a.bumpMap]||null),void 0!==a.bumpScale&&(this.bumpScale=a.bumpScale),void 0!==a.normalMap&&(this.normalMap=b[a.normalMap]||null),void 0!==a.normalMapType&&(this.normalMapType=a.normalMapType),void 0!==a.normalScale){let b=a.normalScale;!1===Array.isArray(b)&&(b=[b,b]),this.normalScale=new dx().fromArray(b)}return void 0!==a.displacementMap&&(this.displacementMap=b[a.displacementMap]||null),void 0!==a.displacementScale&&(this.displacementScale=a.displacementScale),void 0!==a.displacementBias&&(this.displacementBias=a.displacementBias),void 0!==a.roughnessMap&&(this.roughnessMap=b[a.roughnessMap]||null),void 0!==a.metalnessMap&&(this.metalnessMap=b[a.metalnessMap]||null),void 0!==a.emissiveMap&&(this.emissiveMap=b[a.emissiveMap]||null),void 0!==a.emissiveIntensity&&(this.emissiveIntensity=a.emissiveIntensity),void 0!==a.specularMap&&(this.specularMap=b[a.specularMap]||null),void 0!==a.specularIntensityMap&&(this.specularIntensityMap=b[a.specularIntensityMap]||null),void 0!==a.specularColorMap&&(this.specularColorMap=b[a.specularColorMap]||null),void 0!==a.envMap&&(this.envMap=b[a.envMap]||null),void 0!==a.envMapRotation&&this.envMapRotation.fromArray(a.envMapRotation),void 0!==a.envMapIntensity&&(this.envMapIntensity=a.envMapIntensity),void 0!==a.reflectivity&&(this.reflectivity=a.reflectivity),void 0!==a.refractionRatio&&(this.refractionRatio=a.refractionRatio),void 0!==a.lightMap&&(this.lightMap=b[a.lightMap]||null),void 0!==a.lightMapIntensity&&(this.lightMapIntensity=a.lightMapIntensity),void 0!==a.aoMap&&(this.aoMap=b[a.aoMap]||null),void 0!==a.aoMapIntensity&&(this.aoMapIntensity=a.aoMapIntensity),void 0!==a.gradientMap&&(this.gradientMap=b[a.gradientMap]||null),void 0!==a.clearcoatMap&&(this.clearcoatMap=b[a.clearcoatMap]||null),void 0!==a.clearcoatRoughnessMap&&(this.clearcoatRoughnessMap=b[a.clearcoatRoughnessMap]||null),void 0!==a.clearcoatNormalMap&&(this.clearcoatNormalMap=b[a.clearcoatNormalMap]||null),void 0!==a.clearcoatNormalScale&&(this.clearcoatNormalScale=new dx().fromArray(a.clearcoatNormalScale)),void 0!==a.iridescenceMap&&(this.iridescenceMap=b[a.iridescenceMap]||null),void 0!==a.iridescenceThicknessMap&&(this.iridescenceThicknessMap=b[a.iridescenceThicknessMap]||null),void 0!==a.transmissionMap&&(this.transmissionMap=b[a.transmissionMap]||null),void 0!==a.thicknessMap&&(this.thicknessMap=b[a.thicknessMap]||null),void 0!==a.anisotropyMap&&(this.anisotropyMap=b[a.anisotropyMap]||null),void 0!==a.sheenColorMap&&(this.sheenColorMap=b[a.sheenColorMap]||null),void 0!==a.sheenRoughnessMap&&(this.sheenRoughnessMap=b[a.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(a){this.name=a.name,this.blending=a.blending,this.side=a.side,this.vertexColors=a.vertexColors,this.opacity=a.opacity,this.transparent=a.transparent,this.blendSrc=a.blendSrc,this.blendDst=a.blendDst,this.blendEquation=a.blendEquation,this.blendSrcAlpha=a.blendSrcAlpha,this.blendDstAlpha=a.blendDstAlpha,this.blendEquationAlpha=a.blendEquationAlpha,this.blendColor.copy(a.blendColor),this.blendAlpha=a.blendAlpha,this.depthFunc=a.depthFunc,this.depthTest=a.depthTest,this.depthWrite=a.depthWrite,this.stencilWriteMask=a.stencilWriteMask,this.stencilFunc=a.stencilFunc,this.stencilRef=a.stencilRef,this.stencilFuncMask=a.stencilFuncMask,this.stencilFail=a.stencilFail,this.stencilZFail=a.stencilZFail,this.stencilZPass=a.stencilZPass,this.stencilWrite=a.stencilWrite;let b=a.clippingPlanes,c=null;if(null!==b){let a=b.length;c=Array(a);for(let d=0;d!==a;++d)c[d]=b[d].clone()}return this.clippingPlanes=c,this.clipIntersection=a.clipIntersection,this.clipShadows=a.clipShadows,this.shadowSide=a.shadowSide,this.colorWrite=a.colorWrite,this.precision=a.precision,this.polygonOffset=a.polygonOffset,this.polygonOffsetFactor=a.polygonOffsetFactor,this.polygonOffsetUnits=a.polygonOffsetUnits,this.dithering=a.dithering,this.alphaTest=a.alphaTest,this.alphaHash=a.alphaHash,this.alphaToCoverage=a.alphaToCoverage,this.premultipliedAlpha=a.premultipliedAlpha,this.forceSinglePass=a.forceSinglePass,this.allowOverride=a.allowOverride,this.visible=a.visible,this.toneMapped=a.toneMapped,this.userData=JSON.parse(JSON.stringify(a.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(a){!0===a&&this.version++}}class fD extends fC{constructor(a){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ev(0xffffff),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.alphaMap=a.alphaMap,this.rotation=a.rotation,this.sizeAttenuation=a.sizeAttenuation,this.fog=a.fog,this}}let fE=new dz,fF=new dz,fG=new dz,fH=new dx,fI=new dx,fJ=new dY,fK=new dz,fL=new dz,fM=new dz,fN=new dx,fO=new dx,fP=new dx;class fQ extends en{constructor(a=new fD){if(super(),this.isSprite=!0,this.type="Sprite",void 0===e){e=new ft;const a=new fu(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);e.setIndex([0,1,2,0,2,3]),e.setAttribute("position",new fw(a,3,0,!1)),e.setAttribute("uv",new fw(a,2,3,!1))}this.geometry=e,this.material=a,this.center=new dx(.5,.5),this.count=1}intersectsFrustum(a){return a.intersectsSprite(this)}raycast(a,b){let c,d;null===a.camera&&dh('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),fF.setFromMatrixScale(this.matrixWorld),fJ.copy(a.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(a.camera.matrixWorldInverse,this.matrixWorld),fG.setFromMatrixPosition(this.modelViewMatrix),a.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&fF.multiplyScalar(-fG.z);let e=this.material.rotation;0!==e&&(d=Math.cos(e),c=Math.sin(e));let f=this.center;fR(fK.set(-.5,-.5,0),fG,f,fF,c,d),fR(fL.set(.5,-.5,0),fG,f,fF,c,d),fR(fM.set(.5,.5,0),fG,f,fF,c,d),fN.set(0,0),fO.set(1,0),fP.set(1,1);let g=a.ray.intersectTriangle(fK,fL,fM,!1,fE);if(null===g&&(fR(fL.set(-.5,.5,0),fG,f,fF,c,d),fO.set(0,1),null===(g=a.ray.intersectTriangle(fK,fM,fL,!1,fE))))return;let h=a.ray.origin.distanceTo(fE);h<a.near||h>a.far||b.push({distance:h,point:fE.clone(),uv:eN.getInterpolation(fE,fK,fL,fM,fN,fO,fP,new dx),face:null,object:this})}copy(a,b){return super.copy(a,b),void 0!==a.center&&this.center.copy(a.center),this.material=a.material,this}}function fR(a,b,c,d,e,f){fH.subVectors(a,c).addScalar(.5).multiply(d),void 0!==e?(fI.x=f*fH.x-e*fH.y,fI.y=e*fH.x+f*fH.y):fI.copy(fH),a.copy(b),a.x+=fI.x,a.y+=fI.y,a.applyMatrix4(fJ)}let fS=new dz,fT=new dz;class fU extends en{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(a){super.copy(a,!1);let b=a.levels;for(let a=0,c=b.length;a<c;a++){let c=b[a];this.addLevel(c.object.clone(),c.distance,c.hysteresis)}return this.autoUpdate=a.autoUpdate,this}addLevel(a,b=0,c=0){let d;b=Math.abs(b);let e=this.levels;for(d=0;d<e.length&&!(b<e[d].distance);d++);return e.splice(d,0,{distance:b,hysteresis:c,object:a}),this.add(a),this}removeLevel(a){let b=this.levels;for(let c=0;c<b.length;c++)if(b[c].distance===a){let a=b.splice(c,1);return this.remove(a[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(a){let b=this.levels;if(b.length>0){let c,d;for(c=1,d=b.length;c<d;c++){let d=b[c].distance;if(b[c].object.visible&&(d-=d*b[c].hysteresis),a<d)break}return b[c-1].object}return null}raycast(a,b){if(this.levels.length>0){fS.setFromMatrixPosition(this.matrixWorld);let c=a.ray.origin.distanceTo(fS);this.getObjectForDistance(c).raycast(a,b)}}update(a){let b=this.levels;if(b.length>1){let c,d;fS.setFromMatrixPosition(a.matrixWorld),fT.setFromMatrixPosition(this.matrixWorld);let e=fS.distanceTo(fT)/a.zoom;for(c=1,b[0].object.visible=!0,d=b.length;c<d;c++){let a=b[c].distance;if(b[c].object.visible&&(a-=a*b[c].hysteresis),e>=a)b[c-1].object.visible=!1,b[c].object.visible=!0;else break}for(this._currentLevel=c-1;c<d;c++)b[c].object.visible=!1}}toJSON(a){let b=super.toJSON(a);b.object.autoUpdate=this.autoUpdate,b.object.levels=[];let c=this.levels;for(let a=0,d=c.length;a<d;a++){let d=c[a];b.object.levels.push({object:d.object.uuid,distance:d.distance,hysteresis:d.hysteresis})}return b}}let fV=new dz,fW=new dz,fX=new dz,fY=new dz;class fZ{constructor(a=new dz,b=new dz(0,0,-1)){this.origin=a,this.direction=b}set(a,b){return this.origin.copy(a),this.direction.copy(b),this}copy(a){return this.origin.copy(a.origin),this.direction.copy(a.direction),this}at(a,b){return b.copy(this.origin).addScaledVector(this.direction,a)}lookAt(a){return this.direction.copy(a).sub(this.origin).normalize(),this}recast(a){return this.origin.copy(this.at(a,fV)),this}closestPointToPoint(a,b){b.subVectors(a,this.origin);let c=b.dot(this.direction);return c<0?b.copy(this.origin):b.copy(this.origin).addScaledVector(this.direction,c)}distanceToPoint(a){return Math.sqrt(this.distanceSqToPoint(a))}distanceSqToPoint(a){let b=fV.subVectors(a,this.origin).dot(this.direction);return b<0?this.origin.distanceToSquared(a):(fV.copy(this.origin).addScaledVector(this.direction,b),fV.distanceToSquared(a))}distanceSqToSegment(a,b,c,d){let e,f,g,h;fW.copy(a).add(b).multiplyScalar(.5),fX.copy(b).sub(a).normalize(),fY.copy(this.origin).sub(fW);let i=.5*a.distanceTo(b),j=-this.direction.dot(fX),k=fY.dot(this.direction),l=-fY.dot(fX),m=fY.lengthSq(),n=Math.abs(1-j*j);if(n>0)if(e=j*l-k,f=j*k-l,h=i*n,e>=0)if(f>=-h)if(f<=h){let a=1/n;e*=a,f*=a,g=e*(e+j*f+2*k)+f*(j*e+f+2*l)+m}else g=-(e=Math.max(0,-(j*(f=i)+k)))*e+f*(f+2*l)+m;else g=-(e=Math.max(0,-(j*(f=-i)+k)))*e+f*(f+2*l)+m;else f<=-h?(f=(e=Math.max(0,-(-j*i+k)))>0?-i:Math.min(Math.max(-i,-l),i),g=-e*e+f*(f+2*l)+m):f<=h?(e=0,g=(f=Math.min(Math.max(-i,-l),i))*(f+2*l)+m):(f=(e=Math.max(0,-(j*i+k)))>0?i:Math.min(Math.max(-i,-l),i),g=-e*e+f*(f+2*l)+m);else f=j>0?-i:i,g=-(e=Math.max(0,-(j*f+k)))*e+f*(f+2*l)+m;return c&&c.copy(this.origin).addScaledVector(this.direction,e),d&&d.copy(fW).addScaledVector(fX,f),g}intersectSphere(a,b){if(a.radius<0)return null;fV.subVectors(a.center,this.origin);let c=fV.dot(this.direction),d=fV.dot(fV)-c*c,e=a.radius*a.radius;if(d>e)return null;let f=Math.sqrt(e-d),g=c-f,h=c+f;return h<0?null:g<0?this.at(h,b):this.at(g,b)}intersectsSphere(a){return!(a.radius<0)&&this.distanceSqToPoint(a.center)<=a.radius*a.radius}distanceToPlane(a){let b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;let c=-(this.origin.dot(a.normal)+a.constant)/b;return c>=0?c:null}intersectPlane(a,b){let c=this.distanceToPlane(a);return null===c?null:this.at(c,b)}intersectsPlane(a){let b=a.distanceToPoint(this.origin);return!!(0===b||a.normal.dot(this.direction)*b<0)}intersectBox(a,b){let c,d,e,f,g,h,i=1/this.direction.x,j=1/this.direction.y,k=1/this.direction.z,l=this.origin;return(i>=0?(c=(a.min.x-l.x)*i,d=(a.max.x-l.x)*i):(c=(a.max.x-l.x)*i,d=(a.min.x-l.x)*i),j>=0?(e=(a.min.y-l.y)*j,f=(a.max.y-l.y)*j):(e=(a.max.y-l.y)*j,f=(a.min.y-l.y)*j),c>f||e>d||((e>c||isNaN(c))&&(c=e),(f<d||isNaN(d))&&(d=f),k>=0?(g=(a.min.z-l.z)*k,h=(a.max.z-l.z)*k):(g=(a.max.z-l.z)*k,h=(a.min.z-l.z)*k),c>h||g>d||((g>c||c!=c)&&(c=g),(h<d||d!=d)&&(d=h),d<0)))?null:this.at(c>=0?c:d,b)}intersectsBox(a){return null!==this.intersectBox(a,fV)}intersectTriangle(a,b,c,d,e){let f,g,h,i,j,k,l,m,n,o,p,q,r=this.origin,s=this.direction,t=s.x,u=s.y,v=s.z,w=a.x-r.x,x=a.y-r.y,y=a.z-r.z,z=b.x-r.x,A=b.y-r.y,B=b.z-r.z,C=c.x-r.x,D=c.y-r.y,E=c.z-r.z,F=Math.abs(t),G=Math.abs(u),H=Math.abs(v);if(F>=G&&F>=H?(h=t,k=w,n=z,q=C,t>=0?(f=u,g=v,i=x,j=y,l=A,m=B,o=D,p=E):(f=v,g=u,i=y,j=x,l=B,m=A,o=E,p=D)):G>=H?(h=u,k=x,n=A,q=D,u>=0?(f=v,g=t,i=y,j=w,l=B,m=z,o=E,p=C):(f=t,g=v,i=w,j=y,l=z,m=B,o=C,p=E)):(h=v,k=y,n=B,q=E,v>=0?(f=t,g=u,i=w,j=x,l=z,m=A,o=C,p=D):(f=u,g=t,i=x,j=w,l=A,m=z,o=D,p=C)),0===h)return null;let I=f/h,J=g/h,K=1/h,L=i-I*k,M=j-J*k,N=l-I*n,O=m-J*n,P=o-I*q,Q=p-J*q,R=P*O-Q*N,S=L*Q-M*P,T=N*M-O*L;if(d){if(R<0||S<0||T<0)return null}else if((R<0||S<0||T<0)&&(R>0||S>0||T>0))return null;let U=R+S+T;if(0===U)return null;let V=K*(R*k+S*n+T*q);return(U>0?V<0:V>0)?null:this.at(V/U,e)}applyMatrix4(a){return this.origin.applyMatrix4(a),this.direction.transformDirection(a),this}equals(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class f$ extends fC{constructor(a){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ev(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 d6,this.combine=ay,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapRotation.copy(a.envMapRotation),this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.fog=a.fog,this}}let f_=new dY,f0=new fZ,f1=new fl,f2=new dz,f3=new dz,f4=new dz,f5=new dz,f6=new dz,f7=new dz,f8=new dz,f9=new dz;class ga extends en{constructor(a=new ft,b=new f$){super(),this.isMesh=!0,this.type="Mesh",this.geometry=a,this.material=b,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(a,b){return super.copy(a,b),void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice()),void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary)),this.material=Array.isArray(a.material)?a.material.slice():a.material,this.geometry=a.geometry,this}updateMorphTargets(){let a=this.geometry.morphAttributes,b=Object.keys(a);if(b.length>0){let c=a[b[0]];if(void 0!==c){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,b=c.length;a<b;a++){let b=c[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=a}}}}getVertexPosition(a,b){let c=this.geometry,d=c.attributes.position,e=c.morphAttributes.position,f=c.morphTargetsRelative;b.fromBufferAttribute(d,a);let g=this.morphTargetInfluences;if(e&&g){f7.set(0,0,0);for(let c=0,d=e.length;c<d;c++){let d=g[c],h=e[c];0!==d&&(f6.fromBufferAttribute(h,a),f?f7.addScaledVector(f6,d):f7.addScaledVector(f6.sub(b),d))}b.add(f7)}return b}intersectsFrustum(a){return a.intersectsObject(this)}raycast(a,b){let c=this.geometry,d=this.material,e=this.matrixWorld;void 0===d||(null===c.boundingSphere&&c.computeBoundingSphere(),f1.copy(c.boundingSphere),f1.applyMatrix4(e),f0.copy(a.ray).recast(a.near),!1===f1.containsPoint(f0.origin)&&(null===f0.intersectSphere(f1,f2)||f0.origin.distanceToSquared(f2)>(a.far-a.near)**2)||(f_.copy(e).invert(),f0.copy(a.ray).applyMatrix4(f_),(null===c.boundingBox||!1!==f0.intersectsBox(c.boundingBox))&&this._computeIntersections(a,b,f0)))}_computeIntersections(a,b,c){let d,e=this.geometry,f=this.material,g=e.index,h=e.attributes.position,i=e.attributes.uv,j=e.attributes.uv1,k=e.attributes.normal,l=e.groups,m=e.drawRange;if(null!==g)if(Array.isArray(f))for(let e=0,h=l.length;e<h;e++){let h=l[e],n=f[h.materialIndex],o=Math.max(h.start,m.start),p=Math.min(g.count,Math.min(h.start+h.count,m.start+m.count));for(let e=o;e<p;e+=3)(d=gb(this,n,a,c,i,j,k,g.getX(e),g.getX(e+1),g.getX(e+2)))&&(d.faceIndex=Math.floor(e/3),d.face.materialIndex=h.materialIndex,b.push(d))}else{let e=Math.max(0,m.start),h=Math.min(g.count,m.start+m.count);for(let l=e;l<h;l+=3)(d=gb(this,f,a,c,i,j,k,g.getX(l),g.getX(l+1),g.getX(l+2)))&&(d.faceIndex=Math.floor(l/3),b.push(d))}else if(void 0!==h)if(Array.isArray(f))for(let e=0,g=l.length;e<g;e++){let g=l[e],n=f[g.materialIndex],o=Math.max(g.start,m.start),p=Math.min(h.count,Math.min(g.start+g.count,m.start+m.count));for(let e=o;e<p;e+=3)(d=gb(this,n,a,c,i,j,k,e,e+1,e+2))&&(d.faceIndex=Math.floor(e/3),d.face.materialIndex=g.materialIndex,b.push(d))}else{let e=Math.max(0,m.start),g=Math.min(h.count,m.start+m.count);for(let h=e;h<g;h+=3)(d=gb(this,f,a,c,i,j,k,h,h+1,h+2))&&(d.faceIndex=Math.floor(h/3),b.push(d))}}}function gb(a,b,c,d,e,f,g,h,i,j){a.getVertexPosition(h,f3),a.getVertexPosition(i,f4),a.getVertexPosition(j,f5);let k=function(a,b,c,d,e,f,g,h){if(null===(b.side===P?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,b.side===O,h)))return null;f9.copy(h),f9.applyMatrix4(a.matrixWorld);let i=c.ray.origin.distanceTo(f9);return i<c.near||i>c.far?null:{distance:i,point:f9.clone(),object:a}}(a,b,c,d,f3,f4,f5,f8);if(k){let a=new dz;eN.getBarycoord(f8,f3,f4,f5,a),e&&(k.uv=eN.getInterpolatedAttribute(e,h,i,j,a,new dx)),f&&(k.uv1=eN.getInterpolatedAttribute(f,h,i,j,a,new dx)),g&&(k.normal=eN.getInterpolatedAttribute(g,h,i,j,a,new dz),k.normal.dot(d.direction)>0&&k.normal.multiplyScalar(-1));let b={a:h,b:i,c:j,normal:new dz,materialIndex:0};eN.getNormal(f3,f4,f5,b.normal),k.face=b,k.barycoord=a}return k}let gc=new dR,gd=new dR,ge=new dR,gf=new dR,gg=new dY,gh=new dz,gi=new fl,gj=new dY,gk=new fZ;class gl extends ga{constructor(a,b){super(a,b),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=aJ,this.bindMatrix=new dY,this.bindMatrixInverse=new dY,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let a=this.geometry;null===this.boundingBox&&(this.boundingBox=new eO),this.boundingBox.makeEmpty();let b=a.getAttribute("position");for(let a=0;a<b.count;a++)this.getVertexPosition(a,gh),this.boundingBox.expandByPoint(gh)}computeBoundingSphere(){let a=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new fl),this.boundingSphere.makeEmpty();let b=a.getAttribute("position");for(let a=0;a<b.count;a++)this.getVertexPosition(a,gh),this.boundingSphere.expandByPoint(gh)}copy(a,b){return super.copy(a,b),this.bindMode=a.bindMode,this.bindMatrix.copy(a.bindMatrix),this.bindMatrixInverse.copy(a.bindMatrixInverse),this.skeleton=a.skeleton,null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),this}raycast(a,b){let c=this.material,d=this.matrixWorld;void 0===c||(null===this.boundingSphere&&this.computeBoundingSphere(),gi.copy(this.boundingSphere),gi.applyMatrix4(d),!1===a.ray.intersectsSphere(gi)||(gj.copy(d).invert(),gk.copy(a.ray).applyMatrix4(gj),(null===this.boundingBox||!1!==gk.intersectsBox(this.boundingBox))&&this._computeIntersections(a,b,gk)))}getVertexPosition(a,b){return super.getVertexPosition(a,b),this.applyBoneTransform(a,b),b}bind(a,b){this.skeleton=a,void 0===b&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),b=this.matrixWorld),this.bindMatrix.copy(b),this.bindMatrixInverse.copy(b).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let a=new dR,b=this.geometry.attributes.skinWeight;for(let c=0,d=b.count;c<d;c++){a.fromBufferAttribute(b,c);let d=1/a.manhattanLength();d!==1/0?a.multiplyScalar(d):a.set(1,0,0,0),b.setXYZW(c,a.x,a.y,a.z,a.w)}}updateMatrixWorld(a){super.updateMatrixWorld(a),this.bindMode===aJ?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===aK?this.bindMatrixInverse.copy(this.bindMatrix).invert():dg("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(a,b){let c=this.skeleton,d=this.geometry;gd.fromBufferAttribute(d.attributes.skinIndex,a),ge.fromBufferAttribute(d.attributes.skinWeight,a),b.isVector4?(gc.copy(b),b.set(0,0,0,0)):(gc.set(...b,1),b.set(0,0,0)),gc.applyMatrix4(this.bindMatrix);for(let a=0;a<4;a++){let d=ge.getComponent(a);if(0!==d){let e=gd.getComponent(a);gg.multiplyMatrices(c.bones[e].matrixWorld,c.boneInverses[e]),b.addScaledVector(gf.copy(gc).applyMatrix4(gg),d)}}return b.isVector4&&(b.w=gc.w),b.applyMatrix4(this.bindMatrixInverse)}}class gm extends en{constructor(){super(),this.isBone=!0,this.type="Bone"}}class gn extends dQ{constructor(a=null,b=1,c=1,d,e,f,g,h,i=aU,j=aU,k,l){super(null,f,g,h,i,j,d,e,k,l),this.isDataTexture=!0,this.image={data:a,width:b,height:c},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let go=new dY,gp=new dY;class gq{constructor(a=[],b=[]){this.uuid=dq(),this.bones=a.slice(0),this.boneInverses=b,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let a=this.bones,b=this.boneInverses;if(this.boneMatrices=new Float32Array(16*a.length),0===b.length)this.calculateInverses();else if(a.length!==b.length){dg("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let a=0,b=this.bones.length;a<b;a++)this.boneInverses.push(new dY)}}calculateInverses(){this.boneInverses.length=0;for(let a=0,b=this.bones.length;a<b;a++){let b=new dY;this.bones[a]&&b.copy(this.bones[a].matrixWorld).invert(),this.boneInverses.push(b)}}pose(){for(let a=0,b=this.bones.length;a<b;a++){let b=this.bones[a];b&&b.matrixWorld.copy(this.boneInverses[a]).invert()}for(let a=0,b=this.bones.length;a<b;a++){let b=this.bones[a];b&&(b.parent&&b.parent.isBone?(b.matrix.copy(b.parent.matrixWorld).invert(),b.matrix.multiply(b.matrixWorld)):b.matrix.copy(b.matrixWorld),b.matrix.decompose(b.position,b.quaternion,b.scale))}}update(){let a=this.bones,b=this.boneInverses,c=this.boneMatrices,d=this.boneTexture;for(let d=0,e=a.length;d<e;d++){let e=a[d]?a[d].matrixWorld:gp;go.multiplyMatrices(e,b[d]),go.toArray(c,16*d)}null!==d&&(d.needsUpdate=!0)}clone(){return new gq(this.bones,this.boneInverses)}computeBoneTexture(){let a=Math.sqrt(4*this.bones.length),b=new Float32Array((a=Math.max(a=4*Math.ceil(a/4),4))*a*4);b.set(this.boneMatrices);let c=new gn(b,a,a,bh,a8);return c.needsUpdate=!0,this.boneMatrices=b,this.boneTexture=c,this}getBoneByName(a){for(let b=0,c=this.bones.length;b<c;b++){let c=this.bones[b];if(c.name===a)return c}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(a,b){this.uuid=a.uuid;for(let c=0,d=a.bones.length;c<d;c++){let d=a.bones[c],e=b[d];void 0===e&&(dg("Skeleton: No bone found with UUID:",d),e=new gm),this.bones.push(e),this.boneInverses.push(new dY().fromArray(a.boneInverses[c]))}return this.init(),this}toJSON(){let a={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};a.uuid=this.uuid;let b=this.bones,c=this.boneInverses;for(let d=0,e=b.length;d<e;d++){let e=b[d];a.bones.push(e.uuid);let f=c[d];a.boneInverses.push(f.toArray())}return a}}class gr extends e8{constructor(a,b,c,d=1){super(a,b,c),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=d}copy(a){return super.copy(a),this.meshPerAttribute=a.meshPerAttribute,this}toJSON(){let a=super.toJSON();return a.meshPerAttribute=this.meshPerAttribute,a.isInstancedBufferAttribute=!0,a}}let gs=new dY,gt=new dY,gu=[],gv=new eO,gw=new dY,gx=new ga,gy=new fl;class gz extends ga{constructor(a,b,c){super(a,b),this.isInstancedMesh=!0,this.instanceMatrix=new gr(new Float32Array(16*c),16),this.instanceColor=null,this.morphTexture=null,this.count=c,this.boundingBox=null,this.boundingSphere=null;for(let a=0;a<c;a++)this.setMatrixAt(a,gw)}computeBoundingBox(){let a=this.geometry,b=this.count;null===this.boundingBox&&(this.boundingBox=new eO),null===a.boundingBox&&a.computeBoundingBox(),this.boundingBox.makeEmpty();for(let c=0;c<b;c++)this.getMatrixAt(c,gs),gv.copy(a.boundingBox).applyMatrix4(gs),this.boundingBox.union(gv)}computeBoundingSphere(){let a=this.geometry,b=this.count;null===this.boundingSphere&&(this.boundingSphere=new fl),null===a.boundingSphere&&a.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let c=0;c<b;c++)this.getMatrixAt(c,gs),gy.copy(a.boundingSphere).applyMatrix4(gs),this.boundingSphere.union(gy)}copy(a,b){return super.copy(a,b),this.instanceMatrix.copy(a.instanceMatrix),null!==a.morphTexture&&(this.morphTexture=a.morphTexture.clone()),null!==a.instanceColor&&(this.instanceColor=a.instanceColor.clone()),this.count=a.count,null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),this}getColorAt(a,b){return null===this.instanceColor?b.setRGB(1,1,1):b.fromArray(this.instanceColor.array,3*a)}getMatrixAt(a,b){return b.fromArray(this.instanceMatrix.array,16*a)}getMorphAt(a,b){let c=b.morphTargetInfluences,d=this.morphTexture.source.data.data,e=a*(c.length+1)+1;for(let a=0;a<c.length;a++)c[a]=d[e+a]}raycast(a,b){let c=this.matrixWorld,d=this.count;if((gx.geometry=this.geometry,gx.material=this.material,void 0!==gx.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),gy.copy(this.boundingSphere),gy.applyMatrix4(c),!1!==a.ray.intersectsSphere(gy)))for(let e=0;e<d;e++){this.getMatrixAt(e,gs),gt.multiplyMatrices(c,gs),gx.matrixWorld=gt,gx.raycast(a,gu);for(let a=0,c=gu.length;a<c;a++){let c=gu[a];c.instanceId=e,c.object=this,b.push(c)}gu.length=0}}setColorAt(a,b){return null===this.instanceColor&&(this.instanceColor=new gr(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),b.toArray(this.instanceColor.array,3*a),this}setMatrixAt(a,b){return b.toArray(this.instanceMatrix.array,16*a),this}setMorphAt(a,b){let c=b.morphTargetInfluences,d=c.length+1;null===this.morphTexture&&(this.morphTexture=new gn(new Float32Array(d*this.count),d,this.count,bk,a8));let e=this.morphTexture.source.data.data,f=0;for(let a=0;a<c.length;a++)f+=c[a];let g=this.geometry.morphTargetsRelative?1:1-f,h=d*a;return e[h]=g,e.set(c,h+1),this}updateMorphTargets(){}dispose(){super.dispose(),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let gA=new fl,gB=new dx(.5,.5),gC=new dz;class gD{constructor(a=new fA,b=new fA,c=new fA,d=new fA,e=new fA,f=new fA){this.planes=[a,b,c,d,e,f]}set(a,b,c,d,e,f){let g=this.planes;return g[0].copy(a),g[1].copy(b),g[2].copy(c),g[3].copy(d),g[4].copy(e),g[5].copy(f),this}copy(a){let b=this.planes;for(let c=0;c<6;c++)b[c].copy(a.planes[c]);return this}setFromProjectionMatrix(a,b=c$,c=!1){let d=this.planes,e=a.elements,f=e[0],g=e[1],h=e[2],i=e[3],j=e[4],k=e[5],l=e[6],m=e[7],n=e[8],o=e[9],p=e[10],q=e[11],r=e[12],s=e[13],t=e[14],u=e[15];if(d[0].setComponents(i-f,m-j,q-n,u-r).normalize(),d[1].setComponents(i+f,m+j,q+n,u+r).normalize(),d[2].setComponents(i+g,m+k,q+o,u+s).normalize(),d[3].setComponents(i-g,m-k,q-o,u-s).normalize(),c)d[4].setComponents(h,l,p,t).normalize(),d[5].setComponents(i-h,m-l,q-p,u-t).normalize();else if(d[4].setComponents(i-h,m-l,q-p,u-t).normalize(),b===c$)d[5].setComponents(i+h,m+l,q+p,u+t).normalize();else if(b===c_)d[5].setComponents(h,l,p,t).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+b);return this}intersectsObject(a){if(void 0!==a.boundingSphere)null===a.boundingSphere&&a.computeBoundingSphere(),gA.copy(a.boundingSphere).applyMatrix4(a.matrixWorld);else{let b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere(),gA.copy(b.boundingSphere).applyMatrix4(a.matrixWorld)}return this.intersectsSphere(gA)}intersectsSprite(a){return gA.center.set(0,0,0),gA.radius=.7071067811865476+gB.distanceTo(a.center),gA.applyMatrix4(a.matrixWorld),this.intersectsSphere(gA)}intersectsSphere(a){let b=this.planes,c=a.center,d=-a.radius;for(let a=0;a<6;a++)if(b[a].distanceToPoint(c)<d)return!1;return!0}intersectsBox(a){let b=this.planes;for(let c=0;c<6;c++){let d=b[c];if(gC.x=d.normal.x>0?a.max.x:a.min.x,gC.y=d.normal.y>0?a.max.y:a.min.y,gC.z=d.normal.z>0?a.max.z:a.min.z,0>d.distanceToPoint(gC))return!1}return!0}containsPoint(a){let b=this.planes;for(let c=0;c<6;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}clone(){return new this.constructor().copy(this)}}let gE=new dY;class gF{constructor(){this.coordinateSystem=c$,this._frustums=[],this._count=0}setFromArrayCamera(a){let b=a.cameras,c=this._frustums;for(let a=0;a<b.length;a++){let d=b[a];gE.multiplyMatrices(d.projectionMatrix,d.matrixWorldInverse),void 0===c[a]&&(c[a]=new gD),c[a].setFromProjectionMatrix(gE,d.coordinateSystem,d.reversedDepth)}return this._count=b.length,this}intersectsObject(a){let b=this._frustums;for(let c=0;c<this._count;c++)if(b[c].intersectsObject(a))return!0;return!1}intersectsSprite(a){let b=this._frustums;for(let c=0;c<this._count;c++)if(b[c].intersectsSprite(a))return!0;return!1}intersectsSphere(a){let b=this._frustums;for(let c=0;c<this._count;c++)if(b[c].intersectsSphere(a))return!0;return!1}intersectsBox(a){let b=this._frustums;for(let c=0;c<this._count;c++)if(b[c].intersectsBox(a))return!0;return!1}containsPoint(a){let b=this._frustums;for(let c=0;c<this._count;c++)if(b[c].containsPoint(a))return!0;return!1}copy(a){this.coordinateSystem=a.coordinateSystem;let b=this._frustums,c=a._frustums;for(let d=0;d<a._count;d++)void 0===b[d]&&(b[d]=new gD),b[d].copy(c[d]);return this._count=a._count,this}clone(){return new gF().copy(this)}}function gG(a,b){return a-b}function gH(a,b){return a.z-b.z}function gI(a,b){return b.z-a.z}class gJ{constructor(){this.index=0,this.pool=[],this.list=[]}push(a,b,c,d){let e=this.pool,f=this.list;this.index>=e.length&&e.push({start:-1,count:-1,z:-1,index:-1});let g=e[this.index];f.push(g),this.index++,g.start=a,g.count=b,g.z=c,g.index=d}reset(){this.list.length=0,this.index=0}}let gK=new dY,gL=new ev(1,1,1),gM=new gD,gN=new gF,gO=new eO,gP=new fl,gQ=new dz,gR=new dz,gS=new dz,gT=new gJ,gU=new ga,gV=[];function gW(a,b){if(a.constructor!==b.constructor){let c=Math.min(a.length,b.length);for(let d=0;d<c;d++)b[d]=a[d]}else{let c=Math.min(a.length,b.length);b.set(new a.constructor(a.buffer,0,c))}}class gX extends ga{constructor(a,b,c=2*b,d){super(new ft,d),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=a,this._maxVertexCount=b,this._maxIndexCount=c,this._multiDrawCounts=new Int32Array(a),this._multiDrawStarts=new Int32Array(a),this._multiDrawCount=0,this._multiDrawBytesPerElement=1,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 a=Math.sqrt(4*this._maxInstanceCount),b=new gn(new Float32Array((a=Math.max(a=4*Math.ceil(a/4),4))*a*4),a,a,bh,a8);this._matricesTexture=b}_initIndirectTexture(){let a=Math.sqrt(this._maxInstanceCount),b=new gn(new Uint32Array((a=Math.ceil(a))*a),a,a,bl,a7);this._indirectTexture=b}_initColorsTexture(){let a=Math.sqrt(this._maxInstanceCount),b=new gn(new Float32Array((a=Math.ceil(a))*a*4).fill(1),a,a,bh,a8);b.colorSpace=dG.workingColorSpace,this._colorsTexture=b}_initializeGeometry(a){let b=this.geometry,c=this._maxVertexCount,d=this._maxIndexCount;if(!1===this._geometryInitialized){for(let d in a.attributes){let{array:e,itemSize:f,normalized:g}=a.getAttribute(d),h=new e8(new e.constructor(c*f),f,g);b.setAttribute(d,h)}if(null!==a.getIndex()){let a=c>65535?new Uint32Array(d):new Uint16Array(d);b.setIndex(new e8(a,1))}this._geometryInitialized=!0}}_validateGeometry(a){let b=this.geometry;if(!!a.getIndex()!=!!b.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let c in b.attributes){if(!a.hasAttribute(c))throw Error(`THREE.BatchedMesh: Added geometry missing "${c}". All geometries must have consistent attributes.`);let d=a.getAttribute(c),e=b.getAttribute(c);if(d.itemSize!==e.itemSize||d.normalized!==e.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(a){let b=this._instanceInfo;if(a<0||a>=b.length||!1===b[a].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${a}. Instance is either out of range or has been deleted.`)}validateGeometryId(a){let b=this._geometryInfo;if(a<0||a>=b.length||!1===b[a].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${a}. Geometry is either out of range or has been deleted.`)}setCustomSort(a){return this.customSort=a,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new eO);let a=this.boundingBox,b=this._instanceInfo;a.makeEmpty();for(let c=0,d=b.length;c<d;c++){if(!1===b[c].active)continue;let d=b[c].geometryIndex;this.getMatrixAt(c,gK),this.getBoundingBoxAt(d,gO).applyMatrix4(gK),a.union(gO)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new fl);let a=this.boundingSphere,b=this._instanceInfo;a.makeEmpty();for(let c=0,d=b.length;c<d;c++){if(!1===b[c].active)continue;let d=b[c].geometryIndex;this.getMatrixAt(c,gK),this.getBoundingSphereAt(d,gP).applyMatrix4(gK),a.union(gP)}}addInstance(a){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let b={visible:!0,active:!0,geometryIndex:a},c=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(gG),c=this._availableInstanceIds.shift(),this._instanceInfo[c]=b):(c=this._instanceInfo.length,this._instanceInfo.push(b));let d=this._matricesTexture;gK.identity().toArray(d.image.data,16*c),d.needsUpdate=!0;let e=this._colorsTexture;return e&&(gL.toArray(e.image.data,4*c),e.needsUpdate=!0),this._visibilityChanged=!0,c}addGeometry(a,b=-1,c=-1){let d;this._initializeGeometry(a),this._validateGeometry(a);let e={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},f=this._geometryInfo;e.vertexStart=this._nextVertexStart,e.reservedVertexCount=-1===b?a.getAttribute("position").count:b;let g=a.getIndex();if(null!==g&&(e.indexStart=this._nextIndexStart,e.reservedIndexCount=-1===c?g.count:c),-1!==e.indexStart&&e.indexStart+e.reservedIndexCount>this._maxIndexCount||e.vertexStart+e.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(gG),f[d=this._availableGeometryIds.shift()]=e):(d=this._geometryCount,this._geometryCount++,f.push(e)),this.setGeometryAt(d,a),this._nextIndexStart=e.indexStart+e.reservedIndexCount,this._nextVertexStart=e.vertexStart+e.reservedVertexCount,d}setGeometryAt(a,b){if(a>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(b);let c=this.geometry,d=null!==c.getIndex(),e=c.getIndex(),f=b.getIndex(),g=this._geometryInfo[a];if(d&&f.count>g.reservedIndexCount||b.attributes.position.count>g.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let h=g.vertexStart,i=g.reservedVertexCount;for(let a in g.vertexCount=b.getAttribute("position").count,c.attributes){let d=b.getAttribute(a),e=c.getAttribute(a);!function(a,b,c=0){let d=b.itemSize;if(a.isInterleavedBufferAttribute||a.array.constructor!==b.array.constructor){let e=a.count;for(let f=0;f<e;f++)for(let e=0;e<d;e++)b.setComponent(f+c,e,a.getComponent(f,e))}else b.array.set(a.array,c*d);b.needsUpdate=!0}(d,e,h);let f=d.itemSize;for(let a=d.count;a<i;a++){let b=h+a;for(let a=0;a<f;a++)e.setComponent(b,a,0)}e.needsUpdate=!0,e.addUpdateRange(h*f,i*f)}if(d){let a=g.indexStart,c=g.reservedIndexCount;g.indexCount=b.getIndex().count;for(let b=0;b<f.count;b++)e.setX(a+b,h+f.getX(b));for(let b=f.count;b<c;b++)e.setX(a+b,h);e.needsUpdate=!0,e.addUpdateRange(a,g.reservedIndexCount)}return g.start=d?g.indexStart:g.vertexStart,g.count=d?g.indexCount:g.vertexCount,g.boundingBox=null,null!==b.boundingBox&&(g.boundingBox=b.boundingBox.clone()),g.boundingSphere=null,null!==b.boundingSphere&&(g.boundingSphere=b.boundingSphere.clone()),this._visibilityChanged=!0,a}deleteGeometry(a){let b=this._geometryInfo;if(a>=b.length||!1===b[a].active)return this;let c=this._instanceInfo;for(let b=0,d=c.length;b<d;b++)c[b].active&&c[b].geometryIndex===a&&this.deleteInstance(b);return b[a].active=!1,this._availableGeometryIds.push(a),this._visibilityChanged=!0,this}deleteInstance(a){return this.validateInstanceId(a),this._instanceInfo[a].active=!1,this._availableInstanceIds.push(a),this._visibilityChanged=!0,this}optimize(){let a=0,b=0,c=this._geometryInfo,d=c.map((a,b)=>b).sort((a,b)=>c[a].vertexStart-c[b].vertexStart),e=this.geometry;for(let f=0,g=c.length;f<g;f++){let g=c[d[f]];if(!1!==g.active){if(null!==e.index){if(g.indexStart!==b){let{indexStart:c,vertexStart:d,reservedIndexCount:f}=g,h=e.index,i=h.array,j=a-d;for(let a=c;a<c+f;a++)i[a]=i[a]+j;h.array.copyWithin(b,c,c+f),h.addUpdateRange(b,f),h.needsUpdate=!0,g.indexStart=b}b+=g.reservedIndexCount}if(g.vertexStart!==a){let{vertexStart:b,reservedVertexCount:c}=g,d=e.attributes;for(let e in d){let f=d[e],{array:g,itemSize:h}=f;g.copyWithin(a*h,b*h,(b+c)*h),f.addUpdateRange(a*h,c*h),f.needsUpdate=!0}g.vertexStart=a}a+=g.reservedVertexCount,g.start=e.index?g.indexStart:g.vertexStart}}return this._nextIndexStart=b,this._nextVertexStart=a,this._visibilityChanged=!0,this}getBoundingBoxAt(a,b){if(a>=this._geometryCount)return null;let c=this.geometry,d=this._geometryInfo[a];if(null===d.boundingBox){let a=new eO,b=c.index,e=c.attributes.position;for(let c=d.start,f=d.start+d.count;c<f;c++){let d=c;b&&(d=b.getX(d)),a.expandByPoint(gQ.fromBufferAttribute(e,d))}d.boundingBox=a}return b.copy(d.boundingBox),b}getBoundingSphereAt(a,b){if(a>=this._geometryCount)return null;let c=this.geometry,d=this._geometryInfo[a];if(null===d.boundingSphere){let b=new fl;this.getBoundingBoxAt(a,gO),gO.getCenter(b.center);let e=c.index,f=c.attributes.position,g=0;for(let a=d.start,c=d.start+d.count;a<c;a++){let c=a;e&&(c=e.getX(c)),gQ.fromBufferAttribute(f,c),g=Math.max(g,b.center.distanceToSquared(gQ))}b.radius=Math.sqrt(g),d.boundingSphere=b}return b.copy(d.boundingSphere),b}setMatrixAt(a,b){this.validateInstanceId(a);let c=this._matricesTexture,d=this._matricesTexture.image.data;return b.toArray(d,16*a),c.needsUpdate=!0,this}getMatrixAt(a,b){return this.validateInstanceId(a),b.fromArray(this._matricesTexture.image.data,16*a)}setColorAt(a,b){return this.validateInstanceId(a),null===this._colorsTexture&&this._initColorsTexture(),b.toArray(this._colorsTexture.image.data,4*a),this._colorsTexture.needsUpdate=!0,this}getColorAt(a,b){return(this.validateInstanceId(a),null!==this._colorsTexture)?b.fromArray(this._colorsTexture.image.data,4*a):b.isVector4?b.set(1,1,1,1):b.setRGB(1,1,1)}setVisibleAt(a,b){return this.validateInstanceId(a),this._instanceInfo[a].visible===b||(this._instanceInfo[a].visible=b,this._visibilityChanged=!0),this}getVisibleAt(a){return this.validateInstanceId(a),this._instanceInfo[a].visible}setGeometryIdAt(a,b){return this.validateInstanceId(a),this.validateGeometryId(b),this._instanceInfo[a].geometryIndex=b,this._visibilityChanged=!0,this}getGeometryIdAt(a){return this.validateInstanceId(a),this._instanceInfo[a].geometryIndex}getGeometryRangeAt(a,b={}){this.validateGeometryId(a);let c=this._geometryInfo[a];return b.vertexStart=c.vertexStart,b.vertexCount=c.vertexCount,b.reservedVertexCount=c.reservedVertexCount,b.indexStart=c.indexStart,b.indexCount=c.indexCount,b.reservedIndexCount=c.reservedIndexCount,b.start=c.start,b.count=c.count,b}setInstanceCount(a){let b=this._availableInstanceIds,c=this._instanceInfo;for(b.sort(gG);b[b.length-1]===c.length-1;)c.pop(),b.pop();if(a<c.length)throw Error(`THREE.BatchedMesh: Instance ids outside the range ${a} are being used. Cannot shrink instance count.`);let d=new Int32Array(a),e=new Int32Array(a);gW(this._multiDrawCounts,d),gW(this._multiDrawStarts,e),this._multiDrawCounts=d,this._multiDrawStarts=e,this._maxInstanceCount=a;let f=this._indirectTexture,g=this._matricesTexture,h=this._colorsTexture;f.dispose(),this._initIndirectTexture(),gW(f.image.data,this._indirectTexture.image.data),g.dispose(),this._initMatricesTexture(),gW(g.image.data,this._matricesTexture.image.data),h&&(h.dispose(),this._initColorsTexture(),gW(h.image.data,this._colorsTexture.image.data))}setGeometrySize(a,b){let c=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...c.map(a=>a.vertexStart+a.reservedVertexCount))>a)throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${b}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...c.map(a=>a.indexStart+a.reservedIndexCount))>b)throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${b}. Cannot shrink further.`);let d=this.geometry;d.dispose(),this._maxVertexCount=a,this._maxIndexCount=b,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new ft,this._initializeGeometry(d));let e=this.geometry;for(let a in d.index&&gW(d.index.array,e.index.array),d.attributes)gW(d.attributes[a].array,e.attributes[a].array)}raycast(a,b){let c=this._instanceInfo,d=this._geometryInfo,e=this.matrixWorld,f=this.geometry;gU.material=this.material,gU.geometry.index=f.index,gU.geometry.attributes=f.attributes,null===gU.geometry.boundingBox&&(gU.geometry.boundingBox=new eO),null===gU.geometry.boundingSphere&&(gU.geometry.boundingSphere=new fl);for(let f=0,g=c.length;f<g;f++){if(!c[f].visible||!c[f].active)continue;let g=c[f].geometryIndex,h=d[g];gU.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(f,gU.matrixWorld).premultiply(e),this.getBoundingBoxAt(g,gU.geometry.boundingBox),this.getBoundingSphereAt(g,gU.geometry.boundingSphere),gU.raycast(a,gV);for(let a=0,c=gV.length;a<c;a++){let c=gV[a];c.object=this,c.batchId=f,b.push(c)}gV.length=0}gU.material=null,gU.geometry.index=null,gU.geometry.attributes={},gU.geometry.setDrawRange(0,1/0)}copy(a){return super.copy(a),this.geometry=a.geometry.clone(),this.perObjectFrustumCulled=a.perObjectFrustumCulled,this.sortObjects=a.sortObjects,this.boundingBox=null!==a.boundingBox?a.boundingBox.clone():null,this.boundingSphere=null!==a.boundingSphere?a.boundingSphere.clone():null,this._geometryInfo=a._geometryInfo.map(a=>({...a,boundingBox:null!==a.boundingBox?a.boundingBox.clone():null,boundingSphere:null!==a.boundingSphere?a.boundingSphere.clone():null})),this._instanceInfo=a._instanceInfo.map(a=>({...a})),this._availableInstanceIds=a._availableInstanceIds.slice(),this._availableGeometryIds=a._availableGeometryIds.slice(),this._nextIndexStart=a._nextIndexStart,this._nextVertexStart=a._nextVertexStart,this._geometryCount=a._geometryCount,this._maxInstanceCount=a._maxInstanceCount,this._maxVertexCount=a._maxVertexCount,this._maxIndexCount=a._maxIndexCount,this._geometryInitialized=a._geometryInitialized,this._multiDrawCounts=a._multiDrawCounts.slice(),this._multiDrawStarts=a._multiDrawStarts.slice(),this._multiDrawBytesPerElement=a._multiDrawBytesPerElement,this._indirectTexture=a._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=a._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=a._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){super.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(a,b,c,d,e){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let f=d.getIndex(),g=null===f?1:f.array.BYTES_PER_ELEMENT,h=1;e.wireframe&&(h=2,g=d.attributes.position.count>65535?4:2);let i=this._instanceInfo,j=this._multiDrawStarts,k=this._multiDrawCounts,l=this._geometryInfo,m=this.perObjectFrustumCulled,n=this._indirectTexture,o=n.image.data,p=c.isArrayCamera?gN:gM;m&&(c.isArrayCamera?p.setFromArrayCamera(c):(gK.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse).multiply(this.matrixWorld),p.setFromProjectionMatrix(gK,c.coordinateSystem,c.reversedDepth)));let q=0;if(this.sortObjects){gK.copy(this.matrixWorld).invert(),gQ.setFromMatrixPosition(c.matrixWorld).applyMatrix4(gK),gR.set(0,0,-1).transformDirection(c.matrixWorld).transformDirection(gK);for(let a=0,b=i.length;a<b;a++)if(i[a].visible&&i[a].active){let b=i[a].geometryIndex;this.getMatrixAt(a,gK),this.getBoundingSphereAt(b,gP).applyMatrix4(gK);let c=!1;if(m&&(c=!p.intersectsSphere(gP)),!c){let c=l[b],d=gS.subVectors(gP.center,gQ).dot(gR);gT.push(c.start,c.count,d,a)}}let a=gT.list,b=this.customSort;null===b?a.sort(e.transparent?gI:gH):b.call(this,a,c);for(let b=0,c=a.length;b<c;b++){let c=a[b];j[q]=c.start*g*h,k[q]=c.count*h,o[q]=c.index,q++}gT.reset()}else for(let a=0,b=i.length;a<b;a++)if(i[a].visible&&i[a].active){let b=i[a].geometryIndex,c=!1;if(m&&(this.getMatrixAt(a,gK),this.getBoundingSphereAt(b,gP).applyMatrix4(gK),c=!p.intersectsSphere(gP)),!c){let c=l[b];j[q]=c.start*g*h,k[q]=c.count*h,o[q]=a,q++}}n.needsUpdate=!0,this._multiDrawCount=q,this._multiDrawBytesPerElement=g,this._visibilityChanged=!1}onBeforeShadow(a,b,c,d,e,f){this.onBeforeRender(a,null,d,e,f)}}class gY extends fC{constructor(a){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ev(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.linewidth=a.linewidth,this.linecap=a.linecap,this.linejoin=a.linejoin,this.fog=a.fog,this}}let gZ=new dz,g$=new dz,g_=new dY,g0=new fZ,g1=new fl,g2=new dz,g3=new dz;class g4 extends en{constructor(a=new ft,b=new gY){super(),this.isLine=!0,this.type="Line",this.geometry=a,this.material=b,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(a,b){return super.copy(a,b),this.material=Array.isArray(a.material)?a.material.slice():a.material,this.geometry=a.geometry,this}computeLineDistances(){let a=this.geometry;if(null===a.index){let b=a.attributes.position,c=[0];for(let a=1,d=b.count;a<d;a++)gZ.fromBufferAttribute(b,a-1),g$.fromBufferAttribute(b,a),c[a]=c[a-1],c[a]+=gZ.distanceTo(g$);a.setAttribute("lineDistance",new fh(c,1))}else dg("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(a){return a.intersectsObject(this)}raycast(a,b){let c=this.geometry,d=this.matrixWorld,e=a.params.Line.threshold,f=c.drawRange;if(null===c.boundingSphere&&c.computeBoundingSphere(),g1.copy(c.boundingSphere),g1.applyMatrix4(d),g1.radius+=e,!1===a.ray.intersectsSphere(g1))return;g_.copy(d).invert(),g0.copy(a.ray).applyMatrix4(g_);let g=e/((this.scale.x+this.scale.y+this.scale.z)/3),h=g*g,i=this.isLineSegments?2:1,j=c.index,k=c.attributes.position;if(null!==j){let c=Math.max(0,f.start),d=Math.min(j.count,f.start+f.count);for(let e=c,f=d-1;e<f;e+=i){let c=g5(this,a,g0,h,j.getX(e),j.getX(e+1),e);c&&b.push(c)}if(this.isLineLoop){let e=g5(this,a,g0,h,j.getX(d-1),j.getX(c),d-1);e&&b.push(e)}}else{let c=Math.max(0,f.start),d=Math.min(k.count,f.start+f.count);for(let e=c,f=d-1;e<f;e+=i){let c=g5(this,a,g0,h,e,e+1,e);c&&b.push(c)}if(this.isLineLoop){let e=g5(this,a,g0,h,d-1,c,d-1);e&&b.push(e)}}}updateMorphTargets(){let a=this.geometry.morphAttributes,b=Object.keys(a);if(b.length>0){let c=a[b[0]];if(void 0!==c){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,b=c.length;a<b;a++){let b=c[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=a}}}}}function g5(a,b,c,d,e,f,g){let h=a.geometry.attributes.position;if(gZ.fromBufferAttribute(h,e),g$.fromBufferAttribute(h,f),c.distanceSqToSegment(gZ,g$,g2,g3)>d)return;g2.applyMatrix4(a.matrixWorld);let i=b.ray.origin.distanceTo(g2);if(!(i<b.near)&&!(i>b.far))return{distance:i,point:g3.clone().applyMatrix4(a.matrixWorld),index:g,face:null,faceIndex:null,barycoord:null,object:a}}let g6=new dz,g7=new dz;class g8 extends g4{constructor(a,b){super(a,b),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let a=this.geometry;if(null===a.index){let b=a.attributes.position,c=[];for(let a=0,d=b.count;a<d;a+=2)g6.fromBufferAttribute(b,a),g7.fromBufferAttribute(b,a+1),c[a]=0===a?0:c[a-1],c[a+1]=c[a]+g6.distanceTo(g7);a.setAttribute("lineDistance",new fh(c,1))}else dg("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class g9 extends g4{constructor(a,b){super(a,b),this.isLineLoop=!0,this.type="LineLoop"}}class ha extends fC{constructor(a){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ev(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.alphaMap=a.alphaMap,this.size=a.size,this.sizeAttenuation=a.sizeAttenuation,this.fog=a.fog,this}}let hb=new dY,hc=new fZ,hd=new fl,he=new dz;class hf extends en{constructor(a=new ft,b=new ha){super(),this.isPoints=!0,this.type="Points",this.geometry=a,this.material=b,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(a,b){return super.copy(a,b),this.material=Array.isArray(a.material)?a.material.slice():a.material,this.geometry=a.geometry,this}intersectsFrustum(a){return a.intersectsObject(this)}raycast(a,b){let c=this.geometry,d=this.matrixWorld,e=a.params.Points.threshold,f=c.drawRange;if(null===c.boundingSphere&&c.computeBoundingSphere(),hd.copy(c.boundingSphere),hd.applyMatrix4(d),hd.radius+=e,!1===a.ray.intersectsSphere(hd))return;hb.copy(d).invert(),hc.copy(a.ray).applyMatrix4(hb);let g=e/((this.scale.x+this.scale.y+this.scale.z)/3),h=g*g,i=c.index,j=c.attributes.position;if(null!==i){let c=Math.max(0,f.start),e=Math.min(i.count,f.start+f.count);for(let f=c;f<e;f++){let c=i.getX(f);he.fromBufferAttribute(j,c),hg(he,c,h,d,a,b,this)}}else{let c=Math.max(0,f.start),e=Math.min(j.count,f.start+f.count);for(let f=c;f<e;f++)he.fromBufferAttribute(j,f),hg(he,f,h,d,a,b,this)}}updateMorphTargets(){let a=this.geometry.morphAttributes,b=Object.keys(a);if(b.length>0){let c=a[b[0]];if(void 0!==c){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,b=c.length;a<b;a++){let b=c[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[b]=a}}}}}function hg(a,b,c,d,e,f,g){let h=hc.distanceSqToPoint(a);if(h<c){let c=new dz;hc.closestPointToPoint(a,c),c.applyMatrix4(d);let i=e.ray.origin.distanceTo(c);if(i<e.near||i>e.far)return;f.push({distance:i,distanceToRay:Math.sqrt(h),point:c,index:b,face:null,faceIndex:null,barycoord:null,object:g})}}class hh extends dQ{constructor(a,b,c,d,e=aZ,f=aZ,g,h,i){super(a,b,c,d,e,f,g,h,i),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const j=this;"requestVideoFrameCallback"in a&&(this._requestVideoFrameCallbackId=a.requestVideoFrameCallback(function b(){j.needsUpdate=!0,j._requestVideoFrameCallbackId=a.requestVideoFrameCallback(b)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let a=this.image;!1=="requestVideoFrameCallback"in a&&a.readyState>=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class hi extends hh{constructor(a,b,c,d,e,f,g,h){super({},a,b,c,d,e,f,g,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(a){this.image=a,this.needsUpdate=!0}}class hj extends dQ{constructor(a,b){super({width:a,height:b}),this.isFramebufferTexture=!0,this.magFilter=aU,this.minFilter=aU,this.generateMipmaps=!1,this.needsUpdate=!0}}class hk extends dQ{constructor(a,b,c,d,e,f,g,h,i,j,k,l){super(null,f,g,h,i,j,d,e,k,l),this.isCompressedTexture=!0,this.image={width:b,height:c},this.mipmaps=a,this.flipY=!1,this.generateMipmaps=!1}}class hl extends hk{constructor(a,b,c,d,e,f){super(a,b,c,e,f),this.isCompressedArrayTexture=!0,this.image.depth=d,this.wrapR=aS,this.layerUpdates=new Set}copy(a){return super.copy(a),this.wrapR=a.wrapR,this}addLayerUpdate(a){this.layerUpdates.add(a)}clearLayerUpdates(){this.layerUpdates.clear()}}class hm extends hk{constructor(a,b,c){super(void 0,a[0].width,a[0].height,b,c,aM),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=a}}class hn extends dQ{constructor(a=[],b=aM,c,d,e,f,g,h,i,j){super(a,b,c,d,e,f,g,h,i,j),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(a){this.image=a}}class ho extends dQ{constructor(a,b,c,d,e,f,g,h,i){super(a,b,c,d,e,f,g,h,i),this.isCanvasTexture=!0,this.needsUpdate=!0}}class hp extends dQ{constructor(a,b,c,d,e,f,g,h,i){super(a,b,c,d,e,f,g,h,i),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const j=a?a.parentNode:null;null!==j&&"requestPaint"in j&&(j.onpaint=()=>{this.needsUpdate=!0},j.requestPaint())}dispose(){let a=this.image?this.image.parentNode:null;null!==a&&"onpaint"in a&&(a.onpaint=null),super.dispose()}}class hq extends dQ{constructor(a,b,c=a7,d,e,f,g=aU,h=aU,i,j=bi,k=1){if(j!==bi&&j!==bj)throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:a,height:b,depth:k},d,e,f,g,h,j,c,i),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(a){return super.copy(a),this.source=new dL(Object.assign({},a.image)),this.compareFunction=a.compareFunction,this}toJSON(a){let b=super.toJSON(a);return b.compareFunction=this.compareFunction,b}}class hr extends hq{constructor(a,b=a7,c=aM,d,e,f=aU,g=aU,h,i=bi){const j={width:a,height:a,depth:1};super(a,a,b,c,d,e,f,g,h,i),this.image=[j,j,j,j,j,j],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(a){this.image=a}}class hs extends dQ{constructor(a=null){super(),this.sourceTexture=a,this.isExternalTexture=!0}copy(a){return super.copy(a),this.sourceTexture=a.sourceTexture,this}}class ht extends ft{constructor(a=1,b=1,c=1,d=1,e=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};const g=this;d=Math.floor(d),e=Math.floor(e);const h=[],i=[],j=[],k=[];let l=0,m=0;function n(a,b,c,d,e,f,n,o,p,q,r){let s=f/p,t=n/q,u=f/2,v=n/2,w=o/2,x=p+1,y=q+1,z=0,A=0,B=new dz;for(let f=0;f<y;f++){let g=f*t-v;for(let h=0;h<x;h++){let l=h*s-u;B[a]=l*d,B[b]=g*e,B[c]=w,i.push(B.x,B.y,B.z),B[a]=0,B[b]=0,B[c]=o>0?1:-1,j.push(B.x,B.y,B.z),k.push(h/p),k.push(1-f/q),z+=1}}for(let a=0;a<q;a++)for(let b=0;b<p;b++){let c=l+b+x*a,d=l+b+x*(a+1),e=l+(b+1)+x*(a+1),f=l+(b+1)+x*a;h.push(c,d,f),h.push(d,e,f),A+=6}g.addGroup(m,A,r),m+=A,l+=z}n("z","y","x",-1,-1,c,b,a,f=Math.floor(f),e,0),n("z","y","x",1,-1,c,b,-a,f,e,1),n("x","z","y",1,1,a,c,b,d,f,2),n("x","z","y",1,-1,a,c,-b,d,f,3),n("x","y","z",1,-1,a,b,c,d,e,4),n("x","y","z",-1,-1,a,b,-c,d,e,5),this.setIndex(h),this.setAttribute("position",new fh(i,3)),this.setAttribute("normal",new fh(j,3)),this.setAttribute("uv",new fh(k,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new ht(a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments)}}class hu extends ft{constructor(a=1,b=1,c=4,d=8,e=1){super(),this.type="CapsuleGeometry",this.parameters={radius:a,height:b,capSegments:c,radialSegments:d,heightSegments:e},b=Math.max(0,b),c=Math.max(1,Math.floor(c)),d=Math.max(3,Math.floor(d));const f=[],g=[],h=[],i=[],j=b/2,k=Math.PI/2*a,l=b,m=2*k+l,n=2*c+(e=Math.max(1,Math.floor(e))),o=d+1,p=new dz,q=new dz;for(let r=0;r<=n;r++){let s=0,t=0,u=0,v=0;if(r<=c){const b=r/c,d=b*Math.PI/2;t=-j-a*Math.cos(d),u=a*Math.sin(d),v=-a*Math.cos(d),s=b*k}else if(r<=c+e){const d=(r-c)/e;t=-j+d*b,u=a,v=0,s=k+d*l}else{const b=(r-c-e)/c,d=b*Math.PI/2;t=j+a*Math.sin(d),u=a*Math.cos(d),v=a*Math.sin(d),s=k+l+b*k}const w=Math.max(0,Math.min(1,s/m));let x=0;0===r?x=.5/d:r===n&&(x=-.5/d);for(let a=0;a<=d;a++){const b=a/d,c=b*Math.PI*2,e=Math.sin(c),f=Math.cos(c);q.x=-u*f,q.y=t,q.z=u*e,g.push(q.x,q.y,q.z),p.set(-u*f,v,u*e),p.normalize(),h.push(p.x,p.y,p.z),i.push(b+x,w)}if(r>0){const a=(r-1)*o;for(let b=0;b<d;b++){const c=a+b,d=a+b+1,e=r*o+b,g=r*o+b+1;f.push(c,d,e),f.push(d,g,e)}}}this.setIndex(f),this.setAttribute("position",new fh(g,3)),this.setAttribute("normal",new fh(h,3)),this.setAttribute("uv",new fh(i,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new hu(a.radius,a.height,a.capSegments,a.radialSegments,a.heightSegments)}}class hv extends ft{constructor(a=1,b=32,c=0,d=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d},b=Math.max(3,b);const e=[],f=[],g=[],h=[],i=new dz,j=new dx;f.push(0,0,0),g.push(0,0,1),h.push(.5,.5);for(let e=0,k=3;e<=b;e++,k+=3){const l=c+e/b*d;i.x=a*Math.cos(l),i.y=a*Math.sin(l),f.push(i.x,i.y,i.z),g.push(0,0,1),j.x=(f[k]/a+1)/2,j.y=(f[k+1]/a+1)/2,h.push(j.x,j.y)}for(let a=1;a<=b;a++)e.push(a,a+1,0);this.setIndex(e),this.setAttribute("position",new fh(f,3)),this.setAttribute("normal",new fh(g,3)),this.setAttribute("uv",new fh(h,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new hv(a.radius,a.segments,a.thetaStart,a.thetaLength)}}class hw extends ft{constructor(a=1,b=1,c=1,d=32,e=1,f=!1,g=0,h=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};const i=this;d=Math.floor(d),e=Math.floor(e);const j=[],k=[],l=[],m=[];let n=0;const o=[],p=c/2;let q=0;function r(c){let e=n,f=new dx,o=new dz,r=0,s=!0===c?a:b,t=!0===c?1:-1;for(let a=1;a<=d;a++)k.push(0,p*t,0),l.push(0,t,0),m.push(.5,.5),n++;let u=n;for(let a=0;a<=d;a++){let b=a/d*h+g,c=Math.cos(b),e=Math.sin(b);o.x=s*e,o.y=p*t,o.z=s*c,k.push(o.x,o.y,o.z),l.push(0,t,0),f.x=.5*c+.5,f.y=.5*e*t+.5,m.push(f.x,f.y),n++}for(let a=0;a<d;a++){let b=e+a,d=u+a;!0===c?j.push(d,d+1,b):j.push(d+1,d,b),r+=3}i.addGroup(q,r,!0===c?1:2),q+=r}(function(){let f=new dz,r=new dz,s=0,t=(b-a)/c;for(let i=0;i<=e;i++){let j=[],q=i/e,s=q*(b-a)+a;for(let a=0;a<=d;a++){let b=a/d,e=b*h+g,i=Math.sin(e),o=Math.cos(e);r.x=s*i,r.y=-q*c+p,r.z=s*o,k.push(r.x,r.y,r.z),f.set(i,t,o).normalize(),l.push(f.x,f.y,f.z),m.push(b,1-q),j.push(n++)}o.push(j)}for(let c=0;c<d;c++)for(let d=0;d<e;d++){let f=o[d][c],g=o[d+1][c],h=o[d+1][c+1],i=o[d][c+1];(a>0||0!==d)&&(j.push(f,g,i),s+=3),(b>0||d!==e-1)&&(j.push(g,h,i),s+=3)}i.addGroup(q,s,0),q+=s})(),!1===f&&(a>0&&r(!0),b>0&&r(!1)),this.setIndex(j),this.setAttribute("position",new fh(k,3)),this.setAttribute("normal",new fh(l,3)),this.setAttribute("uv",new fh(m,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new hw(a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength)}}class hx extends hw{constructor(a=1,b=1,c=32,d=1,e=!1,f=0,g=2*Math.PI){super(0,a,b,c,d,e,f,g),this.type="ConeGeometry",this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}static fromJSON(a){return new hx(a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength)}}class hy extends ft{constructor(a=[],b=[],c=1,d=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:a,indices:b,radius:c,detail:d};const e=[],f=[];function g(a){e.push(a.x,a.y,a.z)}function h(b,c){let d=3*b;c.x=a[d+0],c.y=a[d+1],c.z=a[d+2]}function i(a,b,c,d){d<0&&1===a.x&&(f[b]=a.x-1),0===c.x&&0===c.z&&(f[b]=d/2/Math.PI+.5)}function j(a){return Math.atan2(a.z,-a.x)}(function(a){let c=new dz,d=new dz,e=new dz;for(let f=0;f<b.length;f+=3)h(b[f+0],c),h(b[f+1],d),h(b[f+2],e),function(a,b,c,d){let e=d+1,f=[];for(let d=0;d<=e;d++){f[d]=[];let g=a.clone().lerp(c,d/e),h=b.clone().lerp(c,d/e),i=e-d;for(let a=0;a<=i;a++)0===a&&d===e?f[d][a]=g:f[d][a]=g.clone().lerp(h,a/i)}for(let a=0;a<e;a++)for(let b=0;b<2*(e-a)-1;b++){let c=Math.floor(b/2);b%2==0?(g(f[a][c+1]),g(f[a+1][c]),g(f[a][c])):(g(f[a][c+1]),g(f[a+1][c+1]),g(f[a+1][c]))}}(c,d,e,a)})(d),function(a){let b=new dz;for(let c=0;c<e.length;c+=3)b.x=e[c+0],b.y=e[c+1],b.z=e[c+2],b.normalize().multiplyScalar(a),e[c+0]=b.x,e[c+1]=b.y,e[c+2]=b.z}(c),function(){let a=new dz;for(let c=0;c<e.length;c+=3){var b;a.x=e[c+0],a.y=e[c+1],a.z=e[c+2];let d=j(a)/2/Math.PI+.5,g=Math.atan2(-(b=a).y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+.5;f.push(d,1-g)}(function(){let a=new dz,b=new dz,c=new dz,d=new dz,g=new dx,h=new dx,k=new dx;for(let l=0,m=0;l<e.length;l+=9,m+=6){a.set(e[l+0],e[l+1],e[l+2]),b.set(e[l+3],e[l+4],e[l+5]),c.set(e[l+6],e[l+7],e[l+8]),g.set(f[m+0],f[m+1]),h.set(f[m+2],f[m+3]),k.set(f[m+4],f[m+5]),d.copy(a).add(b).add(c).divideScalar(3);let n=j(d);i(g,m+0,a,n),i(h,m+2,b,n),i(k,m+4,c,n)}})(),function(){for(let a=0;a<f.length;a+=6){let b=f[a+0],c=f[a+2],d=f[a+4],e=Math.max(b,c,d),g=Math.min(b,c,d);e>.9&&g<.1&&(b<.2&&(f[a+0]+=1),c<.2&&(f[a+2]+=1),d<.2&&(f[a+4]+=1))}}()}(),this.setAttribute("position",new fh(e,3)),this.setAttribute("normal",new fh(e.slice(),3)),this.setAttribute("uv",new fh(f,2)),0===d?this.computeVertexNormals():this.normalizeNormals()}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new hy(a.vertices,a.indices,a.radius,a.detail)}}class hz extends hy{constructor(a=1,b=0){const c=(1+Math.sqrt(5))/2,d=1/c;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,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b),this.type="DodecahedronGeometry",this.parameters={radius:a,detail:b}}static fromJSON(a){return new hz(a.radius,a.detail)}}let hA=new dz,hB=new dz,hC=new dz,hD=new eN;class hE extends ft{constructor(a=null,b=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:a,thresholdAngle:b},null!==a){const c=Math.cos(dn*b),d=a.getIndex(),e=a.getAttribute("position"),f=d?d.count:e.count,g=[0,0,0],h=["a","b","c"],i=[,,,],j={},k=[];for(let a=0;a<f;a+=3){d?(g[0]=d.getX(a),g[1]=d.getX(a+1),g[2]=d.getX(a+2)):(g[0]=a,g[1]=a+1,g[2]=a+2);const{a:b,b:f,c:l}=hD;if(b.fromBufferAttribute(e,g[0]),f.fromBufferAttribute(e,g[1]),l.fromBufferAttribute(e,g[2]),hD.getNormal(hC),i[0]=`${Math.round(1e4*b.x)},${Math.round(1e4*b.y)},${Math.round(1e4*b.z)}`,i[1]=`${Math.round(1e4*f.x)},${Math.round(1e4*f.y)},${Math.round(1e4*f.z)}`,i[2]=`${Math.round(1e4*l.x)},${Math.round(1e4*l.y)},${Math.round(1e4*l.z)}`,i[0]!==i[1]&&i[1]!==i[2]&&i[2]!==i[0])for(let a=0;a<3;a++){const b=(a+1)%3,d=i[a],e=i[b],f=hD[h[a]],l=hD[h[b]],m=`${d}_${e}`,n=`${e}_${d}`;n in j&&j[n]?(hC.dot(j[n].normal)<=c&&(k.push(f.x,f.y,f.z),k.push(l.x,l.y,l.z)),j[n]=null):m in j||(j[m]={index0:g[a],index1:g[b],normal:hC.clone()})}}for(const a in j)if(j[a]){const{index0:b,index1:c}=j[a];hA.fromBufferAttribute(e,b),hB.fromBufferAttribute(e,c),k.push(hA.x,hA.y,hA.z),k.push(hB.x,hB.y,hB.z)}this.setAttribute("position",new fh(k,3))}}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}}class hF{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){dg("Curve: .getPoint() not implemented.")}getPointAt(a,b){let c=this.getUtoTmapping(a);return this.getPoint(c,b)}getPoints(a=5){let b=[];for(let c=0;c<=a;c++)b.push(this.getPoint(c/a));return b}getSpacedPoints(a=5){let b=[];for(let c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b}getLength(){let a=this.getLengths();return a[a.length-1]}getLengths(a=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let b=[],c,d=this.getPoint(0),e=0;b.push(0);for(let f=1;f<=a;f++)b.push(e+=(c=this.getPoint(f/a)).distanceTo(d)),d=c;return this.cacheArcLengths=b,b}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(a,b=null){let c,d=this.getLengths(),e=0,f=d.length;c=b||a*d[f-1];let g=0,h=f-1,i;for(;g<=h;)if((i=d[e=Math.floor(g+(h-g)/2)]-c)<0)g=e+1;else if(i>0)h=e-1;else{h=e;break}if(d[e=h]===c)return e/(f-1);let j=d[e],k=d[e+1];return(e+(c-j)/(k-j))/(f-1)}getTangent(a,b){let c=a-1e-4,d=a+1e-4;c<0&&(c=0),d>1&&(d=1);let e=this.getPoint(c),f=this.getPoint(d),g=b||(e.isVector2?new dx:new dz);return g.copy(f).sub(e).normalize(),g}getTangentAt(a,b){let c=this.getUtoTmapping(a);return this.getTangent(c,b)}computeFrenetFrames(a,b=!1){let c=new dz,d=[],e=[],f=[],g=new dz,h=new dY;for(let b=0;b<=a;b++){let c=b/a;d[b]=this.getTangentAt(c,new dz)}e[0]=new dz,f[0]=new dz;let i=Number.MAX_VALUE,j=Math.abs(d[0].x),k=Math.abs(d[0].y),l=Math.abs(d[0].z);j<=i&&(i=j,c.set(1,0,0)),k<=i&&(i=k,c.set(0,1,0)),l<=i&&c.set(0,0,1),g.crossVectors(d[0],c).normalize(),e[0].crossVectors(d[0],g),f[0].crossVectors(d[0],e[0]);for(let b=1;b<=a;b++){if(e[b]=e[b-1].clone(),f[b]=f[b-1].clone(),g.crossVectors(d[b-1],d[b]),g.length()>Number.EPSILON){g.normalize();let a=Math.acos(dr(d[b-1].dot(d[b]),-1,1));e[b].applyMatrix4(h.makeRotationAxis(g,a))}f[b].crossVectors(d[b],e[b])}if(!0===b){let b=Math.acos(dr(e[0].dot(e[a]),-1,1));b/=a,d[0].dot(g.crossVectors(e[0],e[a]))>0&&(b=-b);for(let c=1;c<=a;c++)e[c].applyMatrix4(h.makeRotationAxis(d[c],b*c)),f[c].crossVectors(d[c],e[c])}return{tangents:d,normals:e,binormals:f}}clone(){return new this.constructor().copy(this)}copy(a){return this.arcLengthDivisions=a.arcLengthDivisions,this}toJSON(){let a={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return a.arcLengthDivisions=this.arcLengthDivisions,a.type=this.type,a}fromJSON(a){return this.arcLengthDivisions=a.arcLengthDivisions,this}}class hG extends hF{constructor(a=0,b=0,c=1,d=1,e=0,f=2*Math.PI,g=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=a,this.aY=b,this.xRadius=c,this.yRadius=d,this.aStartAngle=e,this.aEndAngle=f,this.aClockwise=g,this.aRotation=h}getPoint(a,b=new dx){let c=2*Math.PI,d=this.aEndAngle-this.aStartAngle,e=Math.abs(d)<Number.EPSILON;for(;d<0;)d+=c;for(;d>c;)d-=c;d<Number.EPSILON&&(d=e?0:c),!0!==this.aClockwise||e||(d===c?d=-c:d-=c);let f=this.aStartAngle+a*d,g=this.aX+this.xRadius*Math.cos(f),h=this.aY+this.yRadius*Math.sin(f);if(0!==this.aRotation){let a=Math.cos(this.aRotation),b=Math.sin(this.aRotation),c=g-this.aX,d=h-this.aY;g=c*a-d*b+this.aX,h=c*b+d*a+this.aY}return b.set(g,h)}copy(a){return super.copy(a),this.aX=a.aX,this.aY=a.aY,this.xRadius=a.xRadius,this.yRadius=a.yRadius,this.aStartAngle=a.aStartAngle,this.aEndAngle=a.aEndAngle,this.aClockwise=a.aClockwise,this.aRotation=a.aRotation,this}toJSON(){let a=super.toJSON();return a.aX=this.aX,a.aY=this.aY,a.xRadius=this.xRadius,a.yRadius=this.yRadius,a.aStartAngle=this.aStartAngle,a.aEndAngle=this.aEndAngle,a.aClockwise=this.aClockwise,a.aRotation=this.aRotation,a}fromJSON(a){return super.fromJSON(a),this.aX=a.aX,this.aY=a.aY,this.xRadius=a.xRadius,this.yRadius=a.yRadius,this.aStartAngle=a.aStartAngle,this.aEndAngle=a.aEndAngle,this.aClockwise=a.aClockwise,this.aRotation=a.aRotation,this}}class hH extends hG{constructor(a,b,c,d,e,f){super(a,b,c,c,d,e,f),this.isArcCurve=!0,this.type="ArcCurve"}}function hI(){let a=0,b=0,c=0,d=0;function e(e,f,g,h){a=e,b=g,c=-3*e+3*f-2*g-h,d=2*e-2*f+g+h}return{initCatmullRom:function(a,b,c,d,f){e(b,c,f*(c-a),f*(d-b))},initNonuniformCatmullRom:function(a,b,c,d,f,g,h){let i=(b-a)/f-(c-a)/(f+g)+(c-b)/g,j=(c-b)/g-(d-b)/(g+h)+(d-c)/h;e(b,c,i*=g,j*=g)},calc:function(e){let f=e*e;return a+b*e+c*f+f*e*d}}}let hJ=new dz,hK=new dz,hL=new hI,hM=new hI,hN=new hI;class hO extends hF{constructor(a=[],b=!1,c="centripetal",d=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=a,this.closed=b,this.curveType=c,this.tension=d}getPoint(a,b=new dz){let c,d,e=this.points,f=e.length,g=(f-!this.closed)*a,h=Math.floor(g),i=g-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/f)+1)*f:0===i&&h===f-1&&(h=f-2,i=1),this.closed||h>0?c=e[(h-1)%f]:(hK.subVectors(e[0],e[1]).add(e[0]),c=hK);let j=e[h%f],k=e[(h+1)%f];if(this.closed||h+2<f?d=e[(h+2)%f]:(hJ.subVectors(e[f-1],e[f-2]).add(e[f-1]),d=hJ),"centripetal"===this.curveType||"chordal"===this.curveType){let a="chordal"===this.curveType?.5:.25,b=Math.pow(c.distanceToSquared(j),a),e=Math.pow(j.distanceToSquared(k),a),f=Math.pow(k.distanceToSquared(d),a);e<1e-4&&(e=1),b<1e-4&&(b=e),f<1e-4&&(f=e),hL.initNonuniformCatmullRom(c.x,j.x,k.x,d.x,b,e,f),hM.initNonuniformCatmullRom(c.y,j.y,k.y,d.y,b,e,f),hN.initNonuniformCatmullRom(c.z,j.z,k.z,d.z,b,e,f)}else"catmullrom"===this.curveType&&(hL.initCatmullRom(c.x,j.x,k.x,d.x,this.tension),hM.initCatmullRom(c.y,j.y,k.y,d.y,this.tension),hN.initCatmullRom(c.z,j.z,k.z,d.z,this.tension));return b.set(hL.calc(i),hM.calc(i),hN.calc(i)),b}copy(a){super.copy(a),this.points=[];for(let b=0,c=a.points.length;b<c;b++){let c=a.points[b];this.points.push(c.clone())}return this.closed=a.closed,this.curveType=a.curveType,this.tension=a.tension,this}toJSON(){let a=super.toJSON();a.points=[];for(let b=0,c=this.points.length;b<c;b++){let c=this.points[b];a.points.push(c.toArray())}return a.closed=this.closed,a.curveType=this.curveType,a.tension=this.tension,a}fromJSON(a){super.fromJSON(a),this.points=[];for(let b=0,c=a.points.length;b<c;b++){let c=a.points[b];this.points.push(new dz().fromArray(c))}return this.closed=a.closed,this.curveType=a.curveType,this.tension=a.tension,this}}function hP(a,b,c,d,e){let f=(d-b)*.5,g=(e-c)*.5,h=a*a;return a*h*(2*c-2*d+f+g)+(-3*c+3*d-2*f-g)*h+f*a+c}function hQ(a,b,c,d){let e;return(e=1-a)*e*b+2*(1-a)*a*c+a*a*d}function hR(a,b,c,d,e){let f,g;return(f=1-a)*f*f*b+3*(g=1-a)*g*a*c+3*(1-a)*a*a*d+a*a*a*e}class hS extends hF{constructor(a=new dx,b=new dx,c=new dx,d=new dx){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=a,this.v1=b,this.v2=c,this.v3=d}getPoint(a,b=new dx){let c=this.v0,d=this.v1,e=this.v2,f=this.v3;return b.set(hR(a,c.x,d.x,e.x,f.x),hR(a,c.y,d.y,e.y,f.y)),b}copy(a){return super.copy(a),this.v0.copy(a.v0),this.v1.copy(a.v1),this.v2.copy(a.v2),this.v3.copy(a.v3),this}toJSON(){let a=super.toJSON();return a.v0=this.v0.toArray(),a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a.v3=this.v3.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v0.fromArray(a.v0),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this.v3.fromArray(a.v3),this}}class hT extends hF{constructor(a=new dz,b=new dz,c=new dz,d=new dz){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=a,this.v1=b,this.v2=c,this.v3=d}getPoint(a,b=new dz){let c=this.v0,d=this.v1,e=this.v2,f=this.v3;return b.set(hR(a,c.x,d.x,e.x,f.x),hR(a,c.y,d.y,e.y,f.y),hR(a,c.z,d.z,e.z,f.z)),b}copy(a){return super.copy(a),this.v0.copy(a.v0),this.v1.copy(a.v1),this.v2.copy(a.v2),this.v3.copy(a.v3),this}toJSON(){let a=super.toJSON();return a.v0=this.v0.toArray(),a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a.v3=this.v3.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v0.fromArray(a.v0),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this.v3.fromArray(a.v3),this}}class hU extends hF{constructor(a=new dx,b=new dx){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=a,this.v2=b}getPoint(a,b=new dx){return 1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),b.multiplyScalar(a).add(this.v1)),b}getPointAt(a,b){return this.getPoint(a,b)}getTangent(a,b=new dx){return b.subVectors(this.v2,this.v1).normalize()}getTangentAt(a,b){return this.getTangent(a,b)}copy(a){return super.copy(a),this.v1.copy(a.v1),this.v2.copy(a.v2),this}toJSON(){let a=super.toJSON();return a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this}}class hV extends hF{constructor(a=new dz,b=new dz){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=a,this.v2=b}getPoint(a,b=new dz){return 1===a?b.copy(this.v2):(b.copy(this.v2).sub(this.v1),b.multiplyScalar(a).add(this.v1)),b}getPointAt(a,b){return this.getPoint(a,b)}getTangent(a,b=new dz){return b.subVectors(this.v2,this.v1).normalize()}getTangentAt(a,b){return this.getTangent(a,b)}copy(a){return super.copy(a),this.v1.copy(a.v1),this.v2.copy(a.v2),this}toJSON(){let a=super.toJSON();return a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this}}class hW extends hF{constructor(a=new dx,b=new dx,c=new dx){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=a,this.v1=b,this.v2=c}getPoint(a,b=new dx){let c=this.v0,d=this.v1,e=this.v2;return b.set(hQ(a,c.x,d.x,e.x),hQ(a,c.y,d.y,e.y)),b}copy(a){return super.copy(a),this.v0.copy(a.v0),this.v1.copy(a.v1),this.v2.copy(a.v2),this}toJSON(){let a=super.toJSON();return a.v0=this.v0.toArray(),a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v0.fromArray(a.v0),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this}}class hX extends hF{constructor(a=new dz,b=new dz,c=new dz){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=a,this.v1=b,this.v2=c}getPoint(a,b=new dz){let c=this.v0,d=this.v1,e=this.v2;return b.set(hQ(a,c.x,d.x,e.x),hQ(a,c.y,d.y,e.y),hQ(a,c.z,d.z,e.z)),b}copy(a){return super.copy(a),this.v0.copy(a.v0),this.v1.copy(a.v1),this.v2.copy(a.v2),this}toJSON(){let a=super.toJSON();return a.v0=this.v0.toArray(),a.v1=this.v1.toArray(),a.v2=this.v2.toArray(),a}fromJSON(a){return super.fromJSON(a),this.v0.fromArray(a.v0),this.v1.fromArray(a.v1),this.v2.fromArray(a.v2),this}}class hY extends hF{constructor(a=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=a}getPoint(a,b=new dx){let c=this.points,d=(c.length-1)*a,e=Math.floor(d),f=d-e,g=c[0===e?e:e-1],h=c[e],i=c[e>c.length-2?c.length-1:e+1],j=c[e>c.length-3?c.length-1:e+2];return b.set(hP(f,g.x,h.x,i.x,j.x),hP(f,g.y,h.y,i.y,j.y)),b}copy(a){super.copy(a),this.points=[];for(let b=0,c=a.points.length;b<c;b++){let c=a.points[b];this.points.push(c.clone())}return this}toJSON(){let a=super.toJSON();a.points=[];for(let b=0,c=this.points.length;b<c;b++){let c=this.points[b];a.points.push(c.toArray())}return a}fromJSON(a){super.fromJSON(a),this.points=[];for(let b=0,c=a.points.length;b<c;b++){let c=a.points[b];this.points.push(new dx().fromArray(c))}return this}}var hZ=Object.freeze({__proto__:null,ArcCurve:hH,CatmullRomCurve3:hO,CubicBezierCurve:hS,CubicBezierCurve3:hT,EllipseCurve:hG,LineCurve:hU,LineCurve3:hV,QuadraticBezierCurve:hW,QuadraticBezierCurve3:hX,SplineCurve:hY});class h$ extends hF{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(a){this.curves.push(a)}closePath(){let a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);if(!a.equals(b)){let c=!0===a.isVector2?"LineCurve":"LineCurve3";this.curves.push(new hZ[c](b,a))}return this}getPoint(a,b){let c=a*this.getLength(),d=this.getCurveLengths(),e=0;for(;e<d.length;){if(d[e]>=c){let a=d[e]-c,f=this.curves[e],g=f.getLength(),h=0===g?0:1-a/g;return f.getPointAt(h,b)}e++}return null}getLength(){let a=this.getCurveLengths();return a[a.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 a=[],b=0;for(let c=0,d=this.curves.length;c<d;c++)a.push(b+=this.curves[c].getLength());return this.cacheLengths=a,a}getSpacedPoints(a=40){let b=[];for(let c=0;c<=a;c++)b.push(this.getPoint(c/a));return this.autoClose&&b.push(b[0]),b}getPoints(a=12){let b,c=[];for(let d=0,e=this.curves;d<e.length;d++){let f=e[d],g=f.isEllipseCurve?2*a:f.isLineCurve||f.isLineCurve3?1:f.isSplineCurve?a*f.points.length:a,h=f.getPoints(g);for(let a=0;a<h.length;a++){let d=h[a];b&&b.equals(d)||(c.push(d),b=d)}}return this.autoClose&&c.length>1&&!c[c.length-1].equals(c[0])&&c.push(c[0]),c}copy(a){super.copy(a),this.curves=[];for(let b=0,c=a.curves.length;b<c;b++){let c=a.curves[b];this.curves.push(c.clone())}return this.autoClose=a.autoClose,this}toJSON(){let a=super.toJSON();a.autoClose=this.autoClose,a.curves=[];for(let b=0,c=this.curves.length;b<c;b++){let c=this.curves[b];a.curves.push(c.toJSON())}return a}fromJSON(a){super.fromJSON(a),this.autoClose=a.autoClose,this.curves=[];for(let b=0,c=a.curves.length;b<c;b++){let c=a.curves[b];this.curves.push(new hZ[c.type]().fromJSON(c))}return this}}class h_ extends h${constructor(a){super(),this.type="Path",this.currentPoint=new dx,a&&this.setFromPoints(a)}setFromPoints(a){this.moveTo(a[0].x,a[0].y);for(let b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y);return this}moveTo(a,b){return this.currentPoint.set(a,b),this}lineTo(a,b){let c=new hU(this.currentPoint.clone(),new dx(a,b));return this.curves.push(c),this.currentPoint.set(a,b),this}quadraticCurveTo(a,b,c,d){let e=new hW(this.currentPoint.clone(),new dx(a,b),new dx(c,d));return this.curves.push(e),this.currentPoint.set(c,d),this}bezierCurveTo(a,b,c,d,e,f){let g=new hS(this.currentPoint.clone(),new dx(a,b),new dx(c,d),new dx(e,f));return this.curves.push(g),this.currentPoint.set(e,f),this}splineThru(a){let b=new hY([this.currentPoint.clone()].concat(a));return this.curves.push(b),this.currentPoint.copy(a[a.length-1]),this}arc(a,b,c,d,e,f){let g=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(a+g,b+h,c,d,e,f),this}absarc(a,b,c,d,e,f){return this.absellipse(a,b,c,c,d,e,f),this}ellipse(a,b,c,d,e,f,g,h){let i=this.currentPoint.x,j=this.currentPoint.y;return this.absellipse(a+i,b+j,c,d,e,f,g,h),this}absellipse(a,b,c,d,e,f,g,h){let i=new hG(a,b,c,d,e,f,g,h);if(this.curves.length>0){let a=i.getPoint(0);a.equals(this.currentPoint)||this.lineTo(a.x,a.y)}this.curves.push(i);let j=i.getPoint(1);return this.currentPoint.copy(j),this}copy(a){return super.copy(a),this.currentPoint.copy(a.currentPoint),this}toJSON(){let a=super.toJSON();return a.currentPoint=this.currentPoint.toArray(),a}fromJSON(a){return super.fromJSON(a),this.currentPoint.fromArray(a.currentPoint),this}}class h0 extends h_{constructor(a){super(a),this.uuid=dq(),this.type="Shape",this.holes=[]}getPointsHoles(a){let b=[];for(let c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b}extractPoints(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}}copy(a){super.copy(a),this.holes=[];for(let b=0,c=a.holes.length;b<c;b++){let c=a.holes[b];this.holes.push(c.clone())}return this}toJSON(){let a=super.toJSON();a.uuid=this.uuid,a.holes=[];for(let b=0,c=this.holes.length;b<c;b++){let c=this.holes[b];a.holes.push(c.toJSON())}return a}fromJSON(a){super.fromJSON(a),this.uuid=a.uuid,this.holes=[];for(let b=0,c=a.holes.length;b<c;b++){let c=a.holes[b];this.holes.push(new h_().fromJSON(c))}return this}}function h1(a,b,c,d,e){let f;if(e===function(a,b,c,d){let e=0;for(let f=b,g=c-d;f<c;f+=d)e+=(a[g]-a[f])*(a[f+1]+a[g+1]),g=f;return e}(a,b,c,d)>0)for(let e=b;e<c;e+=d)f=ie(e/d|0,a[e],a[e+1],f);else for(let e=c-d;e>=b;e-=d)f=ie(e/d|0,a[e],a[e+1],f);return f&&h8(f,f.next)&&(ig(f),f=f.next),f}function h2(a,b){if(!a)return a;b||(b=a);let c=a,d;do if(d=!1,!c.steiner&&(h8(c,c.next)||0===h7(c.prev,c,c.next))){if(ig(c),(c=b=c.prev)===c.next)break;d=!0}else c=c.next;while(d||c!==b);return b}function h3(a,b){let c=a.x-b.x;return 0===c&&0==(c=a.y-b.y)&&(c=(a.next.y-a.y)/(a.next.x-a.x)-(b.next.y-b.y)/(b.next.x-b.x)),c}function h4(a,b,c,d,e){return(a=((a=((a=((a=((a=(a-c)*e|0)|a<<8)&0xff00ff)|a<<4)&0xf0f0f0f)|a<<2)&0x33333333)|a<<1)&0x55555555)|(b=((b=((b=((b=((b=(b-d)*e|0)|b<<8)&0xff00ff)|b<<4)&0xf0f0f0f)|b<<2)&0x33333333)|b<<1)&0x55555555)<<1}function h5(a,b,c,d,e,f,g,h){return(e-g)*(b-h)>=(a-g)*(f-h)&&(a-g)*(d-h)>=(c-g)*(b-h)&&(c-g)*(f-h)>=(e-g)*(d-h)}function h6(a,b,c,d,e,f,g,h){return(a!==g||b!==h)&&h5(a,b,c,d,e,f,g,h)}function h7(a,b,c){return(b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y)}function h8(a,b){return a.x===b.x&&a.y===b.y}function h9(a,b,c,d){let e=ib(h7(a,b,c)),f=ib(h7(a,b,d)),g=ib(h7(c,d,a)),h=ib(h7(c,d,b));return!!(e!==f&&g!==h||0===e&&ia(a,c,b)||0===f&&ia(a,d,b)||0===g&&ia(c,a,d)||0===h&&ia(c,b,d))}function ia(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function ib(a){return a>0?1:a<0?-1:0}function ic(a,b){return 0>h7(a.prev,a,a.next)?h7(a,b,a.next)>=0&&h7(a,a.prev,b)>=0:0>h7(a,b,a.prev)||0>h7(a,a.next,b)}function id(a,b){let c=ih(a.i,a.x,a.y),d=ih(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,c.next=e,e.prev=c,d.next=c,c.prev=d,f.next=d,d.prev=f,d}function ie(a,b,c,d){let e=ih(a,b,c);return d?(e.next=d.next,e.prev=d,d.next.prev=e,d.next=e):(e.prev=e,e.next=e),e}function ig(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ih(a,b,c){return{i:a,x:b,y:c,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ii{static triangulate(a,b,c=2){return function(a,b,c=2){let d,e,f,g=b&&b.length,h=g?b[0]*c:a.length,i=h1(a,0,h,c,!0),j=[];if(!i||i.next===i.prev)return j;if(g&&(i=function(a,b,c,d){let e=[];for(let c=0,f=b.length;c<f;c++){let g=b[c]*d,h=c<f-1?b[c+1]*d:a.length,i=h1(a,g,h,d,!1);i===i.next&&(i.steiner=!0),e.push(function(a){let b=a,c=a;do(b.x<c.x||b.x===c.x&&b.y<c.y)&&(c=b),b=b.next;while(b!==a);return c}(i))}e.sort(h3);for(let a=0;a<e.length;a++)c=function(a,b){let c=function(a,b){let c,d=b,e=a.x,f=a.y,g=-1/0;if(h8(a,d))return d;do{if(h8(a,d.next))return d.next;if(f<=d.y&&f>=d.next.y&&d.next.y!==d.y){let a=d.x+(f-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(a<=e&&a>g&&(g=a,c=d.x<d.next.x?d:d.next,a===e))return c}d=d.next}while(d!==b);if(!c)return null;let h=c,i=c.x,j=c.y,k=1/0;d=c;do{if(e>=d.x&&d.x>=i&&e!==d.x&&h5(f<j?e:g,f,i,j,f<j?g:e,f,d.x,d.y)){var l,m;let b=Math.abs(f-d.y)/(e-d.x);ic(d,a)&&(b<k||b===k&&(d.x>c.x||d.x===c.x&&(l=c,m=d,0>h7(l.prev,l,m.prev)&&0>h7(m.next,l,l.next))))&&(c=d,k=b)}d=d.next}while(d!==h);return c}(a,b);if(!c)return b;let d=id(c,a);return h2(d,d.next),h2(c,c.next)}(e[a],c);return c}(a,b,i,c)),a.length>80*c){d=a[0],e=a[1];let b=d,g=e;for(let f=c;f<h;f+=c){let c=a[f],h=a[f+1];c<d&&(d=c),h<e&&(e=h),c>b&&(b=c),h>g&&(g=h)}f=0!==(f=Math.max(b-d,g-e))?32767/f:0}return function a(b,c,d,e,f,g,h){if(!b)return;!h&&g&&function(a,b,c,d){let e=a;do 0===e.z&&(e.z=h4(e.x,e.y,b,c,d)),e.prevZ=e.prev,e.nextZ=e.next,e=e.next;while(e!==a);e.prevZ.nextZ=null,e.prevZ=null,function(a){let b,c=1;do{let d,e=a;a=null;let f=null;for(b=0;e;){b++;let g=e,h=0;for(let a=0;a<c&&(h++,g=g.nextZ);a++);let i=c;for(;h>0||i>0&&g;)0!==h&&(0===i||!g||e.z<=g.z)?(d=e,e=e.nextZ,h--):(d=g,g=g.nextZ,i--),f?f.nextZ=d:a=d,d.prevZ=f,f=d;e=g}f.nextZ=null,c*=2}while(b>1)}(e)}(b,e,f,g);let i=b;for(;b.prev!==b.next;){let j=b.prev,k=b.next;if(g?function(a,b,c,d){let e=a.prev,f=a.next;if(h7(e,a,f)>=0)return!1;let g=e.x,h=a.x,i=f.x,j=e.y,k=a.y,l=f.y,m=Math.min(g,h,i),n=Math.min(j,k,l),o=Math.max(g,h,i),p=Math.max(j,k,l),q=h4(m,n,b,c,d),r=h4(o,p,b,c,d),s=a.prevZ,t=a.nextZ;for(;s&&s.z>=q&&t&&t.z<=r;){if(s.x>=m&&s.x<=o&&s.y>=n&&s.y<=p&&s!==e&&s!==f&&h6(g,j,h,k,i,l,s.x,s.y)&&h7(s.prev,s,s.next)>=0||(s=s.prevZ,t.x>=m&&t.x<=o&&t.y>=n&&t.y<=p&&t!==e&&t!==f&&h6(g,j,h,k,i,l,t.x,t.y)&&h7(t.prev,t,t.next)>=0))return!1;t=t.nextZ}for(;s&&s.z>=q;){if(s.x>=m&&s.x<=o&&s.y>=n&&s.y<=p&&s!==e&&s!==f&&h6(g,j,h,k,i,l,s.x,s.y)&&h7(s.prev,s,s.next)>=0)return!1;s=s.prevZ}for(;t&&t.z<=r;){if(t.x>=m&&t.x<=o&&t.y>=n&&t.y<=p&&t!==e&&t!==f&&h6(g,j,h,k,i,l,t.x,t.y)&&h7(t.prev,t,t.next)>=0)return!1;t=t.nextZ}return!0}(b,e,f,g):function(a){let b=a.prev,c=a.next;if(h7(b,a,c)>=0)return!1;let d=b.x,e=a.x,f=c.x,g=b.y,h=a.y,i=c.y,j=Math.min(d,e,f),k=Math.min(g,h,i),l=Math.max(d,e,f),m=Math.max(g,h,i),n=c.next;for(;n!==b;){if(n.x>=j&&n.x<=l&&n.y>=k&&n.y<=m&&h6(d,g,e,h,f,i,n.x,n.y)&&h7(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}(b)){c.push(j.i,b.i,k.i),ig(b),b=k.next,i=k.next;continue}if((b=k)===i){h?1===h?a(b=function(a,b){let c=a;do{let d=c.prev,e=c.next.next;!h8(d,e)&&h9(d,c,c.next,e)&&ic(d,e)&&ic(e,d)&&(b.push(d.i,c.i,e.i),ig(c),ig(c.next),c=a=e),c=c.next}while(c!==a);return h2(c)}(h2(b),c),c,d,e,f,g,2):2===h&&function(b,c,d,e,f,g){let h=b;do{let b=h.next.next;for(;b!==h.prev;){var i,j;if(h.i!==b.i&&(i=h,j=b,i.next.i!==j.i&&i.prev.i!==j.i&&!function(a,b){let c=a;do{if(c.i!==a.i&&c.next.i!==a.i&&c.i!==b.i&&c.next.i!==b.i&&h9(c,c.next,a,b))return!0;c=c.next}while(c!==a);return!1}(i,j)&&(ic(i,j)&&ic(j,i)&&function(a,b){let c=a,d=!1,e=(a.x+b.x)/2,f=(a.y+b.y)/2;do c.y>f!=c.next.y>f&&c.next.y!==c.y&&e<(c.next.x-c.x)*(f-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==a);return d}(i,j)&&(h7(i.prev,i,j.prev)||h7(i,j.prev,j))||h8(i,j)&&h7(i.prev,i,i.next)>0&&h7(j.prev,j,j.next)>0))){let i=id(h,b);h=h2(h,h.next),i=h2(i,i.next),a(h,c,d,e,f,g,0),a(i,c,d,e,f,g,0);return}b=b.next}h=h.next}while(h!==b)}(b,c,d,e,f,g):a(h2(b),c,d,e,f,g,1);break}}}(i,j,c,d,e,f,0),j}(a,b,c)}}class ij{static area(a){let b=a.length,c=0;for(let d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return .5*c}static isClockWise(a){return 0>ij.area(a)}static triangulateShape(a,b){let c=[],d=[],e=[];ik(a),il(c,a);let f=a.length;b.forEach(ik);for(let a=0;a<b.length;a++)d.push(f),f+=b[a].length,il(c,b[a]);let g=ii.triangulate(c,d);for(let a=0;a<g.length;a+=3)e.push(g.slice(a,a+3));return e}}function ik(a){let b=a.length;b>2&&a[b-1].equals(a[0])&&a.pop()}function il(a,b){for(let c=0;c<b.length;c++)a.push(b[c].x),a.push(b[c].y)}class im extends ft{constructor(a=new h0([new dx(.5,.5),new dx(-.5,.5),new dx(-.5,-.5),new dx(.5,-.5)]),b={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:a,options:b},a=Array.isArray(a)?a:[a];const c=this,d=[],e=[];for(let f=0,g=a.length;f<g;f++)!function(a){let f,g,h,i,j,k=[],l=void 0!==b.curveSegments?b.curveSegments:12,m=void 0!==b.steps?b.steps:1,n=void 0!==b.depth?b.depth:1,o=void 0===b.bevelEnabled||b.bevelEnabled,p=void 0!==b.bevelThickness?b.bevelThickness:.2,q=void 0!==b.bevelSize?b.bevelSize:p-.1,r=void 0!==b.bevelOffset?b.bevelOffset:0,s=void 0!==b.bevelSegments?b.bevelSegments:3,t=b.extrudePath,u=void 0!==b.UVGenerator?b.UVGenerator:io,v,w=!1;if(t){v=t.getSpacedPoints(m),w=!0,o=!1;let a=!!t.isCatmullRomCurve3&&t.closed;f=t.computeFrenetFrames(m,a),g=new dz,h=new dz,i=new dz}o||(s=0,p=0,q=0,r=0);let x=a.extractPoints(l),y=x.shape,z=x.holes;if(!ij.isClockWise(y)){y=y.reverse();for(let a=0,b=z.length;a<b;a++){let b=z[a];ij.isClockWise(b)&&(z[a]=b.reverse())}}function A(a){let b=1e-10*1e-10,c=a[0];for(let d=1;d<=a.length;d++){let e=d%a.length,f=a[e],g=f.x-c.x,h=f.y-c.y,i=g*g+h*h,j=Math.max(Math.abs(f.x),Math.abs(f.y),Math.abs(c.x),Math.abs(c.y));if(i<=b*j*j){a.splice(e,1),d--;continue}c=f}}A(y),z.forEach(A);let B=z.length,C=y;for(let a=0;a<B;a++){let b=z[a];y=y.concat(b)}function D(a,b,c){return b||dh("ExtrudeGeometry: vec does not exist"),a.clone().addScaledVector(b,c)}let E=y.length;function F(a,b,c){let d,e,f,g=a.x-b.x,h=a.y-b.y,i=c.x-a.x,j=c.y-a.y,k=g*g+h*h;if(Math.abs(g*j-h*i)>Number.EPSILON){let l=Math.sqrt(k),m=Math.sqrt(i*i+j*j),n=b.x-h/l,o=b.y+g/l,p=((c.x-j/m-n)*j-(c.y+i/m-o)*i)/(g*j-h*i),q=(d=n+g*p-a.x)*d+(e=o+h*p-a.y)*e;if(q<=2)return new dx(d,e);f=Math.sqrt(q/2)}else{let a=!1;g>Number.EPSILON?i>Number.EPSILON&&(a=!0):g<-Number.EPSILON?i<-Number.EPSILON&&(a=!0):Math.sign(h)===Math.sign(j)&&(a=!0),a?(d=-h,e=g,f=Math.sqrt(k)):(d=g,e=h,f=Math.sqrt(k/2))}return new dx(d/f,e/f)}let G=[];for(let a=0,b=C.length,c=b-1,d=a+1;a<b;a++,c++,d++)c===b&&(c=0),d===b&&(d=0),G[a]=F(C[a],C[c],C[d]);let H=[],I,J=G.concat();for(let a=0;a<B;a++){let b=z[a];I=[];for(let a=0,c=b.length,d=c-1,e=a+1;a<c;a++,d++,e++)d===c&&(d=0),e===c&&(e=0),I[a]=F(b[a],b[d],b[e]);H.push(I),J=J.concat(I)}if(0===s)j=ij.triangulateShape(C,z);else{let a=[],b=[];for(let c=0;c<s;c++){let d=c/s,e=p*Math.cos(d*Math.PI/2),f=q*Math.sin(d*Math.PI/2)+r;for(let b=0,c=C.length;b<c;b++){let c=D(C[b],G[b],f);N(c.x,c.y,-e),0===d&&a.push(c)}for(let a=0;a<B;a++){let c=z[a];I=H[a];let g=[];for(let a=0,b=c.length;a<b;a++){let b=D(c[a],I[a],f);N(b.x,b.y,-e),0===d&&g.push(b)}0===d&&b.push(g)}}j=ij.triangulateShape(a,b)}let K=j.length,L=q+r;for(let a=0;a<E;a++){let b=o?D(y[a],J[a],L):y[a];w?(h.copy(f.normals[0]).multiplyScalar(b.x),g.copy(f.binormals[0]).multiplyScalar(b.y),i.copy(v[0]).add(h).add(g),N(i.x,i.y,i.z)):N(b.x,b.y,0)}for(let a=1;a<=m;a++)for(let b=0;b<E;b++){let c=o?D(y[b],J[b],L):y[b];w?(h.copy(f.normals[a]).multiplyScalar(c.x),g.copy(f.binormals[a]).multiplyScalar(c.y),i.copy(v[a]).add(h).add(g),N(i.x,i.y,i.z)):N(c.x,c.y,n/m*a)}for(let a=s-1;a>=0;a--){let b=a/s,c=p*Math.cos(b*Math.PI/2),d=q*Math.sin(b*Math.PI/2)+r;for(let a=0,b=C.length;a<b;a++){let b=D(C[a],G[a],d);N(b.x,b.y,n+c)}for(let a=0,b=z.length;a<b;a++){let b=z[a];I=H[a];for(let a=0,e=b.length;a<e;a++){let e=D(b[a],I[a],d);w?N(e.x,e.y+v[m-1].y,v[m-1].x+c):N(e.x,e.y,n+c)}}}function M(a,b){let e=a.length;for(;--e>=0;){let f=e,g=e-1;g<0&&(g=a.length-1);for(let a=0,e=m+2*s;a<e;a++){let e=E*a,h=E*(a+1);!function(a,b,e,f){P(a),P(b),P(f),P(b),P(e),P(f);let g=d.length/3,h=u.generateSideWallUV(c,d,g-6,g-3,g-2,g-1);Q(h[0]),Q(h[1]),Q(h[3]),Q(h[1]),Q(h[2]),Q(h[3])}(b+f+e,b+g+e,b+g+h,b+f+h)}}}function N(a,b,c){k.push(a),k.push(b),k.push(c)}function O(a,b,e){P(a),P(b),P(e);let f=d.length/3,g=u.generateTopUV(c,d,f-3,f-2,f-1);Q(g[0]),Q(g[1]),Q(g[2])}function P(a){d.push(k[3*a+0]),d.push(k[3*a+1]),d.push(k[3*a+2])}function Q(a){e.push(a.x),e.push(a.y)}(function(){let a=d.length/3;if(o){let a=0*E;for(let b=0;b<K;b++){let c=j[b];O(c[2]+a,c[1]+a,c[0]+a)}a=E*(m+2*s);for(let b=0;b<K;b++){let c=j[b];O(c[0]+a,c[1]+a,c[2]+a)}}else{for(let a=0;a<K;a++){let b=j[a];O(b[2],b[1],b[0])}for(let a=0;a<K;a++){let b=j[a];O(b[0]+E*m,b[1]+E*m,b[2]+E*m)}}c.addGroup(a,d.length/3-a,0)})(),function(){let a=d.length/3,b=0;M(C,0),b+=C.length;for(let a=0,c=z.length;a<c;a++){let c=z[a];M(c,b),b+=c.length}c.addGroup(a,d.length/3-a,1)}()}(a[f]);this.setAttribute("position",new fh(d,3)),this.setAttribute("uv",new fh(e,2)),this.computeVertexNormals()}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}toJSON(){let a=super.toJSON();return function(a,b,c){if(c.shapes=[],Array.isArray(a))for(let b=0,d=a.length;b<d;b++){let d=a[b];c.shapes.push(d.uuid)}else c.shapes.push(a.uuid);return c.options=Object.assign({},b),void 0!==b.extrudePath&&(c.options.extrudePath=b.extrudePath.toJSON()),c}(this.parameters.shapes,this.parameters.options,a)}static fromJSON(a,b){let c=[];for(let d=0,e=a.shapes.length;d<e;d++){let e=b[a.shapes[d]];c.push(e)}let d=a.options.extrudePath;return void 0!==d&&(a.options.extrudePath=new hZ[d.type]().fromJSON(d)),new im(c,a.options)}}let io={generateTopUV:function(a,b,c,d,e){let f=b[3*c],g=b[3*c+1],h=b[3*d],i=b[3*d+1],j=b[3*e],k=b[3*e+1];return[new dx(f,g),new dx(h,i),new dx(j,k)]},generateSideWallUV:function(a,b,c,d,e,f){let g=b[3*c],h=b[3*c+1],i=b[3*c+2],j=b[3*d],k=b[3*d+1],l=b[3*d+2],m=b[3*e],n=b[3*e+1],o=b[3*e+2],p=b[3*f],q=b[3*f+1],r=b[3*f+2];return Math.abs(h-k)<Math.abs(g-j)?[new dx(g,1-i),new dx(j,1-l),new dx(m,1-o),new dx(p,1-r)]:[new dx(h,1-i),new dx(k,1-l),new dx(n,1-o),new dx(q,1-r)]}};class ip extends hy{constructor(a=1,b=0){const c=(1+Math.sqrt(5))/2;super([-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,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],a,b),this.type="IcosahedronGeometry",this.parameters={radius:a,detail:b}}static fromJSON(a){return new ip(a.radius,a.detail)}}class iq extends ft{constructor(a=[new dx(0,-.5),new dx(.5,0),new dx(0,.5)],b=12,c=0,d=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:a,segments:b,phiStart:c,phiLength:d},b=Math.floor(b),d=dr(d,0,2*Math.PI);const e=[],f=[],g=[],h=[],i=[],j=1/b,k=new dz,l=new dx,m=new dz,n=new dz,o=new dz;let p=0,q=0;for(let b=0;b<=a.length-1;b++)switch(b){case 0:p=a[b+1].x-a[b].x,m.x=+(q=a[b+1].y-a[b].y),m.y=-p,m.z=0*q,o.copy(m),m.normalize(),h.push(m.x,m.y,m.z);break;case a.length-1:h.push(o.x,o.y,o.z);break;default:p=a[b+1].x-a[b].x,m.x=+(q=a[b+1].y-a[b].y),m.y=-p,m.z=0*q,n.copy(m),m.x+=o.x,m.y+=o.y,m.z+=o.z,m.normalize(),h.push(m.x,m.y,m.z),o.copy(n)}for(let e=0;e<=b;e++){const m=c+e*j*d,n=Math.sin(m),o=Math.cos(m);for(let c=0;c<=a.length-1;c++){k.x=a[c].x*n,k.y=a[c].y,k.z=a[c].x*o,f.push(k.x,k.y,k.z),l.x=e/b,l.y=c/(a.length-1),g.push(l.x,l.y);const d=h[3*c+0]*n,j=h[3*c+1],m=h[3*c+0]*o;i.push(d,j,m)}}for(let c=0;c<b;c++)for(let b=0;b<a.length-1;b++){const d=b+c*a.length,f=d+a.length,g=d+a.length+1,h=d+1;e.push(d,f,h),e.push(g,h,f)}this.setIndex(e),this.setAttribute("position",new fh(f,3)),this.setAttribute("uv",new fh(g,2)),this.setAttribute("normal",new fh(i,3))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new iq(a.points,a.segments,a.phiStart,a.phiLength)}}class ir extends hy{constructor(a=1,b=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],a,b),this.type="OctahedronGeometry",this.parameters={radius:a,detail:b}}static fromJSON(a){return new ir(a.radius,a.detail)}}class is extends ft{constructor(a=1,b=1,c=1,d=1){super(),this.type="PlaneGeometry",this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};const e=a/2,f=b/2,g=Math.floor(c),h=Math.floor(d),i=g+1,j=h+1,k=a/g,l=b/h,m=[],n=[],o=[],p=[];for(let a=0;a<j;a++){const b=a*l-f;for(let c=0;c<i;c++){const d=c*k-e;n.push(d,-b,0),o.push(0,0,1),p.push(c/g),p.push(1-a/h)}}for(let a=0;a<h;a++)for(let b=0;b<g;b++){const c=b+i*a,d=b+i*(a+1),e=b+1+i*(a+1),f=b+1+i*a;m.push(c,d,f),m.push(d,e,f)}this.setIndex(m),this.setAttribute("position",new fh(n,3)),this.setAttribute("normal",new fh(o,3)),this.setAttribute("uv",new fh(p,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new is(a.width,a.height,a.widthSegments,a.heightSegments)}}class it extends ft{constructor(a=.5,b=1,c=32,d=1,e=0,f=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f},c=Math.max(3,c);const g=[],h=[],i=[],j=[];let k=a;const l=(b-a)/(d=Math.max(1,d)),m=new dz,n=new dx;for(let a=0;a<=d;a++){for(let a=0;a<=c;a++){const d=e+a/c*f;m.x=k*Math.cos(d),m.y=k*Math.sin(d),h.push(m.x,m.y,m.z),i.push(0,0,1),n.x=(m.x/b+1)/2,n.y=(m.y/b+1)/2,j.push(n.x,n.y)}k+=l}for(let a=0;a<d;a++){const b=a*(c+1);for(let a=0;a<c;a++){const d=a+b,e=d+c+1,f=d+c+2,h=d+1;g.push(d,e,h),g.push(e,f,h)}}this.setIndex(g),this.setAttribute("position",new fh(h,3)),this.setAttribute("normal",new fh(i,3)),this.setAttribute("uv",new fh(j,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new it(a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength)}}class iu extends ft{constructor(a=new h0([new dx(0,.5),new dx(-.5,-.5),new dx(.5,-.5)]),b=12){super(),this.type="ShapeGeometry",this.parameters={shapes:a,curveSegments:b};const c=[],d=[],e=[],f=[];let g=0,h=0;if(!1===Array.isArray(a))i(a);else for(let b=0;b<a.length;b++)i(a[b]),this.addGroup(g,h,b),g+=h,h=0;function i(a){let g=d.length/3,i=a.extractPoints(b),j=i.shape,k=i.holes;!1===ij.isClockWise(j)&&(j=j.reverse());for(let a=0,b=k.length;a<b;a++){let b=k[a];!0===ij.isClockWise(b)&&(k[a]=b.reverse())}let l=ij.triangulateShape(j,k);for(let a=0,b=k.length;a<b;a++){let b=k[a];j=j.concat(b)}for(let a=0,b=j.length;a<b;a++){let b=j[a];d.push(b.x,b.y,0),e.push(0,0,1),f.push(b.x,b.y)}for(let a=0,b=l.length;a<b;a++){let b=l[a],d=b[0]+g,e=b[1]+g,f=b[2]+g;c.push(d,e,f),h+=3}}this.setIndex(c),this.setAttribute("position",new fh(d,3)),this.setAttribute("normal",new fh(e,3)),this.setAttribute("uv",new fh(f,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}toJSON(){let a=super.toJSON();return function(a,b){if(b.shapes=[],Array.isArray(a))for(let c=0,d=a.length;c<d;c++){let d=a[c];b.shapes.push(d.uuid)}else b.shapes.push(a.uuid);return b}(this.parameters.shapes,a)}static fromJSON(a,b){let c=[];for(let d=0,e=a.shapes.length;d<e;d++){let e=b[a.shapes[d]];c.push(e)}return new iu(c,a.curveSegments)}}class iv extends ft{constructor(a=1,b=32,c=16,d=0,e=2*Math.PI,f=0,g=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g},b=Math.max(3,Math.floor(b)),c=Math.max(2,Math.floor(c));const h=Math.min(f+g,Math.PI);let i=0;const j=[],k=new dz,l=new dz,m=[],n=[],o=[],p=[];for(let m=0;m<=c;m++){const q=[],r=m/c,s=a*Math.cos(f+r*g),t=Math.sqrt(a*a-s*s);let u=0;0===m&&0===f?u=.5/b:m===c&&h===Math.PI&&(u=-.5/b);for(let a=0;a<=b;a++){const c=a/b,f=d+c*e;k.x=-t*Math.cos(f),k.y=s,k.z=t*Math.sin(f),n.push(k.x,k.y,k.z),l.copy(k).normalize(),o.push(l.x,l.y,l.z),p.push(c+u,1-r),q.push(i++)}j.push(q)}for(let a=0;a<c;a++)for(let d=0;d<b;d++){const b=j[a][d+1],e=j[a][d],g=j[a+1][d],i=j[a+1][d+1];(0!==a||f>0)&&m.push(b,e,i),(a!==c-1||h<Math.PI)&&m.push(e,g,i)}this.setIndex(m),this.setAttribute("position",new fh(n,3)),this.setAttribute("normal",new fh(o,3)),this.setAttribute("uv",new fh(p,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new iv(a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength)}}class iw extends hy{constructor(a=1,b=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],a,b),this.type="TetrahedronGeometry",this.parameters={radius:a,detail:b}}static fromJSON(a){return new iw(a.radius,a.detail)}}class ix extends ft{constructor(a=1,b=.4,c=12,d=48,e=2*Math.PI,f=0,g=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e,thetaStart:f,thetaLength:g},c=Math.floor(c),d=Math.floor(d);const h=[],i=[],j=[],k=[],l=new dz,m=new dz,n=new dz;for(let h=0;h<=c;h++){const o=f+h/c*g;for(let f=0;f<=d;f++){const g=f/d*e;m.x=(a+b*Math.cos(o))*Math.cos(g),m.y=(a+b*Math.cos(o))*Math.sin(g),m.z=b*Math.sin(o),i.push(m.x,m.y,m.z),l.x=a*Math.cos(g),l.y=a*Math.sin(g),n.subVectors(m,l).normalize(),j.push(n.x,n.y,n.z),k.push(f/d),k.push(h/c)}}for(let a=1;a<=c;a++)for(let b=1;b<=d;b++){const c=(d+1)*a+b-1,e=(d+1)*(a-1)+b-1,f=(d+1)*(a-1)+b,g=(d+1)*a+b;h.push(c,e,g),h.push(e,f,g)}this.setIndex(h),this.setAttribute("position",new fh(i,3)),this.setAttribute("normal",new fh(j,3)),this.setAttribute("uv",new fh(k,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new ix(a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc,a.thetaStart,a.thetaLength)}}class iy extends ft{constructor(a=1,b=.4,c=64,d=8,e=2,f=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f},c=Math.floor(c),d=Math.floor(d);const g=[],h=[],i=[],j=[],k=new dz,l=new dz,m=new dz,n=new dz,o=new dz,p=new dz,q=new dz;for(let g=0;g<=c;++g){const s=g/c*e*Math.PI*2;r(s,e,f,a,m),r(s+.01,e,f,a,n),p.subVectors(n,m),q.addVectors(n,m),o.crossVectors(p,q),q.crossVectors(o,p),o.normalize(),q.normalize();for(let a=0;a<=d;++a){const e=a/d*Math.PI*2,f=-b*Math.cos(e),n=b*Math.sin(e);k.x=m.x+(f*q.x+n*o.x),k.y=m.y+(f*q.y+n*o.y),k.z=m.z+(f*q.z+n*o.z),h.push(k.x,k.y,k.z),l.subVectors(k,m).normalize(),i.push(l.x,l.y,l.z),j.push(g/c),j.push(a/d)}}for(let a=1;a<=c;a++)for(let b=1;b<=d;b++){const c=(d+1)*(a-1)+(b-1),e=(d+1)*a+(b-1),f=(d+1)*a+b,h=(d+1)*(a-1)+b;g.push(c,e,h),g.push(e,f,h)}function r(a,b,c,d,e){let f=Math.cos(a),g=Math.sin(a),h=c/b*a,i=Math.cos(h);e.x=d*(2+i)*.5*f,e.y=d*(2+i)*g*.5,e.z=d*Math.sin(h)*.5}this.setIndex(g),this.setAttribute("position",new fh(h,3)),this.setAttribute("normal",new fh(i,3)),this.setAttribute("uv",new fh(j,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}static fromJSON(a){return new iy(a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q)}}class iz extends ft{constructor(a=new hX(new dz(-1,-1,0),new dz(-1,1,0),new dz(1,1,0)),b=64,c=1,d=8,e=!1){super(),this.type="TubeGeometry",this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};const f=a.computeFrenetFrames(b,e);this.tangents=f.tangents,this.normals=f.normals,this.binormals=f.binormals;const g=new dz,h=new dz,i=new dx;let j=new dz;const k=[],l=[],m=[],n=[];function o(e){j=a.getPointAt(e/b,j);let i=f.normals[e],m=f.binormals[e];for(let a=0;a<=d;a++){let b=a/d*Math.PI*2,e=Math.sin(b),f=-Math.cos(b);h.x=f*i.x+e*m.x,h.y=f*i.y+e*m.y,h.z=f*i.z+e*m.z,h.normalize(),l.push(h.x,h.y,h.z),g.x=j.x+c*h.x,g.y=j.y+c*h.y,g.z=j.z+c*h.z,k.push(g.x,g.y,g.z)}}(function(){for(let a=0;a<b;a++)o(a);o(!1===e?b:0),function(){for(let a=0;a<=b;a++)for(let c=0;c<=d;c++)i.x=a/b,i.y=c/d,m.push(i.x,i.y)}(),function(){for(let a=1;a<=b;a++)for(let b=1;b<=d;b++){let c=(d+1)*(a-1)+(b-1),e=(d+1)*a+(b-1),f=(d+1)*a+b,g=(d+1)*(a-1)+b;n.push(c,e,g),n.push(e,f,g)}}()})(),this.setIndex(n),this.setAttribute("position",new fh(k,3)),this.setAttribute("normal",new fh(l,3)),this.setAttribute("uv",new fh(m,2))}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}toJSON(){let a=super.toJSON();return a.path=this.parameters.path.toJSON(),a}static fromJSON(a){return new iz(new hZ[a.path.type]().fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed)}}class iA extends ft{constructor(a=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:a},null!==a){const b=[],c=new Set,d=new dz,e=new dz;if(null!==a.index){const f=a.attributes.position,g=a.index;let h=a.groups;0===h.length&&(h=[{start:0,count:g.count,materialIndex:0}]);for(let a=0,i=h.length;a<i;++a){const i=h[a],j=i.start,k=i.count;for(let a=j,h=j+k;a<h;a+=3)for(let h=0;h<3;h++){const i=g.getX(a+h),j=g.getX(a+(h+1)%3);d.fromBufferAttribute(f,i),e.fromBufferAttribute(f,j),!0===iB(d,e,c)&&(b.push(d.x,d.y,d.z),b.push(e.x,e.y,e.z))}}}else{const f=a.attributes.position;for(let a=0,g=f.count/3;a<g;a++)for(let g=0;g<3;g++){const h=3*a+g,i=3*a+(g+1)%3;d.fromBufferAttribute(f,h),e.fromBufferAttribute(f,i),!0===iB(d,e,c)&&(b.push(d.x,d.y,d.z),b.push(e.x,e.y,e.z))}}this.setAttribute("position",new fh(b,3))}}copy(a){return super.copy(a),this.parameters=Object.assign({},a.parameters),this}}function iB(a,b,c){let d=`${a.x},${a.y},${a.z}-${b.x},${b.y},${b.z}`,e=`${b.x},${b.y},${b.z}-${a.x},${a.y},${a.z}`;return!0!==c.has(d)&&!0!==c.has(e)&&(c.add(d),c.add(e),!0)}var iC=Object.freeze({__proto__:null,BoxGeometry:ht,CapsuleGeometry:hu,CircleGeometry:hv,ConeGeometry:hx,CylinderGeometry:hw,DodecahedronGeometry:hz,EdgesGeometry:hE,ExtrudeGeometry:im,IcosahedronGeometry:ip,LatheGeometry:iq,OctahedronGeometry:ir,PlaneGeometry:is,PolyhedronGeometry:hy,RingGeometry:it,ShapeGeometry:iu,SphereGeometry:iv,TetrahedronGeometry:iw,TorusGeometry:ix,TorusKnotGeometry:iy,TubeGeometry:iz,WireframeGeometry:iA});class iD extends fC{constructor(a){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ev(0),this.transparent=!0,this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.fog=a.fog,this}}function iE(a){let b={};for(let c in a)for(let d in b[c]={},a[c]){let e=a[c][d];if(iG(e))e.isRenderTargetTexture?(dg("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),b[c][d]=null):b[c][d]=e.clone();else if(Array.isArray(e))if(iG(e[0])){let a=[];for(let b=0,c=e.length;b<c;b++)a[b]=e[b].clone();b[c][d]=a}else b[c][d]=e.slice();else b[c][d]=e}return b}function iF(a){let b={};for(let c=0;c<a.length;c++){let d=iE(a[c]);for(let a in d)b[a]=d[a]}return b}function iG(a){return a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)}function iH(a){let b=a.getRenderTarget();return null===b?a.outputColorSpace:!0===b.isXRRenderTarget?b.texture.colorSpace:dG.workingColorSpace}let iI={clone:iE,merge:iF};class iJ extends fC{constructor(a){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!==a&&this.setValues(a)}copy(a){return super.copy(a),this.fragmentShader=a.fragmentShader,this.vertexShader=a.vertexShader,this.uniforms=iE(a.uniforms),this.uniformsGroups=function(a){let b=[];for(let c=0;c<a.length;c++)b.push(a[c].clone());return b}(a.uniformsGroups),this.defines=Object.assign({},a.defines),this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.fog=a.fog,this.lights=a.lights,this.clipping=a.clipping,this.extensions=Object.assign({},a.extensions),this.glslVersion=a.glslVersion,this.defaultAttributeValues=Object.assign({},a.defaultAttributeValues),this.index0AttributeName=a.index0AttributeName,this.uniformsNeedUpdate=a.uniformsNeedUpdate,this}toJSON(a){let b=super.toJSON(a);for(let c in b.glslVersion=this.glslVersion,b.uniforms={},this.uniforms){let d=this.uniforms[c].value;d&&d.isTexture?b.uniforms[c]={type:"t",value:d.toJSON(a).uuid}:d&&d.isColor?b.uniforms[c]={type:"c",value:d.getHex()}:d&&d.isVector2?b.uniforms[c]={type:"v2",value:d.toArray()}:d&&d.isVector3?b.uniforms[c]={type:"v3",value:d.toArray()}:d&&d.isVector4?b.uniforms[c]={type:"v4",value:d.toArray()}:d&&d.isMatrix3?b.uniforms[c]={type:"m3",value:d.toArray()}:d&&d.isMatrix4?b.uniforms[c]={type:"m4",value:d.toArray()}:b.uniforms[c]={value:d}}Object.keys(this.defines).length>0&&(b.defines=this.defines),b.vertexShader=this.vertexShader,b.fragmentShader=this.fragmentShader,b.lights=this.lights,b.clipping=this.clipping;let c={};for(let a in this.extensions)!0===this.extensions[a]&&(c[a]=!0);return Object.keys(c).length>0&&(b.extensions=c),b}fromJSON(a,b){if(super.fromJSON(a,b),void 0!==a.uniforms)for(let c in a.uniforms){let d=a.uniforms[c];switch(this.uniforms[c]={},d.type){case"t":this.uniforms[c].value=b[d.value]||null;break;case"c":this.uniforms[c].value=new ev().setHex(d.value);break;case"v2":this.uniforms[c].value=new dx().fromArray(d.value);break;case"v3":this.uniforms[c].value=new dz().fromArray(d.value);break;case"v4":this.uniforms[c].value=new dR().fromArray(d.value);break;case"m3":this.uniforms[c].value=new dC().fromArray(d.value);break;case"m4":this.uniforms[c].value=new dY().fromArray(d.value);break;default:this.uniforms[c].value=d.value}}if(void 0!==a.defines&&(this.defines=a.defines),void 0!==a.vertexShader&&(this.vertexShader=a.vertexShader),void 0!==a.fragmentShader&&(this.fragmentShader=a.fragmentShader),void 0!==a.glslVersion&&(this.glslVersion=a.glslVersion),void 0!==a.extensions)for(let b in a.extensions)this.extensions[b]=a.extensions[b];return void 0!==a.lights&&(this.lights=a.lights),void 0!==a.clipping&&(this.clipping=a.clipping),this}}class iK extends iJ{constructor(a){super(a),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class iL extends fC{constructor(a){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ev(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 ev(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(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 d6,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(a)}copy(a){return super.copy(a),this.defines={STANDARD:""},this.color.copy(a.color),this.roughness=a.roughness,this.metalness=a.metalness,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.roughnessMap=a.roughnessMap,this.metalnessMap=a.metalnessMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapRotation.copy(a.envMapRotation),this.envMapIntensity=a.envMapIntensity,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.flatShading=a.flatShading,this.fog=a.fog,this}}class iM extends iL{constructor(a){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 dx(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(a){this.ior=(1+.4*a)/(1-.4*a)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ev(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 ev(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ev(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(a)}get anisotropy(){return this._anisotropy}set anisotropy(a){this._anisotropy>0!=a>0&&this.version++,this._anisotropy=a}get clearcoat(){return this._clearcoat}set clearcoat(a){this._clearcoat>0!=a>0&&this.version++,this._clearcoat=a}get iridescence(){return this._iridescence}set iridescence(a){this._iridescence>0!=a>0&&this.version++,this._iridescence=a}get dispersion(){return this._dispersion}set dispersion(a){this._dispersion>0!=a>0&&this.version++,this._dispersion=a}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(a){this._retroreflectivity>0!=a>0&&this.version++,this._retroreflectivity=a}get sheen(){return this._sheen}set sheen(a){this._sheen>0!=a>0&&this.version++,this._sheen=a}get transmission(){return this._transmission}set transmission(a){this._transmission>0!=a>0&&this.version++,this._transmission=a}copy(a){return super.copy(a),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=a.anisotropy,this.anisotropyRotation=a.anisotropyRotation,this.anisotropyMap=a.anisotropyMap,this.clearcoat=a.clearcoat,this.clearcoatMap=a.clearcoatMap,this.clearcoatRoughness=a.clearcoatRoughness,this.clearcoatRoughnessMap=a.clearcoatRoughnessMap,this.clearcoatNormalMap=a.clearcoatNormalMap,this.clearcoatNormalScale.copy(a.clearcoatNormalScale),this.dispersion=a.dispersion,this.ior=a.ior,this.iridescence=a.iridescence,this.iridescenceMap=a.iridescenceMap,this.iridescenceIOR=a.iridescenceIOR,this.iridescenceThicknessRange=[...a.iridescenceThicknessRange],this.iridescenceThicknessMap=a.iridescenceThicknessMap,this.retroreflectivity=a.retroreflectivity,this.sheen=a.sheen,this.sheenColor.copy(a.sheenColor),this.sheenColorMap=a.sheenColorMap,this.sheenRoughness=a.sheenRoughness,this.sheenRoughnessMap=a.sheenRoughnessMap,this.transmission=a.transmission,this.transmissionMap=a.transmissionMap,this.thickness=a.thickness,this.thicknessMap=a.thicknessMap,this.attenuationDistance=a.attenuationDistance,this.attenuationColor.copy(a.attenuationColor),this.specularIntensity=a.specularIntensity,this.specularIntensityMap=a.specularIntensityMap,this.specularColor.copy(a.specularColor),this.specularColorMap=a.specularColorMap,this}}class iN extends fC{constructor(a){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ev(0xffffff),this.specular=new ev(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ev(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new d6,this.combine=ay,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(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.specular.copy(a.specular),this.shininess=a.shininess,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapRotation.copy(a.envMapRotation),this.combine=a.combine,this.reflectivity=a.reflectivity,this.envMapIntensity=a.envMapIntensity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.flatShading=a.flatShading,this.fog=a.fog,this}}class iO extends fC{constructor(a){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ev(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ev(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(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(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.gradientMap=a.gradientMap,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.alphaMap=a.alphaMap,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.fog=a.fog,this}}class iP extends fC{constructor(a){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(a)}copy(a){return super.copy(a),this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.flatShading=a.flatShading,this}}class iQ extends fC{constructor(a){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ev(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ev(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new d6,this.combine=ay,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(a)}copy(a){return super.copy(a),this.color.copy(a.color),this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapRotation.copy(a.envMapRotation),this.combine=a.combine,this.reflectivity=a.reflectivity,this.envMapIntensity=a.envMapIntensity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.flatShading=a.flatShading,this.fog=a.fog,this}}class iR extends fC{constructor(a){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=cd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(a)}copy(a){return super.copy(a),this.depthPacking=a.depthPacking,this.map=a.map,this.alphaMap=a.alphaMap,this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this}}class iS extends fC{constructor(a){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(a)}copy(a){return super.copy(a),this.map=a.map,this.alphaMap=a.alphaMap,this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this}}class iT extends fC{constructor(a){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ev(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ch,this.normalScale=new dx(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(a)}copy(a){return super.copy(a),this.defines={MATCAP:""},this.color.copy(a.color),this.matcap=a.matcap,this.map=a.map,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalMapType=a.normalMapType,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.alphaMap=a.alphaMap,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.flatShading=a.flatShading,this.fog=a.fog,this}}class iU extends gY{constructor(a){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(a)}copy(a){return super.copy(a),this.scale=a.scale,this.dashSize=a.dashSize,this.gapSize=a.gapSize,this}}function iV(a,b){return a&&a.constructor!==b?"number"==typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a):a}function iW(a){return void 0!==a&&void 0!==a.inTangents&&void 0!==a.outTangents}function iX(a){let b=a.length,c=Array(b);for(let a=0;a!==b;++a)c[a]=a;return c.sort(function(b,c){return a[b]-a[c]}),c}function iY(a,b,c){let d=a.length,e=new a.constructor(d);for(let f=0,g=0;g!==d;++f){let d=c[f]*b;for(let c=0;c!==b;++c)e[g++]=a[d+c]}return e}function iZ(a,b,c,d){let e=1,f=a[0];for(;void 0!==f&&void 0===f[d];)f=a[e++];if(void 0===f)return;let g=f[d];if(void 0!==g)if(Array.isArray(g))do void 0!==(g=f[d])&&(b.push(f.time),c.push(...g)),f=a[e++];while(void 0!==f);else if(void 0!==g.toArray)do void 0!==(g=f[d])&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f);else do void 0!==(g=f[d])&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}class i${static convertArray(a,b){return iV(a,b)}static isTypedArray(a){return c7(a)}static hasTangents(a){return iW(a)}static getKeyframeOrder(a){return iX(a)}static sortedArray(a,b,c){return iY(a,b,c)}static flattenJSON(a,b,c,d){iZ(a,b,c,d)}static subclip(a,b,c,d,e=30){return function(a,b,c,d,e=30){let f=a.clone();f.name=b;let g=[];for(let a=0;a<f.tracks.length;++a){let b=f.tracks[a],h=b.getValueSize(),i=[],j=[];for(let a=0;a<b.times.length;++a){let f=b.times[a]*e;if(!(f<c)&&!(f>=d)){i.push(b.times[a]);for(let c=0;c<h;++c)j.push(b.values[a*h+c])}}0!==i.length&&(b.times=iV(i,b.times.constructor),b.values=iV(j,b.values.constructor),g.push(b))}f.tracks=g;let h=1/0;for(let a=0;a<f.tracks.length;++a)h>f.tracks[a].times[0]&&(h=f.tracks[a].times[0]);for(let a=0;a<f.tracks.length;++a)f.tracks[a].shift(-1*h);return f.resetDuration(),f}(a,b,c,d,e)}static makeClipAdditive(a,b=0,c=a,d=30){return function(a,b=0,c=a,d=30){d<=0&&(d=30);let e=c.tracks.length,f=b/d;for(let b=0;b<e;++b){let d,e=c.tracks[b],g=e.ValueTypeName;if("bool"===g||"string"===g)continue;let h=a.tracks.find(function(a){return a.name===e.name&&a.ValueTypeName===g});if(void 0===h)continue;let i=0,j=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(i=j/3);let k=0,l=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(k=l/3);let m=e.times.length-1;if(f<=e.times[0]){let a=i,b=j-i;d=e.values.slice(a,b)}else if(f>=e.times[m]){let a=m*j+i,b=a+j-i;d=e.values.slice(a,b)}else{let a=e.createInterpolant(),b=i,c=j-i;a.evaluate(f),d=a.resultBuffer.slice(b,c)}"quaternion"===g&&new dy().fromArray(d).normalize().conjugate().toArray(d);let n=h.times.length;for(let a=0;a<n;++a){let b=a*l+k;if("quaternion"===g)dy.multiplyQuaternionsFlat(h.values,b,d,0,h.values,b);else{let a=l-2*k;for(let c=0;c<a;++c)h.values[b+c]-=d[c]}}}return a.blendMode=b9,a}(a,b,c,d)}}class i_{constructor(a,b,c,d){this.parameterPositions=a,this._cachedIndex=0,this.resultBuffer=void 0!==d?d:new b.constructor(c),this.sampleValues=b,this.valueSize=c,this.settings=null,this.DefaultSettings_={}}evaluate(a){let b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{let f;c:{d:if(!(a<d)){for(let f=c+2;;){if(void 0===d){if(a<e)break d;return c=b.length,this._cachedIndex=c,this.copySampleValue_(c-1)}if(c===f)break;if(e=d,a<(d=b[++c]))break b}f=b.length;break c}if(!(a>=e)){let g=b[1];a<g&&(c=2,e=g);for(let f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.copySampleValue_(0);if(c===f)break;if(d=e,a>=(e=b[--c-1]))break b}f=c,c=0;break c}break a}for(;c<f;){let d=c+f>>>1;a<b[d]?f=d:c=d+1}if(d=b[c],void 0===(e=b[c-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===d)return c=b.length,this._cachedIndex=c,this.copySampleValue_(c-1)}this._cachedIndex=c,this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(a){let b=this.resultBuffer,c=this.sampleValues,d=this.valueSize,e=a*d;for(let a=0;a!==d;++a)b[a]=c[e+a];return b}interpolate_(){throw Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class i0 extends i_{constructor(a,b,c,d){super(a,b,c,d),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:b5,endingEnd:b5}}intervalChanged_(a,b,c){let d=this.parameterPositions,e=a-2,f=a+1,g=d[e],h=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case b6:e=a,g=2*b-c;break;case b7:e=d.length-2,g=b+d[e]-d[e+1];break;default:e=a,g=c}if(void 0===h)switch(this.getSettings_().endingEnd){case b6:f=a,h=2*c-b;break;case b7:f=1,h=c+d[1]-d[0];break;default:f=a-1,h=b}let i=(c-b)*.5,j=this.valueSize;this._weightPrev=i/(b-g),this._weightNext=i/(h-c),this._offsetPrev=e*j,this._offsetNext=f*j}interpolate_(a,b,c,d){let e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=a*g,i=h-g,j=this._offsetPrev,k=this._offsetNext,l=this._weightPrev,m=this._weightNext,n=(c-b)/(d-b),o=n*n,p=o*n,q=-l*p+2*l*o-l*n,r=(1+l)*p+(-1.5-2*l)*o+(-.5+l)*n+1,s=(-1-m)*p+(1.5+m)*o+.5*n,t=m*p-m*o;for(let a=0;a!==g;++a)e[a]=q*f[j+a]+r*f[i+a]+s*f[h+a]+t*f[k+a];return e}}class i1 extends i_{constructor(a,b,c,d){super(a,b,c,d)}interpolate_(a,b,c,d){let e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=a*g,i=h-g,j=(c-b)/(d-b),k=1-j;for(let a=0;a!==g;++a)e[a]=f[i+a]*k+f[h+a]*j;return e}}class i2 extends i_{constructor(a,b,c,d){super(a,b,c,d)}interpolate_(a){return this.copySampleValue_(a-1)}}class i3 extends i_{interpolate_(a,b,c,d){let e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=a*g,i=h-g,j=this.inTangents,k=this.outTangents;if(!j||!k){let a=(c-b)/(d-b),j=1-a;for(let b=0;b!==g;++b)e[b]=f[i+b]*j+f[h+b]*a;return e}let l=2*g,m=a-1;for(let n=0;n!==g;++n){let g=f[i+n],o=f[h+n],p=m*l+2*n,q=k[p],r=k[p+1],s=a*l+2*n,t=j[s],u=j[s+1],v=function(a,b,c,d,e){let f=(a-b)/(e-b);for(let g=0;g<8;g++){let g=i4(f,b,c,d,e)-a;if(1e-10>Math.abs(g))break;let h=function(a,b,c,d,e){let f=1-a;return 3*f*f*(c-b)+6*f*a*(d-c)+3*a*a*(e-d)}(f,b,c,d,e);if(1e-10>Math.abs(h))break;f=Math.max(0,Math.min(1,f-g/h))}return f}(c,b,q,t,d);e[n]=i4(v,g,r,u,o)}return e}}function i4(a,b,c,d,e){let f=1-a;return f*f*f*b+3*f*f*a*c+3*f*a*a*d+a*a*a*e}class i5{constructor(a,b,c,d){if(void 0===a)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===b||0===b.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+a);this.name=a,this.times=iV(b,this.TimeBufferType),this.values=iV(c,this.ValueBufferType),this.setInterpolation(d||this.DefaultInterpolation)}static toJSON(a){let b,c=a.constructor;if(c.toJSON!==this.toJSON)b=c.toJSON(a);else{b={name:a.name,times:iV(a.times,Array),values:iV(a.values,Array)};let c=a.getInterpolation();c!==a.DefaultInterpolation&&(b.interpolation=c),iW(a.settings)&&(b.settings={inTangents:iV(a.settings.inTangents,Array),outTangents:iV(a.settings.outTangents,Array)})}return b.type=a.ValueTypeName,b}InterpolantFactoryMethodDiscrete(a){return new i2(this.times,this.values,this.getValueSize(),a)}InterpolantFactoryMethodLinear(a){return new i1(this.times,this.values,this.getValueSize(),a)}InterpolantFactoryMethodSmooth(a){return new i0(this.times,this.values,this.getValueSize(),a)}InterpolantFactoryMethodBezier(a){let b=new i3(this.times,this.values,this.getValueSize(),a);return this.settings&&(b.inTangents=this.settings.inTangents,b.outTangents=this.settings.outTangents),b}setInterpolation(a){let b;switch(a){case b1:b=this.InterpolantFactoryMethodDiscrete;break;case b2:b=this.InterpolantFactoryMethodLinear;break;case b3:b=this.InterpolantFactoryMethodSmooth;break;case b4:b=this.InterpolantFactoryMethodBezier}if(void 0===b){let b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(b);return dg("KeyframeTrack:",b),this}return this.createInterpolant=b,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return b1;case this.InterpolantFactoryMethodLinear:return b2;case this.InterpolantFactoryMethodSmooth:return b3;case this.InterpolantFactoryMethodBezier:return b4}}getValueSize(){return this.values.length/this.times.length}shift(a){if(0!==a){let b=this.times;for(let c=0,d=b.length;c!==d;++c)b[c]+=a}return this}scale(a){if(1!==a){let b=this.times;for(let c=0,d=b.length;c!==d;++c)b[c]*=a;iW(this.settings)&&(i6(this.settings.inTangents,a),i6(this.settings.outTangents,a))}return this}trim(a,b){let c=this.times,d=c.length,e=0,f=d-1;for(;e!==d&&c[e]<a;)++e;for(;-1!==f&&c[f]>b;)--f;if(++f,0!==e||f!==d){e>=f&&(e=(f=Math.max(f,1))-1);let a=this.getValueSize();this.times=c.slice(e,f),this.values=this.values.slice(e*a,f*a)}return this}validate(){let a=!0,b=this.getValueSize();b-Math.floor(b)!=0&&(dh("KeyframeTrack: Invalid value size in track.",this),a=!1);let c=this.times,d=this.values,e=c.length;0===e&&(dh("KeyframeTrack: Track is empty.",this),a=!1);let f=null;for(let b=0;b!==e;b++){let d=c[b];if("number"==typeof d&&isNaN(d)){dh("KeyframeTrack: Time is not a valid number.",this,b,d),a=!1;break}if(null!==f&&f>d){dh("KeyframeTrack: Out of order keys.",this,b,d,f),a=!1;break}f=d}if(void 0!==d&&c7(d))for(let b=0,c=d.length;b!==c;++b){let c=d[b];if(isNaN(c)){dh("KeyframeTrack: Value is not a valid number.",this,b,c),a=!1;break}}return a}optimize(){let a=this.times.slice(),b=this.values.slice(),c=this.getValueSize(),d=this.getInterpolation()===b3,e=a.length-1,f=1;for(let g=1;g<e;++g){let e=!1,h=a[g];if(h!==a[g+1]&&(1!==g||h!==a[0]))if(d)e=!0;else{let a=g*c,d=a-c,f=a+c;for(let g=0;g!==c;++g){let c=b[a+g];if(c!==b[d+g]||c!==b[f+g]){e=!0;break}}}if(e){if(g!==f){a[f]=a[g];let d=g*c,e=f*c;for(let a=0;a!==c;++a)b[e+a]=b[d+a]}++f}}if(e>0){a[f]=a[e];for(let a=e*c,d=f*c,g=0;g!==c;++g)b[d+g]=b[a+g];++f}return f!==a.length?(this.times=a.slice(0,f),this.values=b.slice(0,f*c)):(this.times=a,this.values=b),this}clone(){let a=this.times.slice(),b=this.values.slice(),c=new this.constructor(this.name,a,b);return c.createInterpolant=this.createInterpolant,iW(this.settings)&&(c.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),c}}function i6(a,b){for(let c=0,d=a.length;c!==d;c+=2)a[c]*=b}i5.prototype.ValueTypeName="",i5.prototype.TimeBufferType=Float32Array,i5.prototype.ValueBufferType=Float32Array,i5.prototype.DefaultInterpolation=b2;class i7 extends i5{constructor(a,b,c){super(a,b,c)}}i7.prototype.ValueTypeName="bool",i7.prototype.ValueBufferType=Array,i7.prototype.DefaultInterpolation=b1,i7.prototype.InterpolantFactoryMethodLinear=void 0,i7.prototype.InterpolantFactoryMethodSmooth=void 0;class i8 extends i5{constructor(a,b,c,d){super(a,b,c,d)}}i8.prototype.ValueTypeName="color";class i9 extends i5{constructor(a,b,c,d){super(a,b,c,d)}}i9.prototype.ValueTypeName="number";class ja extends i_{constructor(a,b,c,d){super(a,b,c,d)}interpolate_(a,b,c,d){let e=this.resultBuffer,f=this.sampleValues,g=this.valueSize,h=(c-b)/(d-b),i=a*g;for(let a=i+g;i!==a;i+=4)dy.slerpFlat(e,0,f,i-g,f,i,h);return e}}class jb extends i5{constructor(a,b,c,d){super(a,b,c,d)}InterpolantFactoryMethodLinear(a){return new ja(this.times,this.values,this.getValueSize(),a)}}jb.prototype.ValueTypeName="quaternion",jb.prototype.InterpolantFactoryMethodSmooth=void 0;class jc extends i5{constructor(a,b,c){super(a,b,c)}}jc.prototype.ValueTypeName="string",jc.prototype.ValueBufferType=Array,jc.prototype.DefaultInterpolation=b1,jc.prototype.InterpolantFactoryMethodLinear=void 0,jc.prototype.InterpolantFactoryMethodSmooth=void 0;class jd extends i5{constructor(a,b,c,d){super(a,b,c,d)}}jd.prototype.ValueTypeName="vector";class je{constructor(a="",b=-1,c=[],d=b8){this.name=a,this.tracks=c,this.duration=b,this.blendMode=d,this.uuid=dq(),this.userData={},this.duration<0&&this.resetDuration()}static parse(a){let b=[],c=a.tracks,d=1/(a.fps||1);for(let a=0,e=c.length;a!==e;++a)b.push((function(a){let b;if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let c=function(a){switch(a.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return i9;case"vector":case"vector2":case"vector3":case"vector4":return jd;case"color":return i8;case"quaternion":return jb;case"bool":case"boolean":return i7;case"string":return jc}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a)}(a.type);if(void 0===a.times){let b=[],c=[];iZ(a.keys,b,c,"value"),a.times=b,a.values=c}return b=void 0!==c.parse?c.parse(a):new c(a.name,a.times,a.values,a.interpolation),iW(a.settings)&&(b.settings={inTangents:iV(a.settings.inTangents,Float32Array),outTangents:iV(a.settings.outTangents,Float32Array)}),b})(c[a]).scale(d));let e=new this(a.name,a.duration,b,a.blendMode);return e.uuid=a.uuid,e.userData=JSON.parse(a.userData||"{}"),e}static toJSON(a){let b=[],c=a.tracks,d={name:a.name,duration:a.duration,tracks:b,uuid:a.uuid,blendMode:a.blendMode,userData:JSON.stringify(a.userData)};for(let a=0,d=c.length;a!==d;++a)b.push(i5.toJSON(c[a]));return d}static CreateFromMorphTargetSequence(a,b,c,d){let e=b.length,f=[];for(let a=0;a<e;a++){let g=[],h=[];g.push((a+e-1)%e,a,(a+1)%e),h.push(0,1,0);let i=iX(g);g=iY(g,1,i),h=iY(h,1,i),d||0!==g[0]||(g.push(e),h.push(h[0])),f.push(new i9(".morphTargetInfluences["+b[a].name+"]",g,h).scale(1/c))}return new this(a,-1,f)}static findByName(a,b){let c=a;Array.isArray(a)||(c=a.geometry&&a.geometry.animations||a.animations);for(let a=0;a<c.length;a++)if(c[a].name===b)return c[a];return null}static CreateClipsFromMorphTargetSequences(a,b,c){let d={},e=/^([\w-]*?)([\d]+)$/;for(let b=0,c=a.length;b<c;b++){let c=a[b],f=c.name.match(e);if(f&&f.length>1){let a=f[1],b=d[a];b||(d[a]=b=[]),b.push(c)}}let f=[];for(let a in d)f.push(this.CreateFromMorphTargetSequence(a,d[a],b,c));return f}resetDuration(){let a=this.tracks,b=0;for(let c=0,d=a.length;c!==d;++c){let a=this.tracks[c];b=Math.max(b,a.times[a.times.length-1])}return this.duration=b,this}trim(){for(let a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this}validate(){let a=!0;for(let b=0;b<this.tracks.length;b++)a=a&&this.tracks[b].validate();return a}optimize(){for(let a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}clone(){let a=[];for(let b=0;b<this.tracks.length;b++)a.push(this.tracks[b].clone());let b=new this.constructor(this.name,this.duration,a,this.blendMode);return b.userData=JSON.parse(JSON.stringify(this.userData)),b}toJSON(){return this.constructor.toJSON(this)}}let jf={enabled:!1,files:{},add:function(a,b){!1===this.enabled||jg(a)||(this.files[a]=b)},get:function(a){if(!1!==this.enabled&&!jg(a))return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}};function jg(a){try{let b=a.slice(a.indexOf(":")+1),c=new URL(b);return"blob:"===c.protocol}catch(a){return!1}}class jh{constructor(a,b,c){let d;const e=this;let f=!1,g=0,h=0;const i=[];this.onStart=void 0,this.onLoad=a,this.onProgress=b,this.onError=c,this._abortController=null,this.itemStart=function(a){h++,!1===f&&void 0!==e.onStart&&e.onStart(a,g,h),f=!0},this.itemEnd=function(a){g++,void 0!==e.onProgress&&e.onProgress(a,g,h),g===h&&(f=!1,void 0!==e.onLoad&&e.onLoad())},this.itemError=function(a){void 0!==e.onError&&e.onError(a)},this.resolveURL=function(a){return(a=a.normalize("NFC"),d)?d(a):a},this.setURLModifier=function(a){return d=a,this},this.addHandler=function(a,b){return i.push(a,b),this},this.removeHandler=function(a){let b=i.indexOf(a);return -1!==b&&i.splice(b,2),this},this.getHandler=function(a){for(let b=0,c=i.length;b<c;b+=2){let c=i[b],d=i[b+1];if(c.global&&(c.lastIndex=0),c.test(a))return d}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 ji=new jh;class jj{constructor(a){this.manager=void 0!==a?a:ji,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(a,b){let c=this;return new Promise(function(d,e){c.load(a,d,b,e)})}parse(){}setCrossOrigin(a){return this.crossOrigin=a,this}setWithCredentials(a){return this.withCredentials=a,this}setPath(a){return this.path=a,this}setResourcePath(a){return this.resourcePath=a,this}setRequestHeader(a){return this.requestHeader=a,this}abort(){return this}}jj.DEFAULT_MATERIAL_NAME="__DEFAULT";let jk={};class jl extends Error{constructor(a,b){super(a),this.response=b}}class jm extends jj{constructor(a){super(a),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(a,b,c,d){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a),a=this.manager.resolveURL(a);let e=jf.get(`file:${a}`);if(void 0!==e){this.manager.itemStart(a),setTimeout(()=>{b&&b(e),this.manager.itemEnd(a)},0);return}if(void 0!==jk[a])return void jk[a].push({onLoad:b,onProgress:c,onError:d});jk[a]=[],jk[a].push({onLoad:b,onProgress:c,onError:d});let f=new Request(a,{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}),g=this.mimeType,h=this.responseType;fetch(f).then(b=>{if(200===b.status||0===b.status){if(0===b.status&&dg("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===b.body||void 0===b.body.getReader)return b;let c=jk[a],d=b.body.getReader(),e=b.headers.get("X-File-Size")||b.headers.get("Content-Length"),f=e?parseInt(e):0,g=0!==f,h=0;return new Response(new ReadableStream({start(a){!function b(){d.read().then(({done:d,value:e})=>{if(d)a.close();else{let d=new ProgressEvent("progress",{lengthComputable:g,loaded:h+=e.byteLength,total:f});for(let a=0,b=c.length;a<b;a++){let b=c[a];b.onProgress&&b.onProgress(d)}a.enqueue(e),b()}},b=>{a.error(b)})}()}}))}throw new jl(`fetch for "${b.url}" responded with ${b.status}: ${b.statusText}`,b)}).then(a=>{switch(h){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(a=>new DOMParser().parseFromString(a,g));case"json":return a.json();default:if(""===g)return a.text();{let b=/charset="?([^;"\s]*)"?/i.exec(g),c=new TextDecoder(b&&b[1]?b[1].toLowerCase():void 0);return a.arrayBuffer().then(a=>c.decode(a))}}}).then(b=>{jf.add(`file:${a}`,b);let c=jk[a];delete jk[a];for(let a=0,d=c.length;a<d;a++){let d=c[a];d.onLoad&&d.onLoad(b)}}).catch(b=>{let c=jk[a];if(void 0===c)throw this.manager.itemError(a),b;delete jk[a];for(let a=0,d=c.length;a<d;a++){let d=c[a];d.onError&&d.onError(b)}this.manager.itemError(a)}).finally(()=>{this.manager.itemEnd(a)}),this.manager.itemStart(a)}setResponseType(a){return this.responseType=a,this}setMimeType(a){return this.mimeType=a,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class jn extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=new jm(this.manager);f.setPath(this.path),f.setRequestHeader(this.requestHeader),f.setWithCredentials(this.withCredentials),f.load(a,function(c){try{b(e.parse(JSON.parse(c)))}catch(b){d?d(b):dh(b),e.manager.itemError(a)}},c,d)}parse(a){let b=[];for(let c=0;c<a.length;c++){let d=je.parse(a[c]);b.push(d)}return b}}class jo extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=[],g=new hk,h=new jm(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(e.withCredentials);let i=0;if(Array.isArray(a))for(let j=0,k=a.length;j<k;++j)!function(j){h.load(a[j],function(a){let c=e.parse(a,!0);f[j]={width:c.width,height:c.height,format:c.format,mipmaps:c.mipmaps},6===(i+=1)&&(1===c.mipmapCount&&(g.minFilter=aZ),g.image=f,g.format=c.format,g.needsUpdate=!0,b&&b(g))},c,d)}(j);else h.load(a,function(a){let c=e.parse(a,!0);if(c.isCubemap){let a=c.mipmaps.length/c.mipmapCount;for(let b=0;b<a;b++){f[b]={mipmaps:[]};for(let a=0;a<c.mipmapCount;a++)f[b].mipmaps.push(c.mipmaps[b*c.mipmapCount+a]),f[b].format=c.format,f[b].width=c.width,f[b].height=c.height}g.image=f}else g.image.width=c.width,g.image.height=c.height,g.mipmaps=c.mipmaps;1===c.mipmapCount&&(g.minFilter=aZ),g.format=c.format,g.needsUpdate=!0,b&&b(g)},c,d);return g}}let jp=new WeakMap;class jq extends jj{constructor(a){super(a)}load(a,b,c,d){void 0!==this.path&&(a=this.path+a),a=this.manager.resolveURL(a);let e=this,f=jf.get(`image:${a}`);if(void 0!==f){if(!0===f.complete)e.manager.itemStart(a),setTimeout(function(){b&&b(f),e.manager.itemEnd(a)},0);else{let a=jp.get(f);void 0===a&&(a=[],jp.set(f,a)),a.push({onLoad:b,onError:d})}return f}let g=c8("img");function h(){j(),b&&b(this);let c=jp.get(this)||[];for(let a=0;a<c.length;a++){let b=c[a];b.onLoad&&b.onLoad(this)}jp.delete(this),e.manager.itemEnd(a)}function i(b){j(),d&&d(b),jf.remove(`image:${a}`);let c=jp.get(this)||[];for(let a=0;a<c.length;a++){let d=c[a];d.onError&&d.onError(b)}jp.delete(this),e.manager.itemError(a),e.manager.itemEnd(a)}function j(){g.removeEventListener("load",h,!1),g.removeEventListener("error",i,!1)}return g.addEventListener("load",h,!1),g.addEventListener("error",i,!1),"data:"!==a.slice(0,5)&&void 0!==this.crossOrigin&&(g.crossOrigin=this.crossOrigin),jf.add(`image:${a}`,g),e.manager.itemStart(a),g.src=a,g}}class jr extends jj{constructor(a){super(a)}load(a,b,c,d){let e=new hn;e.colorSpace=ck;let f=new jq(this.manager);f.setCrossOrigin(this.crossOrigin),f.setPath(this.path);let g=0;for(let c=0;c<a.length;++c)!function(c){f.load(a[c],function(a){e.images[c]=a,6==++g&&(e.needsUpdate=!0,b&&b(e))},void 0,d)}(c);return e}}class js extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=new gn,g=new jm(this.manager);return g.setResponseType("arraybuffer"),g.setRequestHeader(this.requestHeader),g.setPath(this.path),g.setWithCredentials(e.withCredentials),g.load(a,function(a){let c;try{c=e.parse(a)}catch(a){void 0!==d?d(a):dh(a);return}e._applyTexData(f,c),b&&b(f,c)},c,d),f}createDataTexture(a){let b=new gn;return this._applyTexData(b,this.parse(a)),b}_applyTexData(a,b){void 0!==b.image?a.image=b.image:void 0!==b.data&&(a.image.width=b.width,a.image.height=b.height,a.image.data=b.data),a.wrapS=void 0!==b.wrapS?b.wrapS:aS,a.wrapT=void 0!==b.wrapT?b.wrapT:aS,a.magFilter=void 0!==b.magFilter?b.magFilter:aZ,a.minFilter=void 0!==b.minFilter?b.minFilter:aZ,a.anisotropy=void 0!==b.anisotropy?b.anisotropy:1,void 0!==b.colorSpace&&(a.colorSpace=b.colorSpace),void 0!==b.flipY&&(a.flipY=b.flipY),void 0!==b.format&&(a.format=b.format),void 0!==b.type&&(a.type=b.type),void 0!==b.mipmaps&&(a.mipmaps=b.mipmaps,a.minFilter=a0),1===b.mipmapCount&&(a.minFilter=aZ),void 0!==b.generateMipmaps&&(a.generateMipmaps=b.generateMipmaps),a.needsUpdate=!0}}class jt extends jj{constructor(a){super(a)}load(a,b,c,d){let e=new dQ,f=new jq(this.manager);return f.setCrossOrigin(this.crossOrigin),f.setPath(this.path),f.load(a,function(a){e.image=a,e.needsUpdate=!0,void 0!==b&&b(e)},c,d),e}}class ju extends en{constructor(a,b=1){super(),this.isLight=!0,this.type="Light",this.color=new ev(a),this.intensity=b}copy(a,b){return super.copy(a,b),this.color.copy(a.color),this.intensity=a.intensity,this}toJSON(a){let b=super.toJSON(a);return b.object.color=this.color.getHex(),b.object.intensity=this.intensity,b}}class jv extends ju{constructor(a,b,c){super(a,c),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(en.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ev(b)}copy(a,b){return super.copy(a,b),this.groundColor.copy(a.groundColor),this}toJSON(a){let b=super.toJSON(a);return b.object.groundColor=this.groundColor.getHex(),b}}let jw=new dY,jx=new dz,jy=new dz;class jz{constructor(a){this.camera=a,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new dx(512,512),this.mapType=a2,this.map=null,this.mapPass=null,this.matrix=new dY,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new gD,this._frameExtents=new dx(1,1),this._viewportCount=1,this._viewports=[new dR(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(a){let b=this.camera;jx.setFromMatrixPosition(a.matrixWorld),b.position.copy(jx),jy.setFromMatrixPosition(a.target.matrixWorld),b.lookAt(jy),b.updateMatrixWorld(),this._updateMatrix(b,this.matrix,this._frustum)}_updateMatrix(a,b,c,d){jw.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),c.setFromProjectionMatrix(jw,a.coordinateSystem,a.reversedDepth);let e=this._frameExtents,f=d?d.z/e.x:1,g=d?d.w/e.y:1,h=d?d.x/e.x:0,i=d?d.y/e.y:0;a.coordinateSystem===c_||a.reversedDepth?b.set(.5*f,0,0,.5*f+h,0,.5*g,0,.5*g+i,0,0,1,0,0,0,0,1):b.set(.5*f,0,0,.5*f+h,0,.5*g,0,.5*g+i,0,0,.5,.5,0,0,0,1),b.multiply(jw)}getViewport(a){return this._viewports[a]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(a){return this.camera=a.camera.clone(),this.intensity=a.intensity,this.bias=a.bias,this.radius=a.radius,this.autoUpdate=a.autoUpdate,this.needsUpdate=a.needsUpdate,this.normalBias=a.normalBias,this.blurSamples=a.blurSamples,this.mapSize.copy(a.mapSize),this.biasNode=a.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let a={};return a.intensity=this.intensity,a.bias=this.bias,a.normalBias=this.normalBias,a.radius=this.radius,a.blurSamples=this.blurSamples,a.mapSize=this.mapSize.toArray(),a.camera=this.camera.toJSON(!1).object,delete a.camera.matrix,a}}let jA=new dz,jB=new dy,jC=new dz;class jD extends en{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new dY,this.projectionMatrix=new dY,this.projectionMatrixInverse=new dY,this.coordinateSystem=c$,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(a,b){return super.copy(a,b),this.matrixWorldInverse.copy(a.matrixWorldInverse),this.projectionMatrix.copy(a.projectionMatrix),this.projectionMatrixInverse.copy(a.projectionMatrixInverse),this.coordinateSystem=a.coordinateSystem,this}getWorldDirection(a){return super.getWorldDirection(a).negate()}updateMatrixWorld(a){super.updateMatrixWorld(a),this.matrixWorld.decompose(jA,jB,jC),1===jC.x&&1===jC.y&&1===jC.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(jA,jB,jC.set(1,1,1)).invert()}updateWorldMatrix(a,b,c=!1){super.updateWorldMatrix(a,b,c),this.matrixWorld.decompose(jA,jB,jC),1===jC.x&&1===jC.y&&1===jC.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(jA,jB,jC.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}let jE=new dz,jF=new dx,jG=new dx;class jH extends jD{constructor(a=50,b=1,c=.1,d=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=a,this.zoom=1,this.near=c,this.far=d,this.focus=10,this.aspect=b,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(a,b){return super.copy(a,b),this.fov=a.fov,this.zoom=a.zoom,this.near=a.near,this.far=a.far,this.focus=a.focus,this.aspect=a.aspect,this.view=null===a.view?null:Object.assign({},a.view),this.filmGauge=a.filmGauge,this.filmOffset=a.filmOffset,this}setFocalLength(a){let b=.5*this.getFilmHeight()/a;this.fov=2*dp*Math.atan(b),this.updateProjectionMatrix()}getFocalLength(){let a=Math.tan(.5*dn*this.fov);return .5*this.getFilmHeight()/a}getEffectiveFOV(){return 2*dp*Math.atan(Math.tan(.5*dn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(a,b,c){jE.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),b.set(jE.x,jE.y).multiplyScalar(-a/jE.z),jE.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),c.set(jE.x,jE.y).multiplyScalar(-a/jE.z)}getViewSize(a,b){return this.getViewBounds(a,jF,jG),b.subVectors(jG,jF)}setViewOffset(a,b,c,d,e,f){this.aspect=a/b,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=a,this.view.fullHeight=b,this.view.offsetX=c,this.view.offsetY=d,this.view.width=e,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let a=this.near,b=a*Math.tan(.5*dn*this.fov)/this.zoom,c=2*b,d=this.aspect*c,e=-.5*d,f=this.view;if(null!==this.view&&this.view.enabled){let a=f.fullWidth,g=f.fullHeight;e+=f.offsetX*d/a,b-=f.offsetY*c/g,d*=f.width/a,c*=f.height/g}let g=this.filmOffset;0!==g&&(e+=a*g/this.getFilmWidth()),this.projectionMatrix.makePerspective(e,e+d,b,b-c,a,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(a){let b=super.toJSON(a);return b.object.fov=this.fov,b.object.zoom=this.zoom,b.object.near=this.near,b.object.far=this.far,b.object.focus=this.focus,b.object.aspect=this.aspect,null!==this.view&&(b.object.view=Object.assign({},this.view)),b.object.filmGauge=this.filmGauge,b.object.filmOffset=this.filmOffset,b}}class jI extends jz{constructor(){super(new jH(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(a){let b=this.camera,c=2*dp*a.angle*this.focus,d=this.mapSize.width/this.mapSize.height*this.aspect,e=a.distance||b.far;(c!==b.fov||d!==b.aspect||e!==b.far)&&(b.fov=c,b.aspect=d,b.far=e,b.updateProjectionMatrix()),super.updateMatrices(a)}copy(a){return super.copy(a),this.focus=a.focus,this.aspect=a.aspect,this}toJSON(){let a=super.toJSON();return a.focus=this.focus,a.aspect=this.aspect,a}}class jJ extends ju{constructor(a,b,c=0,d=Math.PI/3,e=0,f=2){super(a,b),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(en.DEFAULT_UP),this.updateMatrix(),this.target=new en,this.distance=c,this.angle=d,this.penumbra=e,this.decay=f,this.map=null,this.shadow=new jI}get power(){return this.intensity*Math.PI}set power(a){this.intensity=a/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(a,b){return super.copy(a,b),this.distance=a.distance,this.angle=a.angle,this.penumbra=a.penumbra,this.decay=a.decay,this.target=a.target.clone(),this.map=a.map,this.shadow=a.shadow.clone(),this}toJSON(a){let b=super.toJSON(a);return b.object.distance=this.distance,b.object.angle=this.angle,b.object.decay=this.decay,b.object.penumbra=this.penumbra,b.object.target=this.target.uuid,this.map&&this.map.isTexture&&(b.object.map=this.map.toJSON(a).uuid),b.object.shadow=this.shadow.toJSON(),b}}class jK extends jz{constructor(){super(new jH(90,1,.5,500)),this.isPointLightShadow=!0}}class jL extends ju{constructor(a,b,c=0,d=2){super(a,b),this.isPointLight=!0,this.type="PointLight",this.distance=c,this.decay=d,this.shadow=new jK}get power(){return 4*this.intensity*Math.PI}set power(a){this.intensity=a/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(a,b){return super.copy(a,b),this.distance=a.distance,this.decay=a.decay,this.shadow=a.shadow.clone(),this}toJSON(a){let b=super.toJSON(a);return b.object.distance=this.distance,b.object.decay=this.decay,b.object.shadow=this.shadow.toJSON(),b}}class jM extends jD{constructor(a=-1,b=1,c=1,d=-1,e=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=a,this.right=b,this.top=c,this.bottom=d,this.near=e,this.far=f,this.updateProjectionMatrix()}copy(a,b){return super.copy(a,b),this.left=a.left,this.right=a.right,this.top=a.top,this.bottom=a.bottom,this.near=a.near,this.far=a.far,this.zoom=a.zoom,this.view=null===a.view?null:Object.assign({},a.view),this}setViewOffset(a,b,c,d,e,f){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=a,this.view.fullHeight=b,this.view.offsetX=c,this.view.offsetY=d,this.view.width=e,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2,e=c-a,f=c+a,g=d+b,h=d-b;if(null!==this.view&&this.view.enabled){let a=(this.right-this.left)/this.view.fullWidth/this.zoom,b=(this.top-this.bottom)/this.view.fullHeight/this.zoom;e+=a*this.view.offsetX,f=e+a*this.view.width,g-=b*this.view.offsetY,h=g-b*this.view.height}this.projectionMatrix.makeOrthographic(e,f,g,h,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(a){let b=super.toJSON(a);return b.object.zoom=this.zoom,b.object.left=this.left,b.object.right=this.right,b.object.top=this.top,b.object.bottom=this.bottom,b.object.near=this.near,b.object.far=this.far,null!==this.view&&(b.object.view=Object.assign({},this.view)),b}}class jN extends jz{constructor(){super(new jM(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class jO extends ju{constructor(a,b){super(a,b),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(en.DEFAULT_UP),this.updateMatrix(),this.target=new en,this.shadow=new jN}dispose(){super.dispose(),this.shadow.dispose()}copy(a){return super.copy(a),this.target=a.target.clone(),this.shadow=a.shadow.clone(),this}toJSON(a){let b=super.toJSON(a);return b.object.shadow=this.shadow.toJSON(),b.object.target=this.target.uuid,b}}class jP extends ju{constructor(a,b){super(a,b),this.isAmbientLight=!0,this.type="AmbientLight"}}class jQ extends ju{constructor(a,b,c=10,d=10){super(a,b),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=c,this.height=d}get power(){return this.intensity*this.width*this.height*Math.PI}set power(a){this.intensity=a/(this.width*this.height*Math.PI)}copy(a){return super.copy(a),this.width=a.width,this.height=a.height,this}toJSON(a){let b=super.toJSON(a);return b.object.width=this.width,b.object.height=this.height,b}}class jR{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let a=0;a<9;a++)this.coefficients.push(new dz)}set(a){for(let b=0;b<9;b++)this.coefficients[b].copy(a[b]);return this}zero(){for(let a=0;a<9;a++)this.coefficients[a].set(0,0,0);return this}getAt(a,b){let c=a.x,d=a.y,e=a.z,f=this.coefficients;return b.copy(f[0]).multiplyScalar(.282095),b.addScaledVector(f[1],.488603*d),b.addScaledVector(f[2],.488603*e),b.addScaledVector(f[3],.488603*c),b.addScaledVector(f[4],c*d*1.092548),b.addScaledVector(f[5],d*e*1.092548),b.addScaledVector(f[6],.315392*(3*e*e-1)),b.addScaledVector(f[7],c*e*1.092548),b.addScaledVector(f[8],.546274*(c*c-d*d)),b}getIrradianceAt(a,b){let c=a.x,d=a.y,e=a.z,f=this.coefficients;return b.copy(f[0]).multiplyScalar(.886227),b.addScaledVector(f[1],1.023328*d),b.addScaledVector(f[2],1.023328*e),b.addScaledVector(f[3],1.023328*c),b.addScaledVector(f[4],.858086*c*d),b.addScaledVector(f[5],.858086*d*e),b.addScaledVector(f[6],.743125*e*e-.247708),b.addScaledVector(f[7],.858086*c*e),b.addScaledVector(f[8],.429043*(c*c-d*d)),b}add(a){for(let b=0;b<9;b++)this.coefficients[b].add(a.coefficients[b]);return this}addScaledSH(a,b){for(let c=0;c<9;c++)this.coefficients[c].addScaledVector(a.coefficients[c],b);return this}scale(a){for(let b=0;b<9;b++)this.coefficients[b].multiplyScalar(a);return this}lerp(a,b){for(let c=0;c<9;c++)this.coefficients[c].lerp(a.coefficients[c],b);return this}equals(a){for(let b=0;b<9;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0}copy(a){return this.set(a.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(a,b=0){let c=this.coefficients;for(let d=0;d<9;d++)c[d].fromArray(a,b+3*d);return this}toArray(a=[],b=0){let c=this.coefficients;for(let d=0;d<9;d++)c[d].toArray(a,b+3*d);return a}static getBasisAt(a,b){let c=a.x,d=a.y,e=a.z;b[0]=.282095,b[1]=.488603*d,b[2]=.488603*e,b[3]=.488603*c,b[4]=1.092548*c*d,b[5]=1.092548*d*e,b[6]=.315392*(3*e*e-1),b[7]=1.092548*c*e,b[8]=.546274*(c*c-d*d)}}class jS extends ju{constructor(a=new jR,b=1){super(void 0,b),this.isLightProbe=!0,this.sh=a}copy(a){return super.copy(a),this.sh.copy(a.sh),this}toJSON(a){let b=super.toJSON(a);return b.object.sh=this.sh.toArray(),b}}let jT={};class jU extends jj{constructor(a){super(a),this.textures={}}load(a,b,c,d){let e=this,f=new jm(e.manager);f.setPath(e.path),f.setRequestHeader(e.requestHeader),f.setWithCredentials(e.withCredentials),f.load(a,function(c){try{b(e.parse(JSON.parse(c)))}catch(b){d?d(b):dh(b),e.manager.itemError(a)}},c,d)}parse(a){let b=this.createMaterialFromType(a.type);return b.fromJSON(a,this.textures),b}setTextures(a){return this.textures=a,this}createMaterialFromType(a){return jU.createMaterialFromType(a)}static createMaterialFromType(a){let b,c={ShadowMaterial:iD,SpriteMaterial:fD,RawShaderMaterial:iK,ShaderMaterial:iJ,PointsMaterial:ha,MeshPhysicalMaterial:iM,MeshStandardMaterial:iL,MeshPhongMaterial:iN,MeshToonMaterial:iO,MeshNormalMaterial:iP,MeshLambertMaterial:iQ,MeshDepthMaterial:iR,MeshDistanceMaterial:iS,MeshBasicMaterial:f$,MeshMatcapMaterial:iT,LineDashedMaterial:iU,LineBasicMaterial:gY,Material:fC,...jT}[a];return void 0===c?(di(`MaterialLoader: Unknown material type "${a}". Use .registerMaterial() before starting the deserialization process.`),b=new fC):b=new c,b}static registerMaterial(a,b){jT[a]=b}}class jV{static extractUrlBase(a){let b=a.lastIndexOf("/");return -1===b?"./":a.slice(0,b+1)}static resolveURL(a,b){return"string"!=typeof a||""===a?"":(/^https?:\/\//i.test(b)&&/^\//.test(a)&&(b=b.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a))?a:b+a}}class jW extends ft{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(a){return super.copy(a),this.instanceCount=a.instanceCount,this}toJSON(){let a=super.toJSON();return a.instanceCount=this.instanceCount,a.isInstancedBufferGeometry=!0,a}}class jX extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=new jm(e.manager);f.setPath(e.path),f.setRequestHeader(e.requestHeader),f.setWithCredentials(e.withCredentials),f.load(a,function(c){try{b(e.parse(JSON.parse(c)))}catch(b){d?d(b):dh(b),e.manager.itemError(a)}},c,d)}parse(a){let b={},c={};function d(a,d){if(void 0!==b[d])return b[d];let e=a.interleavedBuffers[d],f=function(a,b){if(void 0!==c[b])return c[b];let d=new Uint32Array(a.arrayBuffers[b]).buffer;return c[b]=d,d}(a,e.buffer),g=new fu(c6(e.type,f),e.stride);return g.uuid=e.uuid,void 0!==e.usage&&g.setUsage(e.usage),b[d]=g,g}let e=a.isInstancedBufferGeometry?new jW:new ft,f=a.data.index;if(void 0!==f){let a=c6(f.type,f.array);e.setIndex(new e8(a,1))}let g=a.data.attributes;for(let b in g){let c,f=g[b];if(f.isInterleavedBufferAttribute)c=new fw(d(a.data,f.data),f.itemSize,f.offset,f.normalized);else{let a=c6(f.type,f.array);c=new(f.isInstancedBufferAttribute?gr:e8)(a,f.itemSize,f.normalized)}void 0!==f.name&&(c.name=f.name),void 0!==f.usage&&c.setUsage(f.usage),void 0!==f.gpuType&&(c.gpuType=f.gpuType),e.setAttribute(b,c)}let h=a.data.morphAttributes;if(h)for(let b in h){let c=h[b],f=[];for(let b=0,e=c.length;b<e;b++){let e,g=c[b];e=g.isInterleavedBufferAttribute?new fw(d(a.data,g.data),g.itemSize,g.offset,g.normalized):new e8(c6(g.type,g.array),g.itemSize,g.normalized),void 0!==g.name&&(e.name=g.name),void 0!==g.usage&&e.setUsage(g.usage),void 0!==g.gpuType&&(e.gpuType=g.gpuType),f.push(e)}e.morphAttributes[b]=f}a.data.morphTargetsRelative&&(e.morphTargetsRelative=!0);let i=a.data.groups||a.data.drawcalls||a.data.offsets;if(void 0!==i)for(let a=0,b=i.length;a!==b;++a){let b=i[a];e.addGroup(b.start,b.count,b.materialIndex)}let j=a.data.boundingSphere;return void 0!==j&&(e.boundingSphere=new fl().fromJSON(j)),a.name&&(e.name=a.name),a.userData&&(e.userData=a.userData),e}}let jY={};class jZ extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=""===this.path?jV.extractUrlBase(a):this.path;this.resourcePath=this.resourcePath||f;let g=new jm(this.manager);g.setPath(this.path),g.setRequestHeader(this.requestHeader),g.setWithCredentials(this.withCredentials),g.load(a,function(c){let f=null;try{f=JSON.parse(c)}catch(b){void 0!==d&&d(b),dh("ObjectLoader: Can't parse "+a+".",b.message);return}let g=f.metadata;if(void 0===g||void 0===g.type||"geometry"===g.type.toLowerCase()){void 0!==d&&d(Error("THREE.ObjectLoader: Can't load "+a)),dh("ObjectLoader: Can't load "+a);return}e.parse(f,b)},c,d)}async loadAsync(a,b){let c,d=""===this.path?jV.extractUrlBase(a):this.path;this.resourcePath=this.resourcePath||d;let e=new jm(this.manager);e.setPath(this.path),e.setRequestHeader(this.requestHeader),e.setWithCredentials(this.withCredentials);let f=await e.loadAsync(a,b);try{c=JSON.parse(f)}catch(b){throw Error("THREE.ObjectLoader: Can't parse "+a+". "+b.message)}let g=c.metadata;if(void 0===g||void 0===g.type||"geometry"===g.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+a);return await this.parseAsync(c)}parse(a,b){let c=this.parseAnimations(a.animations),d=this.parseShapes(a.shapes),e=this.parseGeometries(a.geometries,d),f=this.parseImages(a.images,function(){void 0!==b&&b(i)}),g=this.parseTextures(a.textures,f),h=this.parseMaterials(a.materials,g),i=this.parseObject(a.object,e,h,g,c),j=this.parseSkeletons(a.skeletons,i);if(this.bindSkeletons(i,j),this.bindLightTargets(i),void 0!==b){let a=!1;for(let b in f)if(f[b].data instanceof HTMLImageElement){a=!0;break}!1===a&&b(i)}return i}async parseAsync(a){let b=this.parseAnimations(a.animations),c=this.parseShapes(a.shapes),d=this.parseGeometries(a.geometries,c),e=await this.parseImagesAsync(a.images),f=this.parseTextures(a.textures,e),g=this.parseMaterials(a.materials,f),h=this.parseObject(a.object,d,g,f,b),i=this.parseSkeletons(a.skeletons,h);return this.bindSkeletons(h,i),this.bindLightTargets(h),h}static registerGeometry(a,b){jY[a]=b}parseShapes(a){let b={};if(void 0!==a)for(let c=0,d=a.length;c<d;c++){let d=new h0().fromJSON(a[c]);b[d.uuid]=d}return b}parseSkeletons(a,b){let c={},d={};if(b.traverse(function(a){a.isBone&&(d[a.uuid]=a)}),void 0!==a)for(let b=0,e=a.length;b<e;b++){let e=new gq().fromJSON(a[b],d);c[e.uuid]=e}return c}parseGeometries(a,b){let c={};if(void 0!==a){let d=new jX;for(let e=0,f=a.length;e<f;e++){let f,g=a[e];switch(g.type){case"BufferGeometry":case"InstancedBufferGeometry":f=d.parse(g);break;default:g.type in iC?f=iC[g.type].fromJSON(g,b):g.type in jY?f=jY[g.type].fromJSON(g,b):dg(`ObjectLoader: Unknown geometry type "${g.type}". Use .registerGeometry() before starting the deserialization process.`)}f.uuid=g.uuid,void 0!==g.name&&(f.name=g.name),void 0!==g.userData&&(f.userData=g.userData),c[g.uuid]=f}}return c}parseMaterials(a,b){let c={},d={};if(void 0!==a){let e=new jU;e.setTextures(b);for(let b=0,f=a.length;b<f;b++){let f=a[b];void 0===c[f.uuid]&&(c[f.uuid]=e.parse(f)),d[f.uuid]=c[f.uuid]}}return d}parseAnimations(a){let b={};if(void 0!==a)for(let c=0;c<a.length;c++){let d=a[c],e=je.parse(d);b[e.uuid]=e}return b}parseImages(a,b){let c,d=this,e={};function f(a){if("string"==typeof a){var b;return b=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:d.resourcePath+a,b=d.manager.resolveURL(b),d.manager.itemStart(b),c.load(b,function(){d.manager.itemEnd(b)},void 0,function(){d.manager.itemError(b),d.manager.itemEnd(b)})}return a.data?{data:c6(a.type,a.data),width:a.width,height:a.height}:null}if(void 0!==a&&a.length>0){(c=new jq(new jh(b))).setCrossOrigin(this.crossOrigin);for(let b=0,c=a.length;b<c;b++){let c=a[b],d=c.url;if(Array.isArray(d)){let a=[];for(let b=0,c=d.length;b<c;b++){let c=f(d[b]);null!==c&&(c instanceof HTMLImageElement?a.push(c):a.push(new gn(c.data,c.width,c.height)))}e[c.uuid]=new dL(a)}else{let a=f(c.url);e[c.uuid]=new dL(a)}}}return e}async parseImagesAsync(a){let b,c=this,d={};async function e(a){if("string"==typeof a){let d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:c.resourcePath+a;return await b.loadAsync(d)}return a.data?{data:c6(a.type,a.data),width:a.width,height:a.height}:null}if(void 0!==a&&a.length>0){(b=new jq(this.manager)).setCrossOrigin(this.crossOrigin);for(let b=0,c=a.length;b<c;b++){let c=a[b],f=c.url;if(Array.isArray(f)){let a=[];for(let b=0,c=f.length;b<c;b++){let c=f[b],d=await e(c);null!==d&&(d instanceof HTMLImageElement?a.push(d):a.push(new gn(d.data,d.width,d.height)))}d[c.uuid]=new dL(a)}else{let a=await e(c.url);d[c.uuid]=new dL(a)}}}return d}parseTextures(a,b){function c(a,b){return"number"==typeof a?a:(dg("ObjectLoader.parseTexture: Constant should be in numeric form.",a),b[a])}let d={};if(void 0!==a)for(let e=0,f=a.length;e<f;e++){let f,g=a[e];void 0===g.image&&dg('ObjectLoader: No "image" specified for',g.uuid),void 0===b[g.image]&&dg("ObjectLoader: Undefined image",g.image);let h=b[g.image],i=h.data;Array.isArray(i)?(f=new hn,6===i.length&&(f.needsUpdate=!0)):(f=i&&i.data?new gn:new dQ,i&&(f.needsUpdate=!0)),f.source=h,f.uuid=g.uuid,void 0!==g.name&&(f.name=g.name),void 0!==g.mapping&&(f.mapping=c(g.mapping,j$)),void 0!==g.channel&&(f.channel=g.channel),void 0!==g.offset&&f.offset.fromArray(g.offset),void 0!==g.repeat&&f.repeat.fromArray(g.repeat),void 0!==g.center&&f.center.fromArray(g.center),void 0!==g.rotation&&(f.rotation=g.rotation),void 0!==g.wrap&&(f.wrapS=c(g.wrap[0],j_),f.wrapT=c(g.wrap[1],j_)),void 0!==g.format&&(f.format=g.format),void 0!==g.internalFormat&&(f.internalFormat=g.internalFormat),void 0!==g.type&&(f.type=g.type),void 0!==g.colorSpace&&(f.colorSpace=g.colorSpace),void 0!==g.minFilter&&(f.minFilter=c(g.minFilter,j0)),void 0!==g.magFilter&&(f.magFilter=c(g.magFilter,j0)),void 0!==g.anisotropy&&(f.anisotropy=g.anisotropy),void 0!==g.flipY&&(f.flipY=g.flipY),void 0!==g.generateMipmaps&&(f.generateMipmaps=g.generateMipmaps),void 0!==g.premultiplyAlpha&&(f.premultiplyAlpha=g.premultiplyAlpha),void 0!==g.unpackAlignment&&(f.unpackAlignment=g.unpackAlignment),void 0!==g.compareFunction&&(f.compareFunction=g.compareFunction),void 0!==g.normalized&&(f.normalized=g.normalized),void 0!==g.userData&&(f.userData=g.userData),d[g.uuid]=f}return d}parseObject(a,b,c,d,e){let f,g,h;function i(a){return void 0===b[a]&&dg("ObjectLoader: Undefined geometry",a),b[a]}function j(a){if(void 0!==a){if(Array.isArray(a)){let b=[];for(let d=0,e=a.length;d<e;d++){let e=a[d];void 0===c[e]&&dg("ObjectLoader: Undefined material",e),b.push(c[e])}return b}return void 0===c[a]&&dg("ObjectLoader: Undefined material",a),c[a]}}function k(a){return void 0===d[a]&&dg("ObjectLoader: Undefined texture",a),d[a]}switch(a.type){case"Scene":f=new ez,void 0!==a.background&&(Number.isInteger(a.background)?f.background=new ev(a.background):f.background=k(a.background)),void 0!==a.environment&&(f.environment=k(a.environment)),void 0!==a.fog&&("Fog"===a.fog.type?f.fog=new ey(a.fog.color,a.fog.near,a.fog.far):"FogExp2"===a.fog.type&&(f.fog=new ex(a.fog.color,a.fog.density)),""!==a.fog.name&&(f.fog.name=a.fog.name)),void 0!==a.backgroundBlurriness&&(f.backgroundBlurriness=a.backgroundBlurriness),void 0!==a.backgroundIntensity&&(f.backgroundIntensity=a.backgroundIntensity),void 0!==a.backgroundRotation&&f.backgroundRotation.fromArray(a.backgroundRotation),void 0!==a.environmentIntensity&&(f.environmentIntensity=a.environmentIntensity),void 0!==a.environmentRotation&&f.environmentRotation.fromArray(a.environmentRotation);break;case"PerspectiveCamera":f=new jH(a.fov,a.aspect,a.near,a.far),void 0!==a.focus&&(f.focus=a.focus),void 0!==a.zoom&&(f.zoom=a.zoom),void 0!==a.filmGauge&&(f.filmGauge=a.filmGauge),void 0!==a.filmOffset&&(f.filmOffset=a.filmOffset),void 0!==a.view&&(f.view=Object.assign({},a.view));break;case"OrthographicCamera":f=new jM(a.left,a.right,a.top,a.bottom,a.near,a.far),void 0!==a.zoom&&(f.zoom=a.zoom),void 0!==a.view&&(f.view=Object.assign({},a.view));break;case"AmbientLight":f=new jP(a.color,a.intensity);break;case"DirectionalLight":(f=new jO(a.color,a.intensity)).target=a.target||"";break;case"PointLight":f=new jL(a.color,a.intensity,a.distance,a.decay);break;case"RectAreaLight":f=new jQ(a.color,a.intensity,a.width,a.height);break;case"SpotLight":(f=new jJ(a.color,a.intensity,a.distance,a.angle,a.penumbra,a.decay)).target=a.target||"";break;case"HemisphereLight":f=new jv(a.color,a.groundColor,a.intensity);break;case"LightProbe":f=new jS(new jR().fromArray(a.sh),a.intensity);break;case"SkinnedMesh":f=new gl(g=i(a.geometry),h=j(a.material)),void 0!==a.bindMode&&(f.bindMode=a.bindMode),void 0!==a.bindMatrix&&f.bindMatrix.fromArray(a.bindMatrix),void 0!==a.skeleton&&(f.skeleton=a.skeleton);break;case"Mesh":f=new ga(g=i(a.geometry),h=j(a.material));break;case"InstancedMesh":g=i(a.geometry),h=j(a.material);let l=a.count,m=a.instanceMatrix,n=a.instanceColor;(f=new gz(g,h,l)).instanceMatrix=new gr(new Float32Array(m.array),16),void 0!==n&&(f.instanceColor=new gr(new Float32Array(n.array),n.itemSize));break;case"BatchedMesh":g=i(a.geometry),h=j(a.material),(f=new gX(a.maxInstanceCount,a.maxVertexCount,a.maxIndexCount,h)).geometry=g,f.perObjectFrustumCulled=a.perObjectFrustumCulled,f.sortObjects=a.sortObjects,f._drawRanges=a.drawRanges,f._reservedRanges=a.reservedRanges,f._geometryInfo=a.geometryInfo.map(a=>{let b=null,c=null;return void 0!==a.boundingBox&&(b=new eO().fromJSON(a.boundingBox)),void 0!==a.boundingSphere&&(c=new fl().fromJSON(a.boundingSphere)),{...a,boundingBox:b,boundingSphere:c}}),f._instanceInfo=a.instanceInfo,f._availableInstanceIds=a._availableInstanceIds,f._availableGeometryIds=a._availableGeometryIds,f._nextIndexStart=a.nextIndexStart,f._nextVertexStart=a.nextVertexStart,f._geometryCount=a.geometryCount,f._maxInstanceCount=a.maxInstanceCount,f._maxVertexCount=a.maxVertexCount,f._maxIndexCount=a.maxIndexCount,f._geometryInitialized=a.geometryInitialized,f._matricesTexture=k(a.matricesTexture.uuid),f._indirectTexture=k(a.indirectTexture.uuid),void 0!==a.colorsTexture&&(f._colorsTexture=k(a.colorsTexture.uuid)),void 0!==a.boundingSphere&&(f.boundingSphere=new fl().fromJSON(a.boundingSphere)),void 0!==a.boundingBox&&(f.boundingBox=new eO().fromJSON(a.boundingBox));break;case"LOD":f=new fU;break;case"Line":f=new g4(i(a.geometry),j(a.material));break;case"LineLoop":f=new g9(i(a.geometry),j(a.material));break;case"LineSegments":f=new g8(i(a.geometry),j(a.material));break;case"PointCloud":case"Points":f=new hf(i(a.geometry),j(a.material));break;case"Sprite":f=new fQ(j(a.material));break;case"Group":f=new eo;break;case"Bone":f=new gm;break;default:f=new en}if(f.uuid=a.uuid,void 0!==a.name&&(f.name=a.name),void 0!==a.matrix?(f.matrix.fromArray(a.matrix),void 0!==a.matrixAutoUpdate&&(f.matrixAutoUpdate=a.matrixAutoUpdate),f.matrixAutoUpdate&&f.matrix.decompose(f.position,f.quaternion,f.scale)):(void 0!==a.position&&f.position.fromArray(a.position),void 0!==a.rotation&&f.rotation.fromArray(a.rotation),void 0!==a.quaternion&&f.quaternion.fromArray(a.quaternion),void 0!==a.scale&&f.scale.fromArray(a.scale)),void 0!==a.up&&f.up.fromArray(a.up),void 0!==a.pivot&&(f.pivot=new dz().fromArray(a.pivot)),void 0!==a.morphTargetDictionary&&(f.morphTargetDictionary=Object.assign({},a.morphTargetDictionary)),void 0!==a.morphTargetInfluences&&(f.morphTargetInfluences=a.morphTargetInfluences.slice()),void 0!==a.castShadow&&(f.castShadow=a.castShadow),void 0!==a.receiveShadow&&(f.receiveShadow=a.receiveShadow),a.shadow&&(void 0!==a.shadow.intensity&&(f.shadow.intensity=a.shadow.intensity),void 0!==a.shadow.bias&&(f.shadow.bias=a.shadow.bias),void 0!==a.shadow.normalBias&&(f.shadow.normalBias=a.shadow.normalBias),void 0!==a.shadow.radius&&(f.shadow.radius=a.shadow.radius),void 0!==a.shadow.blurSamples&&(f.shadow.blurSamples=a.shadow.blurSamples),void 0!==a.shadow.focus&&(f.shadow.focus=a.shadow.focus),void 0!==a.shadow.aspect&&(f.shadow.aspect=a.shadow.aspect),void 0!==a.shadow.mapSize&&f.shadow.mapSize.fromArray(a.shadow.mapSize),void 0!==a.shadow.camera&&(f.shadow.camera=this.parseObject(a.shadow.camera))),void 0!==a.visible&&(f.visible=a.visible),void 0!==a.frustumCulled&&(f.frustumCulled=a.frustumCulled),void 0!==a.renderOrder&&(f.renderOrder=a.renderOrder),void 0!==a.static&&(f.static=a.static),void 0!==a.userData&&(f.userData=a.userData),void 0!==a.layers&&(f.layers.mask=a.layers),void 0!==a.children){let g=a.children;for(let a=0;a<g.length;a++)f.add(this.parseObject(g[a],b,c,d,e))}if(void 0!==a.animations){let b=a.animations;for(let a=0;a<b.length;a++){let c=b[a];f.animations.push(e[c])}}if("LOD"===a.type){void 0!==a.autoUpdate&&(f.autoUpdate=a.autoUpdate);let b=a.levels;for(let a=0;a<b.length;a++){let c=b[a],d=f.getObjectByProperty("uuid",c.object);void 0!==d&&f.addLevel(d,c.distance,c.hysteresis)}}return f}bindSkeletons(a,b){0!==Object.keys(b).length&&a.traverse(function(a){if(!0===a.isSkinnedMesh&&void 0!==a.skeleton){let c=b[a.skeleton];void 0===c?dg("ObjectLoader: No skeleton found with UUID:",a.skeleton):a.bind(c,a.bindMatrix)}})}bindLightTargets(a){a.traverse(function(b){if(b.isDirectionalLight||b.isSpotLight){let c=b.target,d=a.getObjectByProperty("uuid",c);void 0!==d?b.target=d:b.target=new en}})}}let j$={UVMapping:aL,CubeReflectionMapping:aM,CubeRefractionMapping:aN,EquirectangularReflectionMapping:aO,EquirectangularRefractionMapping:aP,CubeUVReflectionMapping:aQ},j_={RepeatWrapping:aR,ClampToEdgeWrapping:aS,MirroredRepeatWrapping:aT},j0={NearestFilter:aU,NearestMipmapNearestFilter:aV,NearestMipmapLinearFilter:aX,LinearFilter:aZ,LinearMipmapNearestFilter:a$,LinearMipmapLinearFilter:a0},j1=new WeakMap;class j2 extends jj{constructor(a){super(a),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&dg("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&dg("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(a){return this.options=a,this}load(a,b,c,d){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a),a=this.manager.resolveURL(a);let e=this,f=jf.get(`image-bitmap:${a}`);if(void 0!==f)return(e.manager.itemStart(a),f.then)?void f.then(c=>{!0===j1.has(f)?(d&&d(j1.get(f)),e.manager.itemError(a)):b&&b(c),e.manager.itemEnd(a)}):void setTimeout(function(){b&&b(f),e.manager.itemEnd(a)},0);let g={};g.credentials="anonymous"===this.crossOrigin?"same-origin":"include",g.headers=this.requestHeader,g.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let h=fetch(a,g).then(function(a){return a.blob()}).then(function(a){return createImageBitmap(a,Object.assign({},e.options,{colorSpaceConversion:"none"}))}).then(function(c){return jf.add(`image-bitmap:${a}`,c),b&&b(c),e.manager.itemEnd(a),c}).catch(function(b){d&&d(b),j1.set(h,b),jf.remove(`image-bitmap:${a}`),e.manager.itemError(a),e.manager.itemEnd(a)});jf.add(`image-bitmap:${a}`,h),e.manager.itemStart(a)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class j3{static getContext(){return void 0===f&&(f=new(window.AudioContext||window.webkitAudioContext)),f}static setContext(a){f=a}}class j4 extends jj{constructor(a){super(a)}load(a,b,c,d){let e=this,f=new jm(this.manager);function g(b){d?d(b):dh(b),e.manager.itemError(a)}f.setResponseType("arraybuffer"),f.setPath(this.path),f.setRequestHeader(this.requestHeader),f.setWithCredentials(this.withCredentials),f.load(a,function(c){try{let d=c.slice(0),f=j3.getContext(),h=a+"#decode";e.manager.itemStart(h),f.decodeAudioData(d,function(a){b(a),e.manager.itemEnd(h)}).catch(function(a){g(a),e.manager.itemEnd(h)})}catch(a){g(a)}},c,d)}}let j5=new dY,j6=new dY,j7=new dY;class j8{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new jH,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new jH,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(a){let b=this._cache;if(b.focus!==a.focus||b.fov!==a.fov||b.aspect!==a.aspect*this.aspect||b.near!==a.near||b.far!==a.far||b.zoom!==a.zoom||b.eyeSep!==this.eyeSep){let c,d;b.focus=a.focus,b.fov=a.fov,b.aspect=a.aspect*this.aspect,b.near=a.near,b.far=a.far,b.zoom=a.zoom,b.eyeSep=this.eyeSep,j7.copy(a.projectionMatrix);let e=b.eyeSep/2,f=e*b.near/b.focus,g=b.near*Math.tan(dn*b.fov*.5)/b.zoom;j6.elements[12]=-e,j5.elements[12]=e,c=-g*b.aspect+f,d=g*b.aspect+f,j7.elements[0]=2*b.near/(d-c),j7.elements[8]=(d+c)/(d-c),this.cameraL.projectionMatrix.copy(j7),c=-g*b.aspect-f,d=g*b.aspect-f,j7.elements[0]=2*b.near/(d-c),j7.elements[8]=(d+c)/(d-c),this.cameraR.projectionMatrix.copy(j7)}this.cameraL.matrix.copy(a.matrixWorld).multiply(j6),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(a.matrixWorld).multiply(j5),this.cameraR.matrixWorldNeedsUpdate=!0}}class j9 extends en{constructor(a,b,c){super(),this.type="CubeCamera",this.renderTarget=c,this.coordinateSystem=null,this.activeMipmapLevel=0;const d=new jH(-90,1,a,b);d.layers=this.layers,this.add(d);const e=new jH(-90,1,a,b);e.layers=this.layers,this.add(e);const f=new jH(-90,1,a,b);f.layers=this.layers,this.add(f);const g=new jH(-90,1,a,b);g.layers=this.layers,this.add(g);const h=new jH(-90,1,a,b);h.layers=this.layers,this.add(h);const i=new jH(-90,1,a,b);i.layers=this.layers,this.add(i)}updateCoordinateSystem(){let a=this.coordinateSystem,b=this.children.concat(),[c,d,e,f,g,h]=b;for(let a of b)this.remove(a);if(a===c$)c.up.set(0,1,0),c.lookAt(1,0,0),d.up.set(0,1,0),d.lookAt(-1,0,0),e.up.set(0,0,-1),e.lookAt(0,1,0),f.up.set(0,0,1),f.lookAt(0,-1,0),g.up.set(0,1,0),g.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(a===c_)c.up.set(0,-1,0),c.lookAt(-1,0,0),d.up.set(0,-1,0),d.lookAt(1,0,0),e.up.set(0,0,1),e.lookAt(0,1,0),f.up.set(0,0,-1),f.lookAt(0,-1,0),g.up.set(0,-1,0),g.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+a);for(let a of b)this.add(a),a.updateMatrixWorld()}update(a,b){null===this.parent&&this.updateMatrixWorld();let{renderTarget:c,activeMipmapLevel:d}=this;this.coordinateSystem!==a.coordinateSystem&&(this.coordinateSystem=a.coordinateSystem,this.updateCoordinateSystem());let[e,f,g,h,i,j]=this.children,k=a.getRenderTarget(),l=a.getActiveCubeFace(),m=a.getActiveMipmapLevel(),n=a.xr.enabled;a.xr.enabled=!1;let o=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;let p=!1;p=!0===a.isWebGLRenderer?a.state.buffers.depth.getReversed():a.reversedDepthBuffer,a.setRenderTarget(c,0,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,e),a.setRenderTarget(c,1,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,f),a.setRenderTarget(c,2,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,g),a.setRenderTarget(c,3,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,h),a.setRenderTarget(c,4,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,i),c.texture.generateMipmaps=o,a.setRenderTarget(c,5,d),p&&!1===a.autoClear&&a.clearDepth(),a.render(b,j),a.setRenderTarget(k,l,m),a.xr.enabled=n,c.texture.needsPMREMUpdate=!0}}class ka extends jH{constructor(a=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=a}}class kb{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(a){this._document=a,void 0!==a.hidden&&(this._pageVisibilityHandler=kc.bind(this),a.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(a){return this._timescale=a,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(a){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==a?a:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function kc(){!1===this._document.hidden&&this.reset()}let kd=new dz,ke=new dy,kf=new dz,kg=new dz,kh=new dz;class ki extends en{constructor(){super(),this.type="AudioListener",this.context=j3.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new kb}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(a){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=a,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(a){return this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01),this}updateMatrixWorld(a){super.updateMatrixWorld(a),this._timer.update();let b=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(kd,ke,kf),kg.set(0,0,-1).applyQuaternion(ke),kh.set(0,1,0).applyQuaternion(ke),b.positionX){let a=this.context.currentTime+this.timeDelta;b.positionX.linearRampToValueAtTime(kd.x,a),b.positionY.linearRampToValueAtTime(kd.y,a),b.positionZ.linearRampToValueAtTime(kd.z,a),b.forwardX.linearRampToValueAtTime(kg.x,a),b.forwardY.linearRampToValueAtTime(kg.y,a),b.forwardZ.linearRampToValueAtTime(kg.z,a),b.upX.linearRampToValueAtTime(kh.x,a),b.upY.linearRampToValueAtTime(kh.y,a),b.upZ.linearRampToValueAtTime(kh.z,a)}else b.setPosition(kd.x,kd.y,kd.z),b.setOrientation(kg.x,kg.y,kg.z,kh.x,kh.y,kh.z)}}class kj extends en{constructor(a){super(),this.type="Audio",this.listener=a,this.context=a.context,this.gain=this.context.createGain(),this.gain.connect(a.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(a){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=a,this.connect(),this}setMediaElementSource(a){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(a),this.connect(),this}setMediaStreamSource(a){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(a),this.connect(),this}setBuffer(a){return this.buffer=a,this.sourceType="buffer",this.autoplay&&this.play(),this}play(a=0){if(!0===this.isPlaying)return void dg("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void dg("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+a;let b=this.context.createBufferSource();return b.buffer=this.buffer,b.loop=this.loop,b.loopStart=this.loopStart,b.loopEnd=this.loopEnd,b.onended=this.onEnded.bind(this),b.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=b,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){return!1===this.hasPlaybackControl?void dg("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(a=0){return!1===this.hasPlaybackControl?void dg("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+a),this.source.onended=null),this.isPlaying=!1,this)}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let a=1,b=this.filters.length;a<b;a++)this.filters[a-1].connect(this.filters[a]);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 a=1,b=this.filters.length;a<b;a++)this.filters[a-1].disconnect(this.filters[a]);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(a){return a||(a=[]),!0===this._connected?(this.disconnect(),this.filters=a.slice(),this.connect()):this.filters=a.slice(),this}setDetune(a){return this.detune=a,!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(a){return this.setFilters(a?[a]:[])}setPlaybackRate(a){return!1===this.hasPlaybackControl?void dg("Audio: this Audio has no playback control."):(this.playbackRate=a,!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?(dg("Audio: this Audio has no playback control."),!1):this.loop}setLoop(a){return!1===this.hasPlaybackControl?void dg("Audio: this Audio has no playback control."):(this.loop=a,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(a){return this.loopStart=a,this}setLoopEnd(a){return this.loopEnd=a,this}getVolume(){return this.gain.gain.value}setVolume(a){return this.gain.gain.setTargetAtTime(a,this.context.currentTime,.01),this}copy(a,b){return(super.copy(a,b),"buffer"!==a.sourceType)?dg("Audio: Audio source type cannot be copied."):(this.autoplay=a.autoplay,this.buffer=a.buffer,this.detune=a.detune,this.loop=a.loop,this.loopStart=a.loopStart,this.loopEnd=a.loopEnd,this.offset=a.offset,this.duration=a.duration,this.playbackRate=a.playbackRate,this.hasPlaybackControl=a.hasPlaybackControl,this.sourceType=a.sourceType,this.filters=a.filters.slice()),this}clone(a){return new this.constructor(this.listener).copy(this,a)}}let kk=new dz,kl=new dy,km=new dz,kn=new dz;class ko extends kj{constructor(a){super(a),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(a){return this.panner.refDistance=a,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(a){return this.panner.rolloffFactor=a,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(a){return this.panner.distanceModel=a,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(a){return this.panner.maxDistance=a,this}setDirectionalCone(a,b,c){return this.panner.coneInnerAngle=a,this.panner.coneOuterAngle=b,this.panner.coneOuterGain=c,this}updateMatrixWorld(a){if(super.updateMatrixWorld(a),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(kk,kl,km),kn.set(0,0,1).applyQuaternion(kl);let b=this.panner;if(b.positionX){let a=this.context.currentTime+this.listener.timeDelta;b.positionX.linearRampToValueAtTime(kk.x,a),b.positionY.linearRampToValueAtTime(kk.y,a),b.positionZ.linearRampToValueAtTime(kk.z,a),b.orientationX.linearRampToValueAtTime(kn.x,a),b.orientationY.linearRampToValueAtTime(kn.y,a),b.orientationZ.linearRampToValueAtTime(kn.z,a)}else b.setPosition(kk.x,kk.y,kk.z),b.setOrientation(kn.x,kn.y,kn.z)}}class kp{constructor(a,b=2048){this.analyser=a.context.createAnalyser(),this.analyser.fftSize=b,this.data=new Uint8Array(this.analyser.frequencyBinCount),a.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let a=0,b=this.getFrequencyData();for(let c=0;c<b.length;c++)a+=b[c];return a/b.length}}class kq{constructor(a,b,c){let d,e,f;switch(this.binding=a,this.valueSize=c,b){case"quaternion":d=this._slerp,e=this._slerpAdditive,f=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*c),this._workIndex=5;break;case"string":case"bool":d=this._select,e=this._select,f=this._setAdditiveIdentityOther,this.buffer=Array(5*c);break;default:d=this._lerp,e=this._lerpAdditive,f=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*c)}this._mixBufferRegion=d,this._mixBufferRegionAdditive=e,this._setIdentity=f,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(a,b){let c=this.buffer,d=this.valueSize,e=a*d+d,f=this.cumulativeWeight;if(0===f){for(let a=0;a!==d;++a)c[e+a]=c[a];f=b}else{f+=b;let a=b/f;this._mixBufferRegion(c,e,0,a,d)}this.cumulativeWeight=f}accumulateAdditive(a){let b=this.buffer,c=this.valueSize,d=c*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(b,d,0,a,c),this.cumulativeWeightAdditive+=a}apply(a){let b=this.valueSize,c=this.buffer,d=a*b+b,e=this.cumulativeWeight,f=this.cumulativeWeightAdditive,g=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,e<1){let a=b*this._origIndex;this._mixBufferRegion(c,d,a,1-e,b)}f>0&&this._mixBufferRegionAdditive(c,d,this._addIndex*b,1,b);for(let a=b,e=b+b;a!==e;++a)if(c[a]!==c[a+b]){g.setValue(c,d);break}}saveOriginalState(){let a=this.binding,b=this.buffer,c=this.valueSize,d=c*this._origIndex;a.getValue(b,d);for(let a=c;a!==d;++a)b[a]=b[d+a%c];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let a=3*this.valueSize;this.binding.setValue(this.buffer,a)}_setAdditiveIdentityNumeric(){let a=this._addIndex*this.valueSize,b=a+this.valueSize;for(let c=a;c<b;c++)this.buffer[c]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let a=this._origIndex*this.valueSize,b=this._addIndex*this.valueSize;for(let c=0;c<this.valueSize;c++)this.buffer[b+c]=this.buffer[a+c]}_select(a,b,c,d,e){if(d>=.5)for(let d=0;d!==e;++d)a[b+d]=a[c+d]}_slerp(a,b,c,d){dy.slerpFlat(a,b,a,b,a,c,d)}_slerpAdditive(a,b,c,d,e){let f=this._workIndex*e;dy.multiplyQuaternionsFlat(a,f,a,b,a,c),dy.slerpFlat(a,b,a,b,a,f,d)}_lerp(a,b,c,d,e){let f=1-d;for(let g=0;g!==e;++g){let e=b+g;a[e]=a[e]*f+a[c+g]*d}}_lerpAdditive(a,b,c,d,e){for(let f=0;f!==e;++f){let e=b+f;a[e]=a[e]+a[c+f]*d}}}let kr="\\[\\]\\.:\\/",ks=RegExp("["+kr+"]","g"),kt="[^"+kr+"]",ku="[^"+kr.replace("\\.","")+"]",kv=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",kt)+/(WCOD+)?/.source.replace("WCOD",ku)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kt)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kt)+"$"),kw=["material","materials","bones","map"];class kx{constructor(a,b,c){const d=c||ky.parseTrackName(b);this._targetGroup=a,this._bindings=a.subscribe_(b,d)}getValue(a,b){this.bind();let c=this._targetGroup.nCachedObjects_,d=this._bindings[c];void 0!==d&&d.getValue(a,b)}setValue(a,b){let c=this._bindings;for(let d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)}bind(){let a=this._bindings;for(let b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()}unbind(){let a=this._bindings;for(let b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}}class ky{constructor(a,b,c){this.path=b,this.parsedPath=c||ky.parseTrackName(b),this.node=ky.findNode(a,this.parsedPath.nodeName),this.rootNode=a,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(a,b,c){return a&&a.isAnimationObjectGroup?new ky.Composite(a,b,c):new ky(a,b,c)}static sanitizeNodeName(a){return a.replace(/\s/g,"_").replace(ks,"")}static parseTrackName(a){let b=kv.exec(a);if(null===b)throw Error("THREE.PropertyBinding: Cannot parse trackName: "+a);let c={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]},d=c.nodeName&&c.nodeName.lastIndexOf(".");if(void 0!==d&&-1!==d){let a=c.nodeName.substring(d+1);-1!==kw.indexOf(a)&&(c.nodeName=c.nodeName.substring(0,d),c.objectName=a)}if(null===c.propertyName||0===c.propertyName.length)throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+a);return c}static findNode(a,b){if(void 0===b||""===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){let c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){let c=function(a){for(let d=0;d<a.length;d++){let e=a[d];if(e.name===b||e.uuid===b)return e;let f=c(e.children);if(f)return f}return null},d=c(a.children);if(d)return d}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(a,b){a[b]=this.targetObject[this.propertyName]}_getValue_array(a,b){let c=this.resolvedProperty;for(let d=0,e=c.length;d!==e;++d)a[b++]=c[d]}_getValue_arrayElement(a,b){a[b]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(a,b){this.resolvedProperty.toArray(a,b)}_setValue_direct(a,b){this.targetObject[this.propertyName]=a[b]}_setValue_direct_setNeedsUpdate(a,b){this.targetObject[this.propertyName]=a[b],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(a,b){this.targetObject[this.propertyName]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(a,b){let c=this.resolvedProperty;for(let d=0,e=c.length;d!==e;++d)c[d]=a[b++]}_setValue_array_setNeedsUpdate(a,b){let c=this.resolvedProperty;for(let d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(a,b){let c=this.resolvedProperty;for(let d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(a,b){this.resolvedProperty[this.propertyIndex]=a[b]}_setValue_arrayElement_setNeedsUpdate(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(a,b){this.resolvedProperty.fromArray(a,b)}_setValue_fromArray_setNeedsUpdate(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(a,b){this.bind(),this.getValue(a,b)}_setValue_unbound(a,b){this.bind(),this.setValue(a,b)}bind(){let a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;if(a||(a=ky.findNode(this.rootNode,b.nodeName),this.node=a),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!a)return void dg("PropertyBinding: No target node found for track: "+this.path+".");if(c){let d=b.objectIndex;switch(c){case"materials":if(!a.material)return void dh("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!a.material.materials)return void dh("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);a=a.material.materials;break;case"bones":if(!a.skeleton)return void dh("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);a=a.skeleton.bones;for(let b=0;b<a.length;b++)if(a[b].name===d){d=b;break}break;case"map":if("map"in a){a=a.map;break}if(!a.material)return void dh("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!a.material.map)return void dh("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);a=a.material.map;break;default:if(void 0===a[c])return void dh("PropertyBinding: Can not bind to objectName of node undefined.",this);a=a[c]}if(void 0!==d){if(void 0===a[d])return void dh("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,a);a=a[d]}}let f=a[d];if(void 0===f)return void dh("PropertyBinding: Trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",a);let g=this.Versioning.None;this.targetObject=a,!0===a.isMaterial?g=this.Versioning.NeedsUpdate:!0===a.isObject3D&&(g=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry)return void dh("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!a.geometry.morphAttributes)return void dh("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==a.morphTargetDictionary[e]&&(e=a.morphTargetDictionary[e])}h=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(h=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=d;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][g]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}ky.Composite=kx,ky.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},ky.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},ky.prototype.GetterByBindingType=[ky.prototype._getValue_direct,ky.prototype._getValue_array,ky.prototype._getValue_arrayElement,ky.prototype._getValue_toArray],ky.prototype.SetterByBindingTypeAndVersioning=[[ky.prototype._setValue_direct,ky.prototype._setValue_direct_setNeedsUpdate,ky.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ky.prototype._setValue_array,ky.prototype._setValue_array_setNeedsUpdate,ky.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ky.prototype._setValue_arrayElement,ky.prototype._setValue_arrayElement_setNeedsUpdate,ky.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ky.prototype._setValue_fromArray,ky.prototype._setValue_fromArray_setNeedsUpdate,ky.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class kz{constructor(){this.isAnimationObjectGroup=!0,this.uuid=dq(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const a={};this._indicesByUUID=a;for(let b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const b=this;this.stats={objects:{get total(){return b._objects.length},get inUse(){return this.total-b.nCachedObjects_}},get bindingsPerObject(){return b._bindings.length}}}add(){let a=this._objects,b=this._indicesByUUID,c=this._paths,d=this._parsedPaths,e=this._bindings,f=e.length,g,h=a.length,i=this.nCachedObjects_;for(let j=0,k=arguments.length;j!==k;++j){let k=arguments[j],l=k.uuid,m=b[l];if(void 0===m){m=h++,b[l]=m,a.push(k);for(let a=0;a!==f;++a)e[a].push(new ky(k,c[a],d[a]))}else if(m<i){g=a[m];let h=--i,j=a[h];b[j.uuid]=m,a[m]=j,b[l]=h,a[h]=k;for(let a=0;a!==f;++a){let b=e[a],f=b[h],g=b[m];b[m]=f,void 0===g&&(g=new ky(k,c[a],d[a])),b[h]=g}}else a[m]!==g&&dh("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=i}remove(){let a=this._objects,b=this._indicesByUUID,c=this._bindings,d=c.length,e=this.nCachedObjects_;for(let f=0,g=arguments.length;f!==g;++f){let g=arguments[f],h=g.uuid,i=b[h];if(void 0!==i&&i>=e){let f=e++,j=a[f];b[j.uuid]=i,a[i]=j,b[h]=f,a[f]=g;for(let a=0;a!==d;++a){let b=c[a],d=b[f],e=b[i];b[i]=d,b[f]=e}}}this.nCachedObjects_=e}uncache(){let a=this._objects,b=this._indicesByUUID,c=this._bindings,d=c.length,e=this.nCachedObjects_,f=a.length;for(let g=0,h=arguments.length;g!==h;++g){let h=arguments[g],i=h.uuid,j=b[i];if(void 0!==j)if(delete b[i],j<e){let g=--e,h=a[g],i=--f,k=a[i];j!==g&&(b[h.uuid]=j),a[j]=h,g!==i&&(b[k.uuid]=g),a[g]=k,a.pop();for(let a=0;a!==d;++a){let b=c[a],d=b[g],e=b[i];b[j]=d,b[g]=e,b.pop()}}else{let e=--f,g=a[e];j!==e&&(b[g.uuid]=j),a[j]=g,a.pop();for(let a=0;a!==d;++a){let b=c[a];b[j]=b[e],b.pop()}}}this.nCachedObjects_=e}subscribe_(a,b){let c=this._bindingsIndicesByPath,d=c[a],e=this._bindings;if(void 0!==d)return e[d];let f=this._paths,g=this._parsedPaths,h=this._objects,i=h.length,j=this.nCachedObjects_,k=Array(i);d=e.length,c[a]=d,f.push(a),g.push(b),e.push(k);for(let c=j,d=h.length;c!==d;++c){let d=h[c];k[c]=new ky(d,a,b)}return k}unsubscribe_(a){let b=this._bindingsIndicesByPath,c=b[a];if(void 0!==c){let a=this._paths,d=this._parsedPaths,e=this._bindings,f=e.length-1,g=e[f];b[a[f]]=c,e[c]=g,e.pop(),d[c]=d[f],d.pop(),a[c]=a[f],a.pop()}}}class kA{constructor(a,b,c=null,d=b.blendMode){this._mixer=a,this._clip=b,this._localRoot=c,this.blendMode=d;const e=b.tracks,f=e.length,g=Array(f),h={endingStart:b5,endingEnd:b5};for(let a=0;a!==f;++a){const b=e[a].createInterpolant(null);g[a]=b,b.settings=h}this._interpolantSettings=h,this._interpolants=g,this._propertyBindings=Array(f),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=b_,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(a){return this._startTime=a,this}setLoop(a,b){return this.loop=a,this.repetitions=b,this}setEffectiveWeight(a){return this.weight=a,this._effectiveWeight=this.enabled?a:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(a){return this._scheduleFading(a,0,1)}fadeOut(a){return this._scheduleFading(a,1,0)}crossFadeFrom(a,b,c=!1){if(a.fadeOut(b),this.fadeIn(b),!0===c){let c=this._clip.duration,d=a._clip.duration;a._restoreTimeScale=a.timeScale,this._restoreTimeScale=this.timeScale,a.warp(1,d/c,b),this.warp(c/d,1,b)}return this}crossFadeTo(a,b,c=!1){return a.crossFadeFrom(this,b,c)}stopFading(){let a=this._weightInterpolant;return null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this}setEffectiveTimeScale(a){return this.timeScale=a,this._effectiveTimeScale=this.paused?0:a,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(a){return this.timeScale=this._clip.duration/a,this.stopWarping()}syncWith(a){return this.time=a.time,this.timeScale=a.timeScale,this.stopWarping()}halt(a){return this.warp(this._effectiveTimeScale,0,a)}warp(a,b,c){let d=this._mixer,e=d.time,f=this.timeScale,g=this._timeScaleInterpolant;null===g&&(g=d._lendControlInterpolant(),this._timeScaleInterpolant=g);let h=g.parameterPositions,i=g.sampleValues;return h[0]=e,h[1]=e+c,i[0]=a/f,i[1]=b/f,this}stopWarping(){let a=this._timeScaleInterpolant;return null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(a,b,c,d){if(!this.enabled)return void this._updateWeight(a);let e=this._startTime;if(null!==e){let d=(a-e)*c;d<0||0===c?b=0:(this._startTime=null,b=c*d)}b*=this._updateTimeScale(a);let f=this._updateTime(b),g=this._updateWeight(a);if(g>0){let a=this._interpolants,b=this._propertyBindings;if(this.blendMode===b9)for(let c=0,d=a.length;c!==d;++c)a[c].evaluate(f),b[c].accumulateAdditive(g);else for(let c=0,e=a.length;c!==e;++c)a[c].evaluate(f),b[c].accumulate(d,g)}}_updateWeight(a){let b=0;if(this.enabled){b=this.weight;let c=this._weightInterpolant;if(null!==c){let d=c.evaluate(a)[0];b*=d,a>c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b,b}_updateTimeScale(a){let b=0;if(!this.paused){b=this.timeScale;let c=this._timeScaleInterpolant;null!==c&&(b*=c.evaluate(a)[0],a>c.parameterPositions[1]&&(0===b?this.paused=!0:(null!==this._restoreTimeScale&&(b=this._restoreTimeScale),this.timeScale=b),this.stopWarping()))}return this._effectiveTimeScale=b,b}_updateTime(a){let b=this._clip.duration,c=this.loop,d=this.time+a,e=this._loopCount,f=c===b0;if(0===a)return -1===e?d:f&&(1&e)==1?b-d:d;if(c===b$){-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(d>=b)d=b;else if(d<0)d=0;else{this.time=d;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=d,this._mixer.dispatchEvent({type:"finished",action:this,direction:a<0?-1:1})}}else{if(-1===e&&(a>=0?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f)),d>=b||d<0){let c=Math.floor(d/b);d-=b*c,e+=Math.abs(c);let g=this.repetitions-e;if(g<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,d=a>0?b:0,this.time=d,this._mixer.dispatchEvent({type:"finished",action:this,direction:a>0?1:-1});else{if(1===g){let b=a<0;this._setEndings(b,!b,f)}else this._setEndings(!1,!1,f);this._loopCount=e,this.time=d,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this._loopCount=e,this.time=d;if(f&&(1&e)==1)return b-d}return d}_setEndings(a,b,c){let d=this._interpolantSettings;c?(d.endingStart=b6,d.endingEnd=b6):(a?d.endingStart=this.zeroSlopeAtStart?b6:b5:d.endingStart=b7,b?d.endingEnd=this.zeroSlopeAtEnd?b6:b5:d.endingEnd=b7)}_scheduleFading(a,b,c){let d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(f=d._lendControlInterpolant(),this._weightInterpolant=f);let g=f.parameterPositions,h=f.sampleValues;return g[0]=e,h[0]=b,g[1]=e+a,h[1]=c,this}}let kB=new Float32Array(1);class kC extends dk{constructor(a){super(),this._root=a,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(a,b){let c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,h=c.uuid,i=this._bindingsByRootAndName,j=i[h];void 0===j&&(j={},i[h]=j);for(let a=0;a!==e;++a){let e=d[a],i=e.name,k=j[i];if(void 0!==k)++k.referenceCount,f[a]=k;else{if(void 0!==(k=f[a])){null===k._cacheIndex&&(++k.referenceCount,this._addInactiveBinding(k,h,i));continue}let d=b&&b._propertyBindings[a].binding.parsedPath;k=new kq(ky.create(c,i,d),e.ValueTypeName,e.getValueSize()),++k.referenceCount,this._addInactiveBinding(k,h,i),f[a]=k}g[a].resultBuffer=k.buffer}}_activateAction(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){let b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]),this._addInactiveAction(a,c,b)}let b=a._propertyBindings;for(let a=0,c=b.length;a!==c;++a){let c=b[a];0==c.useCount++&&(this._lendBinding(c),c.saveOriginalState())}this._lendAction(a)}}_deactivateAction(a){if(this._isActiveAction(a)){let b=a._propertyBindings;for(let a=0,c=b.length;a!==c;++a){let c=b[a];0==--c.useCount&&(c.restoreOriginalState(),this._takeBackBinding(c))}this._takeBackAction(a)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}_isActiveAction(a){let b=a._cacheIndex;return null!==b&&b<this._nActiveActions}_addInactiveAction(a,b,c){let d=this._actions,e=this._actionsByClip,f=e[b];if(void 0===f)f={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,e[b]=f;else{let b=f.knownActions;a._byClipCacheIndex=b.length,b.push(a)}a._cacheIndex=d.length,d.push(a),f.actionByRoot[c]=a}_removeInactiveAction(a){let b=this._actions,c=b[b.length-1],d=a._cacheIndex;c._cacheIndex=d,b[d]=c,b.pop(),a._cacheIndex=null;let e=a._clip.uuid,f=this._actionsByClip,g=f[e],h=g.knownActions,i=h[h.length-1],j=a._byClipCacheIndex;i._byClipCacheIndex=j,h[j]=i,h.pop(),a._byClipCacheIndex=null;let k=g.actionByRoot,l=(a._localRoot||this._root).uuid;delete k[l],0===h.length&&delete f[e],this._removeInactiveBindingsForAction(a)}_removeInactiveBindingsForAction(a){let b=a._propertyBindings;for(let a=0,c=b.length;a!==c;++a){let c=b[a];0==--c.referenceCount&&this._removeInactiveBinding(c)}}_lendAction(a){let b=this._actions,c=a._cacheIndex,d=this._nActiveActions++,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e}_takeBackAction(a){let b=this._actions,c=a._cacheIndex,d=--this._nActiveActions,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e}_addInactiveBinding(a,b,c){let d=this._bindingsByRootAndName,e=this._bindings,f=d[b];void 0===f&&(f={},d[b]=f),f[c]=a,a._cacheIndex=e.length,e.push(a)}_removeInactiveBinding(a){let b=this._bindings,c=a.binding,d=c.rootNode.uuid,e=c.path,f=this._bindingsByRootAndName,g=f[d],h=b[b.length-1],i=a._cacheIndex;h._cacheIndex=i,b[i]=h,b.pop(),delete g[e],0===Object.keys(g).length&&delete f[d]}_lendBinding(a){let b=this._bindings,c=a._cacheIndex,d=this._nActiveBindings++,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e}_takeBackBinding(a){let b=this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e}_lendControlInterpolant(){let a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];return void 0===c&&((c=new i1(new Float32Array(2),new Float32Array(2),1,kB)).__cacheIndex=b,a[b]=c),c}_takeBackControlInterpolant(a){let b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,e=b[d];a.__cacheIndex=d,b[d]=a,e.__cacheIndex=c,b[c]=e}clipAction(a,b,c){let d=b||this._root,e=d.uuid,f="string"==typeof a?je.findByName(d,a):a,g=null!==f?f.uuid:a,h=this._actionsByClip[g],i=null;if(void 0===c&&(c=null!==f?f.blendMode:b8),void 0!==h){let a=h.actionByRoot[e];if(void 0!==a&&a.blendMode===c)return a;i=h.knownActions[0],null===f&&(f=i._clip)}if(null===f)return null;let j=new kA(this,f,b,c);return this._bindAction(j,i),this._addInactiveAction(j,g,e),j}existingAction(a,b){let c=b||this._root,d=c.uuid,e="string"==typeof a?je.findByName(c,a):a,f=e?e.uuid:a,g=this._actionsByClip[f];return void 0!==g&&g.actionByRoot[d]||null}stopAllAction(){let a=this._actions,b=this._nActiveActions;for(let c=b-1;c>=0;--c)a[c].stop();return this}update(a){a*=this.timeScale;let b=this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1;for(let g=0;g!==c;++g)b[g]._update(d,a,e,f);let g=this._bindings,h=this._nActiveBindings;for(let a=0;a!==h;++a)g[a].apply(f);return this}setTime(a){this.time=0;for(let a=0;a<this._actions.length;a++)this._actions[a].time=0;return this.update(a)}getRoot(){return this._root}uncacheClip(a){let b=this._actions,c=a.uuid,d=this._actionsByClip,e=d[c];if(void 0!==e){let a=e.knownActions;for(let c=0,d=a.length;c!==d;++c){let d=a[c];this._deactivateAction(d);let e=d._cacheIndex,f=b[b.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,f._cacheIndex=e,b[e]=f,b.pop(),this._removeInactiveBindingsForAction(d)}delete d[c]}}uncacheRoot(a){let b=a.uuid,c=this._actionsByClip;for(let a in c){let d=c[a].actionByRoot[b];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}let d=this._bindingsByRootAndName[b];if(void 0!==d)for(let a in d){let b=d[a];b.restoreOriginalState(),this._removeInactiveBinding(b)}}uncacheAction(a,b){let c=this.existingAction(a,b);null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}}class kD extends dS{constructor(a=1,b=1,c=1,d={}){super(a,b,d),this.isRenderTarget3D=!0,this.depth=c;for(let d=0;d<this.textures.length;d++){const e=new dW(null,a,b,c);e.isRenderTargetTexture=!0,e.renderTarget=this,this.textures[d]=e}this._setTextureOptions(d)}}class kE{constructor(a){this.value=a}clone(){return new kE(void 0===this.value.clone?this.value:this.value.clone())}}let kF=0;class kG extends dk{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:kF++}),this.name="",this.usage=cP,this.uniforms=[]}add(a){return this.uniforms.push(a),this}remove(a){let b=this.uniforms.indexOf(a);return -1!==b&&this.uniforms.splice(b,1),this}setName(a){return this.name=a,this}setUsage(a){return this.usage=a,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(a){this.name=a.name,this.usage=a.usage;let b=a.uniforms;this.uniforms.length=0;for(let a=0,c=b.length;a<c;a++){let c=Array.isArray(b[a])?b[a]:[b[a]];for(let a=0;a<c.length;a++)this.uniforms.push(c[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class kH extends fu{constructor(a,b,c=1){super(a,b),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=c}copy(a){return super.copy(a),this.meshPerAttribute=a.meshPerAttribute,this}clone(a){let b=super.clone(a);return b.meshPerAttribute=this.meshPerAttribute,b}toJSON(a){let b=super.toJSON(a);return b.isInstancedInterleavedBuffer=!0,b.meshPerAttribute=this.meshPerAttribute,b}}class kI{constructor(a,b,c,d,e,f=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=a,this.type=b,this.itemSize=c,this.elementSize=d,this.count=e,this.normalized=f,this.version=0}set needsUpdate(a){!0===a&&this.version++}setBuffer(a){return this.buffer=a,this}setType(a,b){return this.type=a,this.elementSize=b,this}setItemSize(a){return this.itemSize=a,this}setCount(a){return this.count=a,this}}let kJ=new dY;class kK{constructor(a,b,c=0,d=1/0){this.ray=new fZ(a,b),this.near=c,this.far=d,this.camera=null,this.layers=new d7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(a,b){this.ray.set(a,b)}setFromCamera(a,b){b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize(),this.camera=b):b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,b.projectionMatrix.elements[14]).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld),this.camera=b):dh("Raycaster: Unsupported camera type: "+b.type)}setFromXRController(a){return kJ.identity().extractRotation(a.matrixWorld),this.ray.origin.setFromMatrixPosition(a.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(kJ),this}intersectObject(a,b=!0,c=[]){return kM(a,this,c,b),c.sort(kL),c}intersectObjects(a,b=!0,c=[]){for(let d=0,e=a.length;d<e;d++)kM(a[d],this,c,b);return c.sort(kL),c}}function kL(a,b){return a.distance-b.distance}function kM(a,b,c,d){let e=!0;if(a.layers.test(b.layers)&&!1===a.raycast(b,c)&&(e=!1),!0===e&&!0===d){let d=a.children;for(let a=0,e=d.length;a<e;a++)kM(d[a],b,c,!0)}}class kN{constructor(a=!0){this.autoStart=a,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,dg("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 a=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let b=performance.now();a=(b-this.oldTime)/1e3,this.oldTime=b,this.elapsedTime+=a}return a}}class kO{constructor(a=1,b=0,c=0){this.radius=a,this.phi=b,this.theta=c}set(a,b,c){return this.radius=a,this.phi=b,this.theta=c,this}copy(a){return this.radius=a.radius,this.phi=a.phi,this.theta=a.theta,this}makeSafe(){return this.phi=dr(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(a){return this.setFromCartesianCoords(a.x,a.y,a.z)}setFromCartesianCoords(a,b,c){return this.radius=Math.sqrt(a*a+b*b+c*c),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(a,c),this.phi=Math.acos(dr(b/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class kP{constructor(a=1,b=0,c=0){this.radius=a,this.theta=b,this.y=c}set(a,b,c){return this.radius=a,this.theta=b,this.y=c,this}copy(a){return this.radius=a.radius,this.theta=a.theta,this.y=a.y,this}setFromVector3(a){return this.setFromCartesianCoords(a.x,a.y,a.z)}setFromCartesianCoords(a,b,c){return this.radius=Math.sqrt(a*a+c*c),this.theta=Math.atan2(a,c),this.y=b,this}clone(){return new this.constructor().copy(this)}}class kQ{static{kQ.prototype.isMatrix2=!0}constructor(a,b,c,d){this.elements=[1,0,0,1],void 0!==a&&this.set(a,b,c,d)}identity(){return this.set(1,0,0,1),this}fromArray(a,b=0){for(let c=0;c<4;c++)this.elements[c]=a[c+b];return this}set(a,b,c,d){let e=this.elements;return e[0]=a,e[2]=b,e[1]=c,e[3]=d,this}}let kR=new dx;class kS{constructor(a=new dx(Infinity,Infinity),b=new dx(-1/0,-1/0)){this.isBox2=!0,this.min=a,this.max=b}set(a,b){return this.min.copy(a),this.max.copy(b),this}setFromPoints(a){this.makeEmpty();for(let b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this}setFromCenterAndSize(a,b){let c=kR.copy(b).multiplyScalar(.5);return this.min.copy(a).sub(c),this.max.copy(a).add(c),this}clone(){return new this.constructor().copy(this)}copy(a){return this.min.copy(a.min),this.max.copy(a.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(a){return this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(a){return this.isEmpty()?a.set(0,0):a.subVectors(this.max,this.min)}expandByPoint(a){return this.min.min(a),this.max.max(a),this}expandByVector(a){return this.min.sub(a),this.max.add(a),this}expandByScalar(a){return this.min.addScalar(-a),this.max.addScalar(a),this}containsPoint(a){return a.x>=this.min.x&&a.x<=this.max.x&&a.y>=this.min.y&&a.y<=this.max.y}containsBox(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y}getParameter(a,b){return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(a){return a.max.x>=this.min.x&&a.min.x<=this.max.x&&a.max.y>=this.min.y&&a.min.y<=this.max.y}clampPoint(a,b){return b.copy(a).clamp(this.min,this.max)}distanceToPoint(a){return this.clampPoint(a,kR).distanceTo(a)}intersect(a){return this.min.max(a.min),this.max.min(a.max),this.isEmpty()&&this.makeEmpty(),this}union(a){return this.min.min(a.min),this.max.max(a.max),this}translate(a){return this.min.add(a),this.max.add(a),this}equals(a){return a.min.equals(this.min)&&a.max.equals(this.max)}}let kT=new dz,kU=new dz,kV=new dz,kW=new dz,kX=new dz,kY=new dz,kZ=new dz;class k${constructor(a=new dz,b=new dz){this.start=a,this.end=b}set(a,b){return this.start.copy(a),this.end.copy(b),this}copy(a){return this.start.copy(a.start),this.end.copy(a.end),this}getCenter(a){return a.addVectors(this.start,this.end).multiplyScalar(.5)}delta(a){return a.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(a,b){return this.delta(b).multiplyScalar(a).add(this.start)}closestPointToPointParameter(a,b){kT.subVectors(a,this.start),kU.subVectors(this.end,this.start);let c=kU.dot(kU);if(0===c)return 0;let d=kU.dot(kT)/c;return b&&(d=dr(d,0,1)),d}closestPointToPoint(a,b,c){let d=this.closestPointToPointParameter(a,b);return this.delta(c).multiplyScalar(d).add(this.start)}distanceSqToLine3(a,b=kY,c=kZ){let d,e,f=1e-8*1e-8,g=this.start,h=a.start,i=this.end,j=a.end;kV.subVectors(i,g),kW.subVectors(j,h),kX.subVectors(g,h);let k=kV.dot(kV),l=kW.dot(kW),m=kW.dot(kX);if(k<=f&&l<=f)return b.copy(g),c.copy(h),b.sub(c),b.dot(b);if(k<=f)d=0,e=dr(e=m/l,0,1);else{let a=kV.dot(kX);if(l<=f)e=0,d=dr(-a/k,0,1);else{let b=kV.dot(kW),c=k*l-b*b;d=0!==c?dr((b*m-a*l)/c,0,1):0,(e=(b*d+m)/l)<0?(e=0,d=dr(-a/k,0,1)):e>1&&(e=1,d=dr((b-a)/k,0,1))}}return b.copy(g).addScaledVector(kV,d),c.copy(h).addScaledVector(kW,e),b.distanceToSquared(c)}applyMatrix4(a){return this.start.applyMatrix4(a),this.end.applyMatrix4(a),this}equals(a){return a.start.equals(this.start)&&a.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}let k_=new dz;class k0 extends en{constructor(a,b){super(),this.light=a,this.matrixAutoUpdate=!1,this.color=b,this.type="SpotLightHelper";const c=new ft,d=[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 a=0,b=1;a<32;a++,b++){const c=a/32*Math.PI*2,e=b/32*Math.PI*2;d.push(Math.cos(c),Math.sin(c),1,Math.cos(e),Math.sin(e),1)}c.setAttribute("position",new fh(d,3));const e=new gY({fog:!1,toneMapped:!1});this.cone=new g8(c,e),this.add(this.cone),this.update()}dispose(){super.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 a=this.light.distance?this.light.distance:1e3,b=a*Math.tan(this.light.angle);this.cone.scale.set(b,b,a),k_.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(k_),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let k1=new dz,k2=new dY,k3=new dY;class k4 extends g8{constructor(a){const b=function a(b){let c=[];!0===b.isBone&&c.push(b);for(let d=0;d<b.children.length;d++)c.push(...a(b.children[d]));return c}(a),c=new ft,d=[],e=[];for(let a=0;a<b.length;a++){const c=b[a];c.parent&&c.parent.isBone&&(d.push(0,0,0),d.push(0,0,0),e.push(0,0,0),e.push(0,0,0))}c.setAttribute("position",new fh(d,3)),c.setAttribute("color",new fh(e,3)),super(c,new gY({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=a,this.bones=b,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1;const f=new ev(255),g=new ev(65280);this.setColors(f,g)}updateMatrixWorld(a){let b=this.bones,c=this.geometry,d=c.getAttribute("position");k3.copy(this.root.matrixWorld).invert();for(let a=0,c=0;a<b.length;a++){let e=b[a];e.parent&&e.parent.isBone&&(k2.multiplyMatrices(k3,e.matrixWorld),k1.setFromMatrixPosition(k2),d.setXYZ(c,k1.x,k1.y,k1.z),k2.multiplyMatrices(k3,e.parent.matrixWorld),k1.setFromMatrixPosition(k2),d.setXYZ(c+1,k1.x,k1.y,k1.z),c+=2)}c.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(a)}setColors(a,b){let c=this.geometry.getAttribute("color");for(let d=0;d<c.count;d+=2)c.setXYZ(d,a.r,a.g,a.b),c.setXYZ(d+1,b.r,b.g,b.b);return c.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class k5 extends ga{constructor(a,b,c){super(new iv(b,4,2),new f$({wireframe:!0,fog:!1,toneMapped:!1})),this.light=a,this.color=c,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){super.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 k6=new dz,k7=new ev,k8=new ev;class k9 extends en{constructor(a,b,c){super(),this.light=a,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.color=c,this.type="HemisphereLightHelper";const d=new ir(b);d.rotateY(.5*Math.PI),this.material=new f$({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const e=new Float32Array(3*d.getAttribute("position").count);d.setAttribute("color",new e8(e,3)),this.add(new ga(d,this.material)),this.update()}dispose(){super.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let a=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let b=a.geometry.getAttribute("color");k7.copy(this.light.color),k8.copy(this.light.groundColor);for(let a=0,c=b.count;a<c;a++){let d=a<c/2?k7:k8;b.setXYZ(a,d.r,d.g,d.b)}b.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),a.lookAt(k6.setFromMatrixPosition(this.light.matrixWorld).negate())}}class la extends g8{constructor(a=10,b=10,c=4473924,d=8947848){c=new ev(c),d=new ev(d);const e=b/2,f=a/b,g=a/2,h=[],i=[];for(let a=0,j=0,k=-g;a<=b;a++,k+=f){h.push(-g,0,k,g,0,k),h.push(k,0,-g,k,0,g);const b=a===e?c:d;b.toArray(i,j),j+=3,b.toArray(i,j),j+=3,b.toArray(i,j),j+=3,b.toArray(i,j),j+=3}const j=new ft;j.setAttribute("position",new fh(h,3)),j.setAttribute("color",new fh(i,3)),super(j,new gY({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class lb extends g8{constructor(a=10,b=16,c=8,d=64,e=4473924,f=8947848){e=new ev(e),f=new ev(f);const g=[],h=[];if(b>1)for(let c=0;c<b;c++){const d=c/b*(2*Math.PI),i=Math.sin(d)*a,j=Math.cos(d)*a;g.push(0,0,0),g.push(i,0,j);const k=1&c?e:f;h.push(k.r,k.g,k.b),h.push(k.r,k.g,k.b)}for(let b=0;b<c;b++){const i=1&b?e:f,j=a-a/c*b;for(let a=0;a<d;a++){let b=a/d*(2*Math.PI),c=Math.sin(b)*j,e=Math.cos(b)*j;g.push(c,0,e),h.push(i.r,i.g,i.b),c=Math.sin(b=(a+1)/d*(2*Math.PI))*j,e=Math.cos(b)*j,g.push(c,0,e),h.push(i.r,i.g,i.b)}}const i=new ft;i.setAttribute("position",new fh(g,3)),i.setAttribute("color",new fh(h,3)),super(i,new gY({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}let lc=new dz,ld=new dz,le=new dz;class lf extends en{constructor(a,b,c){super(),this.light=a,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.color=c,this.type="DirectionalLightHelper",void 0===b&&(b=1);let d=new ft;d.setAttribute("position",new fh([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));const e=new gY({fog:!1,toneMapped:!1});this.lightPlane=new g4(d,e),this.add(this.lightPlane),(d=new ft).setAttribute("position",new fh([0,0,0,0,0,1],3)),this.targetLine=new g4(d,e),this.add(this.targetLine),this.update()}dispose(){super.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),lc.setFromMatrixPosition(this.light.matrixWorld),ld.setFromMatrixPosition(this.light.target.matrixWorld),le.subVectors(ld,lc),this.lightPlane.lookAt(ld),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(ld),this.targetLine.scale.z=le.length()}}let lg=new dz,lh=new jD;class li extends g8{constructor(a){const b=new ft,c=new gY({color:0xffffff,vertexColors:!0,toneMapped:!1}),d=[],e=[],f={};function g(a,b){h(a),h(b)}function h(a){d.push(0,0,0),e.push(0,0,0),void 0===f[a]&&(f[a]=[]),f[a].push(d.length/3-1)}g("n1","n2"),g("n2","n4"),g("n4","n3"),g("n3","n1"),g("f1","f2"),g("f2","f4"),g("f4","f3"),g("f3","f1"),g("n1","f1"),g("n2","f2"),g("n3","f3"),g("n4","f4"),g("p","n1"),g("p","n2"),g("p","n3"),g("p","n4"),g("u1","u2"),g("u2","u3"),g("u3","u1"),g("c","t"),g("p","c"),g("cn1","cn2"),g("cn3","cn4"),g("cf1","cf2"),g("cf3","cf4"),b.setAttribute("position",new fh(d,3)),b.setAttribute("color",new fh(e,3)),super(b,c),this.type="CameraHelper",this.camera=a,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=f,this.update();const i=new ev(0xffaa00),j=new ev(0xff0000),k=new ev(43775),l=new ev(0xffffff),m=new ev(3355443);this.setColors(i,j,k,l,m)}setColors(a,b,c,d,e){let f=this.geometry.getAttribute("color");return f.setXYZ(0,a.r,a.g,a.b),f.setXYZ(1,a.r,a.g,a.b),f.setXYZ(2,a.r,a.g,a.b),f.setXYZ(3,a.r,a.g,a.b),f.setXYZ(4,a.r,a.g,a.b),f.setXYZ(5,a.r,a.g,a.b),f.setXYZ(6,a.r,a.g,a.b),f.setXYZ(7,a.r,a.g,a.b),f.setXYZ(8,a.r,a.g,a.b),f.setXYZ(9,a.r,a.g,a.b),f.setXYZ(10,a.r,a.g,a.b),f.setXYZ(11,a.r,a.g,a.b),f.setXYZ(12,a.r,a.g,a.b),f.setXYZ(13,a.r,a.g,a.b),f.setXYZ(14,a.r,a.g,a.b),f.setXYZ(15,a.r,a.g,a.b),f.setXYZ(16,a.r,a.g,a.b),f.setXYZ(17,a.r,a.g,a.b),f.setXYZ(18,a.r,a.g,a.b),f.setXYZ(19,a.r,a.g,a.b),f.setXYZ(20,a.r,a.g,a.b),f.setXYZ(21,a.r,a.g,a.b),f.setXYZ(22,a.r,a.g,a.b),f.setXYZ(23,a.r,a.g,a.b),f.setXYZ(24,b.r,b.g,b.b),f.setXYZ(25,b.r,b.g,b.b),f.setXYZ(26,b.r,b.g,b.b),f.setXYZ(27,b.r,b.g,b.b),f.setXYZ(28,b.r,b.g,b.b),f.setXYZ(29,b.r,b.g,b.b),f.setXYZ(30,b.r,b.g,b.b),f.setXYZ(31,b.r,b.g,b.b),f.setXYZ(32,c.r,c.g,c.b),f.setXYZ(33,c.r,c.g,c.b),f.setXYZ(34,c.r,c.g,c.b),f.setXYZ(35,c.r,c.g,c.b),f.setXYZ(36,c.r,c.g,c.b),f.setXYZ(37,c.r,c.g,c.b),f.setXYZ(38,d.r,d.g,d.b),f.setXYZ(39,d.r,d.g,d.b),f.setXYZ(40,e.r,e.g,e.b),f.setXYZ(41,e.r,e.g,e.b),f.setXYZ(42,e.r,e.g,e.b),f.setXYZ(43,e.r,e.g,e.b),f.setXYZ(44,e.r,e.g,e.b),f.setXYZ(45,e.r,e.g,e.b),f.setXYZ(46,e.r,e.g,e.b),f.setXYZ(47,e.r,e.g,e.b),f.setXYZ(48,e.r,e.g,e.b),f.setXYZ(49,e.r,e.g,e.b),f.needsUpdate=!0,this}update(){let a,b,c=this.geometry,d=this.pointMap;if(lh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)a=1,b=0;else if(this.camera.coordinateSystem===c$)a=-1,b=1;else if(this.camera.coordinateSystem===c_)a=0,b=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);lj("c",d,c,lh,0,0,a),lj("t",d,c,lh,0,0,b),lj("n1",d,c,lh,-1,-1,a),lj("n2",d,c,lh,1,-1,a),lj("n3",d,c,lh,-1,1,a),lj("n4",d,c,lh,1,1,a),lj("f1",d,c,lh,-1,-1,b),lj("f2",d,c,lh,1,-1,b),lj("f3",d,c,lh,-1,1,b),lj("f4",d,c,lh,1,1,b),lj("u1",d,c,lh,.7,1.1,a),lj("u2",d,c,lh,-.7,1.1,a),lj("u3",d,c,lh,0,2,a),lj("cf1",d,c,lh,-1,0,b),lj("cf2",d,c,lh,1,0,b),lj("cf3",d,c,lh,0,-1,b),lj("cf4",d,c,lh,0,1,b),lj("cn1",d,c,lh,-1,0,a),lj("cn2",d,c,lh,1,0,a),lj("cn3",d,c,lh,0,-1,a),lj("cn4",d,c,lh,0,1,a),c.getAttribute("position").needsUpdate=!0}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}function lj(a,b,c,d,e,f,g){lg.set(e,f,g).unproject(d);let h=b[a];if(void 0!==h){let a=c.getAttribute("position");for(let b=0,c=h.length;b<c;b++)a.setXYZ(h[b],lg.x,lg.y,lg.z)}}let lk=new eO;class ll extends g8{constructor(a,b=0xffff00){const c=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]),d=new Float32Array(24),e=new ft;e.setIndex(new e8(c,1)),e.setAttribute("position",new e8(d,3)),super(e,new gY({color:b,toneMapped:!1})),this.object=a,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&lk.setFromObject(this.object),lk.isEmpty())return;let a=lk.min,b=lk.max,c=this.geometry.attributes.position,d=c.array;d[0]=b.x,d[1]=b.y,d[2]=b.z,d[3]=a.x,d[4]=b.y,d[5]=b.z,d[6]=a.x,d[7]=a.y,d[8]=b.z,d[9]=b.x,d[10]=a.y,d[11]=b.z,d[12]=b.x,d[13]=b.y,d[14]=a.z,d[15]=a.x,d[16]=b.y,d[17]=a.z,d[18]=a.x,d[19]=a.y,d[20]=a.z,d[21]=b.x,d[22]=a.y,d[23]=a.z,c.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(a){return this.object=a,this.update(),this}copy(a,b){return super.copy(a,b),this.object=a.object,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class lm extends g8{constructor(a,b=0xffff00){const c=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]),d=new ft;d.setIndex(new e8(c,1)),d.setAttribute("position",new fh([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(d,new gY({color:b,toneMapped:!1})),this.box=a,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(a){let b=this.box;b.isEmpty()||(b.getCenter(this.position),b.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(a))}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class ln extends g4{constructor(a,b=1,c=0xffff00){const d=new ft;d.setAttribute("position",new fh([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)),d.computeBoundingSphere(),super(d,new gY({color:c,toneMapped:!1})),this.type="PlaneHelper",this.plane=a,this.size=b;const e=new ft;e.setAttribute("position",new fh([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),e.computeBoundingSphere(),this.add(new ga(e,new f$({color:c,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(a){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(a)}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}let lo=new dz;class lp extends en{constructor(a=new dz(0,0,1),b=new dz(0,0,0),c=1,d=0xffff00,e=.2*c,f=.2*e){super(),this.type="ArrowHelper",void 0===g&&((g=new ft).setAttribute("position",new fh([0,0,0,0,1,0],3)),(h=new hx(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(b),this.line=new g4(g,new gY({color:d,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ga(h,new f$({color:d,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(a),this.setLength(c,e,f)}setDirection(a){if(a.y>.99999)this.quaternion.set(0,0,0,1);else if(a.y<-.99999)this.quaternion.set(1,0,0,0);else{lo.set(a.z,0,-a.x).normalize();let b=Math.acos(a.y);this.quaternion.setFromAxisAngle(lo,b)}}setLength(a,b=.2*a,c=.2*b){this.line.scale.set(1,Math.max(1e-4,a-b),1),this.line.updateMatrix(),this.cone.scale.set(c,b,c),this.cone.position.y=a,this.cone.updateMatrix()}setColor(a){this.line.material.color.set(a),this.cone.material.color.set(a)}copy(a){return super.copy(a,!1),this.line.copy(a.line),this.cone.copy(a.cone),this}dispose(){super.dispose(),this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class lq extends g8{constructor(a=1){const b=new ft;b.setAttribute("position",new fh([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a],3)),b.setAttribute("color",new fh([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(b,new gY({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(a,b,c){let d=new ev,e=this.geometry.attributes.color.array;return d.set(a),d.toArray(e,0),d.toArray(e,3),d.set(b),d.toArray(e,6),d.toArray(e,9),d.set(c),d.toArray(e,12),d.toArray(e,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class lr{constructor(){this.type="ShapePath",this.color=new ev,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(a,b){return this.currentPath=new h_,this.subPaths.push(this.currentPath),this.currentPath.moveTo(a,b),this}lineTo(a,b){return this.currentPath.lineTo(a,b),this}quadraticCurveTo(a,b,c,d){return this.currentPath.quadraticCurveTo(a,b,c,d),this}bezierCurveTo(a,b,c,d,e,f){return this.currentPath.bezierCurveTo(a,b,c,d,e,f),this}splineThru(a){return this.currentPath.splineThru(a),this}toShapes(){function a(a,b){let c=!1,d=b.length;for(let e=0,f=d-1;e<d;f=e++){let d=b[e],g=b[f];d.y>a.y!=g.y>a.y&&a.x<(g.x-d.x)*(a.y-d.y)/(g.y-d.y)+d.x&&(c=!c)}return c}let b=this.userData.style&&this.userData.style.fillRule||"nonzero";"nonzero"!==b&&"evenodd"!==b&&(dg('Fill-rule "'+b+'" is not supported, falling back to "nonzero".'),b="nonzero");let c="nonzero"===b?a=>0!==a:a=>(1&a)!=0,d=[];for(let b of this.subPaths){let c=b.getPoints();if(c.length<3)continue;let e=ij.area(c);if(0===e)continue;let f=new kS;for(let a=0;a<c.length;a++)f.expandByPoint(c[a]);d.push({subPath:b,points:c,boundingBox:f,interiorPoint:function(b,c){let d=c.getCenter(new dx);if(a(d,b))return d;let e=d.y,f=[],g=b.length;for(let a=0;a<g;a++){let c=b[a],d=b[(a+1)%g];if(c.y>e!=d.y>e){let a=c.x+(e-c.y)*(d.x-c.x)/(d.y-c.y);f.push(a)}}return f.length>1&&(f.sort((a,b)=>a-b),d.x=(f[0]+f[1])/2),d}(c,f),absArea:Math.abs(e),winding:e<0?-1:1,container:null,exclude:!1,role:null})}d.sort((a,b)=>b.absArea-a.absArea);for(let b=0;b<d.length;b++){let e=d[b],f=0;for(let c=b-1;c>=0;c--){let b=d[c];if(b.boundingBox.containsBox(e.boundingBox)&&a(e.interiorPoint,b.points)){e.container=b.exclude?b.container:b,f=b.winding,e.winding+=f;break}}c(e.winding)===c(f)&&(e.exclude=!0)}for(let a of d)a.exclude||(a.role=null===a.container||"hole"===a.container.role?"outer":"hole");let e=[],f=new Map;for(let a of d){if(a.exclude||"outer"!==a.role)continue;let b=new h0;b.curves=a.subPath.curves,e.push(b),f.set(a,b)}for(let a of d){if(a.exclude||"hole"!==a.role)continue;let b=f.get(a.container);if(!b)continue;let c=new h_;c.curves=a.subPath.curves,b.holes.push(c)}return e}}class ls extends dk{constructor(a,b=null){super(),this.object=a,this.domElement=b,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(a){null!==this.domElement&&this.disconnect(),this.domElement=a}disconnect(){}dispose(){}update(){}}function lt(a,b,c,d){let e=function(a){switch(a){case a2:case a3:return{byteLength:1,components:1};case a5:case a4:case a9:return{byteLength:2,components:1};case ba:case bb:return{byteLength:2,components:4};case a7:case a6:case a8:return{byteLength:4,components:1};case bd:case be:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${a}.`)}(d);switch(c){case bf:return a*b;case bk:case bl:return a*b/e.components*e.byteLength;case bm:case bn:return a*b*2/e.components*e.byteLength;case bg:return a*b*3/e.components*e.byteLength;case bh:case bp:return a*b*4/e.components*e.byteLength;case bq:case br:return Math.floor((a+3)/4)*Math.floor((b+3)/4)*8;case bs:case bt:return Math.floor((a+3)/4)*Math.floor((b+3)/4)*16;case bv:case bx:return Math.max(a,16)*Math.max(b,8)/4;case bu:case bw:return Math.max(a,8)*Math.max(b,8)/2;case by:case bz:case bB:case bC:return Math.floor((a+3)/4)*Math.floor((b+3)/4)*8;case bA:case bD:case bE:case bF:return Math.floor((a+3)/4)*Math.floor((b+3)/4)*16;case bG:return Math.floor((a+4)/5)*Math.floor((b+3)/4)*16;case bH:return Math.floor((a+4)/5)*Math.floor((b+4)/5)*16;case bI:return Math.floor((a+5)/6)*Math.floor((b+4)/5)*16;case bJ:return Math.floor((a+5)/6)*Math.floor((b+5)/6)*16;case bK:return Math.floor((a+7)/8)*Math.floor((b+4)/5)*16;case bL:return Math.floor((a+7)/8)*Math.floor((b+5)/6)*16;case bM:return Math.floor((a+7)/8)*Math.floor((b+7)/8)*16;case bN:return Math.floor((a+9)/10)*Math.floor((b+4)/5)*16;case bO:return Math.floor((a+9)/10)*Math.floor((b+5)/6)*16;case bP:return Math.floor((a+9)/10)*Math.floor((b+7)/8)*16;case bQ:return Math.floor((a+9)/10)*Math.floor((b+9)/10)*16;case bR:return Math.floor((a+11)/12)*Math.floor((b+9)/10)*16;case bS:return Math.floor((a+11)/12)*Math.floor((b+11)/12)*16;case bT:case bU:case bV:return Math.ceil(a/4)*Math.ceil(b/4)*16;case bW:case bX:return Math.ceil(a/4)*Math.ceil(b/4)*8;case bY:case bZ:return Math.ceil(a/4)*Math.ceil(b/4)*16}throw Error(`Unable to determine texture byte length for ${c} format.`)}class lu{static contain(a,b){let c;return(c=a.image&&a.image.width?a.image.width/a.image.height:1)>b?(a.repeat.x=1,a.repeat.y=c/b,a.offset.x=0,a.offset.y=(1-a.repeat.y)/2):(a.repeat.x=b/c,a.repeat.y=1,a.offset.x=(1-a.repeat.x)/2,a.offset.y=0),a}static cover(a,b){let c;return(c=a.image&&a.image.width?a.image.width/a.image.height:1)>b?(a.repeat.x=b/c,a.repeat.y=1,a.offset.x=(1-a.repeat.x)/2,a.offset.y=0):(a.repeat.x=1,a.repeat.y=c/b,a.offset.x=0,a.offset.y=(1-a.repeat.y)/2),a}static fill(a){return a.repeat.x=1,a.repeat.y=1,a.offset.x=0,a.offset.y=0,a}static getByteLength(a,b,c,d){return lt(a,b,c,d)}}function lv(){let a=null,b=!1,c=null,d=null;function e(b,f){d=a.requestAnimationFrame(e),c(b,f)}return{start:function(){!0===b||null===c||null!==a&&(d=a.requestAnimationFrame(e),b=!0)},stop:function(){null!==a&&a.cancelAnimationFrame(d),b=!1},setAnimationLoop:function(a){c=a},setContext:function(b){a=b}}}function lw(a){let b=new WeakMap;return{get:function(a){return a.isInterleavedBufferAttribute&&(a=a.data),b.get(a)},remove:function(c){c.isInterleavedBufferAttribute&&(c=c.data);let d=b.get(c);d&&(a.deleteBuffer(d.buffer),b.delete(c))},update:function(c,d){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){let a=b.get(c);(!a||a.version<c.version)&&b.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}let e=b.get(c);if(void 0===e)b.set(c,function(b,c){let d,e=b.array,f=b.usage,g=e.byteLength,h=a.createBuffer();if(a.bindBuffer(c,h),a.bufferData(c,e,f),b.onUploadCallback(),e instanceof Float32Array)d=a.FLOAT;else if("u">typeof Float16Array&&e instanceof Float16Array)d=a.HALF_FLOAT;else if(e instanceof Uint16Array)d=b.isFloat16BufferAttribute?a.HALF_FLOAT:a.UNSIGNED_SHORT;else if(e instanceof Int16Array)d=a.SHORT;else if(e instanceof Uint32Array)d=a.UNSIGNED_INT;else if(e instanceof Int32Array)d=a.INT;else if(e instanceof Int8Array)d=a.BYTE;else if(e instanceof Uint8Array)d=a.UNSIGNED_BYTE;else if(e instanceof Uint8ClampedArray)d=a.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+e);return{buffer:h,type:d,bytesPerElement:e.BYTES_PER_ELEMENT,version:b.version,size:g}}(c,d));else if(e.version<c.version){if(e.size!==c.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(b,c,d){let e=c.array,f=c.updateRanges;if(a.bindBuffer(d,b),0===f.length)a.bufferSubData(d,0,e);else{f.sort((a,b)=>a.start-b.start);let b=0;for(let a=1;a<f.length;a++){let c=f[b],d=f[a];d.start<=c.start+c.count+1?c.count=Math.max(c.count,d.start+d.count-c.start):f[++b]=d}f.length=b+1;for(let b=0,c=f.length;b<c;b++){let c=f[b];a.bufferSubData(d,c.start*e.BYTES_PER_ELEMENT,e,c.start,c.count)}c.clearUpdateRanges()}c.onUploadCallback()}(e.buffer,c,d),e.version=c.version}}}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:D}}));let lx={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( 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 );\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 );\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 );\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_RETROREFLECTION\n vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );\n retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\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 #ifdef USE_RETROREFLECTION\n vec3 getIBLAnisotropyRetroRadiance( 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 getIBLRetroRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\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 } 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_SUN_LIGHTS > 0\n struct SunLight {\n vec3 direction;\n vec3 color;\n };\n uniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n light.color = sunLight.color;\n light.direction = sunLight.direction;\n light.visible = true;\n }\n#endif\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 }\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;\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_RETROREFLECTION\n material.retroreflectivity = retroreflectivity;\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 vec2 dfg;\n vec3 multiScatteringCompensation;\n #ifdef USE_RETROREFLECTION\n float retroreflectivity;\n #endif\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 iridescenceF0Dielectric;\n vec3 iridescenceF0Metallic;\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, alphaB * 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 > 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 vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in 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 vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n #ifdef USE_RETROREFLECTION\n vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n #endif\n reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n vec3 halfDir = normalize( directLight.direction + geometryViewDir );\n float dotVH = saturate( dot( geometryViewDir, halfDir ) );\n vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n #ifdef USE_RETROREFLECTION\n vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n F = mix( F, retroF, saturate( material.retroreflectivity ) );\n #endif\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );\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 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n #else\n computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n #endif\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\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 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, 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 vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n }\n#endif\n#ifdef STANDARD\n float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n #if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n float EssMs = material.dfg.x + material.dfg.y;\n material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n #endif\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 }\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_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n SunLight sunLight;\n #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n SunLightShadow sunLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n sunLight = sunLights[ i ];\n getSunLightInfo( sunLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n sunLightShadow = sunLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 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 vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_RETROREFLECTION\n #ifdef USE_ANISOTROPY\n vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );\n #endif\n radiance += iblRadiance;\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 );\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 * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( 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_SUN_LIGHT_SHADOWS > 0\n #define SUN_LIGHT_CASCADES 2\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n #else\n uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n #endif\n uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n varying vec4 vSunShadowWorldPosition;\n varying vec3 vSunShadowWorldNormal;\n struct SunLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n #endif\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( 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_SUN_LIGHT_SHADOWS > 0\n float getSunShadow(\n #if defined( SHADOWMAP_TYPE_PCF )\n sampler2DShadow shadowMap,\n #else\n sampler2D shadowMap,\n #endif\n SunLightShadow sunLightShadow,\n int shadowIndex\n ) {\n vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n float viewDepth = vSunShadowWorldPosition.w;\n int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;\n float shadow = 1.0;\n for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {\n vec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n float cascadeShadow = getShadow(\n shadowMap,\n sunLightShadow.shadowMapSize,\n sunLightShadow.shadowIntensity,\n sunLightShadow.shadowBias,\n sunLightShadow.shadowRadius,\n sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition\n );\n shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n }\n }\n return shadow;\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 ) );\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_SUN_LIGHT_SHADOWS > 0\n varying vec4 vSunShadowWorldPosition;\n varying vec3 vSunShadowWorldNormal;\n #endif\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_SUN_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_SUN_LIGHT_SHADOWS > 0\n vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n vSunShadowWorldNormal = shadowWorldNormal;\n #endif\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_SUN_LIGHT_SHADOWS > 0\n SunLightShadow sunLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n sunLight = sunLightShadows[ i ];\n shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\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;\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 );\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;\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;\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 <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <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;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n uniform float retroreflectivity;\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;\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}"},ly={common:{diffuse:{value:new ev(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new dC},alphaMap:{value:null},alphaMapTransform:{value:new dC},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new dC}},envmap:{envMap:{value:null},envMapRotation:{value:new dC},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new dC}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new dC}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new dC},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new dC},normalScale:{value:new dx(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new dC},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new dC}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new dC}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new dC}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ev(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{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 dz},probesMax:{value:new dz},probesResolution:{value:new dz}},points:{diffuse:{value:new ev(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new dC},alphaTest:{value:0},uvTransform:{value:new dC}},sprite:{diffuse:{value:new ev(0xffffff)},opacity:{value:1},center:{value:new dx(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new dC},alphaMap:{value:null},alphaMapTransform:{value:new dC},alphaTest:{value:0}}},lz={basic:{uniforms:iF([ly.common,ly.specularmap,ly.envmap,ly.aomap,ly.lightmap,ly.fog]),vertexShader:lx.meshbasic_vert,fragmentShader:lx.meshbasic_frag},lambert:{uniforms:iF([ly.common,ly.specularmap,ly.envmap,ly.aomap,ly.lightmap,ly.emissivemap,ly.bumpmap,ly.normalmap,ly.displacementmap,ly.fog,ly.lights,{emissive:{value:new ev(0)},envMapIntensity:{value:1}}]),vertexShader:lx.meshlambert_vert,fragmentShader:lx.meshlambert_frag},phong:{uniforms:iF([ly.common,ly.specularmap,ly.envmap,ly.aomap,ly.lightmap,ly.emissivemap,ly.bumpmap,ly.normalmap,ly.displacementmap,ly.fog,ly.lights,{emissive:{value:new ev(0)},specular:{value:new ev(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:lx.meshphong_vert,fragmentShader:lx.meshphong_frag},standard:{uniforms:iF([ly.common,ly.envmap,ly.aomap,ly.lightmap,ly.emissivemap,ly.bumpmap,ly.normalmap,ly.displacementmap,ly.roughnessmap,ly.metalnessmap,ly.fog,ly.lights,{emissive:{value:new ev(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lx.meshphysical_vert,fragmentShader:lx.meshphysical_frag},toon:{uniforms:iF([ly.common,ly.aomap,ly.lightmap,ly.emissivemap,ly.bumpmap,ly.normalmap,ly.displacementmap,ly.gradientmap,ly.fog,ly.lights,{emissive:{value:new ev(0)}}]),vertexShader:lx.meshtoon_vert,fragmentShader:lx.meshtoon_frag},matcap:{uniforms:iF([ly.common,ly.bumpmap,ly.normalmap,ly.displacementmap,ly.fog,{matcap:{value:null}}]),vertexShader:lx.meshmatcap_vert,fragmentShader:lx.meshmatcap_frag},points:{uniforms:iF([ly.points,ly.fog]),vertexShader:lx.points_vert,fragmentShader:lx.points_frag},dashed:{uniforms:iF([ly.common,ly.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lx.linedashed_vert,fragmentShader:lx.linedashed_frag},depth:{uniforms:iF([ly.common,ly.displacementmap]),vertexShader:lx.depth_vert,fragmentShader:lx.depth_frag},normal:{uniforms:iF([ly.common,ly.bumpmap,ly.normalmap,ly.displacementmap,{opacity:{value:1}}]),vertexShader:lx.meshnormal_vert,fragmentShader:lx.meshnormal_frag},sprite:{uniforms:iF([ly.sprite,ly.fog]),vertexShader:lx.sprite_vert,fragmentShader:lx.sprite_frag},background:{uniforms:{uvTransform:{value:new dC},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lx.background_vert,fragmentShader:lx.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new dC}},vertexShader:lx.backgroundCube_vert,fragmentShader:lx.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lx.cube_vert,fragmentShader:lx.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lx.equirect_vert,fragmentShader:lx.equirect_frag},distance:{uniforms:iF([ly.common,ly.displacementmap,{referencePosition:{value:new dz},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lx.distance_vert,fragmentShader:lx.distance_frag},shadow:{uniforms:iF([ly.lights,ly.fog,{color:{value:new ev(0)},opacity:{value:1}}]),vertexShader:lx.shadow_vert,fragmentShader:lx.shadow_frag}};lz.physical={uniforms:iF([lz.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new dC},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new dC},clearcoatNormalScale:{value:new dx(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new dC},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new dC},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new dC},sheen:{value:0},sheenColor:{value:new ev(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new dC},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new dC},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new dC},transmissionSamplerSize:{value:new dx},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new dC},attenuationDistance:{value:0},attenuationColor:{value:new ev(0)},specularColor:{value:new ev(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new dC},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new dC},anisotropyVector:{value:new dx},anisotropyMap:{value:null},anisotropyMapTransform:{value:new dC}}]),vertexShader:lx.meshphysical_vert,fragmentShader:lx.meshphysical_frag};let lA={r:0,b:0,g:0},lB=new dY,lC=new dC;function lD(a,b,c,d,e,f){let g,h,i=new ev(0),j=+(!0!==e),k=null,l=0,m=null;function n(a){let c=!0===a.isScene?a.background:null;if(c&&c.isTexture){let d=a.backgroundBlurriness>0;c=b.get(c,d)}return c}function o(b,d){b.getRGB(lA,iH(a)),c.buffers.color.setClear(lA.r,lA.g,lA.b,d,f)}return{getClearColor:function(){return i},setClearColor:function(a,b=1){i.set(a),o(i,j=b)},getClearAlpha:function(){return j},setClearAlpha:function(a){o(i,j=a)},render:function(b){let d=!1,e=n(b);null===e?o(i,j):e&&e.isColor&&(o(e,1),d=!0);let g=a.xr.getEnvironmentBlendMode();"additive"===g?c.buffers.color.setClear(0,0,0,1,f):"alpha-blend"===g&&c.buffers.color.setClear(0,0,0,0,f),(a.autoClear||d)&&(c.buffers.depth.setTest(!0),c.buffers.depth.setMask(!0),c.buffers.color.setMask(!0),a.clear(a.autoClearColor,a.autoClearDepth,a.autoClearStencil))},addToRenderList:function(b,c){let e=n(c);e&&(e.isCubeTexture||e.mapping===aQ)?(void 0===h&&((h=new ga(new ht(1,1,1),new iJ({name:"BackgroundCubeMaterial",uniforms:iE(lz.backgroundCube.uniforms),vertexShader:lz.backgroundCube.vertexShader,fragmentShader:lz.backgroundCube.fragmentShader,side:P,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(a,b,c){this.matrixWorld.copyPosition(c.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),d.update(h)),h.material.uniforms.envMap.value=e,h.material.uniforms.backgroundBlurriness.value=c.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=c.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(lB.makeRotationFromEuler(c.backgroundRotation)).transpose(),e.isCubeTexture&&!1===e.isRenderTargetTexture&&h.material.uniforms.backgroundRotation.value.premultiply(lC),h.material.toneMapped=dG.getTransfer(e.colorSpace)!==cn,(k!==e||l!==e.version||m!==a.toneMapping)&&(h.material.needsUpdate=!0,k=e,l=e.version,m=a.toneMapping),h.layers.enableAll(),b.unshift(h,h.geometry,h.material,0,0,null)):e&&e.isTexture&&(void 0===g&&((g=new ga(new is(2,2),new iJ({name:"BackgroundMaterial",uniforms:iE(lz.background.uniforms),vertexShader:lz.background.vertexShader,fragmentShader:lz.background.fragmentShader,side:O,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(g.material,"map",{get:function(){return this.uniforms.t2D.value}}),d.update(g)),g.material.uniforms.t2D.value=e,g.material.uniforms.backgroundIntensity.value=c.backgroundIntensity,g.material.toneMapped=dG.getTransfer(e.colorSpace)!==cn,!0===e.matrixAutoUpdate&&e.updateMatrix(),g.material.uniforms.uvTransform.value.copy(e.matrix),(k!==e||l!==e.version||m!==a.toneMapping)&&(g.material.needsUpdate=!0,k=e,l=e.version,m=a.toneMapping),g.layers.enableAll(),b.unshift(g,g.geometry,g.material,0,0,null))},dispose:function(){void 0!==h&&(h.geometry.dispose(),h.material.dispose(),h=void 0),void 0!==g&&(g.geometry.dispose(),g.material.dispose(),g=void 0)}}}function lE(a,b){let c=a.getParameter(a.MAX_VERTEX_ATTRIBS),d={},e=j(null),f=e,g=!1;function h(b){return a.bindVertexArray(b)}function i(b){return a.deleteVertexArray(b)}function j(a){let b=[],d=[],e=[];for(let a=0;a<c;a++)b[a]=0,d[a]=0,e[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:b,enabledAttributes:d,attributeDivisors:e,object:a,attributes:{},index:null}}function k(){let a=f.newAttributes;for(let b=0,c=a.length;b<c;b++)a[b]=0}function l(a){m(a,0)}function m(b,c){let d=f.newAttributes,e=f.enabledAttributes,g=f.attributeDivisors;d[b]=1,0===e[b]&&(a.enableVertexAttribArray(b),e[b]=1),g[b]!==c&&(a.vertexAttribDivisor(b,c),g[b]=c)}function n(){let b=f.newAttributes,c=f.enabledAttributes;for(let d=0,e=c.length;d<e;d++)c[d]!==b[d]&&(a.disableVertexAttribArray(d),c[d]=0)}function o(b,c,d,e,f,g,h){!0===h?a.vertexAttribIPointer(b,c,d,f,g):a.vertexAttribPointer(b,c,d,e,f,g)}function p(){q(),g=!0,f!==e&&h((f=e).object)}function q(){e.geometry=null,e.program=null,e.wireframe=!1}return{setup:function(c,e,i,p,q){var r,s,t;let u,v,w,x,y,z,A=!1,B=(r=c,s=p,t=i,u=!0===e.wireframe,void 0===(v=d[s.id])&&(v={},d[s.id]=v),void 0===(x=v[w=!0===r.isInstancedMesh?r.id:0])&&(x={},v[w]=x),void 0===(y=x[t.id])&&(y={},x[t.id]=y),void 0===(z=y[u])&&(z=j(a.createVertexArray()),y[u]=z),z);f!==B&&h((f=B).object),(A=function(a,b,c,d){let e=f.attributes,g=b.attributes,h=0,i=c.getAttributes();for(let b in i)if(i[b].location>=0){let c=e[b],d=g[b];if(void 0===d&&("instanceMatrix"===b&&a.instanceMatrix&&(d=a.instanceMatrix),"instanceColor"===b&&a.instanceColor&&(d=a.instanceColor)),void 0===c||c.attribute!==d||d&&c.data!==d.data)return!0;h++}return f.attributesNum!==h||f.index!==d}(c,p,i,q))&&function(a,b,c,d){let e={},g=b.attributes,h=0,i=c.getAttributes();for(let b in i)if(i[b].location>=0){let c=g[b];void 0===c&&("instanceMatrix"===b&&a.instanceMatrix&&(c=a.instanceMatrix),"instanceColor"===b&&a.instanceColor&&(c=a.instanceColor));let d={};d.attribute=c,c&&c.data&&(d.data=c.data),e[b]=d,h++}f.attributes=e,f.attributesNum=h,f.index=d}(c,p,i,q),null!==q&&b.update(q,a.ELEMENT_ARRAY_BUFFER),(A||g)&&(g=!1,function(c,d,e,f){k();let g=f.attributes,h=e.getAttributes(),i=d.defaultAttributeValues;for(let d in h){let e=h[d];if(e.location>=0){let h=g[d];if(void 0===h&&("instanceMatrix"===d&&c.instanceMatrix&&(h=c.instanceMatrix),"instanceColor"===d&&c.instanceColor&&(h=c.instanceColor)),void 0!==h){let d=h.normalized,g=h.itemSize,i=b.get(h);if(void 0===i)continue;let j=i.buffer,k=i.type,n=i.bytesPerElement,p=k===a.INT||k===a.UNSIGNED_INT||h.gpuType===a6;if(h.isInterleavedBufferAttribute){let b=h.data,i=b.stride,q=h.offset;if(b.isInstancedInterleavedBuffer){for(let a=0;a<e.locationSize;a++)m(e.location+a,b.meshPerAttribute);!0!==c.isInstancedMesh&&void 0===f._maxInstanceCount&&(f._maxInstanceCount=b.meshPerAttribute*b.count)}else for(let a=0;a<e.locationSize;a++)l(e.location+a);a.bindBuffer(a.ARRAY_BUFFER,j);for(let a=0;a<e.locationSize;a++)o(e.location+a,g/e.locationSize,k,d,i*n,(q+g/e.locationSize*a)*n,p)}else{if(h.isInstancedBufferAttribute){for(let a=0;a<e.locationSize;a++)m(e.location+a,h.meshPerAttribute);!0!==c.isInstancedMesh&&void 0===f._maxInstanceCount&&(f._maxInstanceCount=h.meshPerAttribute*h.count)}else for(let a=0;a<e.locationSize;a++)l(e.location+a);a.bindBuffer(a.ARRAY_BUFFER,j);for(let a=0;a<e.locationSize;a++)o(e.location+a,g/e.locationSize,k,d,g*n,g/e.locationSize*a*n,p)}}else if(void 0!==i){let b=i[d];if(void 0!==b)switch(b.length){case 2:a.vertexAttrib2fv(e.location,b);break;case 3:a.vertexAttrib3fv(e.location,b);break;case 4:a.vertexAttrib4fv(e.location,b);break;default:a.vertexAttrib1fv(e.location,b)}}}}n()}(c,e,i,p),null!==q&&a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b.get(q).buffer))},reset:p,resetDefaultState:q,dispose:function(){for(let a in p(),d){let b=d[a];for(let a in b){let c=b[a];for(let a in c){let b=c[a];for(let a in b)i(b[a].object),delete b[a];delete c[a]}}delete d[a]}},releaseStatesOfGeometry:function(a){if(void 0===d[a.id])return;let b=d[a.id];for(let a in b){let c=b[a];for(let a in c){let b=c[a];for(let a in b)i(b[a].object),delete b[a];delete c[a]}}delete d[a.id]},releaseStatesOfObject:function(a){for(let b in d){let c=d[b],e=!0===a.isInstancedMesh?a.id:0,f=c[e];if(void 0!==f){for(let a in f){let b=f[a];for(let a in b)i(b[a].object),delete b[a];delete f[a]}delete c[e],0===Object.keys(c).length&&delete d[b]}}},releaseStatesOfProgram:function(a){for(let b in d){let c=d[b];for(let b in c){let d=c[b];if(void 0===d[a.id])continue;let e=d[a.id];for(let a in e)i(e[a].object),delete e[a];delete d[a.id]}}},initAttributes:k,enableAttribute:l,disableUnusedAttributes:n}}function lF(a,b,c){let d;this.setMode=function(a){d=a},this.render=function(b,e){a.drawArrays(d,b,e),c.update(e,d,1)},this.renderInstances=function(b,e,f){0!==f&&(a.drawArraysInstanced(d,b,e,f),c.update(e,d,f))},this.renderMultiDraw=function(a,e,f){if(0===f)return;b.get("WEBGL_multi_draw").multiDrawArraysWEBGL(d,a,0,e,0,f);let g=0;for(let a=0;a<f;a++)g+=e[a];c.update(g,d,1)}}function lG(a,b,c,d){let e;function f(b){if("highp"===b){if(a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision>0&&a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return"mediump"===b&&a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision>0&&a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let g=void 0!==c.precision?c.precision:"highp",h=f(g);h!==g&&(dg("WebGLRenderer:",g,"not supported, using",h,"instead."),g=h);let i=!0===c.logarithmicDepthBuffer,j=!0===c.reversedDepthBuffer&&b.has("EXT_clip_control");return!0===c.reversedDepthBuffer&&!1===j&&dg("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==e)return e;if(!0===b.has("EXT_texture_filter_anisotropic")){let c=b.get("EXT_texture_filter_anisotropic");e=a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else e=0;return e},getMaxPrecision:f,textureFormatReadable:function(b){return b===bh||d.convert(b)===a.getParameter(a.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(c){let e=c===a9&&(b.has("EXT_color_buffer_half_float")||b.has("EXT_color_buffer_float"));return c===a2||c===a8||!!e||d.convert(c)===a.getParameter(a.IMPLEMENTATION_COLOR_READ_TYPE)},precision:g,logarithmicDepthBuffer:i,reversedDepthBuffer:j,maxTextures:a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:a.getParameter(a.MAX_TEXTURE_SIZE),maxCubemapSize:a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:a.getParameter(a.MAX_VERTEX_ATTRIBS),maxVertexUniforms:a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:a.getParameter(a.MAX_VARYING_VECTORS),maxFragmentUniforms:a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:a.getParameter(a.MAX_SAMPLES),samples:a.getParameter(a.SAMPLES)}}function lH(a){let b=this,c=null,d=0,e=!1,f=!1,g=new fA,h=new dC,i={value:null,needsUpdate:!1};function j(a,c,d,e){let f=null!==a?a.length:0,j=null;if(0!==f){if(j=i.value,!0!==e||null===j){let b=d+4*f,e=c.matrixWorldInverse;h.getNormalMatrix(e),(null===j||j.length<b)&&(j=new Float32Array(b));for(let b=0,c=d;b!==f;++b,c+=4)g.copy(a[b]).applyMatrix4(e,h),g.normal.toArray(j,c),j[c+3]=g.constant}i.value=j,i.needsUpdate=!0}return b.numPlanes=f,b.numIntersection=0,j}this.uniform=i,this.numPlanes=0,this.numIntersection=0,this.init=function(a,b){let c=0!==a.length||b||0!==d||e;return e=b,d=a.length,c},this.beginShadows=function(){f=!0,j(null)},this.endShadows=function(){f=!1},this.setGlobalState=function(a,b){c=j(a,b,0)},this.setState=function(g,h,k){let l=g.clippingPlanes,m=g.clipIntersection,n=g.clipShadows,o=a.get(g);if(e&&null!==l&&0!==l.length&&(!f||n)){let a=f?0:d,b=4*a,e=o.clippingState||null;i.value=e,e=j(l,h,b,k);for(let a=0;a!==b;++a)e[a]=c[a];o.clippingState=e,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=a}else f?j(null):(i.value!==c&&(i.value=c,i.needsUpdate=d>0),b.numPlanes=d,b.numIntersection=0)}}lC.set(-1,0,0,0,1,0,0,0,1);let lI=new jM,lJ=new ev,lK=null,lL=0,lM=0,lN=!1,lO=new dz,lP=new dz;class lQ{constructor(a){this._renderer=a,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(a,b=0,c=.1,d=100,e={}){let{size:f=256,position:g=lO}=e;lK=this._renderer.getRenderTarget(),lL=this._renderer.getActiveCubeFace(),lM=this._renderer.getActiveMipmapLevel(),lN=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(f);let h=this._allocateTargets();return h.depthBuffer=!0,this._sceneToCubeUV(a,c,d,h,g),b>0&&this._blur(h,0,0,b),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(a,b=null){return this._fromTexture(a,b)}fromCubemap(a,b=null){return this._fromTexture(a,b)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lU(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=lT(),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(a){this._lodMax=Math.floor(Math.log2(a)),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 a=0;a<this._lodMeshes.length;a++)this._lodMeshes[a].geometry.dispose()}_cleanup(a){this._renderer.setRenderTarget(lK,lL,lM),this._renderer.xr.enabled=lN,a.scissorTest=!1,lS(a,0,0,a.width,a.height)}_fromTexture(a,b){a.mapping===aM||a.mapping===aN?this._setSize(0===a.image.length?16:a.image[0].width||a.image[0].image.width):this._setSize(a.image.width/4),lK=this._renderer.getRenderTarget(),lL=this._renderer.getActiveCubeFace(),lM=this._renderer.getActiveMipmapLevel(),lN=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let c=b||this._allocateTargets();return this._textureToCubeUV(a,c),this._applyPMREM(c),this._cleanup(c),c}_allocateTargets(){let a=3*Math.max(this._cubeSize,112),b=4*this._cubeSize,c={magFilter:aZ,minFilter:aZ,generateMipmaps:!1,type:a9,format:bh,colorSpace:cl,depthBuffer:!1},d=lR(a,b,c);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==a||this._pingPongRenderTarget.height!==b){var e,f;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=lR(a,b,c);let{_lodMax:d}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=function(a){let b=[],c=[],d=a,e=a-4+1+6;for(let a=0;a<e;a++){let a=Math.pow(2,d);b.push(a);let e=1/(a-2),f=-e,g=1+e,h=[f,f,g,f,g,g,f,f,g,g,f,g],i=new Float32Array(108),j=new Float32Array(108);for(let a=0;a<6;a++){let b=a%3*2/3-1,c=a>2?0:-1,d=[b,c,0,b+2/3,c,0,b+2/3,c+1,0,b,c,0,b+2/3,c+1,0,b,c+1,0];i.set(d,18*a);for(let b=0;b<6;b++){let c=2*h[2*b]-1,d=2*h[2*b+1]-1;0===a?lP.set(1,d,c):1===a?lP.set(-c,1,-d):2===a?lP.set(-c,d,1):3===a?lP.set(-1,d,-c):4===a?lP.set(-c,-1,d):lP.set(c,d,-1),lP.toArray(j,(6*a+b)*3)}}let k=new ft;k.setAttribute("position",new e8(i,3)),k.setAttribute("outputDirection",new e8(j,3)),c.push(new ga(k,null)),d>4&&d--}return{lodMeshes:c,sizeLods:b}}(d)),this._blurMaterial=(e=d,new iJ({name:"SphericalGaussianBlur",defines:{SAMPLES:20,CUBEUV_TEXEL_WIDTH:1/a,CUBEUV_TEXEL_HEIGHT:1/b,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:lV(),fragmentShader:`
2
+
3
+ precision highp float;
4
+ precision highp int;
5
+
6
+ varying vec3 vOutputDirection;
7
+
8
+ uniform sampler2D envMap;
9
+ uniform float sigma;
10
+ uniform float mipInt;
11
+
12
+ #define ENVMAP_TYPE_CUBE_UV
13
+ #include <cube_uv_reflection_fragment>
14
+
15
+ #define PI 3.14159265359
16
+ #define GOLDEN_ANGLE 2.39996322973
17
+
18
+ void main() {
19
+
20
+ if ( sigma == 0.0 ) {
21
+
22
+ gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
23
+ return;
24
+
25
+ }
26
+
27
+ vec3 outputDirection = normalize( vOutputDirection );
28
+
29
+ vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
30
+ vec3 tangent = normalize( cross( up, outputDirection ) );
31
+ vec3 bitangent = cross( outputDirection, tangent );
32
+
33
+ // Truncate the kernel at three standard deviations or at the antipode.
34
+ float thetaMax = min( 3.0 * sigma, PI );
35
+ float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
36
+
37
+ vec3 accumColor = vec3( 0.0 );
38
+ float accumWeight = 0.0;
39
+
40
+ for ( int i = 0; i < SAMPLES; i ++ ) {
41
+
42
+ // Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
43
+ float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
44
+ float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
45
+ float phi = float( i ) * GOLDEN_ANGLE;
46
+
47
+ vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
48
+ vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
49
+
50
+ // Correct the planar sample density to solid angle.
51
+ float weight = sin( theta ) / theta;
52
+
53
+ accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
54
+ accumWeight += weight;
55
+
56
+ }
57
+
58
+ gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
59
+
60
+ }
61
+ `,blending:R,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(f=d,new iJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/a,CUBEUV_TEXEL_HEIGHT:1/b,CUBEUV_MAX_MIP:`${f}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lV(),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:R,depthTest:!1,depthWrite:!1}))}return d}_compileMaterial(a){let b=new ga(new ft,a);this._renderer.compile(b,lI)}_sceneToCubeUV(a,b,c,d,e){let f=new jH(90,1,b,c),g=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],i=this._renderer,j=i.autoClear,k=i.toneMapping;i.getClearColor(lJ),i.toneMapping=aB,i.autoClear=!1,i.state.buffers.depth.getReversed()&&(i.setRenderTarget(d),i.clearDepth(),i.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new ga(new ht,new f$({name:"PMREM.Background",side:P,depthWrite:!1,depthTest:!1})));let l=this._backgroundBox,m=l.material,n=!1,o=a.background;o?o.isColor&&(m.color.copy(o),a.background=null,n=!0):(m.color.copy(lJ),n=!0);for(let b=0;b<6;b++){let c=b%3;0===c?(f.up.set(0,g[b],0),f.position.set(e.x,e.y,e.z),f.lookAt(e.x+h[b],e.y,e.z)):1===c?(f.up.set(0,0,g[b]),f.position.set(e.x,e.y,e.z),f.lookAt(e.x,e.y+h[b],e.z)):(f.up.set(0,g[b],0),f.position.set(e.x,e.y,e.z),f.lookAt(e.x,e.y,e.z+h[b]));let j=this._cubeSize;lS(d,c*j,b>2?j:0,j,j),i.setRenderTarget(d),n&&i.render(l,f),i.render(a,f)}i.toneMapping=k,i.autoClear=j,a.background=o}_textureToCubeUV(a,b){let c=this._renderer,d=a.mapping===aM||a.mapping===aN;d?(null===this._cubemapMaterial&&(this._cubemapMaterial=lU()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===a.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=lT());let e=d?this._cubemapMaterial:this._equirectMaterial,f=this._lodMeshes[0];f.material=e,e.uniforms.envMap.value=a;let g=this._cubeSize;lS(b,0,0,3*g,2*g),c.setRenderTarget(b),c.render(f,lI)}_applyPMREM(a){let b=this._renderer,c=b.autoClear;b.autoClear=!1;let d=this._lodMeshes.length;for(let b=1;b<d;b++)this._applyGGXFilter(a,b-1,b);b.autoClear=c}_applyGGXFilter(a,b,c){let d=this._renderer,e=this._pingPongRenderTarget,f=this._ggxMaterial,g=this._lodMeshes[c];g.material=f;let h=f.uniforms,i=c/(this._lodMeshes.length-1),j=b/(this._lodMeshes.length-1),k=Math.sqrt(i*i-j*j),{_lodMax:l}=this,m=this._sizeLods[c],n=3*m*(c>l-4?c-l+4:0),o=4*(this._cubeSize-m);h.envMap.value=a.texture,h.roughness.value=1.25*i*k,h.mipInt.value=l-b,lS(e,n,o,3*m,2*m),d.setRenderTarget(e),d.render(g,lI),h.envMap.value=e.texture,h.roughness.value=0,h.mipInt.value=l-c,lS(a,n,o,3*m,2*m),d.setRenderTarget(a),d.render(g,lI)}_blur(a,b,c,d){let e=this._pingPongRenderTarget,f=Math.min(d,Math.PI)/Math.SQRT2;this._blurPass(a,e,b,c,f),this._blurPass(e,a,c,c,f)}_blurPass(a,b,c,d,e){let f=this._renderer,g=this._blurMaterial,h=this._lodMeshes[d];h.material=g;let i=g.uniforms;i.envMap.value=a.texture,i.sigma.value=e,i.mipInt.value=this._lodMax-c;let j=this._sizeLods[d];lS(b,3*j*(d>this._lodMax-4?d-this._lodMax+4:0),4*(this._cubeSize-j),3*j,2*j),f.setRenderTarget(b),f.render(h,lI)}}function lR(a,b,c){let d=new dT(a,b,c);return d.texture.mapping=aQ,d.texture.name="PMREM.cubeUv",d.scissorTest=!0,d}function lS(a,b,c,d,e){a.viewport.set(b,c,d,e),a.scissor.set(b,c,d,e)}function lT(){return new iJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lV(),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:R,depthTest:!1,depthWrite:!1})}function lU(){return new iJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lV(),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:R,depthTest:!1,depthWrite:!1})}function lV(){return`
201
+
202
+ precision mediump float;
203
+ precision mediump int;
204
+
205
+ attribute vec3 outputDirection;
206
+
207
+ varying vec3 vOutputDirection;
208
+
209
+ void main() {
210
+
211
+ vOutputDirection = outputDirection;
212
+ gl_Position = vec4( position, 1.0 );
213
+
214
+ }
215
+ `}class lW extends dT{constructor(a=1,b={}){super(a,a,b),this.isWebGLCubeRenderTarget=!0;const c={width:a,height:a,depth:1};this.texture=new hn([c,c,c,c,c,c]),this._setTextureOptions(b),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(a,b){this.texture.type=b.type,this.texture.colorSpace=b.colorSpace,this.texture.generateMipmaps=b.generateMipmaps,this.texture.minFilter=b.minFilter,this.texture.magFilter=b.magFilter;let c={uniforms:{tEquirect:{value:null}},vertexShader:`
216
+
217
+ varying vec3 vWorldDirection;
218
+
219
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
220
+
221
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
222
+
223
+ }
224
+
225
+ void main() {
226
+
227
+ vWorldDirection = transformDirection( position, modelMatrix );
228
+
229
+ #include <begin_vertex>
230
+ #include <project_vertex>
231
+
232
+ }
233
+ `,fragmentShader:`
234
+
235
+ uniform sampler2D tEquirect;
236
+
237
+ varying vec3 vWorldDirection;
238
+
239
+ #include <common>
240
+
241
+ void main() {
242
+
243
+ vec3 direction = normalize( vWorldDirection );
244
+
245
+ vec2 sampleUV = equirectUv( direction );
246
+
247
+ gl_FragColor = texture2D( tEquirect, sampleUV );
248
+
249
+ }
250
+ `},d=new ht(5,5,5),e=new iJ({name:"CubemapFromEquirect",uniforms:iE(c.uniforms),vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,side:P,blending:R});e.uniforms.tEquirect.value=b;let f=new ga(d,e),g=b.minFilter;return b.minFilter===a0&&(b.minFilter=aZ),new j9(1,10,this).update(a,f),b.minFilter=g,f.geometry.dispose(),f.material.dispose(),this}clear(a,b=!0,c=!0,d=!0){let e=a.getRenderTarget();for(let e=0;e<6;e++)a.setRenderTarget(this,e),a.clear(b,c,d);a.setRenderTarget(e)}}function lX(a){let b=new WeakMap,c=new WeakMap,d=null;function e(a,b){return b===aO?a.mapping=aM:b===aP&&(a.mapping=aN),a}function f(a){let c=a.target;c.removeEventListener("dispose",f);let d=b.get(c);void 0!==d&&(b.delete(c),d.dispose())}function g(a){let b=a.target;b.removeEventListener("dispose",g);let d=c.get(b);void 0!==d&&(c.delete(b),d.dispose())}return{get:function(h,i=!1){return null==h?null:i?function(b){if(b&&b.isTexture){let e=b.mapping,f=e===aO||e===aP,h=e===aM||e===aN;if(f||h){let e=c.get(b),i=void 0!==e?e.texture.pmremVersion:0;if(b.isRenderTargetTexture&&b.pmremVersion!==i)return null===d&&(d=new lQ(a)),(e=f?d.fromEquirectangular(b,e):d.fromCubemap(b,e)).texture.pmremVersion=b.pmremVersion,c.set(b,e),e.texture;{if(void 0!==e)return e.texture;let i=b.image;return f&&i&&i.height>0||h&&i&&function(a){let b=0;for(let c=0;c<6;c++)void 0!==a[c]&&b++;return 6===b}(i)?(null===d&&(d=new lQ(a)),(e=f?d.fromEquirectangular(b):d.fromCubemap(b)).texture.pmremVersion=b.pmremVersion,c.set(b,e),b.addEventListener("dispose",g),e.texture):null}}}return b}(h):function(c){if(c&&c.isTexture){let d=c.mapping;if(d===aO||d===aP)if(b.has(c))return e(b.get(c).texture,c.mapping);else{let d=c.image;if(!d||!(d.height>0))return null;{let g=new lW(d.height);return g.fromEquirectangularTexture(a,c),b.set(c,g),c.addEventListener("dispose",f),e(g.texture,c.mapping)}}}return c}(h)},dispose:function(){b=new WeakMap,c=new WeakMap,null!==d&&(d.dispose(),d=null)}}}function lY(a){let b={};function c(c){if(void 0!==b[c])return b[c];let d=a.getExtension(c);return b[c]=d,d}return{has:function(a){return null!==c(a)},init:function(){c("EXT_color_buffer_float"),c("WEBGL_clip_cull_distance"),c("OES_texture_float_linear"),c("EXT_color_buffer_half_float"),c("WEBGL_multisampled_render_to_texture"),c("WEBGL_render_shared_exponent")},get:function(a){let b=c(a);return null===b&&di("WebGLRenderer: "+a+" extension not supported."),b}}}function lZ(a,b,c,d){let e={},f=new WeakMap;function g(a){let h=a.target;for(let a in null!==h.index&&b.remove(h.index),h.attributes)b.remove(h.attributes[a]);h.removeEventListener("dispose",g),delete e[h.id];let i=f.get(h);i&&(b.remove(i),f.delete(h)),d.releaseStatesOfGeometry(h),!0===h.isInstancedBufferGeometry&&delete h._maxInstanceCount,c.memory.geometries--}function h(a){let c=[],d=a.index,e=a.attributes.position,g=0;if(void 0===e)return;if(null!==d){let a=d.array;g=d.version;for(let b=0,d=a.length;b<d;b+=3){let d=a[b+0],e=a[b+1],f=a[b+2];c.push(d,e,e,f,f,d)}}else{let a=e.array;g=e.version;for(let b=0,d=a.length/3-1;b<d;b+=3){let a=b+0,d=b+1,e=b+2;c.push(a,d,d,e,e,a)}}let h=new(e.count>=65535?ff:fd)(c,1);h.version=g;let i=f.get(a);i&&b.remove(i),f.set(a,h)}return{get:function(a,b){return!0===e[b.id]||(b.addEventListener("dispose",g),e[b.id]=!0,c.memory.geometries++),b},update:function(c){let d=c.attributes;for(let c in d)b.update(d[c],a.ARRAY_BUFFER)},getWireframeAttribute:function(a){let b=f.get(a);if(b){let c=a.index;null!==c&&b.version<c.version&&h(a)}else h(a);return f.get(a)}}}function l$(a,b,c){let d,e,f;this.setMode=function(a){d=a},this.setIndex=function(a){e=a.type,f=a.bytesPerElement},this.render=function(b,g){a.drawElements(d,g,e,b*f),c.update(g,d,1)},this.renderInstances=function(b,g,h){0!==h&&(a.drawElementsInstanced(d,g,e,b*f,h),c.update(g,d,h))},this.renderMultiDraw=function(a,f,g){if(0===g)return;b.get("WEBGL_multi_draw").multiDrawElementsWEBGL(d,f,0,e,a,0,g);let h=0;for(let a=0;a<g;a++)h+=f[a];c.update(h,d,1)}}function l_(a){let b={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:b,programs:null,autoReset:!0,reset:function(){b.calls=0,b.triangles=0,b.points=0,b.lines=0},update:function(c,d,e){switch(b.calls++,d){case a.TRIANGLES:b.triangles+=c/3*e;break;case a.LINES:b.lines+=c/2*e;break;case a.LINE_STRIP:b.lines+=e*(c-1);break;case a.LINE_LOOP:b.lines+=e*c;break;case a.POINTS:b.points+=e*c;break;default:dh("WebGLInfo: Unknown draw mode:",d)}}}}function l0(a,b,c){let d=new WeakMap,e=new dR;return{update:function(f,g,h){let i=f.morphTargetInfluences,j=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,k=void 0!==j?j.length:0,l=d.get(g);if(void 0===l||l.count!==k){void 0!==l&&l.texture.dispose();let a=void 0!==g.morphAttributes.position,c=void 0!==g.morphAttributes.normal,f=void 0!==g.morphAttributes.color,h=g.morphAttributes.position||[],i=g.morphAttributes.normal||[],j=g.morphAttributes.color||[],m=0;!0===a&&(m=1),!0===c&&(m=2),!0===f&&(m=3);let n=g.attributes.position.count*m,o=1;n>b.maxTextureSize&&(o=Math.ceil(n/b.maxTextureSize),n=b.maxTextureSize);let p=new Float32Array(n*o*4*k),q=new dU(p,n,o,k);q.type=a8,q.needsUpdate=!0;let r=4*m;for(let b=0;b<k;b++){let d=h[b],g=i[b],k=j[b],l=n*o*4*b;for(let b=0;b<d.count;b++){let h=b*r;!0===a&&(e.fromBufferAttribute(d,b),p[l+h+0]=e.x,p[l+h+1]=e.y,p[l+h+2]=e.z,p[l+h+3]=0),!0===c&&(e.fromBufferAttribute(g,b),p[l+h+4]=e.x,p[l+h+5]=e.y,p[l+h+6]=e.z,p[l+h+7]=0),!0===f&&(e.fromBufferAttribute(k,b),p[l+h+8]=e.x,p[l+h+9]=e.y,p[l+h+10]=e.z,p[l+h+11]=4===k.itemSize?e.w:1)}}l={count:k,texture:q,size:new dx(n,o)},d.set(g,l),g.addEventListener("dispose",function a(){q.dispose(),d.delete(g),g.removeEventListener("dispose",a)})}if(!0===f.isInstancedMesh&&null!==f.morphTexture)h.getUniforms().setValue(a,"morphTexture",f.morphTexture,c);else{let b=0;for(let a=0;a<i.length;a++)b+=i[a];let c=g.morphTargetsRelative?1:1-b;h.getUniforms().setValue(a,"morphTargetBaseInfluence",c),h.getUniforms().setValue(a,"morphTargetInfluences",i)}h.getUniforms().setValue(a,"morphTargetsTexture",l.texture,c),h.getUniforms().setValue(a,"morphTargetsTextureSize",l.size)}}}function l1(a,b,c,d,e){let f=new WeakMap;function g(a){let b=a.target;b.removeEventListener("dispose",g),d.releaseStatesOfObject(b),c.remove(b.instanceMatrix),null!==b.instanceColor&&c.remove(b.instanceColor)}return{update:function(d){let h=e.render.frame,i=d.geometry,j=b.get(d,i);if(f.get(j)!==h&&(b.update(j),f.set(j,h)),d.isInstancedMesh&&(!1===d.hasEventListener("dispose",g)&&d.addEventListener("dispose",g),f.get(d)!==h&&(c.update(d.instanceMatrix,a.ARRAY_BUFFER),null!==d.instanceColor&&c.update(d.instanceColor,a.ARRAY_BUFFER),f.set(d,h))),d.isSkinnedMesh){let a=d.skeleton;f.get(a)!==h&&(a.update(),f.set(a,h))}return j},dispose:function(){f=new WeakMap}}}let l2={[aC]:"LINEAR_TONE_MAPPING",[aD]:"REINHARD_TONE_MAPPING",[aE]:"CINEON_TONE_MAPPING",[aF]:"ACES_FILMIC_TONE_MAPPING",[aH]:"AGX_TONE_MAPPING",[aI]:"NEUTRAL_TONE_MAPPING",[aG]:"CUSTOM_TONE_MAPPING"};function l3(a,b,c,d,e,f){let g,h=new dT(b,c,{type:a,depthBuffer:e,stencilBuffer:f,samples:4*!!d,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),i=null,j=null,k=new ft;k.setAttribute("position",new fh([-1,3,0,-1,-1,0,3,-1,0],3)),k.setAttribute("uv",new fh([0,2,0,0,2,0],2));let l=new iK({uniforms:{tDiffuse:{value:null}},vertexShader:`
251
+ precision highp float;
252
+
253
+ uniform mat4 modelViewMatrix;
254
+ uniform mat4 projectionMatrix;
255
+
256
+ attribute vec3 position;
257
+ attribute vec2 uv;
258
+
259
+ varying vec2 vUv;
260
+
261
+ void main() {
262
+ vUv = uv;
263
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
264
+ }`,fragmentShader:`
265
+ precision highp float;
266
+
267
+ uniform sampler2D tDiffuse;
268
+
269
+ varying vec2 vUv;
270
+
271
+ #include <tonemapping_pars_fragment>
272
+ #include <colorspace_pars_fragment>
273
+
274
+ void main() {
275
+ gl_FragColor = texture2D( tDiffuse, vUv );
276
+
277
+ #ifdef LINEAR_TONE_MAPPING
278
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
279
+ #elif defined( REINHARD_TONE_MAPPING )
280
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
281
+ #elif defined( CINEON_TONE_MAPPING )
282
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
283
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
284
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
285
+ #elif defined( AGX_TONE_MAPPING )
286
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
287
+ #elif defined( NEUTRAL_TONE_MAPPING )
288
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
289
+ #elif defined( CUSTOM_TONE_MAPPING )
290
+ gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
291
+ #endif
292
+
293
+ #ifdef SRGB_TRANSFER
294
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
295
+ #endif
296
+ }`,depthTest:!1,depthWrite:!1}),m=new ga(k,l),n=new jM(-1,1,1,-1,0,1),o=null,p=null,q=!1,r=null,s=[],t=!1;this.setSize=function(a,b){h.setSize(a,b),null!==i&&i.setSize(a,b),null!==j&&j.setSize(a,b);for(let c=0;c<s.length;c++){let d=s[c];d.setSize&&d.setSize(a,b)}},this.setEffects=function(a){t=(s=a).length>0&&!0===s[0].isRenderPass;let b=h.width,c=h.height;s.length>0&&null===i&&(i=new dT(b,c,{type:a9,depthBuffer:!1,stencilBuffer:!1}),j=new dT(b,c,{type:a9,depthBuffer:!1,stencilBuffer:!1}));for(let a=0;a<s.length;a++){let d=s[a];d.setSize&&d.setSize(b,c)}},this.begin=function(a,b){if(q||a.toneMapping===aB&&0===s.length)return!1;if(r=b,null!==b){let a=b.width,c=b.height;(h.width!==a||h.height!==c)&&this.setSize(a,c)}return!1===t&&a.setRenderTarget(h),g=a.toneMapping,a.toneMapping=aB,!0},this.hasRenderPass=function(){return t},this.end=function(a,b){a.toneMapping=g,q=!0;let c=h,d=i;for(let e=0;e<s.length;e++){let f=s[e];!1!==f.enabled&&(f.render(a,d,c,b),!1!==f.needsSwap&&(c=d,d=d===i?j:i))}if(o!==a.outputColorSpace||p!==a.toneMapping){o=a.outputColorSpace,p=a.toneMapping,l.defines={},dG.getTransfer(o)===cn&&(l.defines.SRGB_TRANSFER="");let b=l2[p];b&&(l.defines[b]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=c.texture,a.setRenderTarget(r),a.render(m,n),r=null,q=!1},this.isCompositing=function(){return q},this.dispose=function(){h.dispose(),null!==i&&i.dispose(),null!==j&&j.dispose(),k.dispose(),l.dispose()}}let l4=new dQ,l5=new hq(1,1),l6=new dU,l7=new dW,l8=new hn,l9=[],ma=[],mb=new Float32Array(16),mc=new Float32Array(9),md=new Float32Array(4);function me(a,b,c){let d=a[0];if(d<=0||d>0)return a;let e=b*c,f=l9[e];if(void 0===f&&(f=new Float32Array(e),l9[e]=f),0!==b){d.toArray(f,0);for(let d=1,e=0;d!==b;++d)e+=c,a[d].toArray(f,e)}return f}function mf(a,b){if(a.length!==b.length)return!1;for(let c=0,d=a.length;c<d;c++)if(a[c]!==b[c])return!1;return!0}function mg(a,b){for(let c=0,d=b.length;c<d;c++)a[c]=b[c]}function mh(a,b){let c=ma[b];void 0===c&&(c=new Int32Array(b),ma[b]=c);for(let d=0;d!==b;++d)c[d]=a.allocateTextureUnit();return c}function mi(a,b){let c=this.cache;c[0]!==b&&(a.uniform1f(this.addr,b),c[0]=b)}function mj(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y)&&(a.uniform2f(this.addr,b.x,b.y),c[0]=b.x,c[1]=b.y);else{if(mf(c,b))return;a.uniform2fv(this.addr,b),mg(c,b)}}function mk(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z)&&(a.uniform3f(this.addr,b.x,b.y,b.z),c[0]=b.x,c[1]=b.y,c[2]=b.z);else if(void 0!==b.r)(c[0]!==b.r||c[1]!==b.g||c[2]!==b.b)&&(a.uniform3f(this.addr,b.r,b.g,b.b),c[0]=b.r,c[1]=b.g,c[2]=b.b);else{if(mf(c,b))return;a.uniform3fv(this.addr,b),mg(c,b)}}function ml(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z||c[3]!==b.w)&&(a.uniform4f(this.addr,b.x,b.y,b.z,b.w),c[0]=b.x,c[1]=b.y,c[2]=b.z,c[3]=b.w);else{if(mf(c,b))return;a.uniform4fv(this.addr,b),mg(c,b)}}function mm(a,b){let c=this.cache,d=b.elements;if(void 0===d){if(mf(c,b))return;a.uniformMatrix2fv(this.addr,!1,b),mg(c,b)}else{if(mf(c,d))return;md.set(d),a.uniformMatrix2fv(this.addr,!1,md),mg(c,d)}}function mn(a,b){let c=this.cache,d=b.elements;if(void 0===d){if(mf(c,b))return;a.uniformMatrix3fv(this.addr,!1,b),mg(c,b)}else{if(mf(c,d))return;mc.set(d),a.uniformMatrix3fv(this.addr,!1,mc),mg(c,d)}}function mo(a,b){let c=this.cache,d=b.elements;if(void 0===d){if(mf(c,b))return;a.uniformMatrix4fv(this.addr,!1,b),mg(c,b)}else{if(mf(c,d))return;mb.set(d),a.uniformMatrix4fv(this.addr,!1,mb),mg(c,d)}}function mp(a,b){let c=this.cache;c[0]!==b&&(a.uniform1i(this.addr,b),c[0]=b)}function mq(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y)&&(a.uniform2i(this.addr,b.x,b.y),c[0]=b.x,c[1]=b.y);else{if(mf(c,b))return;a.uniform2iv(this.addr,b),mg(c,b)}}function mr(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z)&&(a.uniform3i(this.addr,b.x,b.y,b.z),c[0]=b.x,c[1]=b.y,c[2]=b.z);else{if(mf(c,b))return;a.uniform3iv(this.addr,b),mg(c,b)}}function ms(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z||c[3]!==b.w)&&(a.uniform4i(this.addr,b.x,b.y,b.z,b.w),c[0]=b.x,c[1]=b.y,c[2]=b.z,c[3]=b.w);else{if(mf(c,b))return;a.uniform4iv(this.addr,b),mg(c,b)}}function mt(a,b){let c=this.cache;c[0]!==b&&(a.uniform1ui(this.addr,b),c[0]=b)}function mu(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y)&&(a.uniform2ui(this.addr,b.x,b.y),c[0]=b.x,c[1]=b.y);else{if(mf(c,b))return;a.uniform2uiv(this.addr,b),mg(c,b)}}function mv(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z)&&(a.uniform3ui(this.addr,b.x,b.y,b.z),c[0]=b.x,c[1]=b.y,c[2]=b.z);else{if(mf(c,b))return;a.uniform3uiv(this.addr,b),mg(c,b)}}function mw(a,b){let c=this.cache;if(void 0!==b.x)(c[0]!==b.x||c[1]!==b.y||c[2]!==b.z||c[3]!==b.w)&&(a.uniform4ui(this.addr,b.x,b.y,b.z,b.w),c[0]=b.x,c[1]=b.y,c[2]=b.z,c[3]=b.w);else{if(mf(c,b))return;a.uniform4uiv(this.addr,b),mg(c,b)}}function mx(a,b,c){let d,e=this.cache,f=c.allocateTextureUnit();e[0]!==f&&(a.uniform1i(this.addr,f),e[0]=f),this.type===a.SAMPLER_2D_SHADOW?(l5.compareFunction=c.isReversedDepthBuffer()?cN:cK,d=l5):d=l4,c.setTexture2D(b||d,f)}function my(a,b,c){let d=this.cache,e=c.allocateTextureUnit();d[0]!==e&&(a.uniform1i(this.addr,e),d[0]=e),c.setTexture3D(b||l7,e)}function mz(a,b,c){let d=this.cache,e=c.allocateTextureUnit();d[0]!==e&&(a.uniform1i(this.addr,e),d[0]=e),c.setTextureCube(b||l8,e)}function mA(a,b,c){let d=this.cache,e=c.allocateTextureUnit();d[0]!==e&&(a.uniform1i(this.addr,e),d[0]=e),c.setTexture2DArray(b||l6,e)}function mB(a,b){a.uniform1fv(this.addr,b)}function mC(a,b){let c=me(b,this.size,2);a.uniform2fv(this.addr,c)}function mD(a,b){let c=me(b,this.size,3);a.uniform3fv(this.addr,c)}function mE(a,b){let c=me(b,this.size,4);a.uniform4fv(this.addr,c)}function mF(a,b){let c=me(b,this.size,4);a.uniformMatrix2fv(this.addr,!1,c)}function mG(a,b){let c=me(b,this.size,9);a.uniformMatrix3fv(this.addr,!1,c)}function mH(a,b){let c=me(b,this.size,16);a.uniformMatrix4fv(this.addr,!1,c)}function mI(a,b){a.uniform1iv(this.addr,b)}function mJ(a,b){a.uniform2iv(this.addr,b)}function mK(a,b){a.uniform3iv(this.addr,b)}function mL(a,b){a.uniform4iv(this.addr,b)}function mM(a,b){a.uniform1uiv(this.addr,b)}function mN(a,b){a.uniform2uiv(this.addr,b)}function mO(a,b){a.uniform3uiv(this.addr,b)}function mP(a,b){a.uniform4uiv(this.addr,b)}function mQ(a,b,c){let d,e=this.cache,f=b.length,g=mh(c,f);mf(e,g)||(a.uniform1iv(this.addr,g),mg(e,g)),d=this.type===a.SAMPLER_2D_SHADOW?l5:l4;for(let a=0;a!==f;++a)c.setTexture2D(b[a]||d,g[a])}function mR(a,b,c){let d=this.cache,e=b.length,f=mh(c,e);mf(d,f)||(a.uniform1iv(this.addr,f),mg(d,f));for(let a=0;a!==e;++a)c.setTexture3D(b[a]||l7,f[a])}function mS(a,b,c){let d=this.cache,e=b.length,f=mh(c,e);mf(d,f)||(a.uniform1iv(this.addr,f),mg(d,f));for(let a=0;a!==e;++a)c.setTextureCube(b[a]||l8,f[a])}function mT(a,b,c){let d=this.cache,e=b.length,f=mh(c,e);mf(d,f)||(a.uniform1iv(this.addr,f),mg(d,f));for(let a=0;a!==e;++a)c.setTexture2DArray(b[a]||l6,f[a])}class mU{constructor(a,b,c){this.id=a,this.addr=c,this.cache=[],this.type=b.type,this.setValue=function(a){switch(a){case 5126:return mi;case 35664:return mj;case 35665:return mk;case 35666:return ml;case 35674:return mm;case 35675:return mn;case 35676:return mo;case 5124:case 35670:return mp;case 35667:case 35671:return mq;case 35668:case 35672:return mr;case 35669:case 35673:return ms;case 5125:return mt;case 36294:return mu;case 36295:return mv;case 36296:return mw;case 35678:case 36198:case 36298:case 36306:case 35682:return mx;case 35679:case 36299:case 36307:return my;case 35680:case 36300:case 36308:case 36293:return mz;case 36289:case 36303:case 36311:case 36292:return mA}}(b.type)}}class mV{constructor(a,b,c){this.id=a,this.addr=c,this.cache=[],this.type=b.type,this.size=b.size,this.setValue=function(a){switch(a){case 5126:return mB;case 35664:return mC;case 35665:return mD;case 35666:return mE;case 35674:return mF;case 35675:return mG;case 35676:return mH;case 5124:case 35670:return mI;case 35667:case 35671:return mJ;case 35668:case 35672:return mK;case 35669:case 35673:return mL;case 5125:return mM;case 36294:return mN;case 36295:return mO;case 36296:return mP;case 35678:case 36198:case 36298:case 36306:case 35682:return mQ;case 35679:case 36299:case 36307:return mR;case 35680:case 36300:case 36308:case 36293:return mS;case 36289:case 36303:case 36311:case 36292:return mT}}(b.type)}}class mW{constructor(a){this.id=a,this.seq=[],this.map={}}setValue(a,b,c){let d=this.seq;for(let e=0,f=d.length;e!==f;++e){let f=d[e];f.setValue(a,b[f.id],c)}}}let mX=/(\w+)(\])?(\[|\.)?/g;function mY(a,b){a.seq.push(b),a.map[b.id]=b}class mZ{constructor(a,b){this.seq=[],this.map={};const c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(let d=0;d<c;++d){const c=a.getActiveUniform(b,d),e=a.getUniformLocation(b,c.name);!function(a,b,c){let d=a.name,e=d.length;for(mX.lastIndex=0;;){let f=mX.exec(d),g=mX.lastIndex,h=f[1],i="]"===f[2],j=f[3];if(i&&(h|=0),void 0===j||"["===j&&g+2===e){mY(c,void 0===j?new mU(h,a,b):new mV(h,a,b));break}{let a=c.map[h];void 0===a&&mY(c,a=new mW(h)),c=a}}}(c,e,this)}const d=[],e=[];for(const b of this.seq)b.type===a.SAMPLER_2D_SHADOW||b.type===a.SAMPLER_CUBE_SHADOW||b.type===a.SAMPLER_2D_ARRAY_SHADOW?d.push(b):e.push(b);d.length>0&&(this.seq=d.concat(e))}setValue(a,b,c,d){let e=this.map[b];void 0!==e&&e.setValue(a,c,d)}setOptional(a,b,c){let d=b[c];void 0!==d&&this.setValue(a,c,d)}static upload(a,b,c,d){for(let e=0,f=b.length;e!==f;++e){let f=b[e],g=c[f.id];!1!==g.needsUpdate&&f.setValue(a,g.value,d)}}static seqWithValue(a,b){let c=[];for(let d=0,e=a.length;d!==e;++d){let e=a[d];e.id in b&&c.push(e)}return c}}function m$(a,b,c){let d=a.createShader(b);return a.shaderSource(d,c),a.compileShader(d),d}let m_=0,m0=new dC;function m1(a,b,c){let d=a.getShaderParameter(b,a.COMPILE_STATUS),e=(a.getShaderInfoLog(b)||"").trim();if(d&&""===e)return"";let f=/ERROR: 0:(\d+)/.exec(e);if(!f)return e;{let d=parseInt(f[1]);return c.toUpperCase()+"\n\n"+e+"\n\n"+function(a,b){let c=a.split("\n"),d=[],e=Math.max(b-6,0),f=Math.min(b+6,c.length);for(let a=e;a<f;a++){let e=a+1;d.push(`${e===b?">":" "} ${e}: ${c[a]}`)}return d.join("\n")}(a.getShaderSource(b),d)}}let m2={[aC]:"Linear",[aD]:"Reinhard",[aE]:"Cineon",[aF]:"ACESFilmic",[aH]:"AgX",[aI]:"Neutral",[aG]:"Custom"},m3=new dz;function m4(a){return""!==a}function m5(a,b){let c=b.numSpotLightShadows+b.numSpotLightMaps-b.numSpotLightShadowsWithMaps;return a.replace(/NUM_SUN_LIGHTS/g,b.numSunLights).replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,b.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,c).replace(/NUM_RECT_AREA_LIGHTS/g,b.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,b.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,b.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,b.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,b.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,b.numPointLightShadows)}function m6(a,b){return a.replace(/NUM_CLIPPING_PLANES/g,b.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,b.numClippingPlanes-b.numClipIntersection)}let m7=/^[ \t]*#include +<([\w\d./]+)>/gm;function m8(a){return a.replace(m7,na)}let m9=new Map;function na(a,b){let c=lx[b];if(void 0===c){let a=m9.get(b);if(void 0!==a)c=lx[a],dg('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',b,a);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+b+">")}return m8(c)}let nb=/#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 nc(a){return a.replace(nb,nd)}function nd(a,b,c,d){let e="";for(let a=parseInt(b);a<parseInt(c);a++)e+=d.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return e}function ne(a){let b=`precision ${a.precision} float;
297
+ precision ${a.precision} int;
298
+ precision ${a.precision} sampler2D;
299
+ precision ${a.precision} samplerCube;
300
+ precision ${a.precision} sampler3D;
301
+ precision ${a.precision} sampler2DArray;
302
+ precision ${a.precision} sampler2DShadow;
303
+ precision ${a.precision} samplerCubeShadow;
304
+ precision ${a.precision} sampler2DArrayShadow;
305
+ precision ${a.precision} isampler2D;
306
+ precision ${a.precision} isampler3D;
307
+ precision ${a.precision} isamplerCube;
308
+ precision ${a.precision} isampler2DArray;
309
+ precision ${a.precision} usampler2D;
310
+ precision ${a.precision} usampler3D;
311
+ precision ${a.precision} usamplerCube;
312
+ precision ${a.precision} usampler2DArray;
313
+ `;return"highp"===a.precision?b+="\n#define HIGH_PRECISION":"mediump"===a.precision?b+="\n#define MEDIUM_PRECISION":"lowp"===a.precision&&(b+="\n#define LOW_PRECISION"),b}let nf={[L]:"SHADOWMAP_TYPE_PCF",[N]:"SHADOWMAP_TYPE_VSM"},ng={[aM]:"ENVMAP_TYPE_CUBE",[aN]:"ENVMAP_TYPE_CUBE",[aQ]:"ENVMAP_TYPE_CUBE_UV"},nh={[aN]:"ENVMAP_MODE_REFRACTION"},ni={[ay]:"ENVMAP_BLENDING_MULTIPLY",[az]:"ENVMAP_BLENDING_MIX",[aA]:"ENVMAP_BLENDING_ADD"};function nj(a,b,c,d){var e,f;let g,h,i,j,k=a.getContext(),l=c.defines,m=c.vertexShader,n=c.fragmentShader,o=nf[c.shadowMapType]||"SHADOWMAP_TYPE_BASIC",p=!1===c.envMap?"ENVMAP_TYPE_CUBE":ng[c.envMapMode]||"ENVMAP_TYPE_CUBE",q=!1===c.envMap?"ENVMAP_MODE_REFLECTION":nh[c.envMapMode]||"ENVMAP_MODE_REFLECTION",r=!1===c.envMap?"ENVMAP_BLENDING_NONE":ni[c.combine]||"ENVMAP_BLENDING_NONE",s=function(a){let b=a.envMapCubeUVHeight;if(null===b)return null;let c=Math.log2(b)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,c),112)),texelHeight:1/b,maxMip:c}}(c),t=[c.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",c.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(m4).join("\n"),u=function(a){let b=[];for(let c in a){let d=a[c];!1!==d&&b.push("#define "+c+" "+d)}return b.join("\n")}(l),v=k.createProgram(),w=c.glslVersion?"#version "+c.glslVersion+"\n":"";if(c.isRawShaderMaterial)(g=["#define SHADER_TYPE "+c.shaderType,"#define SHADER_NAME "+c.shaderName,u].filter(m4).join("\n")).length>0&&(g+="\n"),(h=["#define SHADER_TYPE "+c.shaderType,"#define SHADER_NAME "+c.shaderName,u].filter(m4).join("\n")).length>0&&(h+="\n");else{let a,b,d,i,j;g=[ne(c),"#define SHADER_TYPE "+c.shaderType,"#define SHADER_NAME "+c.shaderName,u,c.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",c.batching?"#define USE_BATCHING":"",c.batchingColor?"#define USE_BATCHING_COLOR":"",c.instancing?"#define USE_INSTANCING":"",c.instancingColor?"#define USE_INSTANCING_COLOR":"",c.instancingMorph?"#define USE_INSTANCING_MORPH":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+q:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",c.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",c.displacementMap?"#define USE_DISPLACEMENTMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.anisotropy?"#define USE_ANISOTROPY":"",c.anisotropyMap?"#define USE_ANISOTROPYMAP":"",c.clearcoatMap?"#define USE_CLEARCOATMAP":"",c.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",c.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",c.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",c.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",c.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.alphaHash?"#define USE_ALPHAHASH":"",c.transmission?"#define USE_TRANSMISSION":"",c.transmissionMap?"#define USE_TRANSMISSIONMAP":"",c.thicknessMap?"#define USE_THICKNESSMAP":"",c.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",c.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",c.mapUv?"#define MAP_UV "+c.mapUv:"",c.alphaMapUv?"#define ALPHAMAP_UV "+c.alphaMapUv:"",c.lightMapUv?"#define LIGHTMAP_UV "+c.lightMapUv:"",c.aoMapUv?"#define AOMAP_UV "+c.aoMapUv:"",c.emissiveMapUv?"#define EMISSIVEMAP_UV "+c.emissiveMapUv:"",c.bumpMapUv?"#define BUMPMAP_UV "+c.bumpMapUv:"",c.normalMapUv?"#define NORMALMAP_UV "+c.normalMapUv:"",c.displacementMapUv?"#define DISPLACEMENTMAP_UV "+c.displacementMapUv:"",c.metalnessMapUv?"#define METALNESSMAP_UV "+c.metalnessMapUv:"",c.roughnessMapUv?"#define ROUGHNESSMAP_UV "+c.roughnessMapUv:"",c.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+c.anisotropyMapUv:"",c.clearcoatMapUv?"#define CLEARCOATMAP_UV "+c.clearcoatMapUv:"",c.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+c.clearcoatNormalMapUv:"",c.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+c.clearcoatRoughnessMapUv:"",c.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+c.iridescenceMapUv:"",c.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+c.iridescenceThicknessMapUv:"",c.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+c.sheenColorMapUv:"",c.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+c.sheenRoughnessMapUv:"",c.specularMapUv?"#define SPECULARMAP_UV "+c.specularMapUv:"",c.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+c.specularColorMapUv:"",c.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+c.specularIntensityMapUv:"",c.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+c.transmissionMapUv:"",c.thicknessMapUv?"#define THICKNESSMAP_UV "+c.thicknessMapUv:"",c.vertexTangents&&!1===c.flatShading?"#define USE_TANGENT":"",c.vertexNormals?"#define HAS_NORMAL":"",c.vertexColors?"#define USE_COLOR":"",c.vertexAlphas?"#define USE_COLOR_ALPHA":"",c.vertexUv1s?"#define USE_UV1":"",c.vertexUv2s?"#define USE_UV2":"",c.vertexUv3s?"#define USE_UV3":"",c.pointsUvs?"#define USE_POINTS_UV":"",c.flatShading?"#define FLAT_SHADED":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals&&!1===c.flatShading?"#define USE_MORPHNORMALS":"",c.morphColors?"#define USE_MORPHCOLORS":"",c.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+c.morphTextureStride:"",c.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+c.morphTargetsCount:"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+o:"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"",c.numLightProbes>0?"#define USE_LIGHT_PROBES":"",c.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",c.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(m4).join("\n"),h=[ne(c),"#define SHADER_TYPE "+c.shaderType,"#define SHADER_NAME "+c.shaderName,u,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp2?"#define FOG_EXP2":"",c.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",c.map?"#define USE_MAP":"",c.matcap?"#define USE_MATCAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+p:"",c.envMap?"#define "+q:"",c.envMap?"#define "+r:"",s?"#define CUBEUV_TEXEL_WIDTH "+s.texelWidth:"",s?"#define CUBEUV_TEXEL_HEIGHT "+s.texelHeight:"",s?"#define CUBEUV_MAX_MIP "+s.maxMip+".0":"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",c.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",c.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.anisotropy?"#define USE_ANISOTROPY":"",c.anisotropyMap?"#define USE_ANISOTROPYMAP":"",c.clearcoat?"#define USE_CLEARCOAT":"",c.clearcoatMap?"#define USE_CLEARCOATMAP":"",c.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",c.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",c.dispersion?"#define USE_DISPERSION":"",c.retroreflection?"#define USE_RETROREFLECTION":"",c.iridescence?"#define USE_IRIDESCENCE":"",c.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",c.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",c.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",c.roughnessMap?"#define USE_ROUGHNESSMAP":"",c.metalnessMap?"#define USE_METALNESSMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.alphaTest?"#define USE_ALPHATEST":"",c.alphaHash?"#define USE_ALPHAHASH":"",c.sheen?"#define USE_SHEEN":"",c.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",c.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",c.transmission?"#define USE_TRANSMISSION":"",c.transmissionMap?"#define USE_TRANSMISSIONMAP":"",c.thicknessMap?"#define USE_THICKNESSMAP":"",c.vertexTangents&&!1===c.flatShading?"#define USE_TANGENT":"",c.vertexColors||c.instancingColor?"#define USE_COLOR":"",c.vertexAlphas||c.batchingColor?"#define USE_COLOR_ALPHA":"",c.vertexUv1s?"#define USE_UV1":"",c.vertexUv2s?"#define USE_UV2":"",c.vertexUv3s?"#define USE_UV3":"",c.pointsUvs?"#define USE_POINTS_UV":"",c.gradientMap?"#define USE_GRADIENTMAP":"",c.flatShading?"#define FLAT_SHADED":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+o:"",c.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",c.numLightProbes>0?"#define USE_LIGHT_PROBES":"",c.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",c.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",c.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",c.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",c.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",c.toneMapping!==aB?"#define TONE_MAPPING":"",c.toneMapping!==aB?lx.tonemapping_pars_fragment:"",c.toneMapping!==aB?(e="toneMapping",void 0===(a=m2[f=c.toneMapping])?(dg("WebGLProgram: Unsupported toneMapping:",f),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+a+"ToneMapping( color ); }"):"",c.dithering?"#define DITHERING":"",c.opaque?"#define OPAQUE":"",lx.colorspace_pars_fragment,(b=function(a){dG._getMatrix(m0,dG.workingColorSpace,a);let b=`mat3( ${m0.elements.map(a=>a.toFixed(4))} )`;switch(dG.getTransfer(a)){case cm:return[b,"LinearTransferOETF"];case cn:return[b,"sRGBTransferOETF"];default:return dg("WebGLProgram: Unsupported color space: ",a),[b,"LinearTransferOETF"]}}(c.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
314
+ return ${b[1]}( vec4( value.rgb * ${b[0]}, value.a ) );
315
+ }`),(dG.getLuminanceCoefficients(m3),d=m3.x.toFixed(4),i=m3.y.toFixed(4),j=m3.z.toFixed(4),`float luminance( const in vec3 rgb ) {
316
+ const vec3 weights = vec3( ${d}, ${i}, ${j} );
317
+ return dot( weights, rgb );
318
+ }`),c.useDepthPacking?"#define DEPTH_PACKING "+c.depthPacking:"","\n"].filter(m4).join("\n")}m=m6(m=m5(m=m8(m),c),c),n=m6(n=m5(n=m8(n),c),c),m=nc(m),n=nc(n),!0!==c.isRawShaderMaterial&&(w="#version 300 es\n",g=[t,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+g,h=["#define varying in",c.glslVersion===cZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",c.glslVersion===cZ?"":"#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"+h);let x=w+g+m,y=w+h+n,z=m$(k,k.VERTEX_SHADER,x),A=m$(k,k.FRAGMENT_SHADER,y);function B(b){if(a.debug.checkShaderErrors){let c=k.getProgramInfoLog(v)||"",d=k.getShaderInfoLog(z)||"",e=k.getShaderInfoLog(A)||"",f=c.trim(),i=d.trim(),j=e.trim(),l=!0,m=!0;if(!1===k.getProgramParameter(v,k.LINK_STATUS))if(l=!1,"function"==typeof a.debug.onShaderError)a.debug.onShaderError(k,v,z,A);else{let a=m1(k,z,"vertex"),c=m1(k,A,"fragment");dh("WebGLProgram: Shader Error "+k.getError()+" - VALIDATE_STATUS "+k.getProgramParameter(v,k.VALIDATE_STATUS)+"\n\nMaterial Name: "+b.name+"\nMaterial Type: "+b.type+"\n\nProgram Info Log: "+f+"\n"+a+"\n"+c)}else""!==f?dg("WebGLProgram: Program Info Log:",f):(""===i||""===j)&&(m=!1);m&&(b.diagnostics={runnable:l,programLog:f,vertexShader:{log:i,prefix:g},fragmentShader:{log:j,prefix:h}})}k.deleteShader(z),k.deleteShader(A),i=new mZ(k,v),j=function(a,b){let c={},d=a.getProgramParameter(b,a.ACTIVE_ATTRIBUTES);for(let e=0;e<d;e++){let d=a.getActiveAttrib(b,e),f=d.name,g=1;d.type===a.FLOAT_MAT2&&(g=2),d.type===a.FLOAT_MAT3&&(g=3),d.type===a.FLOAT_MAT4&&(g=4),c[f]={type:d.type,location:a.getAttribLocation(b,f),locationSize:g}}return c}(k,v)}k.attachShader(v,z),k.attachShader(v,A),void 0!==c.index0AttributeName?k.bindAttribLocation(v,0,c.index0AttributeName):!0===c.hasPositionAttribute&&k.bindAttribLocation(v,0,"position"),k.linkProgram(v),this.getUniforms=function(){return void 0===i&&B(this),i},this.getAttributes=function(){return void 0===j&&B(this),j};let C=!1===c.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===C&&(C=k.getProgramParameter(v,37297)),C},this.destroy=function(){d.releaseStatesOfProgram(this),k.deleteProgram(v),this.program=void 0},this.type=c.shaderType,this.name=c.shaderName,this.id=m_++,this.cacheKey=b,this.usedTimes=1,this.program=v,this.vertexShader=z,this.fragmentShader=A,this}let nk=0;class nl{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(a,b,c){let d=this._getShaderCacheForMaterial(a);return!1===d.has(b)&&(d.add(b),b.usedTimes++),!1===d.has(c)&&(d.add(c),c.usedTimes++),this}remove(a){for(let b of this.materialCache.get(a))b.usedTimes--,0===b.usedTimes&&this.shaderCache.delete(b.code);return this.materialCache.delete(a),this}getVertexShaderStage(a){return this._getShaderStage(a.vertexShader)}getFragmentShaderStage(a){return this._getShaderStage(a.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(a){let b=this.materialCache,c=b.get(a);return void 0===c&&(c=new Set,b.set(a,c)),c}_getShaderStage(a){let b=this.shaderCache,c=b.get(a);return void 0===c&&(c=new nm(a),b.set(a,c)),c}}class nm{constructor(a){this.id=nk++,this.code=a,this.usedTimes=0}}function nn(a,b,c,d,e,f){let g=new d7,h=new nl,i=new Set,j=[],k=new Map,l=d.logarithmicDepthBuffer,m=d.precision,n={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 o(a){return(i.add(a),0===a)?"uv":`uv${a}`}return{getParameters:function(e,g,j,k,p,q){var r;let s,t,u,v,w=k.fog,x=p.geometry,y=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?k.environment:null,z=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap,A=b.get(e.envMap||y,z),B=A&&A.mapping===aQ?A.image.height:null,C=n[e.type];null!==e.precision&&(m=d.getMaxPrecision(e.precision))!==e.precision&&dg("WebGLProgram.getParameters:",e.precision,"not supported, using",m,"instead.");let D=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,E=void 0!==D?D.length:0,F=0;if(void 0!==x.morphAttributes.position&&(F=1),void 0!==x.morphAttributes.normal&&(F=2),void 0!==x.morphAttributes.color&&(F=3),C){let a=lz[C];s=a.vertexShader,t=a.fragmentShader}else{s=e.vertexShader,t=e.fragmentShader;let a=h.getVertexShaderStage(e),b=h.getFragmentShaderStage(e);h.update(e,a,b),u=a.id,v=b.id}let G=a.getRenderTarget(),H=a.state.buffers.depth.getReversed(),I=!0===p.isInstancedMesh,J=!0===p.isBatchedMesh,K=!!e.map,L=!!e.matcap,M=!!A,N=!!e.aoMap,O=!!e.lightMap,R=!!e.bumpMap&&!1===e.wireframe,T=!!e.normalMap,U=!!e.displacementMap,V=!!e.emissiveMap,W=!!e.metalnessMap,X=!!e.roughnessMap,Y=e.anisotropy>0,Z=e.clearcoat>0,$=e.dispersion>0,_=e.retroreflectivity>0,aa=e.iridescence>0,ab=e.sheen>0,ac=e.transmission>0,ad=Y&&!!e.anisotropyMap,ae=Z&&!!e.clearcoatMap,af=Z&&!!e.clearcoatNormalMap,ag=Z&&!!e.clearcoatRoughnessMap,ah=aa&&!!e.iridescenceMap,ai=aa&&!!e.iridescenceThicknessMap,aj=ab&&!!e.sheenColorMap,ak=ab&&!!e.sheenRoughnessMap,al=!!e.specularMap,am=!!e.specularColorMap,an=!!e.specularIntensityMap,ao=ac&&!!e.transmissionMap,ap=ac&&!!e.thicknessMap,aq=!!e.gradientMap,ar=!!e.alphaMap,as=e.alphaTest>0,at=!!e.alphaHash,au=!!e.extensions,av=aB;e.toneMapped&&(null===G||!0===G.isXRRenderTarget)&&(av=a.toneMapping);let aw={shaderID:C,shaderType:e.type,shaderName:e.name,vertexShader:s,fragmentShader:t,defines:e.defines,customVertexShaderID:u,customFragmentShaderID:v,isRawShaderMaterial:!0===e.isRawShaderMaterial,glslVersion:e.glslVersion,precision:m,batching:J,batchingColor:J&&null!==p._colorsTexture,instancing:I,instancingColor:I&&null!==p.instanceColor,instancingMorph:I&&null!==p.morphTexture,outputColorSpace:null===G?a.outputColorSpace:!0===G.isXRRenderTarget?G.texture.colorSpace:dG.workingColorSpace,alphaToCoverage:!!e.alphaToCoverage,map:K,matcap:L,envMap:M,envMapMode:M&&A.mapping,envMapCubeUVHeight:B,aoMap:N,lightMap:O,bumpMap:R,normalMap:T,displacementMap:U,emissiveMap:V,normalMapObjectSpace:T&&e.normalMapType===ci,normalMapTangentSpace:T&&e.normalMapType===ch,packedNormalMap:T&&e.normalMapType===ch&&((r=e.normalMap.format)===bm||r===bD||r===bY),metalnessMap:W,roughnessMap:X,anisotropy:Y,anisotropyMap:ad,clearcoat:Z,clearcoatMap:ae,clearcoatNormalMap:af,clearcoatRoughnessMap:ag,dispersion:$,retroreflection:_,iridescence:aa,iridescenceMap:ah,iridescenceThicknessMap:ai,sheen:ab,sheenColorMap:aj,sheenRoughnessMap:ak,specularMap:al,specularColorMap:am,specularIntensityMap:an,transmission:ac,transmissionMap:ao,thicknessMap:ap,gradientMap:aq,opaque:!1===e.transparent&&e.blending===S&&!1===e.alphaToCoverage,alphaMap:ar,alphaTest:as,alphaHash:at,combine:e.combine,mapUv:K&&o(e.map.channel),aoMapUv:N&&o(e.aoMap.channel),lightMapUv:O&&o(e.lightMap.channel),bumpMapUv:R&&o(e.bumpMap.channel),normalMapUv:T&&o(e.normalMap.channel),displacementMapUv:U&&o(e.displacementMap.channel),emissiveMapUv:V&&o(e.emissiveMap.channel),metalnessMapUv:W&&o(e.metalnessMap.channel),roughnessMapUv:X&&o(e.roughnessMap.channel),anisotropyMapUv:ad&&o(e.anisotropyMap.channel),clearcoatMapUv:ae&&o(e.clearcoatMap.channel),clearcoatNormalMapUv:af&&o(e.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ag&&o(e.clearcoatRoughnessMap.channel),iridescenceMapUv:ah&&o(e.iridescenceMap.channel),iridescenceThicknessMapUv:ai&&o(e.iridescenceThicknessMap.channel),sheenColorMapUv:aj&&o(e.sheenColorMap.channel),sheenRoughnessMapUv:ak&&o(e.sheenRoughnessMap.channel),specularMapUv:al&&o(e.specularMap.channel),specularColorMapUv:am&&o(e.specularColorMap.channel),specularIntensityMapUv:an&&o(e.specularIntensityMap.channel),transmissionMapUv:ao&&o(e.transmissionMap.channel),thicknessMapUv:ap&&o(e.thicknessMap.channel),alphaMapUv:ar&&o(e.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(T||Y),vertexNormals:!!x.attributes.normal,vertexColors:e.vertexColors,vertexAlphas:!0===e.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===p.isPoints&&!!x.attributes.uv&&(K||ar),fog:!!w,useFog:!0===e.fog,fogExp2:!!w&&w.isFogExp2,flatShading:!1===e.wireframe&&(!0===e.flatShading||void 0===x.attributes.normal&&!1===T&&(e.isMeshLambertMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isMeshPhysicalMaterial)),sizeAttenuation:!0===e.sizeAttenuation,logarithmicDepthBuffer:l,reversedDepthBuffer:H,skinning:!0===p.isSkinnedMesh,hasPositionAttribute:void 0!==x.attributes.position,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:E,morphTextureStride:F,numSunLights:g.sun.length,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numSunLightShadows:g.sunShadowMap.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:f.numPlanes,numClipIntersection:f.numIntersection,dithering:e.dithering,shadowMapEnabled:a.shadowMap.enabled&&j.length>0,shadowMapType:a.shadowMap.type,toneMapping:av,decodeVideoTexture:K&&!0===e.map.isVideoTexture&&dG.getTransfer(e.map.colorSpace)===cn,decodeVideoTextureEmissive:V&&!0===e.emissiveMap.isVideoTexture&&dG.getTransfer(e.emissiveMap.colorSpace)===cn,premultipliedAlpha:e.premultipliedAlpha,doubleSided:e.side===Q,flipSided:e.side===P,useDepthPacking:e.depthPacking>=0,depthPacking:e.depthPacking||0,index0AttributeName:e.index0AttributeName,extensionClipCullDistance:au&&!0===e.extensions.clipCullDistance&&c.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(au&&!0===e.extensions.multiDraw||J)&&c.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:c.has("KHR_parallel_shader_compile"),customProgramCacheKey:e.customProgramCacheKey()};return aw.vertexUv1s=i.has(1),aw.vertexUv2s=i.has(2),aw.vertexUv3s=i.has(3),i.clear(),aw},getProgramCacheKey:function(b){var c,d,e,f;let h=[];if(b.shaderID?h.push(b.shaderID):(h.push(b.customVertexShaderID),h.push(b.customFragmentShaderID)),void 0!==b.defines)for(let a in b.defines)h.push(a),h.push(b.defines[a]);return!1===b.isRawShaderMaterial&&(c=h,d=b,c.push(d.precision),c.push(d.outputColorSpace),c.push(d.envMapMode),c.push(d.envMapCubeUVHeight),c.push(d.mapUv),c.push(d.alphaMapUv),c.push(d.lightMapUv),c.push(d.aoMapUv),c.push(d.bumpMapUv),c.push(d.normalMapUv),c.push(d.displacementMapUv),c.push(d.emissiveMapUv),c.push(d.metalnessMapUv),c.push(d.roughnessMapUv),c.push(d.anisotropyMapUv),c.push(d.clearcoatMapUv),c.push(d.clearcoatNormalMapUv),c.push(d.clearcoatRoughnessMapUv),c.push(d.iridescenceMapUv),c.push(d.iridescenceThicknessMapUv),c.push(d.sheenColorMapUv),c.push(d.sheenRoughnessMapUv),c.push(d.specularMapUv),c.push(d.specularColorMapUv),c.push(d.specularIntensityMapUv),c.push(d.transmissionMapUv),c.push(d.thicknessMapUv),c.push(d.combine),c.push(d.fogExp2),c.push(d.sizeAttenuation),c.push(d.morphTargetsCount),c.push(d.morphAttributeCount),c.push(d.numSunLights),c.push(d.numDirLights),c.push(d.numPointLights),c.push(d.numSpotLights),c.push(d.numSpotLightMaps),c.push(d.numHemiLights),c.push(d.numRectAreaLights),c.push(d.numSunLightShadows),c.push(d.numDirLightShadows),c.push(d.numPointLightShadows),c.push(d.numSpotLightShadows),c.push(d.numSpotLightShadowsWithMaps),c.push(d.numLightProbes),c.push(d.shadowMapType),c.push(d.toneMapping),c.push(d.numClippingPlanes),c.push(d.numClipIntersection),c.push(d.depthPacking),e=h,f=b,g.disableAll(),f.instancing&&g.enable(0),f.instancingColor&&g.enable(1),f.instancingMorph&&g.enable(2),f.matcap&&g.enable(3),f.envMap&&g.enable(4),f.normalMapObjectSpace&&g.enable(5),f.normalMapTangentSpace&&g.enable(6),f.clearcoat&&g.enable(7),f.iridescence&&g.enable(8),f.alphaTest&&g.enable(9),f.vertexColors&&g.enable(10),f.vertexAlphas&&g.enable(11),f.vertexUv1s&&g.enable(12),f.vertexUv2s&&g.enable(13),f.vertexUv3s&&g.enable(14),f.vertexTangents&&g.enable(15),f.anisotropy&&g.enable(16),f.alphaHash&&g.enable(17),f.batching&&g.enable(18),f.dispersion&&g.enable(19),f.retroreflection&&g.enable(24),f.batchingColor&&g.enable(20),f.gradientMap&&g.enable(21),f.packedNormalMap&&g.enable(22),f.vertexNormals&&g.enable(23),e.push(g.mask),g.disableAll(),f.fog&&g.enable(0),f.useFog&&g.enable(1),f.flatShading&&g.enable(2),f.logarithmicDepthBuffer&&g.enable(3),f.reversedDepthBuffer&&g.enable(4),f.skinning&&g.enable(5),f.morphTargets&&g.enable(6),f.morphNormals&&g.enable(7),f.morphColors&&g.enable(8),f.premultipliedAlpha&&g.enable(9),f.shadowMapEnabled&&g.enable(10),f.doubleSided&&g.enable(11),f.flipSided&&g.enable(12),f.useDepthPacking&&g.enable(13),f.dithering&&g.enable(14),f.transmission&&g.enable(15),f.sheen&&g.enable(16),f.opaque&&g.enable(17),f.pointsUvs&&g.enable(18),f.decodeVideoTexture&&g.enable(19),f.decodeVideoTextureEmissive&&g.enable(20),f.alphaToCoverage&&g.enable(21),f.numLightProbeGrids>0&&g.enable(22),f.hasPositionAttribute&&g.enable(23),e.push(g.mask),h.push(a.outputColorSpace)),h.push(b.customProgramCacheKey),h.join()},getUniforms:function(a){let b,c=n[a.type];if(c){let a=lz[c];b=iI.clone(a.uniforms)}else b=a.uniforms;return b},acquireProgram:function(b,c){let d=k.get(c);return void 0!==d?++d.usedTimes:(d=new nj(a,c,b,e),j.push(d),k.set(c,d)),d},releaseProgram:function(a){if(0==--a.usedTimes){let b=j.indexOf(a);j[b]=j[j.length-1],j.pop(),k.delete(a.cacheKey),a.destroy()}},releaseShaderCache:function(a){h.remove(a)},programs:j,dispose:function(){h.dispose()}}}function no(){let a=new WeakMap;return{has:function(b){return a.has(b)},get:function(b){let c=a.get(b);return void 0===c&&(c={},a.set(b,c)),c},remove:function(b){a.delete(b)},update:function(b,c,d){a.get(b)[c]=d},dispose:function(){a=new WeakMap}}}function np(a,b){if(a.groupOrder!==b.groupOrder)return a.groupOrder-b.groupOrder;if(a.renderOrder!==b.renderOrder)return a.renderOrder-b.renderOrder;if(a.material.id!==b.material.id)return a.material.id-b.material.id;if(a.materialVariant!==b.materialVariant)return a.materialVariant-b.materialVariant;if(a.z!==b.z)return a.z-b.z;else return a.id-b.id}function nq(a,b){return a.groupOrder!==b.groupOrder?a.groupOrder-b.groupOrder:a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function nr(){let a=[],b=0,c=[],d=[],e=[];function f(a){let b=0;return a.isInstancedMesh&&(b+=2),a.isSkinnedMesh&&(b+=1),b}function g(c,d,e,g,h,i){let j=a[b];return void 0===j?(j={id:c.id,object:c,geometry:d,material:e,materialVariant:f(c),groupOrder:g,renderOrder:c.renderOrder,z:h,group:i},a[b]=j):(j.id=c.id,j.object=c,j.geometry=d,j.material=e,j.materialVariant=f(c),j.groupOrder=g,j.renderOrder=c.renderOrder,j.z=h,j.group=i),b++,j}return{opaque:c,transmissive:d,transparent:e,init:function(){b=0,c.length=0,d.length=0,e.length=0},push:function(a,b,f,h,i,j,k){!0===k.reversedDepth&&(i=-i);let l=g(a,b,f,h,i,j);f.transmission>0?d.push(l):!0===f.transparent?e.push(l):c.push(l)},unshift:function(a,b,f,h,i,j){let k=g(a,b,f,h,i,j);f.transmission>0?d.unshift(k):!0===f.transparent?e.unshift(k):c.unshift(k)},finish:function(){for(let c=b,d=a.length;c<d;c++){let b=a[c];if(null===b.id)break;b.id=null,b.object=null,b.geometry=null,b.material=null,b.group=null}},sort:function(a,b){c.length>1&&c.sort(a||np),d.length>1&&d.sort(b||nq),e.length>1&&e.sort(b||nq)}}}function ns(){let a=new WeakMap;return{get:function(b,c){let d,e=a.get(b);return void 0===e?(d=new nr,a.set(b,[d])):c>=e.length?(d=new nr,e.push(d)):d=e[c],d},dispose:function(){a=new WeakMap}}}function nt(){let a={};return{get:function(b){let c;if(void 0!==a[b.id])return a[b.id];switch(b.type){case"SunLight":case"DirectionalLight":c={direction:new dz,color:new ev};break;case"SpotLight":c={position:new dz,direction:new dz,color:new ev,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":c={position:new dz,color:new ev,distance:0,decay:0};break;case"HemisphereLight":c={direction:new dz,skyColor:new ev,groundColor:new ev};break;case"RectAreaLight":c={color:new ev,position:new dz,halfWidth:new dz,halfHeight:new dz}}return a[b.id]=c,c}}}let nu=0;function nv(a,b){return 2*!!b.castShadow-2*!!a.castShadow+ +!!b.map-!!a.map}function nw(a){let b,c=new nt,d=(b={},{get:function(a){let c;if(void 0!==b[a.id])return b[a.id];switch(a.type){case"SunLight":case"DirectionalLight":case"SpotLight":c={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dx};break;case"PointLight":c={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new dx,shadowCameraNear:1,shadowCameraFar:1e3}}return b[a.id]=c,c}}),e={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],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 a=0;a<9;a++)e.probe.push(new dz);let f=new dz,g=new dY,h=new dY;return{setup:function(b){let f=0,g=0,h=0;for(let a=0;a<9;a++)e.probe[a].set(0,0,0);let i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;b.sort(nv);for(let a=0,w=b.length;a<w;a++){let w=b[a],x=w.color,y=w.intensity,z=w.distance,A=null;if(w.shadow&&w.shadow.map&&(A=w.shadow.map.texture.format===bm?w.shadow.map.texture:w.shadow.map.depthTexture||w.shadow.map.texture),w.isAmbientLight)f+=x.r*y,g+=x.g*y,h+=x.b*y;else if(w.isLightProbe){for(let a=0;a<9;a++)e.probe[a].addScaledVector(w.sh.coefficients[a],y);v++}else if(w.isSunLight){let a=c.get(w);if(a.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){let a=w.shadow,b=d.get(w);b.shadowIntensity=a.intensity,b.shadowBias=a.bias,b.shadowNormalBias=a.normalBias,b.shadowRadius=a.radius,b.shadowMapSize.copy(a.mapSize).multiply(a.getFrameExtents()),e.sunShadow[j]=b,e.sunShadowMap[j]=A;let c=a.getViewportCount();for(let b=0;b<c;b++)e.sunShadowMatrix[k+b]=a.getMatrix(b),e.sunShadowCascade[k+b]=a._cascadeData[b];k+=c,j++}e.sun[i]=a,i++}else if(w.isDirectionalLight){let a=c.get(w);if(a.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){let a=w.shadow,b=d.get(w);b.shadowIntensity=a.intensity,b.shadowBias=a.bias,b.shadowNormalBias=a.normalBias,b.shadowRadius=a.radius,b.shadowMapSize=a.mapSize,e.directionalShadow[l]=b,e.directionalShadowMap[l]=A,e.directionalShadowMatrix[l]=w.shadow.matrix,q++}e.directional[l]=a,l++}else if(w.isSpotLight){let a=c.get(w);a.position.setFromMatrixPosition(w.matrixWorld),a.color.copy(x).multiplyScalar(y),a.distance=z,a.coneCos=Math.cos(w.angle),a.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),a.decay=w.decay,e.spot[n]=a;let b=w.shadow;if(w.map&&(e.spotLightMap[t]=w.map,t++,b.updateMatrices(w),w.castShadow&&u++),e.spotLightMatrix[n]=b.matrix,w.castShadow){let a=d.get(w);a.shadowIntensity=b.intensity,a.shadowBias=b.bias,a.shadowNormalBias=b.normalBias,a.shadowRadius=b.radius,a.shadowMapSize=b.mapSize,e.spotShadow[n]=a,e.spotShadowMap[n]=A,s++}n++}else if(w.isRectAreaLight){let a=c.get(w);a.color.copy(x).multiplyScalar(y),a.halfWidth.set(.5*w.width,0,0),a.halfHeight.set(0,.5*w.height,0),e.rectArea[o]=a,o++}else if(w.isPointLight){let a=c.get(w);if(a.color.copy(w.color).multiplyScalar(w.intensity),a.distance=w.distance,a.decay=w.decay,w.castShadow){let a=w.shadow,b=d.get(w);b.shadowIntensity=a.intensity,b.shadowBias=a.bias,b.shadowNormalBias=a.normalBias,b.shadowRadius=a.radius,b.shadowMapSize=a.mapSize,b.shadowCameraNear=a.camera.near,b.shadowCameraFar=a.camera.far,e.pointShadow[m]=b,e.pointShadowMap[m]=A,e.pointShadowMatrix[m]=w.shadow.matrix,r++}e.point[m]=a,m++}else if(w.isHemisphereLight){let a=c.get(w);a.skyColor.copy(w.color).multiplyScalar(y),a.groundColor.copy(w.groundColor).multiplyScalar(y),e.hemi[p]=a,p++}}o>0&&(!0===a.has("OES_texture_float_linear")?(e.rectAreaLTC1=ly.LTC_FLOAT_1,e.rectAreaLTC2=ly.LTC_FLOAT_2):(e.rectAreaLTC1=ly.LTC_HALF_1,e.rectAreaLTC2=ly.LTC_HALF_2)),e.ambient[0]=f,e.ambient[1]=g,e.ambient[2]=h;let w=e.hash;(w.sunLength!==i||w.directionalLength!==l||w.pointLength!==m||w.spotLength!==n||w.rectAreaLength!==o||w.hemiLength!==p||w.numSunShadows!==j||w.numDirectionalShadows!==q||w.numPointShadows!==r||w.numSpotShadows!==s||w.numSpotMaps!==t||w.numLightProbes!==v)&&(e.sun.length=i,e.directional.length=l,e.spot.length=n,e.rectArea.length=o,e.point.length=m,e.hemi.length=p,e.sunShadow.length=j,e.sunShadowMap.length=j,e.sunShadowMatrix.length=k,e.sunShadowCascade.length=k,e.directionalShadow.length=q,e.directionalShadowMap.length=q,e.directionalShadowMatrix.length=q,e.pointShadow.length=r,e.pointShadowMap.length=r,e.pointShadowMatrix.length=r,e.spotShadow.length=s,e.spotShadowMap.length=s,e.spotLightMatrix.length=s+t-u,e.spotLightMap.length=t,e.numSpotLightShadowsWithMaps=u,e.numLightProbes=v,w.sunLength=i,w.directionalLength=l,w.pointLength=m,w.spotLength=n,w.rectAreaLength=o,w.hemiLength=p,w.numSunShadows=j,w.numDirectionalShadows=q,w.numPointShadows=r,w.numSpotShadows=s,w.numSpotMaps=t,w.numLightProbes=v,e.version=nu++)},setupView:function(a,b){let c=0,d=0,i=0,j=0,k=0,l=0,m=b.matrixWorldInverse;for(let b=0,n=a.length;b<n;b++){let n=a[b];if(n.isSunLight){let a=e.sun[c];a.direction.setFromMatrixPosition(n.matrixWorld),a.direction.transformDirection(m),c++}else if(n.isDirectionalLight){let a=e.directional[d];a.direction.setFromMatrixPosition(n.matrixWorld),f.setFromMatrixPosition(n.target.matrixWorld),a.direction.sub(f),a.direction.transformDirection(m),d++}else if(n.isSpotLight){let a=e.spot[j];a.position.setFromMatrixPosition(n.matrixWorld),a.position.applyMatrix4(m),a.direction.setFromMatrixPosition(n.matrixWorld),f.setFromMatrixPosition(n.target.matrixWorld),a.direction.sub(f),a.direction.transformDirection(m),j++}else if(n.isRectAreaLight){let a=e.rectArea[k];a.position.setFromMatrixPosition(n.matrixWorld),a.position.applyMatrix4(m),h.identity(),g.copy(n.matrixWorld),g.premultiply(m),h.extractRotation(g),a.halfWidth.set(.5*n.width,0,0),a.halfHeight.set(0,.5*n.height,0),a.halfWidth.applyMatrix4(h),a.halfHeight.applyMatrix4(h),k++}else if(n.isPointLight){let a=e.point[i];a.position.setFromMatrixPosition(n.matrixWorld),a.position.applyMatrix4(m),i++}else if(n.isHemisphereLight){let a=e.hemi[l];a.direction.setFromMatrixPosition(n.matrixWorld),a.direction.transformDirection(m),l++}}},state:e}}function nx(a){let b=new nw(a),c=[],d=[],e=[],f={lightsArray:c,shadowsArray:d,lightProbeGridArray:e,camera:null,lights:b,transmissionRenderTarget:{},textureUnits:0};return{init:function(a){f.camera=a,c.length=0,d.length=0,e.length=0},state:f,setupLights:function(){b.setup(c)},setupLightsView:function(a){b.setupView(c,a)},pushLight:function(a){c.push(a)},pushShadow:function(a){d.push(a)},pushLightProbeGrid:function(a){e.push(a)}}}function ny(a){let b=new WeakMap;return{get:function(c,d=0){let e,f=b.get(c);return void 0===f?(e=new nx(a),b.set(c,[e])):d>=f.length?(e=new nx(a),f.push(e)):e=f[d],e},dispose:function(){b=new WeakMap}}}let nz=[new dz(1,0,0),new dz(-1,0,0),new dz(0,1,0),new dz(0,-1,0),new dz(0,0,1),new dz(0,0,-1)],nA=[new dz(0,-1,0),new dz(0,-1,0),new dz(0,0,1),new dz(0,0,-1),new dz(0,-1,0),new dz(0,-1,0)],nB=new dY,nC=new dz,nD=new dz;function nE(a,b,c){let d=new gD,e=new dx,f=new dx,g=new dR,h=new iR,i=new iS,j={},k=c.maxTextureSize,l={[O]:P,[P]:O,[Q]:Q},m=new iJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new dx},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}"}),n=m.clone();n.defines.HORIZONTAL_PASS=1;let o=new ft;o.setAttribute("position",new e8(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let p=new ga(o,m),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=L;let r=this.type;function s(b,c,d,e){let f=null,g=!0===d.isPointLight?b.customDistanceMaterial:b.customDepthMaterial;if(void 0!==g)f=g;else if(f=!0===d.isPointLight?i:h,a.localClippingEnabled&&!0===c.clipShadows&&Array.isArray(c.clippingPlanes)&&0!==c.clippingPlanes.length||c.displacementMap&&0!==c.displacementScale||c.alphaMap&&c.alphaTest>0||c.map&&c.alphaTest>0||!0===c.alphaToCoverage){let a=f.uuid,b=c.uuid,d=j[a];void 0===d&&(d={},j[a]=d);let e=d[b];void 0===e&&(e=f.clone(),d[b]=e,c.addEventListener("dispose",t)),f=e}return f.visible=c.visible,f.wireframe=c.wireframe,e===N?f.side=null!==c.shadowSide?c.shadowSide:c.side:f.side=null!==c.shadowSide?c.shadowSide:l[c.side],f.alphaMap=c.alphaMap,f.alphaTest=!0===c.alphaToCoverage?.5:c.alphaTest,f.map=c.map,f.clipShadows=c.clipShadows,f.clippingPlanes=c.clippingPlanes,f.clipIntersection=c.clipIntersection,f.displacementMap=c.displacementMap,f.displacementScale=c.displacementScale,f.displacementBias=c.displacementBias,f.wireframeLinewidth=c.wireframeLinewidth,f.linewidth=c.linewidth,!0===d.isPointLight&&!0===f.isMeshDistanceMaterial&&(a.properties.get(f).light=d),f}function t(a){for(let b in a.target.removeEventListener("dispose",t),j){let c=j[b],d=a.target.uuid;d in c&&(c[d].dispose(),delete c[d])}}this.render=function(c,h,i){if(!1===q.enabled||!1===q.autoUpdate&&!1===q.needsUpdate||0===c.length)return;this.type===M&&(dg("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=L);let j=a.getRenderTarget(),l=a.getActiveCubeFace(),o=a.getActiveMipmapLevel(),t=a.state;t.setBlending(R),!0===t.buffers.depth.getReversed()?t.buffers.color.setClear(0,0,0,0):t.buffers.color.setClear(1,1,1,1),t.buffers.depth.setTest(!0),t.setScissorTest(!1);let u=r!==this.type;u&&h.traverse(function(a){a.material&&(Array.isArray(a.material)?a.material.forEach(a=>a.needsUpdate=!0):a.material.needsUpdate=!0)});for(let j=0,l=c.length;j<l;j++){let l=c[j],o=l.shadow;if(void 0===o){dg("WebGLShadowMap:",l,"has no shadow.");continue}if(!1===o.autoUpdate&&!1===o.needsUpdate)continue;e.copy(o.mapSize);let q=o.getFrameExtents();e.multiply(q),f.copy(o.mapSize),(e.x>k||e.y>k)&&(e.x>k&&(f.x=Math.floor(k/q.x),e.x=f.x*q.x,o.mapSize.x=f.x),e.y>k&&(f.y=Math.floor(k/q.y),e.y=f.y*q.y,o.mapSize.y=f.y));let r=a.state.buffers.depth.getReversed();if(o.camera._reversedDepth=r,null===o.map||!0===u){if(null!==o.map&&(null!==o.map.depthTexture&&(o.map.depthTexture.dispose(),o.map.depthTexture=null),o.map.dispose()),this.type===N){if(l.isPointLight){dg("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}o.map=new dT(e.x,e.y,{format:bm,type:a9,minFilter:aZ,magFilter:aZ,generateMipmaps:!1}),o.map.texture.name=l.name+".shadowMap",o.map.depthTexture=new hq(e.x,e.y,a8),o.map.depthTexture.name=l.name+".shadowMapDepth",o.map.depthTexture.format=bi,o.map.depthTexture.compareFunction=null,o.map.depthTexture.minFilter=aU,o.map.depthTexture.magFilter=aU}else l.isPointLight?(o.map=new lW(e.x),o.map.depthTexture=new hr(e.x,a7)):(o.map=new dT(e.x,e.y),o.map.depthTexture=new hq(e.x,e.y,a7)),o.map.depthTexture.name=l.name+".shadowMap",o.map.depthTexture.format=bi,this.type===L?(o.map.depthTexture.compareFunction=r?cN:cK,o.map.depthTexture.minFilter=aZ,o.map.depthTexture.magFilter=aZ):(o.map.depthTexture.compareFunction=null,o.map.depthTexture.minFilter=aU,o.map.depthTexture.magFilter=aU);o.camera.updateProjectionMatrix()}!0!==o.map.isWebGLCubeRenderTarget&&(o.map.width!==e.x||o.map.height!==e.y)&&o.map.setSize(e.x,e.y);let v=o.map.isWebGLCubeRenderTarget?6:o.getViewportCount();!0!==l.isPointLight&&o.updateMatrices(l,i);for(let c=0;c<v;c++){let e=o.getCamera(c);if(l.isPointLight){let a=o.camera,b=o.matrix,d=l.distance||a.far;d!==a.far&&(a.far=d,a.updateProjectionMatrix()),nC.setFromMatrixPosition(l.matrixWorld),a.position.copy(nC),nD.copy(a.position),nD.add(nz[c]),a.up.copy(nA[c]),a.lookAt(nD),a.updateMatrixWorld(),b.makeTranslation(-nC.x,-nC.y,-nC.z),nB.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),o._frustum.setFromProjectionMatrix(nB,a.coordinateSystem,a.reversedDepth)}if(o.map.isWebGLCubeRenderTarget)a.setRenderTarget(o.map,c),a.clear();else{0===c&&(a.setRenderTarget(o.map),a.clear());let b=o.getViewport(c);g.set(f.x*b.x,f.y*b.y,f.x*b.z,f.y*b.w),t.viewport(g)}d=o.getFrustum(c),function c(e,f,g,h,i){if(!1===e.visible)return;if(e.layers.test(f.layers)&&(e.isMesh||e.isLine||e.isPoints)&&(e.castShadow||e.receiveShadow&&i===N)&&(!e.frustumCulled||e.intersectsFrustum(d))){e.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,e.matrixWorld);let c=b.update(e),d=e.material;if(Array.isArray(d)){let b=c.groups;for(let j=0,k=b.length;j<k;j++){let k=b[j],l=d[k.materialIndex];if(l&&l.visible){let b=s(e,l,h,i);e.onBeforeShadow(a,e,f,g,c,b,k),a.renderBufferDirect(g,null,c,b,e,k),e.onAfterShadow(a,e,f,g,c,b,k)}}}else if(d.visible){let b=s(e,d,h,i);e.onBeforeShadow(a,e,f,g,c,b,null),a.renderBufferDirect(g,null,c,b,e,null),e.onAfterShadow(a,e,f,g,c,b,null)}}let j=e.children;for(let a=0,b=j.length;a<b;a++)c(j[a],f,g,h,i)}(h,i,e,l,this.type)}!0!==o.isPointLightShadow&&this.type===N&&function(c,d){let f=b.update(p);m.defines.VSM_SAMPLES!==c.blurSamples&&(m.defines.VSM_SAMPLES=c.blurSamples,n.defines.VSM_SAMPLES=c.blurSamples,m.needsUpdate=!0,n.needsUpdate=!0),null===c.mapPass?c.mapPass=new dT(e.x,e.y,{format:bm,type:a9}):(c.mapPass.width!==c.map.width||c.mapPass.height!==c.map.height)&&c.mapPass.setSize(c.map.width,c.map.height),m.uniforms.shadow_pass.value=c.map.depthTexture,m.uniforms.resolution.value.set(c.map.width,c.map.height),m.uniforms.radius.value=c.radius,a.setRenderTarget(c.mapPass),a.clear(),a.renderBufferDirect(d,null,f,m,p,null),n.uniforms.shadow_pass.value=c.mapPass.texture,n.uniforms.resolution.value.set(c.map.width,c.map.height),n.uniforms.radius.value=c.radius,a.setRenderTarget(c.map),a.clear(),a.renderBufferDirect(d,null,f,n,p,null)}(o,i),o.needsUpdate=!1}r=this.type,q.needsUpdate=!1,a.setRenderTarget(j,l,o)}}function nF(a,b){let c=new function(){let b=!1,c=new dR,d=null,e=new dR(0,0,0,0);return{setMask:function(c){d===c||b||(a.colorMask(c,c,c,c),d=c)},setLocked:function(a){b=a},setClear:function(b,d,f,g,h){!0===h&&(b*=g,d*=g,f*=g),c.set(b,d,f,g),!1===e.equals(c)&&(a.clearColor(b,d,f,g),e.copy(c))},reset:function(){b=!1,d=null,e.set(-1,0,0,0)}}},d=new function(){let c=!1,d=!1,e=null,f=null,g=null;return{setReversed:function(a){if(d!==a){let c=b.get("EXT_clip_control");a?c.clipControlEXT(c.LOWER_LEFT_EXT,c.ZERO_TO_ONE_EXT):c.clipControlEXT(c.LOWER_LEFT_EXT,c.NEGATIVE_ONE_TO_ONE_EXT),d=a;let e=g;g=null,this.setClear(e)}},getReversed:function(){return d},setTest:function(b){b?az(a.DEPTH_TEST):aA(a.DEPTH_TEST)},setMask:function(b){e===b||c||(a.depthMask(b),e=b)},setFunc:function(b){if(d&&(b=dj[b]),f!==b){switch(b){case aq:a.depthFunc(a.NEVER);break;case ar:a.depthFunc(a.ALWAYS);break;case as:a.depthFunc(a.LESS);break;case at:a.depthFunc(a.LEQUAL);break;case au:a.depthFunc(a.EQUAL);break;case av:a.depthFunc(a.GEQUAL);break;case aw:a.depthFunc(a.GREATER);break;case ax:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}f=b}},setLocked:function(a){c=a},setClear:function(b){g!==b&&(g=b,d&&(b=1-b),a.clearDepth(b))},reset:function(){c=!1,e=null,f=null,g=null,d=!1}}},e=new function(){let b=!1,c=null,d=null,e=null,f=null,g=null,h=null,i=null,j=null;return{setTest:function(c){b||(c?az(a.STENCIL_TEST):aA(a.STENCIL_TEST))},setMask:function(d){c===d||b||(a.stencilMask(d),c=d)},setFunc:function(b,c,g){(d!==b||e!==c||f!==g)&&(a.stencilFunc(b,c,g),d=b,e=c,f=g)},setOp:function(b,c,d){(g!==b||h!==c||i!==d)&&(a.stencilOp(b,c,d),g=b,h=c,i=d)},setLocked:function(a){b=a},setClear:function(b){j!==b&&(a.clearStencil(b),j=b)},reset:function(){b=!1,c=null,d=null,e=null,f=null,g=null,h=null,i=null,j=null}}},f=new WeakMap,g=new WeakMap,h={},i={},j={},k=new WeakMap,l=[],m=null,n=!1,o=null,p=null,q=null,r=null,s=null,t=null,u=null,v=new ev(0,0,0),w=0,x=!1,y=null,z=null,A=null,B=null,C=null,D=a.getParameter(a.MAX_COMBINED_TEXTURE_IMAGE_UNITS),E=!1,F=a.getParameter(a.VERSION);-1!==F.indexOf("WebGL")?E=parseFloat(/^WebGL (\d)/.exec(F)[1])>=1:-1!==F.indexOf("OpenGL ES")&&(E=parseFloat(/^OpenGL ES (\d)/.exec(F)[1])>=2);let J=null,K={},L=a.getParameter(a.SCISSOR_BOX),M=a.getParameter(a.VIEWPORT),N=new dR().fromArray(L),O=new dR().fromArray(M);function X(b,c,d,e){let f=new Uint8Array(4),g=a.createTexture();a.bindTexture(b,g),a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST);for(let g=0;g<d;g++)b===a.TEXTURE_3D||b===a.TEXTURE_2D_ARRAY?a.texImage3D(c,0,a.RGBA,1,1,e,0,a.RGBA,a.UNSIGNED_BYTE,f):a.texImage2D(c+g,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,f);return g}let ay={};function az(b){!0!==h[b]&&(a.enable(b),h[b]=!0)}function aA(b){!1!==h[b]&&(a.disable(b),h[b]=!1)}ay[a.TEXTURE_2D]=X(a.TEXTURE_2D,a.TEXTURE_2D,1),ay[a.TEXTURE_CUBE_MAP]=X(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6),ay[a.TEXTURE_2D_ARRAY]=X(a.TEXTURE_2D_ARRAY,a.TEXTURE_2D_ARRAY,1,1),ay[a.TEXTURE_3D]=X(a.TEXTURE_3D,a.TEXTURE_3D,1,1),c.setClear(0,0,0,1),d.setClear(1),e.setClear(0),az(a.DEPTH_TEST),d.setFunc(at),aE(!1),aF(H),az(a.CULL_FACE),aD(R);let aB={[Y]:a.FUNC_ADD,[Z]:a.FUNC_SUBTRACT,[$]:a.FUNC_REVERSE_SUBTRACT};aB[_]=a.MIN,aB[aa]=a.MAX;let aC={[ab]:a.ZERO,[ac]:a.ONE,[ad]:a.SRC_COLOR,[af]:a.SRC_ALPHA,[al]:a.SRC_ALPHA_SATURATE,[aj]:a.DST_COLOR,[ah]:a.DST_ALPHA,[ae]:a.ONE_MINUS_SRC_COLOR,[ag]:a.ONE_MINUS_SRC_ALPHA,[ak]:a.ONE_MINUS_DST_COLOR,[ai]:a.ONE_MINUS_DST_ALPHA,[am]:a.CONSTANT_COLOR,[an]:a.ONE_MINUS_CONSTANT_COLOR,[ao]:a.CONSTANT_ALPHA,[ap]:a.ONE_MINUS_CONSTANT_ALPHA};function aD(b,c,d,e,f,g,h,i,j,k){if(b===R){!0===n&&(aA(a.BLEND),n=!1);return}if(!1===n&&(az(a.BLEND),n=!0),b!==W){if(b!==o||k!==x){if((p!==Y||s!==Y)&&(a.blendEquation(a.FUNC_ADD),p=Y,s=Y),k)switch(b){case S:a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA);break;case T:a.blendFunc(a.ONE,a.ONE);break;case U:a.blendFuncSeparate(a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ZERO,a.ONE);break;case V:a.blendFuncSeparate(a.DST_COLOR,a.ONE_MINUS_SRC_ALPHA,a.ZERO,a.ONE);break;default:dh("WebGLState: Invalid blending: ",b)}else switch(b){case S:a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA);break;case T:a.blendFuncSeparate(a.SRC_ALPHA,a.ONE,a.ONE,a.ONE);break;case U:dh("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case V:dh("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:dh("WebGLState: Invalid blending: ",b)}q=null,r=null,t=null,u=null,v.set(0,0,0),w=0,o=b,x=k}return}f=f||c,g=g||d,h=h||e,(c!==p||f!==s)&&(a.blendEquationSeparate(aB[c],aB[f]),p=c,s=f),(d!==q||e!==r||g!==t||h!==u)&&(a.blendFuncSeparate(aC[d],aC[e],aC[g],aC[h]),q=d,r=e,t=g,u=h),(!1===i.equals(v)||j!==w)&&(a.blendColor(i.r,i.g,i.b,j),v.copy(i),w=j),o=b,x=!1}function aE(b){y!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),y=b)}function aF(b){b!==G?(az(a.CULL_FACE),b!==z&&(b===H?a.cullFace(a.BACK):b===I?a.cullFace(a.FRONT):a.cullFace(a.FRONT_AND_BACK))):aA(a.CULL_FACE),z=b}function aG(b,c,e){b?(az(a.POLYGON_OFFSET_FILL),(B!==c||C!==e)&&(B=c,C=e,d.getReversed()&&(c=-c),a.polygonOffset(c,e))):aA(a.POLYGON_OFFSET_FILL)}return{buffers:{color:c,depth:d,stencil:e},enable:az,disable:aA,bindFramebuffer:function(b,c){return j[b]!==c&&(a.bindFramebuffer(b,c),j[b]=c,b===a.DRAW_FRAMEBUFFER&&(j[a.FRAMEBUFFER]=c),b===a.FRAMEBUFFER&&(j[a.DRAW_FRAMEBUFFER]=c),!0)},drawBuffers:function(b,c){let d=l,e=!1;if(b){void 0===(d=k.get(c))&&(d=[],k.set(c,d));let f=b.textures;if(d.length!==f.length||d[0]!==a.COLOR_ATTACHMENT0){for(let b=0,c=f.length;b<c;b++)d[b]=a.COLOR_ATTACHMENT0+b;d.length=f.length,e=!0}}else d[0]!==a.BACK&&(d[0]=a.BACK,e=!0);e&&a.drawBuffers(d)},useProgram:function(b){return m!==b&&(a.useProgram(b),m=b,!0)},setBlending:aD,setMaterial:function(b,f){b.side===Q?aA(a.CULL_FACE):az(a.CULL_FACE);let g=b.side===P;f&&(g=!g),aE(g),b.blending===S&&!1===b.transparent?aD(R):aD(b.blending,b.blendEquation,b.blendSrc,b.blendDst,b.blendEquationAlpha,b.blendSrcAlpha,b.blendDstAlpha,b.blendColor,b.blendAlpha,b.premultipliedAlpha),d.setFunc(b.depthFunc),d.setTest(b.depthTest),d.setMask(b.depthWrite),c.setMask(b.colorWrite);let h=b.stencilWrite;e.setTest(h),h&&(e.setMask(b.stencilWriteMask),e.setFunc(b.stencilFunc,b.stencilRef,b.stencilFuncMask),e.setOp(b.stencilFail,b.stencilZFail,b.stencilZPass)),aG(b.polygonOffset,b.polygonOffsetFactor,b.polygonOffsetUnits),!0===b.alphaToCoverage?az(a.SAMPLE_ALPHA_TO_COVERAGE):aA(a.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:aE,setCullFace:aF,setLineWidth:function(b){b!==A&&(E&&a.lineWidth(b),A=b)},setPolygonOffset:aG,setScissorTest:function(b){b?az(a.SCISSOR_TEST):aA(a.SCISSOR_TEST)},activeTexture:function(b){void 0===b&&(b=a.TEXTURE0+D-1),J!==b&&(a.activeTexture(b),J=b)},bindTexture:function(b,c,d){void 0===d&&(d=null===J?a.TEXTURE0+D-1:J);let e=K[d];void 0===e&&(e={type:void 0,texture:void 0},K[d]=e),(e.type!==b||e.texture!==c)&&(J!==d&&(a.activeTexture(d),J=d),a.bindTexture(b,c||ay[b]),e.type=b,e.texture=c)},unbindTexture:function(){let b=K[J];void 0!==b&&void 0!==b.type&&(a.bindTexture(b.type,null),b.type=void 0,b.texture=void 0)},compressedTexImage2D:function(){try{a.compressedTexImage2D(...arguments)}catch(a){dh("WebGLState:",a)}},compressedTexImage3D:function(){try{a.compressedTexImage3D(...arguments)}catch(a){dh("WebGLState:",a)}},texImage2D:function(){try{a.texImage2D(...arguments)}catch(a){dh("WebGLState:",a)}},texImage3D:function(){try{a.texImage3D(...arguments)}catch(a){dh("WebGLState:",a)}},pixelStorei:function(b,c){i[b]!==c&&(a.pixelStorei(b,c),i[b]=c)},getParameter:function(b){return void 0!==i[b]?i[b]:a.getParameter(b)},updateUBOMapping:function(b,c){let d=g.get(c);void 0===d&&(d=new WeakMap,g.set(c,d));let e=d.get(b);void 0===e&&(e=a.getUniformBlockIndex(c,b.name),d.set(b,e))},uniformBlockBinding:function(b,c){let d=g.get(c).get(b);f.get(c)!==d&&(a.uniformBlockBinding(c,d,b.__bindingPointIndex),f.set(c,d))},texStorage2D:function(){try{a.texStorage2D(...arguments)}catch(a){dh("WebGLState:",a)}},texStorage3D:function(){try{a.texStorage3D(...arguments)}catch(a){dh("WebGLState:",a)}},texSubImage2D:function(){try{a.texSubImage2D(...arguments)}catch(a){dh("WebGLState:",a)}},texSubImage3D:function(){try{a.texSubImage3D(...arguments)}catch(a){dh("WebGLState:",a)}},compressedTexSubImage2D:function(){try{a.compressedTexSubImage2D(...arguments)}catch(a){dh("WebGLState:",a)}},compressedTexSubImage3D:function(){try{a.compressedTexSubImage3D(...arguments)}catch(a){dh("WebGLState:",a)}},scissor:function(b){!1===N.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),N.copy(b))},viewport:function(b){!1===O.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),O.copy(b))},reset:function(){a.disable(a.BLEND),a.disable(a.CULL_FACE),a.disable(a.DEPTH_TEST),a.disable(a.POLYGON_OFFSET_FILL),a.disable(a.SCISSOR_TEST),a.disable(a.STENCIL_TEST),a.disable(a.SAMPLE_ALPHA_TO_COVERAGE),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ONE,a.ZERO),a.blendFuncSeparate(a.ONE,a.ZERO,a.ONE,a.ZERO),a.blendColor(0,0,0,0),a.colorMask(!0,!0,!0,!0),a.clearColor(0,0,0,0),a.depthMask(!0),a.depthFunc(a.LESS),d.setReversed(!1),a.clearDepth(1),a.stencilMask(0xffffffff),a.stencilFunc(a.ALWAYS,0,0xffffffff),a.stencilOp(a.KEEP,a.KEEP,a.KEEP),a.clearStencil(0),a.cullFace(a.BACK),a.frontFace(a.CCW),a.polygonOffset(0,0),a.activeTexture(a.TEXTURE0),a.bindFramebuffer(a.FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null),a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.useProgram(null),a.lineWidth(1),a.scissor(0,0,a.canvas.width,a.canvas.height),a.viewport(0,0,a.canvas.width,a.canvas.height),a.pixelStorei(a.PACK_ALIGNMENT,4),a.pixelStorei(a.UNPACK_ALIGNMENT,4),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,a.BROWSER_DEFAULT_WEBGL),a.pixelStorei(a.PACK_ROW_LENGTH,0),a.pixelStorei(a.PACK_SKIP_PIXELS,0),a.pixelStorei(a.PACK_SKIP_ROWS,0),a.pixelStorei(a.UNPACK_ROW_LENGTH,0),a.pixelStorei(a.UNPACK_IMAGE_HEIGHT,0),a.pixelStorei(a.UNPACK_SKIP_PIXELS,0),a.pixelStorei(a.UNPACK_SKIP_ROWS,0),a.pixelStorei(a.UNPACK_SKIP_IMAGES,0),h={},i={},J=null,K={},j={},k=new WeakMap,l=[],m=null,n=!1,o=null,p=null,q=null,r=null,s=null,t=null,u=null,v=new ev(0,0,0),w=0,x=!1,y=null,z=null,A=null,B=null,C=null,N.set(0,0,a.canvas.width,a.canvas.height),O.set(0,0,a.canvas.width,a.canvas.height),c.reset(),d.reset(),e.reset()}}}function nG(a,b,c,d,e,f,g){let h,i=b.has("WEBGL_multisampled_render_to_texture")?b.get("WEBGL_multisampled_render_to_texture"):null,j="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),k=new dx,l=new WeakMap,m=new Set,n=new WeakMap,o=!1;try{o="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(a){}function p(a,b){return o?new OffscreenCanvas(a,b):c8("canvas")}function q(a,b,c){let d=1,e=R(a);if((e.width>c||e.height>c)&&(d=c/Math.max(e.width,e.height)),d<1)if("u">typeof HTMLImageElement&&a instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&a instanceof ImageBitmap||"u">typeof VideoFrame&&a instanceof VideoFrame){let c=Math.floor(d*e.width),f=Math.floor(d*e.height);void 0===h&&(h=p(c,f));let g=b?p(c,f):h;return g.width=c,g.height=f,g.getContext("2d").drawImage(a,0,0,c,f),dg("WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+c+"x"+f+")."),g}else"data"in a&&dg("WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+").");return a}function r(a){return a.generateMipmaps}function s(b){a.generateMipmap(b)}function t(c,d,e,f,g,h=!1){let i;if(null!==c){if(void 0!==a[c])return a[c];dg("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+c+"'")}f&&((i=b.get("EXT_texture_norm16"))||dg("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let j=d;if(d===a.RED&&(e===a.FLOAT&&(j=a.R32F),e===a.HALF_FLOAT&&(j=a.R16F),e===a.UNSIGNED_BYTE&&(j=a.R8),e===a.UNSIGNED_SHORT&&i&&(j=i.R16_EXT),e===a.SHORT&&i&&(j=i.R16_SNORM_EXT)),d===a.RED_INTEGER&&(e===a.UNSIGNED_BYTE&&(j=a.R8UI),e===a.UNSIGNED_SHORT&&(j=a.R16UI),e===a.UNSIGNED_INT&&(j=a.R32UI),e===a.BYTE&&(j=a.R8I),e===a.SHORT&&(j=a.R16I),e===a.INT&&(j=a.R32I)),d===a.RG&&(e===a.FLOAT&&(j=a.RG32F),e===a.HALF_FLOAT&&(j=a.RG16F),e===a.UNSIGNED_BYTE&&(j=a.RG8),e===a.UNSIGNED_SHORT&&i&&(j=i.RG16_EXT),e===a.SHORT&&i&&(j=i.RG16_SNORM_EXT)),d===a.RG_INTEGER&&(e===a.UNSIGNED_BYTE&&(j=a.RG8UI),e===a.UNSIGNED_SHORT&&(j=a.RG16UI),e===a.UNSIGNED_INT&&(j=a.RG32UI),e===a.BYTE&&(j=a.RG8I),e===a.SHORT&&(j=a.RG16I),e===a.INT&&(j=a.RG32I)),d===a.RGB_INTEGER&&(e===a.UNSIGNED_BYTE&&(j=a.RGB8UI),e===a.UNSIGNED_SHORT&&(j=a.RGB16UI),e===a.UNSIGNED_INT&&(j=a.RGB32UI),e===a.BYTE&&(j=a.RGB8I),e===a.SHORT&&(j=a.RGB16I),e===a.INT&&(j=a.RGB32I)),d===a.RGBA_INTEGER&&(e===a.UNSIGNED_BYTE&&(j=a.RGBA8UI),e===a.UNSIGNED_SHORT&&(j=a.RGBA16UI),e===a.UNSIGNED_INT&&(j=a.RGBA32UI),e===a.BYTE&&(j=a.RGBA8I),e===a.SHORT&&(j=a.RGBA16I),e===a.INT&&(j=a.RGBA32I)),d===a.RGB&&(e===a.UNSIGNED_SHORT&&i&&(j=i.RGB16_EXT),e===a.SHORT&&i&&(j=i.RGB16_SNORM_EXT),e===a.UNSIGNED_INT_5_9_9_9_REV&&(j=a.RGB9_E5),e===a.UNSIGNED_INT_10F_11F_11F_REV&&(j=a.R11F_G11F_B10F)),d===a.RGBA){let b=h?cm:dG.getTransfer(g);e===a.FLOAT&&(j=a.RGBA32F),e===a.HALF_FLOAT&&(j=a.RGBA16F),e===a.UNSIGNED_BYTE&&(j=b===cn?a.SRGB8_ALPHA8:a.RGBA8),e===a.UNSIGNED_SHORT&&i&&(j=i.RGBA16_EXT),e===a.SHORT&&i&&(j=i.RGBA16_SNORM_EXT),e===a.UNSIGNED_SHORT_4_4_4_4&&(j=a.RGBA4),e===a.UNSIGNED_SHORT_5_5_5_1&&(j=a.RGB5_A1)}return(j===a.R16F||j===a.R32F||j===a.RG16F||j===a.RG32F||j===a.RGBA16F||j===a.RGBA32F)&&b.get("EXT_color_buffer_float"),j}function u(b,c){let d;return b?null===c||c===a7||c===bc?d=a.DEPTH24_STENCIL8:c===a8?d=a.DEPTH32F_STENCIL8:c===a5&&(d=a.DEPTH24_STENCIL8,dg("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===c||c===a7||c===bc?d=a.DEPTH_COMPONENT24:c===a8?d=a.DEPTH_COMPONENT32F:c===a5&&(d=a.DEPTH_COMPONENT16),d}function v(a,b){return!0===r(a)||a.isFramebufferTexture&&a.minFilter!==aU&&a.minFilter!==aZ?Math.log2(Math.max(b.width,b.height))+1:void 0!==a.mipmaps&&a.mipmaps.length>0?a.mipmaps.length:a.isCompressedTexture&&Array.isArray(a.image)?b.mipmaps.length:1}function w(a){let b=a.target;b.removeEventListener("dispose",w),function(a){let b=d.get(a);if(void 0===b.__webglInit)return;let c=a.source,e=n.get(c);if(e){let d=e[b.__cacheKey];d.usedTimes--,0===d.usedTimes&&y(a),0===Object.keys(e).length&&n.delete(c)}d.remove(a)}(b),b.isVideoTexture&&l.delete(b),b.isHTMLTexture&&m.delete(b)}function x(b){let c=b.target;c.removeEventListener("dispose",x),function(b){let c=d.get(b);if(b.depthTexture&&(b.depthTexture.dispose(),d.remove(b.depthTexture)),b.isWebGLCubeRenderTarget)for(let b=0;b<6;b++){if(Array.isArray(c.__webglFramebuffer[b]))for(let d=0;d<c.__webglFramebuffer[b].length;d++)a.deleteFramebuffer(c.__webglFramebuffer[b][d]);else a.deleteFramebuffer(c.__webglFramebuffer[b]);c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[b])}else{if(Array.isArray(c.__webglFramebuffer))for(let b=0;b<c.__webglFramebuffer.length;b++)a.deleteFramebuffer(c.__webglFramebuffer[b]);else a.deleteFramebuffer(c.__webglFramebuffer);if(c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer),c.__webglMultisampledFramebuffer&&a.deleteFramebuffer(c.__webglMultisampledFramebuffer),c.__webglColorRenderbuffer)for(let b=0;b<c.__webglColorRenderbuffer.length;b++)c.__webglColorRenderbuffer[b]&&a.deleteRenderbuffer(c.__webglColorRenderbuffer[b]);c.__webglDepthRenderbuffer&&a.deleteRenderbuffer(c.__webglDepthRenderbuffer)}let e=b.textures;for(let b=0,c=e.length;b<c;b++){let c=d.get(e[b]);c.__webglTexture&&(a.deleteTexture(c.__webglTexture),g.memory.textures--),d.remove(e[b])}d.remove(b)}(c)}function y(b){let c=d.get(b);a.deleteTexture(c.__webglTexture);let e=b.source,f=n.get(e);delete f[c.__cacheKey],g.memory.textures--}let z=0;function A(b,e){var f;let h,i=d.get(b);if(b.isVideoTexture&&(f=b,h=g.render.frame,l.get(f)!==h&&(l.set(f,h),f.update())),!1===b.isRenderTargetTexture&&!0!==b.isExternalTexture&&b.version>0&&i.__version!==b.version){let a=b.image;if(null===a)dg("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void H(i,b,e);dg("WebGLRenderer: Texture marked for update but image is incomplete")}}else b.isExternalTexture&&(i.__webglTexture=b.sourceTexture?b.sourceTexture:null);c.bindTexture(a.TEXTURE_2D,i.__webglTexture,a.TEXTURE0+e)}let B={[aR]:a.REPEAT,[aS]:a.CLAMP_TO_EDGE,[aT]:a.MIRRORED_REPEAT},C={[aU]:a.NEAREST,[aV]:a.NEAREST_MIPMAP_NEAREST,[aX]:a.NEAREST_MIPMAP_LINEAR,[aZ]:a.LINEAR,[a$]:a.LINEAR_MIPMAP_NEAREST,[a0]:a.LINEAR_MIPMAP_LINEAR},D={[cH]:a.NEVER,[cO]:a.ALWAYS,[cI]:a.LESS,[cK]:a.LEQUAL,[cJ]:a.EQUAL,[cN]:a.GEQUAL,[cL]:a.GREATER,[cM]:a.NOTEQUAL};function E(c,f){if((f.type===a8&&!1===b.has("OES_texture_float_linear")&&(f.magFilter===aZ||f.magFilter===a$||f.magFilter===aX||f.magFilter===a0||f.minFilter===aZ||f.minFilter===a$||f.minFilter===aX||f.minFilter===a0)&&dg("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),a.texParameteri(c,a.TEXTURE_WRAP_S,B[f.wrapS]),a.texParameteri(c,a.TEXTURE_WRAP_T,B[f.wrapT]),(c===a.TEXTURE_3D||c===a.TEXTURE_2D_ARRAY)&&a.texParameteri(c,a.TEXTURE_WRAP_R,B[f.wrapR]),a.texParameteri(c,a.TEXTURE_MAG_FILTER,C[f.magFilter]),a.texParameteri(c,a.TEXTURE_MIN_FILTER,C[f.minFilter]),f.compareFunction&&(a.texParameteri(c,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(c,a.TEXTURE_COMPARE_FUNC,D[f.compareFunction])),!0===b.has("EXT_texture_filter_anisotropic"))&&f.magFilter!==aU&&(f.minFilter===aX||f.minFilter===a0)&&(f.type!==a8||!1!==b.has("OES_texture_float_linear"))&&(f.anisotropy>1||d.get(f).__currentAnisotropy)){let g=b.get("EXT_texture_filter_anisotropic");a.texParameterf(c,g.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(f.anisotropy,e.getMaxAnisotropy())),d.get(f).__currentAnisotropy=f.anisotropy}}function F(b,c){let d,e=!1;void 0===b.__webglInit&&(b.__webglInit=!0,c.addEventListener("dispose",w));let f=c.source,h=n.get(f);void 0===h&&(h={},n.set(f,h));let i=((d=[]).push(c.wrapS),d.push(c.wrapT),d.push(c.wrapR||0),d.push(c.magFilter),d.push(c.minFilter),d.push(c.anisotropy),d.push(c.internalFormat),d.push(c.format),d.push(c.type),d.push(c.generateMipmaps),d.push(c.premultiplyAlpha),d.push(c.flipY),d.push(c.unpackAlignment),d.push(c.colorSpace),d.join());if(i!==b.__cacheKey){void 0===h[i]&&(h[i]={texture:a.createTexture(),usedTimes:0},g.memory.textures++,e=!0),h[i].usedTimes++;let d=h[b.__cacheKey];void 0!==d&&(h[b.__cacheKey].usedTimes--,0===d.usedTimes&&y(c)),b.__cacheKey=i,b.__webglTexture=h[i].texture}return e}function G(a,b,c){return Math.floor(Math.floor(a/c)/b)}function H(b,g,h){let i=a.TEXTURE_2D;(g.isDataArrayTexture||g.isCompressedArrayTexture)&&(i=a.TEXTURE_2D_ARRAY),g.isData3DTexture&&(i=a.TEXTURE_3D);let j=F(b,g),k=g.source;c.bindTexture(i,b.__webglTexture,a.TEXTURE0+h);let l=d.get(k);if(k.version!==l.__version||!0===j){let b;if(c.activeTexture(a.TEXTURE0+h),!1==("u">typeof ImageBitmap&&g.image instanceof ImageBitmap)){let b=dG.getPrimaries(dG.workingColorSpace),d=g.colorSpace===cj?null:dG.getPrimaries(g.colorSpace),e=g.colorSpace===cj||b===d?a.NONE:a.BROWSER_DEFAULT_WEBGL;c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,g.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),c.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,e)}c.pixelStorei(a.UNPACK_ALIGNMENT,g.unpackAlignment);let d=q(g.image,!1,e.maxTextureSize);d=Q(g,d);let n=f.convert(g.format,g.colorSpace),o=f.convert(g.type),p=t(g.internalFormat,n,o,g.normalized,g.colorSpace,g.isVideoTexture);E(i,g);let w=g.mipmaps,x=!0!==g.isVideoTexture,y=void 0===l.__version||!0===j,z=k.dataReady,A=v(g,d);if(g.isDepthTexture)p=u(g.format===bj,g.type),y&&(x?c.texStorage2D(a.TEXTURE_2D,1,p,d.width,d.height):c.texImage2D(a.TEXTURE_2D,0,p,d.width,d.height,0,n,o,null));else if(g.isDataTexture)if(w.length>0){x&&y&&c.texStorage2D(a.TEXTURE_2D,A,p,w[0].width,w[0].height);for(let d=0,e=w.length;d<e;d++)b=w[d],x?z&&c.texSubImage2D(a.TEXTURE_2D,d,0,0,b.width,b.height,n,o,b.data):c.texImage2D(a.TEXTURE_2D,d,p,b.width,b.height,0,n,o,b.data);g.generateMipmaps=!1}else x?(y&&c.texStorage2D(a.TEXTURE_2D,A,p,d.width,d.height),z&&function(b,d,e,f){let g=b.updateRanges;if(0===g.length)c.texSubImage2D(a.TEXTURE_2D,0,0,0,d.width,d.height,e,f,d.data);else{g.sort((a,b)=>a.start-b.start);let h=0;for(let a=1;a<g.length;a++){let b=g[h],c=g[a],e=b.start+b.count,f=G(c.start,d.width,4),i=G(b.start,d.width,4);c.start<=e+1&&f===i&&G(c.start+c.count-1,d.width,4)===f?b.count=Math.max(b.count,c.start+c.count-b.start):g[++h]=c}g.length=h+1;let i=c.getParameter(a.UNPACK_ROW_LENGTH),j=c.getParameter(a.UNPACK_SKIP_PIXELS),k=c.getParameter(a.UNPACK_SKIP_ROWS);c.pixelStorei(a.UNPACK_ROW_LENGTH,d.width);for(let b=0,h=g.length;b<h;b++){let h=g[b],i=Math.floor(h.start/4),j=Math.ceil(h.count/4),k=i%d.width,l=Math.floor(i/d.width);c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,l),c.texSubImage2D(a.TEXTURE_2D,0,k,l,j,1,e,f,d.data)}b.clearUpdateRanges(),c.pixelStorei(a.UNPACK_ROW_LENGTH,i),c.pixelStorei(a.UNPACK_SKIP_PIXELS,j),c.pixelStorei(a.UNPACK_SKIP_ROWS,k)}}(g,d,n,o)):c.texImage2D(a.TEXTURE_2D,0,p,d.width,d.height,0,n,o,d.data);else if(g.isCompressedTexture)if(g.isCompressedArrayTexture){x&&y&&c.texStorage3D(a.TEXTURE_2D_ARRAY,A,p,w[0].width,w[0].height,d.depth);for(let e=0,f=w.length;e<f;e++)if(b=w[e],g.format!==bh)if(null!==n)if(x){if(z)if(g.layerUpdates.size>0){let d=lt(b.width,b.height,g.format,g.type);for(let f of g.layerUpdates){let g=b.data.subarray(f*d/b.data.BYTES_PER_ELEMENT,(f+1)*d/b.data.BYTES_PER_ELEMENT);c.compressedTexSubImage3D(a.TEXTURE_2D_ARRAY,e,0,0,f,b.width,b.height,1,n,g)}}else c.compressedTexSubImage3D(a.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,d.depth,n,b.data)}else c.compressedTexImage3D(a.TEXTURE_2D_ARRAY,e,p,b.width,b.height,d.depth,0,b.data,0,0);else dg("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else x?z&&c.texSubImage3D(a.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,d.depth,n,o,b.data):c.texImage3D(a.TEXTURE_2D_ARRAY,e,p,b.width,b.height,d.depth,0,n,o,b.data);g.layerUpdates.size>0&&g.clearLayerUpdates()}else{x&&y&&c.texStorage2D(a.TEXTURE_2D,A,p,w[0].width,w[0].height);for(let d=0,e=w.length;d<e;d++)b=w[d],g.format!==bh?null!==n?x?z&&c.compressedTexSubImage2D(a.TEXTURE_2D,d,0,0,b.width,b.height,n,b.data):c.compressedTexImage2D(a.TEXTURE_2D,d,p,b.width,b.height,0,b.data):dg("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?z&&c.texSubImage2D(a.TEXTURE_2D,d,0,0,b.width,b.height,n,o,b.data):c.texImage2D(a.TEXTURE_2D,d,p,b.width,b.height,0,n,o,b.data)}else if(g.isDataArrayTexture)if(x){if(y&&c.texStorage3D(a.TEXTURE_2D_ARRAY,A,p,d.width,d.height,d.depth),z)if(g.layerUpdates.size>0){let b=lt(d.width,d.height,g.format,g.type);for(let e of g.layerUpdates){let f=d.data.subarray(e*b/d.data.BYTES_PER_ELEMENT,(e+1)*b/d.data.BYTES_PER_ELEMENT);c.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,e,d.width,d.height,1,n,o,f)}g.clearLayerUpdates()}else c.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,n,o,d.data)}else c.texImage3D(a.TEXTURE_2D_ARRAY,0,p,d.width,d.height,d.depth,0,n,o,d.data);else if(g.isData3DTexture)x?(y&&c.texStorage3D(a.TEXTURE_3D,A,p,d.width,d.height,d.depth),z&&c.texSubImage3D(a.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,n,o,d.data)):c.texImage3D(a.TEXTURE_3D,0,p,d.width,d.height,d.depth,0,n,o,d.data);else if(g.isFramebufferTexture){if(y)if(x)c.texStorage2D(a.TEXTURE_2D,A,p,d.width,d.height);else{let b=d.width,e=d.height;for(let d=0;d<A;d++)c.texImage2D(a.TEXTURE_2D,d,p,b,e,0,n,o,null),b>>=1,e>>=1}}else if(g.isHTMLTexture){if("texElementImage2D"in a){let b=a.canvas;if(b.hasAttribute("layoutsubtree")||b.setAttribute("layoutsubtree","true"),d.parentNode!==b){b.appendChild(d),m.add(g),b.onpaint=a=>{let b=a.changedElements;for(let a of m)b.includes(a.image)&&(a.needsUpdate=!0)},b.requestPaint();return}if(3===a.texElementImage2D.length)a.texElementImage2D(a.TEXTURE_2D,a.RGBA8,d);else{let b=a.RGBA,c=a.RGBA,e=a.UNSIGNED_BYTE;a.texElementImage2D(a.TEXTURE_2D,0,b,c,e,d)}a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}}else if(w.length>0){if(x&&y){let b=R(w[0]);c.texStorage2D(a.TEXTURE_2D,A,p,b.width,b.height)}for(let d=0,e=w.length;d<e;d++)b=w[d],x?z&&c.texSubImage2D(a.TEXTURE_2D,d,0,0,n,o,b):c.texImage2D(a.TEXTURE_2D,d,p,n,o,b);g.generateMipmaps=!1}else if(x){if(y){let b=R(d);c.texStorage2D(a.TEXTURE_2D,A,p,b.width,b.height)}z&&c.texSubImage2D(a.TEXTURE_2D,0,0,0,n,o,d)}else c.texImage2D(a.TEXTURE_2D,0,p,n,o,d);r(g)&&s(i),l.__version=k.version,g.onUpdate&&g.onUpdate(g)}b.__version=g.version}function I(b,e,g,h,j,k){let l=f.convert(g.format,g.colorSpace),m=f.convert(g.type),n=t(g.internalFormat,l,m,g.normalized,g.colorSpace),o=d.get(e),p=d.get(g);if(p.__renderTarget=e,!o.__hasExternalTextures){let b=Math.max(1,e.width>>k),d=Math.max(1,e.height>>k);j===a.TEXTURE_3D||j===a.TEXTURE_2D_ARRAY?c.texImage3D(j,k,n,b,d,e.depth,0,l,m,null):c.texImage2D(j,k,n,b,d,0,l,m,null)}c.bindFramebuffer(a.FRAMEBUFFER,b),P(e)?i.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,h,j,p.__webglTexture,0,O(e)):(j===a.TEXTURE_2D||j>=a.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=a.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&a.framebufferTexture2D(a.FRAMEBUFFER,h,j,p.__webglTexture,k),c.bindFramebuffer(a.FRAMEBUFFER,null)}function J(b,c,d){if(a.bindRenderbuffer(a.RENDERBUFFER,b),c.depthBuffer){let e=c.depthTexture,f=e&&e.isDepthTexture?e.type:null,g=u(c.stencilBuffer,f),h=c.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT;P(c)?i.renderbufferStorageMultisampleEXT(a.RENDERBUFFER,O(c),g,c.width,c.height):d?a.renderbufferStorageMultisample(a.RENDERBUFFER,O(c),g,c.width,c.height):a.renderbufferStorage(a.RENDERBUFFER,g,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,h,a.RENDERBUFFER,b)}else{let b=c.textures;for(let e=0;e<b.length;e++){let g=b[e],h=f.convert(g.format,g.colorSpace),j=f.convert(g.type),k=t(g.internalFormat,h,j,g.normalized,g.colorSpace);P(c)?i.renderbufferStorageMultisampleEXT(a.RENDERBUFFER,O(c),k,c.width,c.height):d?a.renderbufferStorageMultisample(a.RENDERBUFFER,O(c),k,c.width,c.height):a.renderbufferStorage(a.RENDERBUFFER,k,c.width,c.height)}}a.bindRenderbuffer(a.RENDERBUFFER,null)}function K(b,e,g){let h=!0===e.isWebGLCubeRenderTarget;if(c.bindFramebuffer(a.FRAMEBUFFER,b),!(e.depthTexture&&e.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let j=d.get(e.depthTexture);if(j.__renderTarget=e,j.__webglTexture&&e.depthTexture.image.width===e.width&&e.depthTexture.image.height===e.height||(e.depthTexture.image.width=e.width,e.depthTexture.image.height=e.height,e.depthTexture.needsUpdate=!0),h){if(void 0===j.__webglInit&&(j.__webglInit=!0,e.depthTexture.addEventListener("dispose",w)),void 0===j.__webglTexture){let b;j.__webglTexture=a.createTexture(),c.bindTexture(a.TEXTURE_CUBE_MAP,j.__webglTexture),E(a.TEXTURE_CUBE_MAP,e.depthTexture);let d=f.convert(e.depthTexture.format),g=f.convert(e.depthTexture.type);e.depthTexture.format===bi?b=a.DEPTH_COMPONENT24:e.depthTexture.format===bj&&(b=a.DEPTH24_STENCIL8);for(let c=0;c<6;c++)a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,b,e.width,e.height,0,d,g,null)}}else A(e.depthTexture,0);let k=j.__webglTexture,l=O(e),m=h?a.TEXTURE_CUBE_MAP_POSITIVE_X+g:a.TEXTURE_2D,n=e.depthTexture.format===bj?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT;if(e.depthTexture.format===bi)P(e)?i.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,n,m,k,0,l):a.framebufferTexture2D(a.FRAMEBUFFER,n,m,k,0);else if(e.depthTexture.format===bj)P(e)?i.framebufferTexture2DMultisampleEXT(a.FRAMEBUFFER,n,m,k,0,l):a.framebufferTexture2D(a.FRAMEBUFFER,n,m,k,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function L(b){let e=d.get(b),f=!0===b.isWebGLCubeRenderTarget;if(e.__boundDepthTexture!==b.depthTexture){let a=b.depthTexture;if(e.__depthDisposeCallback&&e.__depthDisposeCallback(),a){let b=()=>{delete e.__boundDepthTexture,delete e.__depthDisposeCallback,a.removeEventListener("dispose",b)};a.addEventListener("dispose",b),e.__depthDisposeCallback=b}e.__boundDepthTexture=a}if(b.depthTexture&&!e.__autoAllocateDepthBuffer)if(f)for(let a=0;a<6;a++)K(e.__webglFramebuffer[a],b,a);else{let a=b.texture.mipmaps;a&&a.length>0?K(e.__webglFramebuffer[0],b,0):K(e.__webglFramebuffer,b,0)}else if(f){e.__webglDepthbuffer=[];for(let d=0;d<6;d++)if(c.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[d]),void 0===e.__webglDepthbuffer[d])e.__webglDepthbuffer[d]=a.createRenderbuffer(),J(e.__webglDepthbuffer[d],b,!1);else{let c=b.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT,f=e.__webglDepthbuffer[d];a.bindRenderbuffer(a.RENDERBUFFER,f),a.framebufferRenderbuffer(a.FRAMEBUFFER,c,a.RENDERBUFFER,f)}}else{let d=b.texture.mipmaps;if(d&&d.length>0?c.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[0]):c.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),void 0===e.__webglDepthbuffer)e.__webglDepthbuffer=a.createRenderbuffer(),J(e.__webglDepthbuffer,b,!1);else{let c=b.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT,d=e.__webglDepthbuffer;a.bindRenderbuffer(a.RENDERBUFFER,d),a.framebufferRenderbuffer(a.FRAMEBUFFER,c,a.RENDERBUFFER,d)}}c.bindFramebuffer(a.FRAMEBUFFER,null)}let M=[],N=[];function O(a){return Math.min(e.maxSamples,a.samples)}function P(a){let c=d.get(a);return a.samples>0&&!0===b.has("WEBGL_multisampled_render_to_texture")&&!1!==c.__useRenderToTexture}function Q(a,b){let c=a.colorSpace,d=a.format,e=a.type;return!0===a.isCompressedTexture||!0===a.isVideoTexture||c!==cl&&c!==cj&&(dG.getTransfer(c)===cn?(d!==bh||e!==a2)&&dg("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):dh("WebGLTextures: Unsupported texture color space:",c)),b}function R(a){return"u">typeof HTMLImageElement&&a instanceof HTMLImageElement?(k.width=a.naturalWidth||a.width,k.height=a.naturalHeight||a.height):"u">typeof VideoFrame&&a instanceof VideoFrame?(k.width=a.displayWidth,k.height=a.displayHeight):(k.width=a.width,k.height=a.height),k}this.allocateTextureUnit=function(){let a=z;return a>=e.maxTextures&&dg("WebGLTextures: Trying to use "+(a+1)+" texture units while this GPU supports only "+e.maxTextures),z+=1,a},this.resetTextureUnits=function(){z=0},this.getTextureUnits=function(){return z},this.setTextureUnits=function(a){z=a},this.setTexture2D=A,this.setTexture2DArray=function(b,e){let f=d.get(b);!1===b.isRenderTargetTexture&&b.version>0&&f.__version!==b.version?H(f,b,e):(b.isExternalTexture&&(f.__webglTexture=b.sourceTexture?b.sourceTexture:null),c.bindTexture(a.TEXTURE_2D_ARRAY,f.__webglTexture,a.TEXTURE0+e))},this.setTexture3D=function(b,e){let f=d.get(b);!1===b.isRenderTargetTexture&&b.version>0&&f.__version!==b.version?H(f,b,e):c.bindTexture(a.TEXTURE_3D,f.__webglTexture,a.TEXTURE0+e)},this.setTextureCube=function(b,g){let h=d.get(b);!0!==b.isCubeDepthTexture&&b.version>0&&h.__version!==b.version?function(b,g,h){if(6!==g.image.length)return;let i=F(b,g),j=g.source;c.bindTexture(a.TEXTURE_CUBE_MAP,b.__webglTexture,a.TEXTURE0+h);let k=d.get(j);if(j.version!==k.__version||!0===i){let b;c.activeTexture(a.TEXTURE0+h);let d=dG.getPrimaries(dG.workingColorSpace),l=g.colorSpace===cj?null:dG.getPrimaries(g.colorSpace),m=g.colorSpace===cj||d===l?a.NONE:a.BROWSER_DEFAULT_WEBGL;c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,g.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,g.unpackAlignment),c.pixelStorei(a.UNPACK_COLORSPACE_CONVERSION_WEBGL,m);let n=g.isCompressedTexture||g.image[0].isCompressedTexture,o=g.image[0]&&g.image[0].isDataTexture,p=[];for(let a=0;a<6;a++)n||o?p[a]=o?g.image[a].image:g.image[a]:p[a]=q(g.image[a],!0,e.maxCubemapSize),p[a]=Q(g,p[a]);let u=p[0],w=f.convert(g.format,g.colorSpace),x=f.convert(g.type),y=t(g.internalFormat,w,x,g.normalized,g.colorSpace),z=!0!==g.isVideoTexture,A=void 0===k.__version||!0===i,B=j.dataReady,C=v(g,u);if(E(a.TEXTURE_CUBE_MAP,g),n){z&&A&&c.texStorage2D(a.TEXTURE_CUBE_MAP,C,y,u.width,u.height);for(let d=0;d<6;d++){b=p[d].mipmaps;for(let e=0;e<b.length;e++){let f=b[e];g.format!==bh?null!==w?z?B&&c.compressedTexSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e,0,0,f.width,f.height,w,f.data):c.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e,y,f.width,f.height,0,f.data):dg("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):z?B&&c.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e,0,0,f.width,f.height,w,x,f.data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e,y,f.width,f.height,0,w,x,f.data)}}}else{if(b=g.mipmaps,z&&A){b.length>0&&C++;let d=R(p[0]);c.texStorage2D(a.TEXTURE_CUBE_MAP,C,y,d.width,d.height)}for(let d=0;d<6;d++)if(o){z?B&&c.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,0,0,p[d].width,p[d].height,w,x,p[d].data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,y,p[d].width,p[d].height,0,w,x,p[d].data);for(let e=0;e<b.length;e++){let f=b[e].image[d].image;z?B&&c.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e+1,0,0,f.width,f.height,w,x,f.data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e+1,y,f.width,f.height,0,w,x,f.data)}}else{z?B&&c.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,0,0,w,x,p[d]):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,y,w,x,p[d]);for(let e=0;e<b.length;e++){let f=b[e];z?B&&c.texSubImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e+1,0,0,w,x,f.image[d]):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,e+1,y,w,x,f.image[d])}}}r(g)&&s(a.TEXTURE_CUBE_MAP),k.__version=j.version,g.onUpdate&&g.onUpdate(g)}b.__version=g.version}(h,b,g):c.bindTexture(a.TEXTURE_CUBE_MAP,h.__webglTexture,a.TEXTURE0+g)},this.rebindTextures=function(b,c,e){let f=d.get(b);void 0!==c&&I(f.__webglFramebuffer,b,b.texture,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,0),void 0!==e&&L(b)},this.setupRenderTarget=function(b){let e=b.texture,h=d.get(b),i=d.get(e);b.addEventListener("dispose",x);let j=b.textures,k=!0===b.isWebGLCubeRenderTarget,l=j.length>1;if(!l&&(void 0===i.__webglTexture&&(i.__webglTexture=a.createTexture()),i.__version=e.version,g.memory.textures++),k){h.__webglFramebuffer=[];for(let b=0;b<6;b++)if(e.mipmaps&&e.mipmaps.length>0){h.__webglFramebuffer[b]=[];for(let c=0;c<e.mipmaps.length;c++)h.__webglFramebuffer[b][c]=a.createFramebuffer()}else h.__webglFramebuffer[b]=a.createFramebuffer()}else{if(e.mipmaps&&e.mipmaps.length>0){h.__webglFramebuffer=[];for(let b=0;b<e.mipmaps.length;b++)h.__webglFramebuffer[b]=a.createFramebuffer()}else h.__webglFramebuffer=a.createFramebuffer();if(l)for(let b=0,c=j.length;b<c;b++){let c=d.get(j[b]);void 0===c.__webglTexture&&(c.__webglTexture=a.createTexture(),g.memory.textures++)}if(b.samples>0&&!1===P(b)){h.__webglMultisampledFramebuffer=a.createFramebuffer(),h.__webglColorRenderbuffer=[],c.bindFramebuffer(a.FRAMEBUFFER,h.__webglMultisampledFramebuffer);for(let c=0;c<j.length;c++){let d=j[c];h.__webglColorRenderbuffer[c]=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,h.__webglColorRenderbuffer[c]);let e=f.convert(d.format,d.colorSpace),g=f.convert(d.type),i=t(d.internalFormat,e,g,d.normalized,d.colorSpace,!0===b.isXRRenderTarget),k=O(b);a.renderbufferStorageMultisample(a.RENDERBUFFER,k,i,b.width,b.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+c,a.RENDERBUFFER,h.__webglColorRenderbuffer[c])}a.bindRenderbuffer(a.RENDERBUFFER,null),b.depthBuffer&&(h.__webglDepthRenderbuffer=a.createRenderbuffer(),J(h.__webglDepthRenderbuffer,b,!0)),c.bindFramebuffer(a.FRAMEBUFFER,null)}}if(k){c.bindTexture(a.TEXTURE_CUBE_MAP,i.__webglTexture),E(a.TEXTURE_CUBE_MAP,e);for(let c=0;c<6;c++)if(e.mipmaps&&e.mipmaps.length>0)for(let d=0;d<e.mipmaps.length;d++)I(h.__webglFramebuffer[c][d],b,e,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+c,d);else I(h.__webglFramebuffer[c],b,e,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+c,0);r(e)&&s(a.TEXTURE_CUBE_MAP),c.unbindTexture()}else if(l){for(let e=0,f=j.length;e<f;e++){let f=j[e],g=d.get(f),i=a.TEXTURE_2D;(b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(i=b.isWebGL3DRenderTarget?a.TEXTURE_3D:a.TEXTURE_2D_ARRAY),c.bindTexture(i,g.__webglTexture),E(i,f),I(h.__webglFramebuffer,b,f,a.COLOR_ATTACHMENT0+e,i,0),r(f)&&s(i)}c.unbindTexture()}else{let d=a.TEXTURE_2D;if((b.isWebGL3DRenderTarget||b.isWebGLArrayRenderTarget)&&(d=b.isWebGL3DRenderTarget?a.TEXTURE_3D:a.TEXTURE_2D_ARRAY),c.bindTexture(d,i.__webglTexture),E(d,e),e.mipmaps&&e.mipmaps.length>0)for(let c=0;c<e.mipmaps.length;c++)I(h.__webglFramebuffer[c],b,e,a.COLOR_ATTACHMENT0,d,c);else I(h.__webglFramebuffer,b,e,a.COLOR_ATTACHMENT0,d,0);r(e)&&s(d),c.unbindTexture()}b.depthBuffer&&L(b)},this.updateRenderTargetMipmap=function(b){let e=b.textures;for(let f=0,g=e.length;f<g;f++){let g=e[f];if(r(g)){let e=b.isWebGLCubeRenderTarget?a.TEXTURE_CUBE_MAP:b.isWebGL3DRenderTarget?a.TEXTURE_3D:b.isWebGLArrayRenderTarget||b.isCompressedArrayTexture?a.TEXTURE_2D_ARRAY:a.TEXTURE_2D,f=d.get(g).__webglTexture;c.bindTexture(e,f),s(e),c.unbindTexture()}}},this.updateMultisampleRenderTarget=function(b){if(b.samples>0){if(!1===P(b)){let e=b.textures,f=b.width,g=b.height,h=a.COLOR_BUFFER_BIT,i=b.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT,k=d.get(b),l=e.length>1;if(l)for(let b=0;b<e.length;b++)c.bindFramebuffer(a.FRAMEBUFFER,k.__webglMultisampledFramebuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+b,a.RENDERBUFFER,null),c.bindFramebuffer(a.FRAMEBUFFER,k.__webglFramebuffer),a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0+b,a.TEXTURE_2D,null,0);c.bindFramebuffer(a.READ_FRAMEBUFFER,k.__webglMultisampledFramebuffer);let m=b.texture.mipmaps;m&&m.length>0?c.bindFramebuffer(a.DRAW_FRAMEBUFFER,k.__webglFramebuffer[0]):c.bindFramebuffer(a.DRAW_FRAMEBUFFER,k.__webglFramebuffer);for(let c=0;c<e.length;c++){if(b.resolveDepthBuffer&&(b.depthBuffer&&(h|=a.DEPTH_BUFFER_BIT),b.stencilBuffer&&b.resolveStencilBuffer&&(h|=a.STENCIL_BUFFER_BIT)),l){a.framebufferRenderbuffer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,k.__webglColorRenderbuffer[c]);let b=d.get(e[c]).__webglTexture;a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,b,0)}a.blitFramebuffer(0,0,f,g,0,0,f,g,h,a.NEAREST),!0===j&&(M.length=0,N.length=0,M.push(a.COLOR_ATTACHMENT0+c),b.depthBuffer&&!1===b.storeMultisampledDepthBuffer&&(M.push(i),N.push(i),a.invalidateFramebuffer(a.DRAW_FRAMEBUFFER,N)),a.invalidateFramebuffer(a.READ_FRAMEBUFFER,M))}if(c.bindFramebuffer(a.READ_FRAMEBUFFER,null),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,null),l)for(let b=0;b<e.length;b++){c.bindFramebuffer(a.FRAMEBUFFER,k.__webglMultisampledFramebuffer),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0+b,a.RENDERBUFFER,k.__webglColorRenderbuffer[b]);let f=d.get(e[b]).__webglTexture;c.bindFramebuffer(a.FRAMEBUFFER,k.__webglFramebuffer),a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0+b,a.TEXTURE_2D,f,0)}c.bindFramebuffer(a.DRAW_FRAMEBUFFER,k.__webglMultisampledFramebuffer)}else if(b.depthBuffer&&!1===b.storeMultisampledDepthBuffer&&j){let c=b.stencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT;a.invalidateFramebuffer(a.DRAW_FRAMEBUFFER,[c])}}},this.setupDepthRenderbuffer=L,this.setupFrameBufferTexture=I,this.useMultisampledRTT=P,this.isReversedDepthBuffer=function(){return c.buffers.depth.getReversed()}}function nH(a,b){return{convert:function(c,d=cj){let e,f=dG.getTransfer(d);if(c===a2)return a.UNSIGNED_BYTE;if(c===ba)return a.UNSIGNED_SHORT_4_4_4_4;if(c===bb)return a.UNSIGNED_SHORT_5_5_5_1;if(c===bd)return a.UNSIGNED_INT_5_9_9_9_REV;if(c===be)return a.UNSIGNED_INT_10F_11F_11F_REV;if(c===a3)return a.BYTE;if(c===a4)return a.SHORT;if(c===a5)return a.UNSIGNED_SHORT;if(c===a6)return a.INT;if(c===a7)return a.UNSIGNED_INT;if(c===a8)return a.FLOAT;if(c===a9)return a.HALF_FLOAT;if(c===bf)return a.ALPHA;if(c===bg)return a.RGB;if(c===bh)return a.RGBA;if(c===bi)return a.DEPTH_COMPONENT;if(c===bj)return a.DEPTH_STENCIL;if(c===bk)return a.RED;if(c===bl)return a.RED_INTEGER;if(c===bm)return a.RG;if(c===bn)return a.RG_INTEGER;if(c===bp)return a.RGBA_INTEGER;if(c===bq||c===br||c===bs||c===bt)if(f===cn){if(null===(e=b.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(c===bq)return e.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(c===br)return e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(c===bs)return e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(c===bt)return e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(e=b.get("WEBGL_compressed_texture_s3tc")))return null;if(c===bq)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(c===br)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(c===bs)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(c===bt)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(c===bu||c===bv||c===bw||c===bx){if(null===(e=b.get("WEBGL_compressed_texture_pvrtc")))return null;if(c===bu)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(c===bv)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(c===bw)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(c===bx)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(c===by||c===bz||c===bA||c===bB||c===bC||c===bD||c===bE){if(null===(e=b.get("WEBGL_compressed_texture_etc")))return null;if(c===by||c===bz)return f===cn?e.COMPRESSED_SRGB8_ETC2:e.COMPRESSED_RGB8_ETC2;if(c===bA)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e.COMPRESSED_RGBA8_ETC2_EAC;if(c===bB)return e.COMPRESSED_R11_EAC;if(c===bC)return e.COMPRESSED_SIGNED_R11_EAC;if(c===bD)return e.COMPRESSED_RG11_EAC;if(c===bE)return e.COMPRESSED_SIGNED_RG11_EAC}if(c===bF||c===bG||c===bH||c===bI||c===bJ||c===bK||c===bL||c===bM||c===bN||c===bO||c===bP||c===bQ||c===bR||c===bS){if(null===(e=b.get("WEBGL_compressed_texture_astc")))return null;if(c===bF)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:e.COMPRESSED_RGBA_ASTC_4x4_KHR;if(c===bG)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:e.COMPRESSED_RGBA_ASTC_5x4_KHR;if(c===bH)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:e.COMPRESSED_RGBA_ASTC_5x5_KHR;if(c===bI)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:e.COMPRESSED_RGBA_ASTC_6x5_KHR;if(c===bJ)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:e.COMPRESSED_RGBA_ASTC_6x6_KHR;if(c===bK)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:e.COMPRESSED_RGBA_ASTC_8x5_KHR;if(c===bL)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:e.COMPRESSED_RGBA_ASTC_8x6_KHR;if(c===bM)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:e.COMPRESSED_RGBA_ASTC_8x8_KHR;if(c===bN)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:e.COMPRESSED_RGBA_ASTC_10x5_KHR;if(c===bO)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:e.COMPRESSED_RGBA_ASTC_10x6_KHR;if(c===bP)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:e.COMPRESSED_RGBA_ASTC_10x8_KHR;if(c===bQ)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:e.COMPRESSED_RGBA_ASTC_10x10_KHR;if(c===bR)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:e.COMPRESSED_RGBA_ASTC_12x10_KHR;if(c===bS)return f===cn?e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:e.COMPRESSED_RGBA_ASTC_12x12_KHR}if(c===bT||c===bU||c===bV){if(null===(e=b.get("EXT_texture_compression_bptc")))return null;if(c===bT)return f===cn?e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:e.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(c===bU)return e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(c===bV)return e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(c===bW||c===bX||c===bY||c===bZ){if(null===(e=b.get("EXT_texture_compression_rgtc")))return null;if(c===bW)return e.COMPRESSED_RED_RGTC1_EXT;if(c===bX)return e.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(c===bY)return e.COMPRESSED_RED_GREEN_RGTC2_EXT;if(c===bZ)return e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return c===bc?a.UNSIGNED_INT_24_8:void 0!==a[c]?a[c]:null}}}let nI=`
319
+ void main() {
320
+
321
+ gl_Position = vec4( position, 1.0 );
322
+
323
+ }`,nJ=`
324
+ uniform sampler2DArray depthColor;
325
+ uniform float depthWidth;
326
+ uniform float depthHeight;
327
+
328
+ void main() {
329
+
330
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
331
+
332
+ if ( coord.x >= 1.0 ) {
333
+
334
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
335
+
336
+ } else {
337
+
338
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
339
+
340
+ }
341
+
342
+ }`;class nK{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(a,b){if(null===this.texture){let c=new hs(a.texture);(a.depthNear!==b.depthNear||a.depthFar!==b.depthFar)&&(this.depthNear=a.depthNear,this.depthFar=a.depthFar),this.texture=c}}getMesh(a){if(null!==this.texture&&null===this.mesh){let b=a.cameras[0].viewport,c=new iJ({vertexShader:nI,fragmentShader:nJ,uniforms:{depthColor:{value:this.texture},depthWidth:{value:b.z},depthHeight:{value:b.w}}});this.mesh=new ga(new is(20,20),c)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class nL extends dk{constructor(a,b){super();const c=this;let d=null,e=1,f=null,g="local-floor",h=1,i=null,j=null,k=null,l=null,m=null,n=null;const o="u">typeof XRWebGLBinding,p=new nK,q={},r=b.getContextAttributes();let s=null,t=null;const u=[],v=[],w=new dx;let x=null,y=null;const z=new jH;z.viewport=new dR;const A=new jH;A.viewport=new dR;const B=[z,A],C=new ka;let D=null,E=null;function F(a){let b=v.indexOf(a.inputSource);if(-1===b)return;let c=u[b];void 0!==c&&(c.update(a.inputSource,a.frame,i||f),c.dispatchEvent({type:a.type,data:a.inputSource}))}function G(){d.removeEventListener("select",F),d.removeEventListener("selectstart",F),d.removeEventListener("selectend",F),d.removeEventListener("squeeze",F),d.removeEventListener("squeezestart",F),d.removeEventListener("squeezeend",F),d.removeEventListener("end",G),d.removeEventListener("inputsourceschange",H);for(let a=0;a<u.length;a++){let b=v[a];null!==b&&(v[a]=null,u[a].disconnect(b))}for(let a in D=null,E=null,p.reset(),q)delete q[a];if(a.setRenderTarget(s),m=null,l=null,k=null,d=null,t=null,M.stop(),c.isPresenting=!1,a.setPixelRatio(x),a.setSize(w.width,w.height,!1),null!==y){let a=y.camera;a.fov=y.fov,a.zoom=y.zoom,a.updateProjectionMatrix(),y=null}c.dispatchEvent({type:"sessionend"})}function H(a){for(let b=0;b<a.removed.length;b++){let c=a.removed[b],d=v.indexOf(c);d>=0&&(v[d]=null,u[d].disconnect(c))}for(let b=0;b<a.added.length;b++){let c=a.added[b],d=v.indexOf(c);if(-1===d){for(let a=0;a<u.length;a++)if(a>=v.length){v.push(c),d=a;break}else if(null===v[a]){v[a]=c,d=a;break}if(-1===d)break}let e=u[d];e&&e.connect(c)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(a){let b=u[a];return void 0===b&&(b=new eq,u[a]=b),b.getTargetRaySpace()},this.getControllerGrip=function(a){let b=u[a];return void 0===b&&(b=new eq,u[a]=b),b.getGripSpace()},this.getHand=function(a){let b=u[a];return void 0===b&&(b=new eq,u[a]=b),b.getHandSpace()},this.setFramebufferScaleFactor=function(a){e=a,!0===c.isPresenting&&dg("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(a){g=a,!0===c.isPresenting&&dg("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return i||f},this.setReferenceSpace=function(a){i=a},this.getBaseLayer=function(){return null!==l?l:m},this.getBinding=function(){return null===k&&o&&(k=new XRWebGLBinding(d,b)),k},this.getFrame=function(){return n},this.getSession=function(){return d},this.setSession=async function(j){if(null!==(d=j)){if(s=a.getRenderTarget(),d.addEventListener("select",F),d.addEventListener("selectstart",F),d.addEventListener("selectend",F),d.addEventListener("squeeze",F),d.addEventListener("squeezestart",F),d.addEventListener("squeezeend",F),d.addEventListener("end",G),d.addEventListener("inputsourceschange",H),!0!==r.xrCompatible&&await b.makeXRCompatible(),x=a.getPixelRatio(),a.getSize(w),o&&"createProjectionLayer"in XRWebGLBinding.prototype){let c=null,f=null,g=null;r.depth&&(g=r.stencil?b.DEPTH24_STENCIL8:b.DEPTH_COMPONENT24,c=r.stencil?bj:bi,f=r.stencil?bc:a7);let h={colorFormat:b.RGBA8,depthFormat:g,scaleFactor:e};l=(k=this.getBinding()).createProjectionLayer(h),d.updateRenderState({layers:[l]}),a.setPixelRatio(1),a.setSize(l.textureWidth,l.textureHeight,!1),t=new dT(l.textureWidth,l.textureHeight,{format:bh,type:a2,depthTexture:new hq(l.textureWidth,l.textureHeight,f,void 0,void 0,void 0,void 0,void 0,void 0,c),stencilBuffer:r.stencil,colorSpace:a.outputColorSpace,samples:4*!!r.antialias,resolveDepthBuffer:!1===l.ignoreDepthValues,resolveStencilBuffer:!1===l.ignoreDepthValues,storeMultisampledDepthBuffer:!1===l.ignoreDepthValues,storeMultisampledStencilBuffer:!1===l.ignoreDepthValues})}else{let c={antialias:r.antialias,alpha:!0,depth:r.depth,stencil:r.stencil,framebufferScaleFactor:e};m=new XRWebGLLayer(d,b,c),d.updateRenderState({baseLayer:m}),a.setPixelRatio(1),a.setSize(m.framebufferWidth,m.framebufferHeight,!1),t=new dT(m.framebufferWidth,m.framebufferHeight,{format:bh,type:a2,colorSpace:a.outputColorSpace,stencilBuffer:r.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues,storeMultisampledDepthBuffer:!1===m.ignoreDepthValues,storeMultisampledStencilBuffer:!1===m.ignoreDepthValues})}t.isXRRenderTarget=!0,this.setFoveation(h),i=null,f=await d.requestReferenceSpace(g),M.setContext(d),M.start(),c.isPresenting=!0,c.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==d)return d.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};const I=new dz,J=new dz;function K(a,b){null===b?a.matrixWorld.copy(a.matrix):a.matrixWorld.multiplyMatrices(b.matrixWorld,a.matrix),a.matrixWorldInverse.copy(a.matrixWorld).invert()}this.updateCamera=function(a){var b,c,e;if(null===d)return;let f=a.near,g=a.far;null!==p.texture&&(p.depthNear>0&&(f=p.depthNear),p.depthFar>0&&(g=p.depthFar)),C.near=A.near=z.near=f,C.far=A.far=z.far=g,(D!==C.near||E!==C.far)&&(d.updateRenderState({depthNear:C.near,depthFar:C.far}),D=C.near,E=C.far),C.layers.mask=6|a.layers.mask,z.layers.mask=-5&C.layers.mask,A.layers.mask=-3&C.layers.mask;let h=a.parent,i=C.cameras;K(C,h);for(let a=0;a<i.length;a++)K(i[a],h);2===i.length?function(a,b,c){I.setFromMatrixPosition(b.matrixWorld),J.setFromMatrixPosition(c.matrixWorld);let d=I.distanceTo(J),e=b.projectionMatrix.elements,f=c.projectionMatrix.elements,g=e[14]/(e[10]-1),h=e[14]/(e[10]+1),i=(e[9]+1)/e[5],j=(e[9]-1)/e[5],k=(e[8]-1)/e[0],l=(f[8]+1)/f[0],m=d/(-k+l),n=-(m*k);if(b.matrixWorld.decompose(a.position,a.quaternion,a.scale),a.translateX(n),a.translateZ(m),a.matrixWorld.compose(a.position,a.quaternion,a.scale),a.matrixWorldInverse.copy(a.matrixWorld).invert(),-1===e[10])a.projectionMatrix.copy(b.projectionMatrix),a.projectionMatrixInverse.copy(b.projectionMatrixInverse);else{let b=g+m,c=h+m;a.projectionMatrix.makePerspective(g*k-n,g*l+(d-n),i*h/c*b,j*h/c*b,b,c),a.projectionMatrixInverse.copy(a.projectionMatrix).invert()}}(C,z,A):C.projectionMatrix.copy(z.projectionMatrix),null===y&&a.isPerspectiveCamera&&(y={camera:a,fov:a.fov,zoom:a.zoom}),b=a,c=C,null===(e=h)?b.matrix.copy(c.matrixWorld):(b.matrix.copy(e.matrixWorld),b.matrix.invert(),b.matrix.multiply(c.matrixWorld)),b.matrix.decompose(b.position,b.quaternion,b.scale),b.updateMatrixWorld(!0),b.projectionMatrix.copy(c.projectionMatrix),b.projectionMatrixInverse.copy(c.projectionMatrixInverse),b.isPerspectiveCamera&&(b.fov=2*dp*Math.atan(1/b.projectionMatrix.elements[5]),b.zoom=1)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==l||null!==m)return h},this.setFoveation=function(a){h=a,null!==l&&(l.fixedFoveation=a),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=a)},this.hasDepthSensing=function(){return null!==p.texture},this.getDepthSensingMesh=function(){return p.getMesh(C)},this.getCameraTexture=function(a){return q[a]};let L=null;const M=new lv;M.setAnimationLoop(function(b,e){if(j=e.getViewerPose(i||f),n=e,null!==j){let b=j.views;null!==m&&(a.setRenderTargetFramebuffer(t,m.framebuffer),a.setRenderTarget(t));let e=!1;b.length!==C.cameras.length&&(C.cameras.length=0,e=!0);for(let c=0;c<b.length;c++){let d=b[c],f=null;if(null!==m)f=m.getViewport(d);else{let b=k.getViewSubImage(l,d);f=b.viewport,0===c&&(a.setRenderTargetTextures(t,b.colorTexture,b.depthStencilTexture),a.setRenderTarget(t))}let g=B[c];void 0===g&&((g=new jH).layers.enable(c),g.viewport=new dR,B[c]=g),g.matrix.fromArray(d.transform.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale),g.projectionMatrix.fromArray(d.projectionMatrix),g.projectionMatrixInverse.copy(g.projectionMatrix).invert(),g.viewport.set(f.x,f.y,f.width,f.height),0===c&&(C.matrix.copy(g.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===e&&C.cameras.push(g)}let f=d.enabledFeatures;if(f&&f.includes("depth-sensing")&&"gpu-optimized"==d.depthUsage&&o){let a=(k=c.getBinding()).getDepthInformation(b[0]);a&&a.isValid&&a.texture&&p.init(a,d.renderState)}if(f&&f.includes("camera-access")&&o){a.state.unbindTexture(),k=c.getBinding();for(let a=0;a<b.length;a++){let c=b[a].camera;if(c){let a=q[c];a||(a=new hs,q[c]=a);let b=k.getCameraImage(c);a.sourceTexture=b}}}}for(let a=0;a<u.length;a++){let b=v[a],c=u[a];null!==b&&void 0!==c&&c.update(b,e,i||f)}L&&L(b,e),e.detectedPlanes&&c.dispatchEvent({type:"planesdetected",data:e}),n=null}),this.setAnimationLoop=function(a){L=a},this.dispose=function(){}}}let nM=new dY,nN=new dC;function nO(a,b){function c(a,b){!0===a.matrixAutoUpdate&&a.updateMatrix(),b.value.copy(a.matrix)}function d(a,d){a.opacity.value=d.opacity,d.color&&a.diffuse.value.copy(d.color),d.emissive&&a.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(a.map.value=d.map,c(d.map,a.mapTransform)),d.alphaMap&&(a.alphaMap.value=d.alphaMap,c(d.alphaMap,a.alphaMapTransform)),d.bumpMap&&(a.bumpMap.value=d.bumpMap,c(d.bumpMap,a.bumpMapTransform),a.bumpScale.value=d.bumpScale,d.side===P&&(a.bumpScale.value*=-1)),d.normalMap&&(a.normalMap.value=d.normalMap,c(d.normalMap,a.normalMapTransform),a.normalScale.value.copy(d.normalScale),d.side===P&&a.normalScale.value.negate()),d.displacementMap&&(a.displacementMap.value=d.displacementMap,c(d.displacementMap,a.displacementMapTransform),a.displacementScale.value=d.displacementScale,a.displacementBias.value=d.displacementBias),d.emissiveMap&&(a.emissiveMap.value=d.emissiveMap,c(d.emissiveMap,a.emissiveMapTransform)),d.specularMap&&(a.specularMap.value=d.specularMap,c(d.specularMap,a.specularMapTransform)),d.alphaTest>0&&(a.alphaTest.value=d.alphaTest);let e=b.get(d),f=e.envMap,g=e.envMapRotation;f&&(a.envMap.value=f,a.envMapRotation.value.setFromMatrix4(nM.makeRotationFromEuler(g)).transpose(),f.isCubeTexture&&!1===f.isRenderTargetTexture&&a.envMapRotation.value.premultiply(nN),a.reflectivity.value=d.reflectivity,a.ior.value=d.ior,a.refractionRatio.value=d.refractionRatio),d.lightMap&&(a.lightMap.value=d.lightMap,a.lightMapIntensity.value=d.lightMapIntensity,c(d.lightMap,a.lightMapTransform)),d.aoMap&&(a.aoMap.value=d.aoMap,a.aoMapIntensity.value=d.aoMapIntensity,c(d.aoMap,a.aoMapTransform))}return{refreshFogUniforms:function(b,c){c.color.getRGB(b.fogColor.value,iH(a)),c.isFog?(b.fogNear.value=c.near,b.fogFar.value=c.far):c.isFogExp2&&(b.fogDensity.value=c.density)},refreshMaterialUniforms:function(a,e,f,g,h){var i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;let F;e.isNodeMaterial?e.uniformsNeedUpdate=!1:e.isMeshBasicMaterial?d(a,e):e.isMeshLambertMaterial?(d(a,e),e.envMap&&(a.envMapIntensity.value=e.envMapIntensity)):e.isMeshToonMaterial?(d(a,e),i=a,(j=e).gradientMap&&(i.gradientMap.value=j.gradientMap)):e.isMeshPhongMaterial?(d(a,e),k=a,l=e,k.specular.value.copy(l.specular),k.shininess.value=Math.max(l.shininess,1e-4),e.envMap&&(a.envMapIntensity.value=e.envMapIntensity)):e.isMeshStandardMaterial?(d(a,e),m=a,n=e,m.metalness.value=n.metalness,n.metalnessMap&&(m.metalnessMap.value=n.metalnessMap,c(n.metalnessMap,m.metalnessMapTransform)),m.roughness.value=n.roughness,n.roughnessMap&&(m.roughnessMap.value=n.roughnessMap,c(n.roughnessMap,m.roughnessMapTransform)),n.envMap&&(m.envMapIntensity.value=n.envMapIntensity),e.isMeshPhysicalMaterial&&(o=a,p=e,q=h,o.ior.value=p.ior,p.sheen>0&&(o.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),o.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(o.sheenColorMap.value=p.sheenColorMap,c(p.sheenColorMap,o.sheenColorMapTransform)),p.sheenRoughnessMap&&(o.sheenRoughnessMap.value=p.sheenRoughnessMap,c(p.sheenRoughnessMap,o.sheenRoughnessMapTransform))),p.clearcoat>0&&(o.clearcoat.value=p.clearcoat,o.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(o.clearcoatMap.value=p.clearcoatMap,c(p.clearcoatMap,o.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(o.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,c(p.clearcoatRoughnessMap,o.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(o.clearcoatNormalMap.value=p.clearcoatNormalMap,c(p.clearcoatNormalMap,o.clearcoatNormalMapTransform),o.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===P&&o.clearcoatNormalScale.value.negate())),p.dispersion>0&&(o.dispersion.value=p.dispersion),p.retroreflectivity>0&&(o.retroreflectivity.value=p.retroreflectivity),p.iridescence>0&&(o.iridescence.value=p.iridescence,o.iridescenceIOR.value=p.iridescenceIOR,o.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(o.iridescenceMap.value=p.iridescenceMap,c(p.iridescenceMap,o.iridescenceMapTransform)),p.iridescenceThicknessMap&&(o.iridescenceThicknessMap.value=p.iridescenceThicknessMap,c(p.iridescenceThicknessMap,o.iridescenceThicknessMapTransform))),p.transmission>0&&(o.transmission.value=p.transmission,o.transmissionSamplerMap.value=q.texture,o.transmissionSamplerSize.value.set(q.width,q.height),p.transmissionMap&&(o.transmissionMap.value=p.transmissionMap,c(p.transmissionMap,o.transmissionMapTransform)),o.thickness.value=p.thickness,p.thicknessMap&&(o.thicknessMap.value=p.thicknessMap,c(p.thicknessMap,o.thicknessMapTransform)),o.attenuationDistance.value=p.attenuationDistance,o.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(o.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(o.anisotropyMap.value=p.anisotropyMap,c(p.anisotropyMap,o.anisotropyMapTransform))),o.specularIntensity.value=p.specularIntensity,o.specularColor.value.copy(p.specularColor),p.specularColorMap&&(o.specularColorMap.value=p.specularColorMap,c(p.specularColorMap,o.specularColorMapTransform)),p.specularIntensityMap&&(o.specularIntensityMap.value=p.specularIntensityMap,c(p.specularIntensityMap,o.specularIntensityMapTransform)))):e.isMeshMatcapMaterial?(d(a,e),r=a,(s=e).matcap&&(r.matcap.value=s.matcap)):e.isMeshDepthMaterial?d(a,e):e.isMeshDistanceMaterial?(d(a,e),t=a,u=e,F=b.get(u).light,t.referencePosition.value.setFromMatrixPosition(F.matrixWorld),t.nearDistance.value=F.shadow.camera.near,t.farDistance.value=F.shadow.camera.far):e.isMeshNormalMaterial?d(a,e):e.isLineBasicMaterial?(v=a,w=e,v.diffuse.value.copy(w.color),v.opacity.value=w.opacity,w.map&&(v.map.value=w.map,c(w.map,v.mapTransform)),e.isLineDashedMaterial&&(x=a,y=e,x.dashSize.value=y.dashSize,x.totalSize.value=y.dashSize+y.gapSize,x.scale.value=y.scale)):e.isPointsMaterial?(z=a,A=e,B=f,C=g,z.diffuse.value.copy(A.color),z.opacity.value=A.opacity,z.size.value=A.size*B,z.scale.value=.5*C,A.map&&(z.map.value=A.map,c(A.map,z.uvTransform)),A.alphaMap&&(z.alphaMap.value=A.alphaMap,c(A.alphaMap,z.alphaMapTransform)),A.alphaTest>0&&(z.alphaTest.value=A.alphaTest)):e.isSpriteMaterial?(D=a,E=e,D.diffuse.value.copy(E.color),D.opacity.value=E.opacity,D.rotation.value=E.rotation,E.map&&(D.map.value=E.map,c(E.map,D.mapTransform)),E.alphaMap&&(D.alphaMap.value=E.alphaMap,c(E.alphaMap,D.alphaMapTransform)),E.alphaTest>0&&(D.alphaTest.value=E.alphaTest)):e.isShadowMaterial?(a.color.value.copy(e.color),a.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}}}function nP(a,b,c,d){let e={},f={},g=[],h=a.getParameter(a.MAX_UNIFORM_BUFFER_BINDINGS);function i(b,c,d,e){if(!0===function(a,b,c,d){let e=a.value,f=b+"_"+c;if(void 0===d[f])return"number"==typeof e||"boolean"==typeof e?d[f]=e:ArrayBuffer.isView(e)?d[f]=e.slice():d[f]=e.clone(),!0;{let a=d[f];if("number"==typeof e||"boolean"==typeof e){if(a!==e)return d[f]=e,!0}else if(ArrayBuffer.isView(e))return!0;else if(!1===a.equals(e))return a.copy(e),!0}return!1}(b,c,d,e)){let c=b.__offset,d=b.value;if(Array.isArray(d)){let a=0;for(let c=0;c<d.length;c++){let e=d[c],f=k(e);j(e,b.__data,a),"number"==typeof e||"boolean"==typeof e||e.isMatrix3||ArrayBuffer.isView(e)||(a+=f.storage/Float32Array.BYTES_PER_ELEMENT)}}else j(d,b.__data,0);a.bufferSubData(a.UNIFORM_BUFFER,c,b.__data)}}function j(a,b,c){"number"==typeof a||"boolean"==typeof a?b[0]=a:a.isMatrix3?(b[0]=a.elements[0],b[1]=a.elements[1],b[2]=a.elements[2],b[3]=0,b[4]=a.elements[3],b[5]=a.elements[4],b[6]=a.elements[5],b[7]=0,b[8]=a.elements[6],b[9]=a.elements[7],b[10]=a.elements[8],b[11]=0):ArrayBuffer.isView(a)?b.set(new a.constructor(a.buffer,a.byteOffset,b.length)):a.toArray(b,c)}function k(a){let b={boundary:0,storage:0};return"number"==typeof a||"boolean"==typeof a?(b.boundary=4,b.storage=4):a.isVector2?(b.boundary=8,b.storage=8):a.isVector3||a.isColor?(b.boundary=16,b.storage=12):a.isVector4?(b.boundary=16,b.storage=16):a.isMatrix3?(b.boundary=48,b.storage=48):a.isMatrix4?(b.boundary=64,b.storage=64):a.isTexture?dg("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(a)?(b.boundary=16,b.storage=a.byteLength):dg("WebGLRenderer: Unsupported uniform value type.",a),b}function l(b){let c=b.target;c.removeEventListener("dispose",l);let d=g.indexOf(c.__bindingPointIndex);g.splice(d,1),a.deleteBuffer(e[c.id]),delete e[c.id],delete f[c.id]}return{bind:function(a,b){let c=b.program;d.uniformBlockBinding(a,c)},update:function(c,j){var m;let n,o,p,q,r=e[c.id];void 0===r&&(function(a){let b=a.uniforms,c=0;for(let a=0,d=b.length;a<d;a++){let d=Array.isArray(b[a])?b[a]:[b[a]];for(let a=0,b=d.length;a<b;a++){let b=d[a],e=Array.isArray(b.value)?b.value:[b.value];for(let a=0,d=e.length;a<d;a++){let d=k(e[a]),f=c%16,g=f%d.boundary,h=f+g;c+=g,0!==h&&16-h<d.storage&&(c+=16-h),b.__data=new Float32Array(d.storage/Float32Array.BYTES_PER_ELEMENT),b.__offset=c,c+=d.storage}}}let d=c%16;d>0&&(c+=16-d),a.__size=c,a.__cache={}}(c),(m=c).__bindingPointIndex=n=function(){for(let a=0;a<h;a++)if(-1===g.indexOf(a))return g.push(a),a;return dh("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),o=a.createBuffer(),p=m.__size,q=m.usage,a.bindBuffer(a.UNIFORM_BUFFER,o),a.bufferData(a.UNIFORM_BUFFER,p,q),a.bindBuffer(a.UNIFORM_BUFFER,null),a.bindBufferBase(a.UNIFORM_BUFFER,n,o),r=o,e[c.id]=r,c.addEventListener("dispose",l));let s=j.program;d.updateUBOMapping(c,s);let t=b.render.frame;f[c.id]!==t&&(function(b){let c=e[b.id],d=b.uniforms,f=b.__cache;a.bindBuffer(a.UNIFORM_BUFFER,c);for(let a=0,b=d.length;a<b;a++){let b=d[a];if(Array.isArray(b))for(let c=0,d=b.length;c<d;c++)i(b[c],a,c,f);else i(b,a,0,f)}a.bindBuffer(a.UNIFORM_BUFFER,null)}(c),f[c.id]=t)},dispose:function(){for(let b in e)a.deleteBuffer(e[b]);g=[],e={},f={}}}}nN.set(-1,0,0,0,1,0,0,0,1);let nQ=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,10751,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]),nR=null;class nS{constructor(a={}){let b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;const{canvas:z=c9(),context:A=null,depth:B=!0,stencil:C=!1,alpha:E=!1,antialias:F=!1,premultipliedAlpha:G=!0,preserveDrawingBuffer:H=!1,powerPreference:I="default",failIfMajorPerformanceCaveat:J=!1,reversedDepthBuffer:K=!1,outputBufferType:L=a2}=a;if(this.isWebGLRenderer=!0,null!==A){if("u">typeof WebGLRenderingContext&&A instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=A.getContextAttributes().alpha}else b=E;const M=new Set([bp,bn,bl]),N=new Set([a2,a7,a5,bc,ba,bb]),R=new Uint32Array(4),S=new Int32Array(4),T=new dz;let U=null,V=null;const W=[],X=[];let Y=null;this.domElement=z,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=aB,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const Z=this;let $=!1,_=null,aa=null,ab=null,ac=null;this._outputColorSpace=ck;let ad=0,ae=0,af=null,ag=-1,ah=null;const ai=new dR,aj=new dR;let ak=null;const al=new ev(0);let am=0,an=z.width,ao=z.height,ap=1,aq=null,ar=null;const as=new dR(0,0,an,ao),at=new dR(0,0,an,ao);let au=!1;const av=new gD;let aw=!1,ax=!1;const ay=new dY,az=new dz,aA=new dR,aC={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let aD=!1;function aE(){return null===af?ap:1}let aF=A;function aG(a,b){return z.getContext(a,b)}try{if("setAttribute"in z&&z.setAttribute("data-engine",`three.js r${D}`),z.addEventListener("webglcontextlost",aJ,!1),z.addEventListener("webglcontextrestored",aK,!1),z.addEventListener("webglcontextcreationerror",aL,!1),null===aF){const a="webgl2";if(aF=aG(a,{alpha:!0,depth:B,stencil:C,antialias:F,premultipliedAlpha:G,preserveDrawingBuffer:H,powerPreference:I,failIfMajorPerformanceCaveat:J}),null===aF)if(aG(a))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}aH()}catch(a){throw z.removeEventListener("webglcontextlost",aJ,!1),z.removeEventListener("webglcontextrestored",aK,!1),z.removeEventListener("webglcontextcreationerror",aL,!1),dh("WebGLRenderer: "+a.message),a}function aH(){(c=new lY(aF)).init(),w=new nH(aF,c),d=new lG(aF,c,a,w),e=new nF(aF,c),d.reversedDepthBuffer&&K&&e.buffers.depth.setReversed(!0),aa=aF.createFramebuffer(),ab=aF.createFramebuffer(),ac=aF.createFramebuffer(),f=new l_(aF),g=new no,h=new nG(aF,c,e,g,d,w,f),i=new lX(Z),j=new lw(aF),x=new lE(aF,j),k=new lZ(aF,j,f,x),l=new l1(aF,k,j,x,f),t=new l0(aF,d,h),q=new lH(g),m=new nn(Z,i,c,d,x,q),n=new nO(Z,g),o=new ns,p=new ny(c),s=new lD(Z,i,e,l,b,G),r=new nE(Z,l,d),y=new nP(aF,f,d,e),u=new lF(aF,c,f),v=new l$(aF,c,f),f.programs=m.programs,Z.capabilities=d,Z.extensions=c,Z.properties=g,Z.renderLists=o,Z.shadowMap=r,Z.state=e,Z.info=f}L!==a2&&(Y=new l3(L,z.width,z.height,F,B,C));const aI=new nL(Z,aF);function aJ(a){a.preventDefault(),de("WebGLRenderer: Context Lost."),$=!0}function aK(){de("WebGLRenderer: Context Restored."),$=!1;let a=f.autoReset,b=r.enabled,c=r.autoUpdate,d=r.needsUpdate,e=r.type;aH(),f.autoReset=a,r.enabled=b,r.autoUpdate=c,r.needsUpdate=d,r.type=e}function aL(a){dh("WebGLRenderer: A WebGL context could not be created. Reason: ",a.statusMessage)}function aM(a){var b,c;let d,e=a.target;e.removeEventListener("dispose",aM),c=b=e,void 0!==(d=g.get(c).programs)&&(d.forEach(function(a){m.releaseProgram(a)}),c.isShaderMaterial&&m.releaseShaderCache(c)),g.remove(b)}function aN(a,b,c,d){null!==_&&a.isNodeMaterial&&_.setObject(d,a),!0===aw&&q.setState(a,c,!1),!0===a.transparent&&a.side===Q&&!1===a.forceSinglePass?(a.side=P,a.needsUpdate=!0,aY(a,b,d),a.side=O,a.needsUpdate=!0,aY(a,b,d),a.side=Q):aY(a,b,d)}this.xr=aI,this.getContext=function(){return aF},this.getContextAttributes=function(){return aF.getContextAttributes()},this.forceContextLoss=function(){let a=c.get("WEBGL_lose_context");a&&a.loseContext()},this.forceContextRestore=function(){let a=c.get("WEBGL_lose_context");a&&a.restoreContext()},this.getPixelRatio=function(){return ap},this.setPixelRatio=function(a){void 0!==a&&(ap=a,this.setSize(an,ao,!1))},this.getSize=function(a){return a.set(an,ao)},this.setSize=function(a,b,c=!0){aI.isPresenting?dg("WebGLRenderer: Can't change size while VR device is presenting."):(an=a,ao=b,z.width=Math.floor(a*ap),z.height=Math.floor(b*ap),!0===c&&(z.style.width=a+"px",z.style.height=b+"px"),null!==Y&&Y.setSize(z.width,z.height),this.setViewport(0,0,a,b))},this.getDrawingBufferSize=function(a){return a.set(an*ap,ao*ap).floor()},this.setDrawingBufferSize=function(a,b,c){an=a,ao=b,ap=c,z.width=Math.floor(a*c),z.height=Math.floor(b*c),this.setViewport(0,0,a,b)},this.setEffects=function(a){if(L===a2)return void dh("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(a){for(let b=0;b<a.length;b++)if(!0===a[b].isOutputPass){dg("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}Y.setEffects(a||[])},this.getCurrentViewport=function(a){return a.copy(ai)},this.getViewport=function(a){return a.copy(as)},this.setViewport=function(a,b,c,d){a.isVector4?as.set(a.x,a.y,a.z,a.w):as.set(a,b,c,d),e.viewport(ai.copy(as).multiplyScalar(ap).round())},this.getScissor=function(a){return a.copy(at)},this.setScissor=function(a,b,c,d){a.isVector4?at.set(a.x,a.y,a.z,a.w):at.set(a,b,c,d),e.scissor(aj.copy(at).multiplyScalar(ap).round())},this.getScissorTest=function(){return au},this.setScissorTest=function(a){e.setScissorTest(au=a)},this.setOpaqueSort=function(a){aq=a},this.setTransparentSort=function(a){ar=a},this.getClearColor=function(a){return a.copy(s.getClearColor())},this.setClearColor=function(){s.setClearColor(...arguments)},this.getClearAlpha=function(){return s.getClearAlpha()},this.setClearAlpha=function(){s.setClearAlpha(...arguments)},this.clear=function(a=!0,b=!0,c=!0){let d=0;if(a){let a=!1;if(null!==af){let b=af.texture.format;a=M.has(b)}if(a){let a=af.texture.type,b=N.has(a),c=s.getClearColor(),d=s.getClearAlpha(),e=c.r,f=c.g,g=c.b;b?(R[0]=e,R[1]=f,R[2]=g,R[3]=d,aF.clearBufferuiv(aF.COLOR,0,R)):(S[0]=e,S[1]=f,S[2]=g,S[3]=d,aF.clearBufferiv(aF.COLOR,0,S))}else d|=aF.COLOR_BUFFER_BIT}b&&(d|=aF.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),c&&(d|=aF.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==d&&aF.clear(d)},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(a){a.setRenderer(this),_=a},this.dispose=function(){z.removeEventListener("webglcontextlost",aJ,!1),z.removeEventListener("webglcontextrestored",aK,!1),z.removeEventListener("webglcontextcreationerror",aL,!1),s.dispose(),o.dispose(),p.dispose(),g.dispose(),i.dispose(),l.dispose(),x.dispose(),y.dispose(),m.dispose(),aI.dispose(),aI.removeEventListener("sessionstart",aP),aI.removeEventListener("sessionend",aQ),aR.stop()},this.renderBufferDirect=function(a,b,f,l,m,o){let p;null===b&&(b=aC);let r=m.isMesh&&0>m.matrixWorld.determinantAffine(),s=function(a,b,c,f,j){!0!==b.isScene&&(b=aC),h.resetTextureUnits();let k=b.fog,l=f.isMeshStandardMaterial||f.isMeshLambertMaterial||f.isMeshPhongMaterial?b.environment:null,m=null===af?Z.outputColorSpace:!0===af.isXRRenderTarget?af.texture.colorSpace:dG.workingColorSpace,o=f.isMeshStandardMaterial||f.isMeshLambertMaterial&&!f.envMap||f.isMeshPhongMaterial&&!f.envMap,p=i.get(f.envMap||l,o),r=!0===f.vertexColors&&!!c.attributes.color&&4===c.attributes.color.itemSize,s=!!c.attributes.tangent&&(!!f.normalMap||f.anisotropy>0),u=!!c.morphAttributes.position,v=!!c.morphAttributes.normal,w=!!c.morphAttributes.color,x=aB;f.toneMapped&&(null===af||!0===af.isXRRenderTarget)&&(x=Z.toneMapping);let z=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,A=void 0!==z?z.length:0,B=g.get(f),C=V.state.lights;if(!0===aw&&(!0===ax||a!==ah)){let b=a===ah&&f.id===ag;q.setState(f,a,b)}let D=!1;f.version===B.__version?B.needsLights&&B.lightsStateVersion!==C.state.version||B.outputColorSpace!==m||j.isBatchedMesh&&!1===B.batching?D=!0:j.isBatchedMesh||!0!==B.batching?j.isBatchedMesh&&!0===B.batchingColor&&null===j._colorsTexture||j.isBatchedMesh&&!1===B.batchingColor&&null!==j._colorsTexture||j.isInstancedMesh&&!1===B.instancing?D=!0:j.isInstancedMesh||!0!==B.instancing?j.isSkinnedMesh&&!1===B.skinning?D=!0:j.isSkinnedMesh||!0!==B.skinning?j.isInstancedMesh&&!0===B.instancingColor&&null===j.instanceColor||j.isInstancedMesh&&!1===B.instancingColor&&null!==j.instanceColor||j.isInstancedMesh&&!0===B.instancingMorph&&null===j.morphTexture||j.isInstancedMesh&&!1===B.instancingMorph&&null!==j.morphTexture||B.envMap!==p||!0===f.fog&&B.fog!==k||void 0!==B.numClippingPlanes&&(B.numClippingPlanes!==q.numPlanes||B.numIntersection!==q.numIntersection)||B.vertexAlphas!==r||B.vertexTangents!==s||B.morphTargets!==u||B.morphNormals!==v||B.morphColors!==w||B.toneMapping!==x||B.morphTargetsCount!==A?D=!0:!!B.lightProbeGrid!=V.state.lightProbeGridArray.length>0&&(D=!0):D=!0:D=!0:D=!0:(D=!0,B.__version=f.version);let E=B.currentProgram;!0===D&&(E=aY(f,b,j),_&&f.isNodeMaterial&&_.onUpdateProgram(f,E,B));let F=!1,G=!1,H=!1,I=E.getUniforms(),J=B.uniforms;if(e.useProgram(E.program)&&(F=!0,G=!0,H=!0),f.id!==ag&&(ag=f.id,G=!0),B.needsLights){let a=function(a,b){if(0===a.length)return null;if(1===a.length)return null!==a[0].texture?a[0]:null;T.setFromMatrixPosition(b.matrixWorld);for(let b=0,c=a.length;b<c;b++){let c=a[b];if(null!==c.texture&&c.boundingBox.containsPoint(T))return c}return null}(V.state.lightProbeGridArray,j);B.lightProbeGrid!==a&&(B.lightProbeGrid=a,G=!0)}if(F||ah!==a){e.buffers.depth.getReversed()&&!0!==a.reversedDepth&&(a._reversedDepth=!0,a.updateProjectionMatrix()),I.setValue(aF,"projectionMatrix",a.projectionMatrix),I.setValue(aF,"viewMatrix",a.matrixWorldInverse);let b=I.map.cameraPosition;void 0!==b&&b.setValue(aF,az.setFromMatrixPosition(a.matrixWorld)),d.logarithmicDepthBuffer&&I.setValue(aF,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2)),(f.isMeshPhongMaterial||f.isMeshToonMaterial||f.isMeshLambertMaterial||f.isMeshBasicMaterial||f.isMeshStandardMaterial||f.isShaderMaterial)&&I.setValue(aF,"isOrthographic",!0===a.isOrthographicCamera),ah!==a&&(ah=a,G=!0,H=!0)}if(B.needsLights&&(C.state.sunShadowMap.length>0&&I.setValue(aF,"sunShadowMap",C.state.sunShadowMap,h),C.state.directionalShadowMap.length>0&&I.setValue(aF,"directionalShadowMap",C.state.directionalShadowMap,h),C.state.spotShadowMap.length>0&&I.setValue(aF,"spotShadowMap",C.state.spotShadowMap,h),C.state.pointShadowMap.length>0&&I.setValue(aF,"pointShadowMap",C.state.pointShadowMap,h)),j.isSkinnedMesh){I.setOptional(aF,j,"bindMatrix"),I.setOptional(aF,j,"bindMatrixInverse");let a=j.skeleton;a&&(null===a.boneTexture&&a.computeBoneTexture(),I.setValue(aF,"boneTexture",a.boneTexture,h))}j.isBatchedMesh&&(I.setOptional(aF,j,"batchingTexture"),I.setValue(aF,"batchingTexture",j._matricesTexture,h),I.setOptional(aF,j,"batchingIdTexture"),I.setValue(aF,"batchingIdTexture",j._indirectTexture,h),I.setOptional(aF,j,"batchingColorTexture"),null!==j._colorsTexture&&I.setValue(aF,"batchingColorTexture",j._colorsTexture,h));let K=c.morphAttributes;if((void 0!==K.position||void 0!==K.normal||void 0!==K.color)&&t.update(j,c,E),(G||B.receiveShadow!==j.receiveShadow)&&(B.receiveShadow=j.receiveShadow,I.setValue(aF,"receiveShadow",j.receiveShadow)),(f.isMeshStandardMaterial||f.isMeshLambertMaterial||f.isMeshPhongMaterial)&&null===f.envMap&&null!==b.environment&&(J.envMapIntensity.value=b.environmentIntensity),void 0!==J.dfgLUT&&(J.dfgLUT.value=(null===nR&&((nR=new gn(nQ,16,16,bm,a9)).name="DFG_LUT",nR.minFilter=aZ,nR.magFilter=aZ,nR.wrapS=aS,nR.wrapT=aS,nR.generateMipmaps=!1,nR.needsUpdate=!0),nR)),G){var L,M;if(I.setValue(aF,"toneMappingExposure",Z.toneMappingExposure),B.needsLights&&(L=J,M=H,L.ambientLightColor.needsUpdate=M,L.lightProbe.needsUpdate=M,L.sunLights.needsUpdate=M,L.sunLightShadows.needsUpdate=M,L.directionalLights.needsUpdate=M,L.directionalLightShadows.needsUpdate=M,L.pointLights.needsUpdate=M,L.pointLightShadows.needsUpdate=M,L.spotLights.needsUpdate=M,L.spotLightShadows.needsUpdate=M,L.rectAreaLights.needsUpdate=M,L.hemisphereLights.needsUpdate=M),k&&!0===f.fog&&n.refreshFogUniforms(J,k),n.refreshMaterialUniforms(J,f,ap,ao,V.state.transmissionRenderTarget[a.id]),B.needsLights&&B.lightProbeGrid){let a=B.lightProbeGrid;J.probesSH.value=a.texture,J.probesMin.value.copy(a.boundingBox.min),J.probesMax.value.copy(a.boundingBox.max),J.probesResolution.value.copy(a.resolution)}mZ.upload(aF,a$(B),J,h)}if(f.isShaderMaterial&&!0===f.uniformsNeedUpdate&&(mZ.upload(aF,a$(B),J,h),f.uniformsNeedUpdate=!1),f.isSpriteMaterial&&I.setValue(aF,"center",j.center),I.setValue(aF,"modelViewMatrix",j.modelViewMatrix),I.setValue(aF,"normalMatrix",j.normalMatrix),I.setValue(aF,"modelMatrix",j.matrixWorld),void 0!==f.uniformsGroups){let a=f.uniformsGroups;for(let b=0,c=a.length;b<c;b++){let c=a[b];y.update(c,E),y.bind(c,E)}}return E}(a,b,f,l,m);e.setMaterial(l,r);let w=f.index,z=1;if(!0===l.wireframe){if(void 0===(w=k.getWireframeAttribute(f)))return;z=2}let A=f.drawRange,B=f.attributes.position,C=A.start*z,D=(A.start+A.count)*z;null!==o&&(C=Math.max(C,o.start*z),D=Math.min(D,(o.start+o.count)*z)),null!==w?(C=Math.max(C,0),D=Math.min(D,w.count)):null!=B&&(C=Math.max(C,0),D=Math.min(D,B.count));let E=D-C;if(E<0||E===1/0)return;x.setup(m,l,s,f,w);let F=u;if(null!==w&&(p=j.get(w),(F=v).setIndex(p)),m.isMesh)!0===l.wireframe?(e.setLineWidth(l.wireframeLinewidth*aE()),F.setMode(aF.LINES)):F.setMode(aF.TRIANGLES);else if(m.isLine){let a=l.linewidth;void 0===a&&(a=1),e.setLineWidth(a*aE()),m.isLineSegments?F.setMode(aF.LINES):m.isLineLoop?F.setMode(aF.LINE_LOOP):F.setMode(aF.LINE_STRIP)}else m.isPoints?F.setMode(aF.POINTS):m.isSprite&&F.setMode(aF.TRIANGLES);if(m.isBatchedMesh)if(c.get("WEBGL_multi_draw"))F.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else{let a=m._multiDrawStarts,b=m._multiDrawCounts,c=m._multiDrawCount,d=w?j.get(w).bytesPerElement:1,e=g.get(l).currentProgram.getUniforms();for(let f=0;f<c;f++)e.setValue(aF,"_gl_DrawID",f),F.render(a[f]/d,b[f])}else if(m.isInstancedMesh)F.renderInstances(C,E,m.count);else if(f.isInstancedBufferGeometry){let a=void 0!==f._maxInstanceCount?f._maxInstanceCount:1/0,b=Math.min(f.instanceCount,a);F.renderInstances(C,E,b)}else F.render(C,E)},this.compile=function(a,b,c=null){null===c&&(c=a),null!==_&&_.renderStart(a,b,c),(V=p.get(c)).init(b),X.push(V),c.traverseVisible(function(a){a.isLight&&a.layers.test(b.layers)&&(V.pushLight(a),a.castShadow&&V.pushShadow(a))}),a!==c&&a.traverseVisible(function(a){a.isLight&&a.layers.test(b.layers)&&(V.pushLight(a),a.castShadow&&V.pushShadow(a))}),V.setupLights(),null!==_&&_.updateLights(V.state.lightsArray),ax=this.localClippingEnabled,!0===(aw=q.init(this.clippingPlanes,ax))&&q.setGlobalState(this.clippingPlanes,b),null!==_&&r.render(V.state.shadowsArray,c,b);let d=new Set;return a.traverse(function(a){if(!(a.isMesh||a.isPoints||a.isLine||a.isSprite))return;let e=a.material;if(e)if(Array.isArray(e))for(let f=0;f<e.length;f++){let g=e[f];aN(g,c,b,a),d.add(g)}else aN(e,c,b,a),d.add(e)}),V=X.pop(),null!==_&&_.renderEnd(),d},this.compileAsync=function(a,b,d=null){let e=this.compile(a,b,d);return new Promise(b=>{function d(){(e.forEach(function(a){let b=g.get(a).currentProgram;(void 0===b||b.isReady())&&e.delete(a)}),0===e.size)?b(a):setTimeout(d,10)}null!==c.get("KHR_parallel_shader_compile")?d():setTimeout(d,10)})};let aO=null;function aP(){aR.stop()}function aQ(){aR.start()}const aR=new lv;function aT(a,b,c,d){if(!1===a.visible)return;if(a.layers.test(b.layers)){if(a.isGroup)c=a.renderOrder;else if(a.isLOD)!0===a.autoUpdate&&a.update(b);else if(a.isLightProbeGrid)V.pushLightProbeGrid(a);else if(a.isLight)V.pushLight(a),a.castShadow&&V.pushShadow(a);else if(a.isSprite){if(!a.frustumCulled||a.intersectsFrustum(av)){d&&aA.setFromMatrixPosition(a.matrixWorld).applyMatrix4(ay);let e=l.update(a),f=a.material;f.visible&&U.push(a,e,f,c,aA.z,null,b)}}else if((a.isMesh||a.isLine||a.isPoints)&&(!a.frustumCulled||a.intersectsFrustum(av))){let e=l.update(a),f=a.material;if(d&&(void 0!==a.boundingSphere?(null===a.boundingSphere&&a.computeBoundingSphere(),aA.copy(a.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),aA.copy(e.boundingSphere.center)),aA.applyMatrix4(a.matrixWorld).applyMatrix4(ay)),Array.isArray(f)){let d=e.groups;for(let g=0,h=d.length;g<h;g++){let h=d[g],i=f[h.materialIndex];i&&i.visible&&U.push(a,e,i,c,aA.z,h,b)}}else f.visible&&U.push(a,e,f,c,aA.z,null,b)}}let e=a.children;for(let a=0,f=e.length;a<f;a++)aT(e[a],b,c,d)}function aU(a,b,c,d){let{opaque:f,transmissive:g,transparent:h}=a;V.setupLightsView(c),!0===aw&&q.setGlobalState(Z.clippingPlanes,c),d&&e.viewport(ai.copy(d)),f.length>0&&aW(f,b,c),g.length>0&&aW(g,b,c),h.length>0&&aW(h,b,c),e.buffers.depth.setTest(!0),e.buffers.depth.setMask(!0),e.buffers.color.setMask(!0),e.setPolygonOffset(!1)}function aV(a,b,e,f){if(null!==(!0===e.isScene?e.overrideMaterial:null))return;if(void 0===V.state.transmissionRenderTarget[f.id]){let a=c.has("EXT_color_buffer_half_float")||c.has("EXT_color_buffer_float");V.state.transmissionRenderTarget[f.id]=new dT(1,1,{generateMipmaps:!0,type:a?a9:a2,minFilter:a0,samples:Math.max(4,d.samples),stencilBuffer:C,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:dG.workingColorSpace})}let g=V.state.transmissionRenderTarget[f.id],i=f.viewport||ai;g.setSize(i.z*Z.transmissionResolutionScale,i.w*Z.transmissionResolutionScale);let j=Z.getRenderTarget(),k=Z.getActiveCubeFace(),l=Z.getActiveMipmapLevel();Z.setRenderTarget(g),Z.getClearColor(al),(am=Z.getClearAlpha())<1&&Z.setClearColor(0xffffff,.5),Z.clear(),aD&&s.render(e);let m=Z.toneMapping;Z.toneMapping=aB;let n=f.viewport;if(void 0!==f.viewport&&(f.viewport=void 0),V.setupLightsView(f),!0===aw&&q.setGlobalState(Z.clippingPlanes,f),aW(a,e,f),h.updateMultisampleRenderTarget(g),h.updateRenderTargetMipmap(g),!1===c.has("WEBGL_multisampled_render_to_texture")){let a=!1;for(let c=0,d=b.length;c<d;c++){let{object:d,geometry:g,material:h,group:i}=b[c];if(h.side===Q&&d.layers.test(f.layers)){let b=h.side;h.side=P,h.needsUpdate=!0,aX(d,e,f,g,h,i),h.side=b,h.needsUpdate=!0,a=!0}}!0===a&&(h.updateMultisampleRenderTarget(g),h.updateRenderTargetMipmap(g))}Z.setRenderTarget(j,k,l),Z.setClearColor(al,am),void 0!==n&&(f.viewport=n),Z.toneMapping=m}function aW(a,b,c){let d=!0===b.isScene?b.overrideMaterial:null;for(let e=0,f=a.length;e<f;e++){let f=a[e],{object:g,geometry:h,group:i}=f,j=f.material;!0===j.allowOverride&&null!==d&&(j=d),g.layers.test(c.layers)&&aX(g,b,c,h,j,i)}}function aX(a,b,c,d,e,f){null!==_&&e.isNodeMaterial&&_.setObject(a,e),a.onBeforeRender(Z,b,c,d,e,f),a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),a.normalMatrix.getNormalMatrix(a.modelViewMatrix),e.onBeforeRender(Z,b,c,d,a,f),!0===e.transparent&&e.side===Q&&!1===e.forceSinglePass?(e.side=P,e.needsUpdate=!0,Z.renderBufferDirect(c,b,d,e,a,f),e.side=O,e.needsUpdate=!0,Z.renderBufferDirect(c,b,d,e,a,f),e.side=Q):Z.renderBufferDirect(c,b,d,e,a,f),a.onAfterRender(Z,b,c,d,e,f)}function aY(a,b,c){var d;!0!==b.isScene&&(b=aC);let e=g.get(a),f=V.state.lights,h=V.state.shadowsArray,j=f.state.version,k=m.getParameters(a,f.state,h,b,c,V.state.lightProbeGridArray),l=m.getProgramCacheKey(k),n=e.programs;e.environment=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?b.environment:null,e.fog=b.fog;let o=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap;e.envMap=i.get(a.envMap||e.environment,o),e.envMapRotation=null!==e.environment&&null===a.envMap?b.environmentRotation:a.envMapRotation,void 0===n&&(a.addEventListener("dispose",aM),e.programs=n=new Map);let p=n.get(l);if(void 0!==p){if(e.currentProgram===p&&e.lightsStateVersion===j)return a_(a,k),p}else k.uniforms=m.getUniforms(a),null!==_&&a.isNodeMaterial&&_.build(a,c,k),a.onBeforeCompile(k,Z),p=m.acquireProgram(k,l),n.set(l,p),e.uniforms=k.uniforms;let r=e.uniforms;return(a.isShaderMaterial||a.isRawShaderMaterial)&&!0!==a.clipping||(r.clippingPlanes=q.uniform),a_(a,k),e.needsLights=(d=a).isMeshLambertMaterial||d.isMeshToonMaterial||d.isMeshPhongMaterial||d.isMeshStandardMaterial||d.isShadowMaterial||d.isShaderMaterial&&!0===d.lights,e.lightsStateVersion=j,e.needsLights&&(r.ambientLightColor.value=f.state.ambient,r.lightProbe.value=f.state.probe,r.sunLights.value=f.state.sun,r.sunLightShadows.value=f.state.sunShadow,r.directionalLights.value=f.state.directional,r.directionalLightShadows.value=f.state.directionalShadow,r.spotLights.value=f.state.spot,r.spotLightShadows.value=f.state.spotShadow,r.rectAreaLights.value=f.state.rectArea,r.ltc_1.value=f.state.rectAreaLTC1,r.ltc_2.value=f.state.rectAreaLTC2,r.pointLights.value=f.state.point,r.pointLightShadows.value=f.state.pointShadow,r.hemisphereLights.value=f.state.hemi,r.sunShadowMatrix.value=f.state.sunShadowMatrix,r.sunShadowCascade.value=f.state.sunShadowCascade,r.directionalShadowMatrix.value=f.state.directionalShadowMatrix,r.spotLightMatrix.value=f.state.spotLightMatrix,r.spotLightMap.value=f.state.spotLightMap,r.pointShadowMatrix.value=f.state.pointShadowMatrix),e.lightProbeGrid=V.state.lightProbeGridArray.length>0,e.currentProgram=p,e.uniformsList=null,p}function a$(a){if(null===a.uniformsList){let b=a.currentProgram.getUniforms();a.uniformsList=mZ.seqWithValue(b.seq,a.uniforms)}return a.uniformsList}function a_(a,b){let c=g.get(a);c.outputColorSpace=b.outputColorSpace,c.batching=b.batching,c.batchingColor=b.batchingColor,c.instancing=b.instancing,c.instancingColor=b.instancingColor,c.instancingMorph=b.instancingMorph,c.skinning=b.skinning,c.morphTargets=b.morphTargets,c.morphNormals=b.morphNormals,c.morphColors=b.morphColors,c.morphTargetsCount=b.morphTargetsCount,c.numClippingPlanes=b.numClippingPlanes,c.numIntersection=b.numClipIntersection,c.vertexAlphas=b.vertexAlphas,c.vertexTangents=b.vertexTangents,c.toneMapping=b.toneMapping}function a1(a){let b=g.get(a);return(b.__readFormat!==a.format||b.__readType!==a.type)&&(b.__readFormat=a.format,b.__readType=a.type,b.__formatReadable=d.textureFormatReadable(a.format),b.__typeReadable=d.textureTypeReadable(a.type)),b}aR.setAnimationLoop(function(a){aO&&aO(a)}),"u">typeof self&&aR.setContext(self),this.setAnimationLoop=function(a){aO=a,aI.setAnimationLoop(a),null===a?aR.stop():aR.start()},aI.addEventListener("sessionstart",aP),aI.addEventListener("sessionend",aQ),this.render=function(a,b){if(void 0!==b&&!0!==b.isCamera)return void dh("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===$)return;null!==_&&_.renderStart(a,b);let c=!0===aI.enabled&&!0===aI.isPresenting,d=null!==Y&&(null===af||c)&&Y.begin(Z,af);if(!0===a.matrixWorldAutoUpdate&&a.updateMatrixWorld(),null===b.parent&&!0===b.matrixWorldAutoUpdate&&b.updateMatrixWorld(),!0===aI.enabled&&!0===aI.isPresenting&&(null===Y||!1===Y.isCompositing())&&(!0===aI.cameraAutoUpdate&&aI.updateCamera(b),b=aI.getCamera()),!0===a.isScene&&a.onBeforeRender(Z,a,b,af),(V=p.get(a,X.length)).init(b),V.state.textureUnits=h.getTextureUnits(),X.push(V),ay.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),av.setFromProjectionMatrix(ay,c$,b.reversedDepth),ax=this.localClippingEnabled,aw=q.init(this.clippingPlanes,ax),(U=o.get(a,W.length)).init(),W.push(U),!0===aI.enabled&&!0===aI.isPresenting){let a=Z.xr.getDepthSensingMesh();null!==a&&aT(a,b,-1/0,Z.sortObjects)}aT(a,b,0,Z.sortObjects),U.finish(),null!==_&&_.updateLights(V.state.lightsArray),!0===Z.sortObjects&&U.sort(aq,ar),(aD=!1===aI.enabled||!1===aI.isPresenting||!1===aI.hasDepthSensing())&&s.addToRenderList(U,a),this.info.render.frame++,!0===this.info.autoReset&&this.info.reset(),!0===aw&&q.beginShadows();let e=V.state.shadowsArray;if(r.render(e,a,b),!0===aw&&q.endShadows(),!1===(d&&Y.hasRenderPass())){let c=U.opaque,d=U.transmissive;if(V.setupLights(),b.isArrayCamera){let e=b.cameras;if(d.length>0)for(let b=0,f=e.length;b<f;b++)aV(c,d,a,e[b]);aD&&s.render(a);for(let b=0,c=e.length;b<c;b++){let c=e[b];aU(U,a,c,c.viewport)}}else d.length>0&&aV(c,d,a,b),aD&&s.render(a),aU(U,a,b)}null!==af&&0===ae&&(h.updateMultisampleRenderTarget(af),h.updateRenderTargetMipmap(af)),d&&Y.end(Z),!0===a.isScene&&a.onAfterRender(Z,a,b),x.resetDefaultState(),ag=-1,ah=null,X.pop(),X.length>0?(V=X[X.length-1],h.setTextureUnits(V.state.textureUnits),!0===aw&&q.setGlobalState(Z.clippingPlanes,V.state.camera)):V=null,W.pop(),U=W.length>0?W[W.length-1]:null,null!==_&&_.renderEnd()},this.getActiveCubeFace=function(){return ad},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return af},this.setRenderTargetTextures=function(a,b,c){let d=g.get(a);d.__autoAllocateDepthBuffer=!1===a.resolveDepthBuffer,!1===d.__autoAllocateDepthBuffer&&(d.__useRenderToTexture=!1),g.get(a.texture).__webglTexture=b,g.get(a.depthTexture).__webglTexture=d.__autoAllocateDepthBuffer?void 0:c,d.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(a,b){let c=g.get(a);c.__webglFramebuffer=b,c.__useDefaultFramebuffer=void 0===b},this.setRenderTarget=function(a,b=0,c=0){af=a,ad=b,ae=c;let d=null,f=!1,i=!1;if(a){let j=g.get(a);if(void 0!==j.__useDefaultFramebuffer){e.bindFramebuffer(aF.FRAMEBUFFER,j.__webglFramebuffer),ai.copy(a.viewport),aj.copy(a.scissor),ak=a.scissorTest,e.viewport(ai),e.scissor(aj),e.setScissorTest(ak),ag=-1;return}if(void 0===j.__webglFramebuffer)h.setupRenderTarget(a);else if(j.__hasExternalTextures)h.rebindTextures(a,g.get(a.texture).__webglTexture,g.get(a.depthTexture).__webglTexture);else if(a.depthBuffer){let b=a.depthTexture;if(j.__boundDepthTexture!==b){if(null!==b&&g.has(b)&&(a.width!==b.image.width||a.height!==b.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");h.setupDepthRenderbuffer(a)}}let k=a.texture;(k.isData3DTexture||k.isDataArrayTexture||k.isCompressedArrayTexture)&&(i=!0);let l=g.get(a).__webglFramebuffer;a.isWebGLCubeRenderTarget?(d=Array.isArray(l[b])?l[b][c]:l[b],f=!0):d=a.samples>0&&!1===h.useMultisampledRTT(a)?g.get(a).__webglMultisampledFramebuffer:Array.isArray(l)?l[c]:l,ai.copy(a.viewport),aj.copy(a.scissor),ak=a.scissorTest}else ai.copy(as).multiplyScalar(ap).floor(),aj.copy(at).multiplyScalar(ap).floor(),ak=au;if(0!==c&&(d=aa),e.bindFramebuffer(aF.FRAMEBUFFER,d)&&e.drawBuffers(a,d),e.viewport(ai),e.scissor(aj),e.setScissorTest(ak),f){let d=g.get(a.texture);aF.framebufferTexture2D(aF.FRAMEBUFFER,aF.COLOR_ATTACHMENT0,aF.TEXTURE_CUBE_MAP_POSITIVE_X+b,d.__webglTexture,c)}else if(i)for(let d=0;d<a.textures.length;d++){let e=g.get(a.textures[d]);aF.framebufferTextureLayer(aF.FRAMEBUFFER,aF.COLOR_ATTACHMENT0+d,e.__webglTexture,c,b)}else if(null!==a&&0!==c){let b=g.get(a.texture);aF.framebufferTexture2D(aF.FRAMEBUFFER,aF.COLOR_ATTACHMENT0,aF.TEXTURE_2D,b.__webglTexture,c)}ag=-1},this.readRenderTargetPixels=function(a,b,c,d,f,h,i,j=0){if(!(a&&a.isWebGLRenderTarget))return void dh("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let k=g.get(a).__webglFramebuffer;if(a.isWebGLCubeRenderTarget&&void 0!==i&&(k=k[i]),k){e.bindFramebuffer(aF.FRAMEBUFFER,k);try{let e=a.textures[j],g=e.format,i=e.type;a.textures.length>1&&aF.readBuffer(aF.COLOR_ATTACHMENT0+j);let k=a1(e);if(!1===k.__formatReadable)return void dh("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!1===k.__typeReadable)return void dh("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");b>=0&&b<=a.width-d&&c>=0&&c<=a.height-f&&aF.readPixels(b,c,d,f,w.convert(g),w.convert(i),h)}finally{let a=null!==af?g.get(af).__webglFramebuffer:null;e.bindFramebuffer(aF.FRAMEBUFFER,a)}}},this.readRenderTargetPixelsAsync=async function(a,b,c,d,f,h,i,j=0){if(!(a&&a.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let k=g.get(a).__webglFramebuffer;if(a.isWebGLCubeRenderTarget&&void 0!==i&&(k=k[i]),k)if(b>=0&&b<=a.width-d&&c>=0&&c<=a.height-f){var l;e.bindFramebuffer(aF.FRAMEBUFFER,k);let i=a.textures[j],m=i.format,n=i.type;a.textures.length>1&&aF.readBuffer(aF.COLOR_ATTACHMENT0+j);let o=a1(i);if(!1===o.__formatReadable)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!1===o.__typeReadable)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let p=aF.createBuffer();aF.bindBuffer(aF.PIXEL_PACK_BUFFER,p),aF.bufferData(aF.PIXEL_PACK_BUFFER,h.byteLength,aF.STREAM_READ),aF.readPixels(b,c,d,f,w.convert(m),w.convert(n),0),aF.bindBuffer(aF.PIXEL_PACK_BUFFER,null);let q=null!==af?g.get(af).__webglFramebuffer:null;e.bindFramebuffer(aF.FRAMEBUFFER,q);let r=aF.fenceSync(aF.SYNC_GPU_COMMANDS_COMPLETE,0);return aF.flush(),await (l=aF,new Promise(function(a,b){setTimeout(function c(){switch(l.clientWaitSync(r,l.SYNC_FLUSH_COMMANDS_BIT,0)){case l.WAIT_FAILED:b();break;case l.TIMEOUT_EXPIRED:setTimeout(c,4);break;default:a()}},4)})),aF.bindBuffer(aF.PIXEL_PACK_BUFFER,p),aF.getBufferSubData(aF.PIXEL_PACK_BUFFER,0,h),aF.bindBuffer(aF.PIXEL_PACK_BUFFER,null),aF.deleteBuffer(p),aF.deleteSync(r),h}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(a,b=null,c=0){let d=Math.pow(2,-c),f=Math.floor(a.image.width*d),g=Math.floor(a.image.height*d),i=null!==b?b.x:0,j=null!==b?b.y:0;h.setTexture2D(a,0),aF.copyTexSubImage2D(aF.TEXTURE_2D,c,0,0,i,j,f,g),e.unbindTexture()},this.copyTextureToTexture=function(a,b,c=null,d=null,f=0,i=0){let j,k,l,m,n,o,p,q,r,s,t=a.isCompressedTexture?a.mipmaps[i]:a.image;if(null!==c)j=c.max.x-c.min.x,k=c.max.y-c.min.y,l=c.isBox3?c.max.z-c.min.z:1,m=c.min.x,n=c.min.y,o=c.isBox3?c.min.z:0;else{let b=Math.pow(2,-f);j=Math.floor(t.width*b),k=Math.floor(t.height*b),l=a.isDataArrayTexture?t.depth:a.isData3DTexture?Math.floor(t.depth*b):1,m=0,n=0,o=0}null!==d?(p=d.x,q=d.y,r=d.z):(p=0,q=0,r=0);let u=w.convert(b.format),v=w.convert(b.type);b.isData3DTexture?(h.setTexture3D(b,0),s=aF.TEXTURE_3D):b.isDataArrayTexture||b.isCompressedArrayTexture?(h.setTexture2DArray(b,0),s=aF.TEXTURE_2D_ARRAY):(h.setTexture2D(b,0),s=aF.TEXTURE_2D),e.activeTexture(aF.TEXTURE0),e.pixelStorei(aF.UNPACK_FLIP_Y_WEBGL,b.flipY),e.pixelStorei(aF.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),e.pixelStorei(aF.UNPACK_ALIGNMENT,b.unpackAlignment);let x=e.getParameter(aF.UNPACK_ROW_LENGTH),y=e.getParameter(aF.UNPACK_IMAGE_HEIGHT),z=e.getParameter(aF.UNPACK_SKIP_PIXELS),A=e.getParameter(aF.UNPACK_SKIP_ROWS),B=e.getParameter(aF.UNPACK_SKIP_IMAGES);e.pixelStorei(aF.UNPACK_ROW_LENGTH,t.width),e.pixelStorei(aF.UNPACK_IMAGE_HEIGHT,t.height),e.pixelStorei(aF.UNPACK_SKIP_PIXELS,m),e.pixelStorei(aF.UNPACK_SKIP_ROWS,n),e.pixelStorei(aF.UNPACK_SKIP_IMAGES,o);let C=a.isDataArrayTexture||a.isData3DTexture,D=b.isDataArrayTexture||b.isData3DTexture;if(a.isDepthTexture){let c=g.get(a),d=g.get(b),h=g.get(c.__renderTarget),s=g.get(d.__renderTarget);e.bindFramebuffer(aF.READ_FRAMEBUFFER,h.__webglFramebuffer),e.bindFramebuffer(aF.DRAW_FRAMEBUFFER,s.__webglFramebuffer);for(let c=0;c<l;c++)C&&(aF.framebufferTextureLayer(aF.READ_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,g.get(a).__webglTexture,f,o+c),aF.framebufferTextureLayer(aF.DRAW_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,g.get(b).__webglTexture,i,r+c)),aF.blitFramebuffer(m,n,j,k,p,q,j,k,aF.DEPTH_BUFFER_BIT,aF.NEAREST);e.bindFramebuffer(aF.READ_FRAMEBUFFER,null),e.bindFramebuffer(aF.DRAW_FRAMEBUFFER,null)}else if(0!==f||a.isRenderTargetTexture||g.has(a)){let c=g.get(a),d=g.get(b);e.bindFramebuffer(aF.READ_FRAMEBUFFER,ab),e.bindFramebuffer(aF.DRAW_FRAMEBUFFER,ac);for(let a=0;a<l;a++)C?aF.framebufferTextureLayer(aF.READ_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,c.__webglTexture,f,o+a):aF.framebufferTexture2D(aF.READ_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,aF.TEXTURE_2D,c.__webglTexture,f),D?aF.framebufferTextureLayer(aF.DRAW_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,d.__webglTexture,i,r+a):aF.framebufferTexture2D(aF.DRAW_FRAMEBUFFER,aF.COLOR_ATTACHMENT0,aF.TEXTURE_2D,d.__webglTexture,i),0!==f?aF.blitFramebuffer(m,n,j,k,p,q,j,k,aF.COLOR_BUFFER_BIT,aF.NEAREST):D?aF.copyTexSubImage3D(s,i,p,q,r+a,m,n,j,k):aF.copyTexSubImage2D(s,i,p,q,m,n,j,k);e.bindFramebuffer(aF.READ_FRAMEBUFFER,null),e.bindFramebuffer(aF.DRAW_FRAMEBUFFER,null)}else D?a.isDataTexture||a.isData3DTexture?aF.texSubImage3D(s,i,p,q,r,j,k,l,u,v,t.data):b.isCompressedArrayTexture?aF.compressedTexSubImage3D(s,i,p,q,r,j,k,l,u,t.data):aF.texSubImage3D(s,i,p,q,r,j,k,l,u,v,t):a.isDataTexture?aF.texSubImage2D(aF.TEXTURE_2D,i,p,q,j,k,u,v,t.data):a.isCompressedTexture?aF.compressedTexSubImage2D(aF.TEXTURE_2D,i,p,q,t.width,t.height,u,t.data):aF.texSubImage2D(aF.TEXTURE_2D,i,p,q,j,k,u,v,t);e.pixelStorei(aF.UNPACK_ROW_LENGTH,x),e.pixelStorei(aF.UNPACK_IMAGE_HEIGHT,y),e.pixelStorei(aF.UNPACK_SKIP_PIXELS,z),e.pixelStorei(aF.UNPACK_SKIP_ROWS,A),e.pixelStorei(aF.UNPACK_SKIP_IMAGES,B),0===i&&b.generateMipmaps&&aF.generateMipmap(s),e.unbindTexture()},this.initRenderTarget=function(a){void 0===g.get(a).__webglFramebuffer&&h.setupRenderTarget(a)},this.initTexture=function(a){a.isCubeTexture?h.setTextureCube(a,0):a.isData3DTexture?h.setTexture3D(a,0):a.isDataArrayTexture||a.isCompressedArrayTexture?h.setTexture2DArray(a,0):h.setTexture2D(a,0),e.unbindTexture()},this.resetState=function(){ad=0,ae=0,af=null,e.reset(),x.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return c$}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(a){this._outputColorSpace=a;let b=this.getContext();b.drawingBufferColorSpace=dG._getDrawingBufferColorSpace(a),b.unpackColorSpace=dG._getUnpackColorSpace()}}var nT=c(20999);let nU=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a))},g=b=a(d,e,f);return f},{useSyncExternalStoreWithSelector:nV}=nT,nW=(a,b)=>{let c=a?nU(a):nU,d=(a,d=b)=>(function(a,b=a=>a,c){let d=nV(a.subscribe,a.getState,a.getInitialState,b,c);return B.useDebugValue(d),d})(c,a,d);return Object.assign(d,c),d},nX=[];function nY(a,b,c=(a,b)=>a===b){if(a===b)return!0;if(!a||!b)return!1;let d=a.length;if(b.length!==d)return!1;for(let e=0;e<d;e++)if(!c(a[e],b[e]))return!1;return!0}function nZ(a,b=null,c=!1,d={}){for(let e of(null===b&&(b=[a]),nX))if(nY(b,e.keys,e.equal)){if(c)return;if(Object.prototype.hasOwnProperty.call(e,"error"))throw e.error;if(Object.prototype.hasOwnProperty.call(e,"response"))return d.lifespan&&d.lifespan>0&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(e.remove,d.lifespan)),e.response;if(!c)throw e.promise}let e={keys:b,equal:d.equal,remove:()=>{let a=nX.indexOf(e);-1!==a&&nX.splice(a,1)},promise:("object"==typeof a&&"function"==typeof a.then?a:a(...b)).then(a=>{e.response=a,d.lifespan&&d.lifespan>0&&(e.timeout=setTimeout(e.remove,d.lifespan))}).catch(a=>e.error=a)};if(nX.push(e),!c)throw e.promise}var n$=c(79277);function n_(a,b,c){if(!a)return;if(!0===c(a))return a;let d=b?a.return:a.child;for(;d;){let a=n_(d,b,c);if(a)return a;d=b?null:d.sibling}}function n0(a){try{return Object.defineProperties(a,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(b){return a}}"u">typeof window&&((null==(t=window.document)?void 0:t.createElement)||(null==(u=window.navigator)?void 0:u.product)==="ReactNative")?B.useLayoutEffect:B.useEffect;let n1=n0(B.createContext(null));class n2 extends B.Component{render(){return B.createElement(n1.Provider,{value:this._reactInternals},this.props.children)}}function n3(){let a=B.useContext(n1);if(null===a)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let b=B.useId();return B.useMemo(()=>{for(let c of[a,null==a?void 0:a.alternate]){if(!c)continue;let a=n_(c,!1,a=>{let c=a.memoizedState;for(;c;){if(c.memoizedState===b)return!0;c=c.next}});if(a)return a}},[a,b])}let n4=Symbol.for("react.context"),n5=a=>null!==a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===n4;function n6(a){let b=a.root;for(;b.getState().previousRoot;)b=b.getState().previousRoot;return b}B.act;let n7=a=>null!=a&&("string"==typeof a||"number"==typeof a||a.isColor),n8=B.useEffect;function n9(a){let b=B.useRef(a);return n8(()=>void(b.current=a),[a]),b}let oa=()=>{};function ob({promise:a,onSettled:b}){return B.use(a),n8(b,[b]),null}let oc=B.Activity?function(){if(!B.Activity)throw Error("its-fine: useActivityBridge requires React 19.2 or later!");let a=n3(),[b]=B.useState(()=>{let b,c=[],d=!1;n_(a,!0,a=>{var b,e;if(a.elementType===B.Activity){let d=(null==(b=a.child)?void 0:b.tag)===22?a.child.stateNode:null;if("number"!=typeof(null==d?void 0:d._visibility))throw Error("its-fine: unsupported React Activity internals!");c.push(d)}else 22===a.tag&&(null==(e=a.return)?void 0:e.elementType)!==B.Activity&&(d=!0)});let e="hidden",f=new Set,g={mounted:!1,connected:!1,subscribe:a=>(f.add(a),()=>{f.delete(a)}),sync(a){g.mounted&&!g.connected&&d&&c.length>0?b||(b=function(a){if("function"==typeof requestAnimationFrame){let b=requestAnimationFrame(a);return()=>cancelAnimationFrame(b)}let b=setTimeout(a,16);return()=>clearTimeout(b)}(()=>{b=void 0,g.sync(!0)})):(null==b||b(),b=void 0);let h=e;if(g.mounted?g.connected?h="visible":a&&(h=c.every(a=>(1&a._visibility)!=0)?"visible":"hidden"):h="hidden",e!==h)for(let a of(e=h,f))a()},Bridge:({children:a})=>B.createElement(B.Activity,{mode:B.useSyncExternalStore(g.subscribe,()=>e,()=>"hidden")},a)};return g});return B.useInsertionEffect(()=>(b.mounted=!0,queueMicrotask(()=>b.sync(!1)),()=>{b.mounted=!1,queueMicrotask(()=>b.sync(!1))}),[b]),B.useLayoutEffect(()=>(b.connected=!0,b.sync(!1),()=>{b.connected=!1,b.sync(!0)}),[b]),b.Bridge}:()=>B.Fragment;function od({set:a}){return n8(()=>(a(new Promise(()=>null)),()=>a(!1)),[a]),null}let oe=((r=class extends B.Component{constructor(...a){super(...a),this.state={error:!1}}componentDidCatch(a){this.props.set(a)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),r);function of(a){return Array.isArray(a)?Math.min(Math.max(a[0],1),a[1]):a}function og(a){var b;return null==(b=a.__r3f)?void 0:b.root.getState()}let oh={obj:a=>a===Object(a)&&!oh.arr(a)&&"function"!=typeof a,fun:a=>"function"==typeof a,str:a=>"string"==typeof a,num:a=>"number"==typeof a,boo:a=>"boolean"==typeof a,und:a=>void 0===a,nul:a=>null===a,arr:a=>Array.isArray(a),equ(a,b,{arrays:c="shallow",objects:d="reference",strict:e=!0}={}){let f;if(typeof a!=typeof b||!!a!=!!b)return!1;if(oh.str(a)||oh.num(a)||oh.boo(a))return a===b;let g=oh.obj(a);if(g&&"reference"===d)return a===b;let h=oh.arr(a);if(h&&"reference"===c)return a===b;if((h||g)&&a===b)return!0;for(f in a)if(!(f in b))return!1;if(g&&"shallow"===c&&"shallow"===d){for(f in e?b:a)if(!oh.equ(a[f],b[f],{strict:e,objects:"reference"}))return!1}else for(f in e?b:a)if(a[f]!==b[f])return!1;if(oh.und(f)){if(h&&0===a.length&&0===b.length||g&&0===Object.keys(a).length&&0===Object.keys(b).length)return!0;if(a!==b)return!1}return!0}},oi=["children","key","ref"];function oj(a){let b={};for(let c in a)oi.includes(c)||(b[c]=a[c]);return b}function ok(a,b,c,d){let e=null==a?void 0:a.__r3f;return!e&&(e={root:b,type:c,parent:null,children:[],props:oj(d),object:a,eventCount:0,handlers:{},previousVisible:void 0,isHidden:!1},a&&(a.__r3f=e)),e}function ol(a,b){if(!b.includes("-")||b in a)return{root:a,key:b,target:a[b]};let c=a,d=b.split("-");for(let e of d){if("object"!=typeof c||null===c){if(void 0!==c)return{root:c,key:d.slice(d.indexOf(e)).join("-"),target:void 0};return{root:a,key:b,target:void 0}}b=e,a=c,c=c[b]}return{root:a,key:b,target:c}}let om=/-\d+$/;function on(a,b){if(oh.str(b.props.attach)){if(om.test(b.props.attach)){let c=b.props.attach.replace(om,""),{root:d,key:e}=ol(a.object,c);Array.isArray(d[e])||(d[e]=[])}let{root:c,key:d}=ol(a.object,b.props.attach);b.previousAttach=c[d],c[d]=b.object}else oh.fun(b.props.attach)&&(b.previousAttach=b.props.attach(a.object,b.object))}function oo(a,b){if(oh.str(b.props.attach)){let{root:c,key:d}=ol(a.object,b.props.attach),e=b.previousAttach;void 0===e?delete c[d]:c[d]=e}else null==b.previousAttach||b.previousAttach(a.object,b.object);delete b.previousAttach}let op=[...oi,"args","dispose","attach","object","onUpdate","dispose"],oq=new Map,or=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],os=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function ot(a,b){var c,d;let e=a.__r3f,f=e&&n6(e).getState(),g=null==e?void 0:e.eventCount;for(let c in b){let g=b[c];if(op.includes(c))continue;if(e&&os.test(c)){"function"==typeof g?e.handlers[c]=g:delete e.handlers[c],e.eventCount=Object.keys(e.handlers).length;continue}if(void 0===g)continue;if("visible"===c&&null!=e&&e.isHidden&&void 0!==e.previousVisible){e.previousVisible=g;continue}let{root:h,key:i,target:j}=ol(a,c);if(void 0===j&&("object"!=typeof h||null===h))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${i}".`);if(j instanceof d7&&g instanceof d7)j.mask=g.mask;else if(j instanceof ev&&n7(g))j.set(g);else if(null!==j&&"object"==typeof j&&"function"==typeof j.set&&"function"==typeof j.copy&&null!=g&&g.constructor&&j.constructor===g.constructor)j.copy(g);else if(null!==j&&"object"==typeof j&&"function"==typeof j.set&&Array.isArray(g))"function"==typeof j.fromArray?j.fromArray(g):j.set(...g);else if(null!==j&&"object"==typeof j&&"function"==typeof j.set&&"number"==typeof g)"function"==typeof j.setScalar?j.setScalar(g):j.set(g);else if(h instanceof iJ&&"uniforms"===i&&oh.obj(g)){oh.obj(h.uniforms)||(h.uniforms={});let a=h.uniforms;for(let b in g){let c=g[b],d=a[b];d?Object.assign(d,c):a[b]={...c}}}else h[i]=g,f&&!f.linear&&or.includes(i)&&null!=(d=h[i])&&d.isTexture&&h[i].format===bh&&h[i].type===a2&&(h[i].colorSpace=ck)}if(null!=e&&e.parent&&null!=f&&f.internal&&null!=(c=e.object)&&c.isObject3D&&g!==e.eventCount){let a=e.object,b=f.internal.interaction.indexOf(a);b>-1&&f.internal.interaction.splice(b,1),e.eventCount&&null!==a.raycast&&f.internal.interaction.push(a)}return e&&void 0===e.props.attach&&(e.object.isBufferGeometry?e.props.attach="geometry":e.object.isMaterial&&(e.props.attach="material")),e&&ou(e),a}function ou(a){var b;if(!a.parent)return;null==a.props.onUpdate||a.props.onUpdate(a.object);let c=null==(b=a.root)||null==b.getState?void 0:b.getState();c&&0===c.internal.frames&&c.invalidate()}let ov=a=>null==a?void 0:a.isObject3D;function ow(a){return(a.eventObject||a.object).uuid+"/"+a.index+a.instanceId}function ox(a,b,c,d){let e=c.get(b);e&&(c.delete(b),0===c.size&&(a.delete(d),e.target.releasePointerCapture(d)))}let oy=a=>!!(null!=a&&a.render),oz=B.createContext(null);function oA(){let a=B.useContext(oz);if(!a)throw Error("R3F: Hooks can only be used within the Canvas component!");return a}function oB(a=a=>a,b){return oA()(a,b)}function oC(a,b=0){let c=oA(),d=c.getState().internal.subscribe,e=n9(a);return n8(()=>d(e,b,c),[b,d,c]),null}let oD=new WeakMap;function oE(a,b){return function(c,...d){var e;let f;return"function"==typeof c&&(null==c||null==(e=c.prototype)?void 0:e.constructor)===c?(f=oD.get(c))||(f=new c,oD.set(c,f)):f=c,a&&a(f),Promise.all(d.map(a=>new Promise((c,d)=>f.load(a,a=>{var b;let d;ov(null==a?void 0:a.scene)&&Object.assign(a,(b=a.scene,d={nodes:{},materials:{},meshes:{}},b&&b.traverse(a=>{a.name&&(d.nodes[a.name]=a),a.material&&!d.materials[a.material.name]&&(d.materials[a.material.name]=a.material),a.isMesh&&!d.meshes[a.name]&&(d.meshes[a.name]=a)}),d)),c(a)},b,b=>d(Error(`Could not load ${a}: ${null==b?void 0:b.message}`))))))}}function oF(a,b,c,d){let e=Array.isArray(b)?b:[b],f=nZ(oE(c,d),[a,...e],!1,{equal:oh.equ});return Array.isArray(b)?f:f[0]}oF.preload=function(a,b,c){let d,e=Array.isArray(b)?b:[b];nZ(oE(c),[a,...e],!0,d)},oF.clear=function(a,b){var c=[a,...Array.isArray(b)?b:[b]];if(void 0===c||0===c.length)nX.splice(0,nX.length);else{let a=nX.find(a=>nY(c,a.keys,a.equal));a&&a.remove()}};let oG={objects:"shallow"},oH=a=>"function"==typeof(null==a?void 0:a.then);var oI={exports:{}},oJ={exports:{}};oJ.exports;let oK=(y||(y=1,x||(x=1,oJ.exports=function(a){function b(a,b,c,d){return new es(a,b,c,d)}function c(){}function d(a){var b="https://react.dev/errors/"+a;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function e(a){for(var b=a,c=b;c&&!c.alternate;)(4098&(b=c).flags)!=0&&(a=b.return),c=b.return;for(;b.return;)b=b.return;return 3===b.tag?a:null}function f(a){if(e(a)!==a)throw Error(d(188))}function g(a){var b=a.alternate;if(!b){if(null===(b=e(a)))throw Error(d(188));return b!==a?null:a}for(var c=a,g=b;;){var h=c.return;if(null===h)break;var i=h.alternate;if(null===i){if(null!==(g=h.return)){c=g;continue}break}if(h.child===i.child){for(i=h.child;i;){if(i===c)return f(h),a;if(i===g)return f(h),b;i=i.sibling}throw Error(d(188))}if(c.return!==g.return)c=h,g=i;else{for(var j=!1,k=h.child;k;){if(k===c){j=!0,c=h,g=i;break}if(k===g){j=!0,g=h,c=i;break}k=k.sibling}if(!j){for(k=i.child;k;){if(k===c){j=!0,c=i,g=h;break}if(k===g){j=!0,g=i,c=h;break}k=k.sibling}if(!j)throw Error(d(189))}}if(c.alternate!==g)throw Error(d(190))}if(3!==c.tag)throw Error(d(188));return c.stateNode.current===c?a:b}function h(a){return null===a||"object"!=typeof a?null:"function"==typeof(a=e0&&a[e0]||a["@@iterator"])?a:null}function i(a){if(null==a)return null;if("function"==typeof a)return a.$$typeof===e2?null:a.displayName||a.name||null;if("string"==typeof a)return a;switch(a){case eN:return"Fragment";case eP:return"Profiler";case eO:return"StrictMode";case eT:return"Suspense";case eU:return"SuspenseList";case eX:return"Activity";case e$:return"ViewTransition"}if("object"==typeof a)switch(a.$$typeof){case eM:return"Portal";case eR:return a.displayName||"Context";case eQ:return(a._context.displayName||"Context")+".Consumer";case eS:var b=a.render;return(a=a.displayName)||(a=""!==(a=b.displayName||b.name||"")?"ForwardRef("+a+")":"ForwardRef"),a;case eV:return null!==(b=a.displayName||null)?b:i(a.type)||"Memo";case eW:b=a._payload,a=a._init;try{return i(a(b))}catch{}}return null}function j(a){return{current:a}}function k(a){0>ho||(a.current=hn[ho],hn[ho]=null,ho--)}function l(a,b){hn[++ho]=a.current,a.current=b}function m(a){var b=42&a;if(0!==b)return b;switch(a&-a){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 a&-a;case 262144:case 524288:case 1048576:case 2097152:return 3932160&a;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&a;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return a}}function n(a,b,c){var d=a.pendingLanes;if(0===d)return 0;var e=0,f=a.suspendedLanes,g=a.pingedLanes;a=a.warmLanes;var h=0x7ffffff&d;return 0!==h?0!=(d=h&~f)?e=m(d):0!=(g&=h)?e=m(g):c||0!=(c=h&~a)&&(e=m(c)):0!=(h=d&~f)?e=m(h):0!==g?e=m(g):c||0!=(c=d&~a)&&(e=m(c)),0===e?0:0!==b&&b!==e&&(b&f)==0&&((f=e&-e)>=(c=b&-b)||32===f&&(4194048&c)!=0)?b:e}function o(a,b){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&b)==0}function p(a,b){(8&b)!=0&&(b|=32&b);var c=a.entangledLanes;if(0!==c)for(a=a.entanglements,c&=b;0<c;){var d=31-hq(c),e=1<<d;b|=a[d],c&=~e}return b}function q(){var a=hv;return(0x3c00000&(hv<<=1))==0&&(hv=4194304),a}function r(a){for(var b=[],c=0;31>c;c++)b.push(a);return b}function s(a,b){a.pendingLanes|=b,0x10000000!==b&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function t(a,b,c){a.pendingLanes|=b,a.suspendedLanes&=~b;var d=31-hq(b);a.entangledLanes|=b,a.entanglements[d]=0x40000000|a.entanglements[d]|261930&c}function u(a,b){var c=a.entangledLanes|=b;for(a=a.entanglements;c;){var d=31-hq(c),e=1<<d;e&b|a[d]&b&&(a[d]|=b),c&=~e}}function v(a,b){var c=b&-b;return((c=(42&c)!=0?1:w(c))&(a.suspendedLanes|b))!=0?0:c}function w(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=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:a=128;break;case 0x10000000:a=0x8000000;break;default:a=0}return a}function x(a){return 2<(a&=-a)?8<a?(0x7ffffff&a)!=0?32:0x10000000:8:2}function y(a){if("function"==typeof hF&&hG(a),hI&&"function"==typeof hI.setStrictMode)try{hI.setStrictMode(hH,a)}catch{}}function z(a,b){return null!=a.name&&"auto"!==a.name?a.name:null!==b.autoName?b.autoName:b.autoName="_"+(a=jS.identifierPrefix)+"t_"+(hJ++).toString(32)+"_"}function A(a){if(null==a||"string"==typeof a)return a;var b,c=null,d=j$;if(null!==d)for(var e=0;e<d.length;e++){var f=a[d[e]];if(null!=f){if("none"===f)return"none";c=null==c?f:c+" "+f}}return null!=(b=c)?b:a.default}function B(a,b){return a=A(a),null==(b=A(b))?"auto"===a?null:a:"auto"===b?null:b}function D(a){if(void 0===g_)try{throw Error()}catch(a){var b=a.stack.trim().match(/\n( *(at )?)/);g_=b&&b[1]||"",g0=-1<a.stack.indexOf(`
343
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
344
+ `+g_+a+g0}function E(a,b){if(!a||hN)return"";hN=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(b){var c=function(){throw Error()};if(Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(c,[])}catch(a){var d=a}Reflect.construct(a,[],c)}else{try{c.call()}catch(a){d=a}c=!1;try{var e=Object.getOwnPropertyDescriptor(a.prototype,"props");Object.defineProperty(a.prototype,"props",{configurable:!0,set:function(){throw Error()}}),c=!0,new a}finally{c&&(void 0!==e?Object.defineProperty(a.prototype,"props",e):delete a.prototype.props)}}}else{try{throw Error()}catch(a){d=a}(c=a())&&"function"==typeof c.catch&&c.catch(function(){})}}catch(a){if(a&&d&&"string"==typeof a.stack)return[a.stack,d.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var e=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");e&&e.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=d.DetermineComponentFrameRoot(),g=f[0],h=f[1];if(g&&h){var i=g.split(`
345
+ `),j=h.split(`
346
+ `);for(e=d=0;d<i.length&&!i[d].includes("DetermineComponentFrameRoot");)d++;for(;e<j.length&&!j[e].includes("DetermineComponentFrameRoot");)e++;if(d===i.length||e===j.length)for(d=i.length-1,e=j.length-1;1<=d&&0<=e&&i[d]!==j[e];)e--;for(;1<=d&&0<=e;d--,e--)if(i[d]!==j[e]){if(1!==d||1!==e)do if(d--,e--,0>e||i[d]!==j[e]){var k=`
347
+ `+i[d].replace(" at new "," at ");return a.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",a.displayName)),k}while(1<=d&&0<=e);break}}}finally{hN=!1,Error.prepareStackTrace=c}return(c=a?a.displayName||a.name:"")?D(c):""}function F(a){try{var b="",c=null;do b+=function(a,b){switch(a.tag){case 26:case 27:case 5:return D(a.type);case 16:return D("Lazy");case 13:return a.child!==b&&null!==b?D("Suspense Fallback"):D("Suspense");case 19:return D("SuspenseList");case 0:case 15:return E(a.type,!1);case 11:return E(a.type.render,!1);case 1:return E(a.type,!0);case 31:return D("Activity");case 30:return D("ViewTransition");default:return""}}(a,c),c=a,a=a.return;while(a);return b}catch(a){return`
348
+ Error generating stack: `+a.message+`
349
+ `+a.stack}}function G(a,b){if("object"==typeof a&&null!==a){var c=hO.get(a);return void 0!==c?c:(b={value:a,source:b,stack:F(b)},hO.set(a,b),b)}return{value:a,source:b,stack:F(b)}}function H(a,b){hP[hQ++]=hS,hP[hQ++]=hR,hR=a,hS=b}function I(a,b,c){hT[hU++]=hW,hT[hU++]=hX,hT[hU++]=hV,hV=a;var d=hW;a=hX;var e=32-hq(d)-1;d&=~(1<<e),c+=1;var f=32-hq(b)+e;if(30<f){var g=e-e%5;f=(d&(1<<g)-1).toString(32),d>>=g,e-=g,hW=1<<32-hq(b)+e|c<<e|d,hX=f+a}else hW=1<<f|c<<e|d,hX=a}function J(a){null!==a.return&&(H(a,1),I(a,1,0))}function K(a){for(;a===hR;)hR=hP[--hQ],hP[hQ]=null,hS=hP[--hQ],hP[hQ]=null;for(;a===hV;)hV=hT[--hU],hT[hU]=null,hX=hT[--hU],hT[hU]=null,hW=hT[--hU],hT[hU]=null}function L(a,b){hT[hU++]=hW,hT[hU++]=hX,hT[hU++]=hV,hW=b.id,hX=b.overflow,hV=a}function M(a,b){l(h$,b),l(hZ,a),l(hY,null),a=e9(b),k(hY),l(hY,a)}function N(){k(hY),k(hZ),k(h$)}function O(a){var b=a.memoizedState;null!==b&&(b=b.memoizedState,fl?fF._currentValue=b:fF._currentValue2=b,l(h_,a));var c=fa(b=hY.current,a.type);b!==c&&(l(hZ,a),l(hY,c))}function P(a){hZ.current===a&&(k(hY),k(hZ)),h_.current===a&&(k(h_),fl?fF._currentValue=fE:fF._currentValue2=fE)}function Q(a){var b=Error(d(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML",""));throw W(G(b,a)),h5}function R(a,b){if(!fo)throw Error(d(175));gK(a.stateNode,a.type,a.memoizedProps,b,a)||Q(a,!0)}function S(a){for(h0=a.return;h0;)switch(h0.tag){case 5:case 31:case 13:h4=!1;return;case 27:case 3:h4=!0;return;default:h0=h0.return}}function T(a){if(!fo||a!==h0)return!1;if(!h2)return S(a),h2=!0,!1;var b=a.tag;if(hh?3!==b&&27!==b&&(5!==b||g$(a.type)&&!fg(a.type,a.memoizedProps))&&h1&&Q(a):3!==b&&(5!==b||g$(a.type)&&!fg(a.type,a.memoizedProps))&&h1&&Q(a),S(a),13===b){if(!fo)throw Error(d(316));if(!(a=null!==(a=a.memoizedState)?a.dehydrated:null))throw Error(d(317));h1=gP(a)}else if(31===b){if(!(a=null!==(a=a.memoizedState)?a.dehydrated:null))throw Error(d(317));h1=gO(a)}else h1=hh&&27===b?gA(a.type,h1):h0?gz(a.stateNode):null;return!0}function U(){fo&&(h1=h0=null,h2=!1)}function V(){var a=h3;return null!==a&&(null===jK?jK=a:jK.push.apply(jK,a),h3=null),a}function W(a){null===h3?h3=[a]:h3.push(a)}function X(a,b,c){fl?(l(h6,b._currentValue),b._currentValue=c):(l(h6,b._currentValue2),b._currentValue2=c)}function Y(a){var b=h6.current;fl?a._currentValue=b:a._currentValue2=b,k(h6)}function Z(a,b,c){for(;null!==a;){var d=a.alternate;if((a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b),a===c)break;a=a.return}}function $(a,b,c,e){var f=a.child;for(null!==f&&(f.return=a);null!==f;){var g=f.dependencies;if(null!==g){var h=f.child;g=g.firstContext;f:for(;null!==g;){var i=g;g=f;for(var j=0;j<b.length;j++)if(i.context===b[j]){g.lanes|=c,null!==(i=g.alternate)&&(i.lanes|=c),Z(g.return,c,a),e||(h=null);break f}g=i.next}}else if(18===f.tag){if(null===(h=f.return))throw Error(d(341));h.lanes|=c,null!==(g=h.alternate)&&(g.lanes|=c),Z(h,c,a),h=null}else 13===f.tag&&null!==f.memoizedState&&null===f.memoizedState.dehydrated?(f.lanes|=c,null!==(h=f.alternate)&&(h.lanes|=c),Z(f.return,c,a),h=null!==(h=f.child)?h.sibling:null):h=f.child;if(null!==h)h.return=f;else for(h=f;null!==h;){if(h===a){h=null;break}if(null!==(f=h.sibling)){f.return=h.return,h=f;break}h=h.return}f=h}}function _(a,b,c,e){a=null;for(var f=b,g=!1;null!==f;){if(!g){if((524288&f.flags)!=0)g=!0;else if((262144&f.flags)!=0)break}if(10===f.tag){var h=f.alternate;if(null===h)throw Error(d(387));if(null!==(h=h.memoizedProps)){var i=f.type;hK(f.pendingProps.value,h.value)||(null!==a?a.push(i):a=[i])}}else if(f===h_.current){if(null===(h=f.alternate))throw Error(d(387));h.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(null!==a?a.push(fF):a=[fF])}f=f.return}return null!==a&&$(b,a,c,e),b.flags|=262144,null!==a}function aa(a){for(a=a.firstContext;null!==a;){var b=a.context;if(!hK(fl?b._currentValue:b._currentValue2,a.memoizedValue))return!0;a=a.next}return!1}function ab(a){h7=a,h8=null,null!==(a=a.dependencies)&&(a.firstContext=null)}function ac(a){return ae(h7,a)}function ad(a,b){return null===h7&&ab(a),ae(a,b)}function ae(a,b){var c=fl?b._currentValue:b._currentValue2;if(b={context:b,memoizedValue:c,next:null},null===h8){if(null===a)throw Error(d(308));h8=b,a.dependencies={lanes:0,firstContext:b},a.flags|=524288}else h8=h8.next=b;return c}function af(){return{controller:new h9,data:new Map,refCount:0}}function ag(a){a.refCount--,0===a.refCount&&ia(ib,function(){a.controller.abort()})}function ah(a,b){if((4194048&a.pendingLanes)!=0){var c=a.transitionTypes;for(null===c&&(c=a.transitionTypes=[]),a=0;a<b.length;a++){var d=b[a];-1===c.indexOf(d)&&c.push(d)}}}function ai(){}function aj(a){a!==ig&&null===a.next&&(null===ig?ie=ig=a:ig=ig.next=a),ii=!0,ih||(ih=!0,fH?fI(function(){(6&jt)!=0?hw(hB,al):am()}):hw(hB,al))}function ak(a,b){if(!ij&&ii){ij=!0;do for(var c=!1,d=ie;null!==d;){if(!b)if(0!==a){var e=d.pendingLanes;if(0===e)var f=0;else{var g=d.suspendedLanes,h=d.pingedLanes;f=0xc000095&(f=(1<<31-hq(42|a)+1)-1&(e&~(g&~h)))?0xc000095&f|1:f?2|f:0}0!==f&&(c=!0,ap(d,f))}else f=jw,(3&(f=n(d,d===ju?f:0,null!==d.cancelPendingCommit||d.timeoutHandle!==fk)))==0||o(d,f)||(c=!0,ap(d,f));d=d.next}while(c);ij=!1}}function al(){am()}function am(){ii=ih=!1;var a=0;0!==ik&&fu()&&(a=ik);for(var b=hA(),c=null,d=ie;null!==d;){var e=d.next,f=an(d,b);0===f?(d.next=null,null===c?ie=e:c.next=e,null===e&&(ig=c)):(c=d,(0!==a||(3&f)!=0)&&(ii=!0)),d=e}0!==jR&&5!==jR||ak(a,!1),0!==ik&&(ik=0)}function an(a,b){for(var c=a.suspendedLanes,d=a.pingedLanes,e=a.expirationTimes,f=-0x3c00001&a.pendingLanes;0<f;){var g=31-hq(f),h=1<<g,i=e[g];-1===i?((h&c)==0||(h&d)!=0)&&(e[g]=function(a,b){switch(a){case 1:case 2:case 4:case 8:case 64:return b+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 b+5e3;default:return -1}}(h,b)):i<=b&&(a.expiredLanes|=h),f&=~h}if(b=ju,c=jw,c=n(a,a===b?c:0,null!==a.cancelPendingCommit||a.timeoutHandle!==fk),d=a.callbackNode,0===c||a===b&&(2===jx||9===jx)||null!==a.cancelPendingCommit)return null!==d&&null!==d&&hx(d),a.callbackNode=null,a.callbackPriority=0;if((3&c)==0||o(a,c)){if((b=c&-c)===a.callbackPriority)return b;switch(null!==d&&hx(d),x(c)){case 2:case 8:c=hC;break;case 32:default:c=hD;break;case 0x10000000:c=hE}return c=hw(c,d=ao.bind(null,a)),a.callbackPriority=b,a.callbackNode=c,b}return null!==d&&null!==d&&hx(d),a.callbackPriority=2,a.callbackNode=null,2}function ao(a,b){if(0!==jR&&5!==jR)return a.callbackNode=null,a.callbackPriority=0,null;var c=a.callbackNode;if(ej()&&a.callbackNode!==c)return null;var d=jw;return 0===(d=n(a,a===ju?d:0,null!==a.cancelPendingCommit||a.timeoutHandle!==fk))?null:(dX(a,d,b),an(a,hA()),null!=a.callbackNode&&a.callbackNode===c?ao.bind(null,a):null)}function ap(a,b){if(ej())return null;dX(a,b,!0)}function aq(){if(0===ik){var a=io;0===a&&(a=ht,(261888&(ht<<=1))==0&&(ht=256)),ik=a}return ik}function ar(){if(0==--im&&(id=null,null!==il)){null!==ip&&(ip.status="fulfilled");var a=il;il=null,io=0,ip=null;for(var b=0;b<a.length;b++)(0,a[b])()}}function as(){var a=ir.current;return null!==a?a:ju.pooledCache}function at(a,b){null===b?l(ir,ir.current):l(ir,b.pool)}function au(){var a=as();return null===a?null:{parent:fl?ic._currentValue:ic._currentValue2,pool:a}}function av(a,b){if(hK(a,b))return!0;if("object"!=typeof a||null===a||"object"!=typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var e=c[d];if(!hM.call(b,e)||!hK(a[e],b[e]))return!1}return!0}function aw(a){return"fulfilled"===(a=a.status)||"rejected"===a}function ax(a,b,c){switch(void 0===(c=a[c])?a.push(b):c!==b&&(b.then(ai,ai),b=c),b.status){case"fulfilled":return b.value;case"rejected":throw aA(a=b.reason),void 0!==a||"reason"in b?a:Error(d(600));default:if("string"==typeof b.status)b.then(ai,ai);else{if(null!==(a=ju)&&100<a.shellSuspendCounter)throw Error(d(482));(a=b).status="pending",a.then(function(a){if("pending"===b.status){var c=b;c.status="fulfilled",c.value=a}},function(a){if("pending"===b.status){var c=b;c.status="rejected",c.reason=a}})}switch(b.status){case"fulfilled":return b.value;case"rejected":throw aA(a=b.reason),a}throw iw=b,is}}function ay(a){try{return(0,a._init)(a._payload)}catch(a){throw null!==a&&"object"==typeof a&&"function"==typeof a.then?(iw=a,is):a}}function az(){if(null===iw)throw Error(d(459));var a=iw;return iw=null,a}function aA(a){if(a===is||a===iu)throw Error(d(483))}function aB(a){var b=iy;return iy+=1,null===ix&&(ix=[]),ax(ix,a,b)}function aC(a,b){a.ref=void 0!==(b=b.props.ref)?b:null}function aD(a,b){throw b.$$typeof===eK?Error(d(525)):Error(d(31,"[object Object]"===(a=Object.prototype.toString.call(b))?"object with keys {"+Object.keys(b).join(", ")+"}":a))}function aE(a){function c(b,c){if(a){var d=b.deletions;null===d?(b.deletions=[c],b.flags|=16):d.push(c)}}function e(b,d){if(!a)return null;for(;null!==d;)c(b,d),d=d.sibling;return null}function f(a){for(var b=new Map;null!==a;)null===a.key?b.set(a.index,a):b.set(a.key,a),a=a.sibling;return b}function g(a,b){return(a=eu(a,b)).index=0,a.sibling=null,a}function i(b,c,d){return b.index=d,a?null!==(d=b.alternate)?(d=d.index)<c?(b.flags|=2,c):d:(b.flags|=0x8000002,c):(b.flags|=1048576,c)}function j(b){return a&&null===b.alternate&&(b.flags|=0x8000002),b}function k(a,b,c,d){return null===b||6!==b.tag?(b=ey(c,a.mode,d)).return=a:(b=g(b,c)).return=a,b}function l(a,b,c,d){var e=c.type;return e===eN?(aC(a=n(a,b,c.props.children,d,c.key),c),a):(null!==b&&(b.elementType===e||"object"==typeof e&&null!==e&&e.$$typeof===eW&&ay(e)===b.type)?aC(b=g(b,c.props),c):aC(b=ew(c.type,c.key,c.props,null,a.mode,d),c),b.return=a,b)}function m(a,b,c,d){return null===b||4!==b.tag||b.stateNode.containerInfo!==c.containerInfo||b.stateNode.implementation!==c.implementation?(b=eA(c,a.mode,d)).return=a:(b=g(b,c.children||[])).return=a,b}function n(a,b,c,d,e){return null===b||7!==b.tag?(b=ex(c,a.mode,d,e)).return=a:(b=g(b,c)).return=a,b}function o(a,b,c){if("string"==typeof b&&""!==b||"number"==typeof b||"bigint"==typeof b)return(b=ey(""+b,a.mode,c)).return=a,b;if("object"==typeof b&&null!==b){switch(b.$$typeof){case eL:return aC(c=ew(b.type,b.key,b.props,null,a.mode,c),b),c.return=a,c;case eM:return(b=eA(b,a.mode,c)).return=a,b;case eW:return o(a,b=ay(b),c)}if(e3(b)||h(b))return(b=ex(b,a.mode,c,null)).return=a,b;if("function"==typeof b.then)return o(a,aB(b),c);if(b.$$typeof===eR)return o(a,ad(a,b),c);aD(a,b)}return null}function p(a,b,c,d){var e=null!==b?b.key:null;if("string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c)return null!==e?null:k(a,b,""+c,d);if("object"==typeof c&&null!==c){switch(c.$$typeof){case eL:return c.key===e?l(a,b,c,d):null;case eM:return c.key===e?m(a,b,c,d):null;case eW:return p(a,b,c=ay(c),d)}if(e3(c)||h(c))return null!==e?null:n(a,b,c,d,null);if("function"==typeof c.then)return p(a,b,aB(c),d);if(c.$$typeof===eR)return p(a,b,ad(a,c),d);aD(a,c)}return null}function q(a,b,c,d,e){if("string"==typeof d&&""!==d||"number"==typeof d||"bigint"==typeof d)return k(b,a=a.get(c)||null,""+d,e);if("object"==typeof d&&null!==d){switch(d.$$typeof){case eL:return l(b,a=a.get(null===d.key?c:d.key)||null,d,e);case eM:return m(b,a=a.get(null===d.key?c:d.key)||null,d,e);case eW:return q(a,b,c,d=ay(d),e)}if(e3(d)||h(d))return n(b,a=a.get(c)||null,d,e,null);if("function"==typeof d.then)return q(a,b,c,aB(d),e);if(d.$$typeof===eR)return q(a,b,c,ad(b,d),e);aD(b,d)}return null}return function(k,l,m,n){try{iy=0;var r=function b(k,l,m,n){if("object"==typeof m&&null!==m&&m.type===eN&&null===m.key&&void 0===m.props.ref&&(m=m.props.children),"object"==typeof m&&null!==m){switch(m.$$typeof){case eL:f:{for(var r=m.key;null!==l;){if(l.key===r){if((r=m.type)===eN){if(7===l.tag){e(k,l.sibling),aC(n=g(l,m.props.children),m),n.return=k,k=n;break f}}else if(l.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===eW&&ay(r)===l.type){e(k,l.sibling),aC(n=g(l,m.props),m),n.return=k,k=n;break f}e(k,l);break}c(k,l),l=l.sibling}m.type===eN?aC(n=ex(m.props.children,k.mode,n,m.key),m):aC(n=ew(m.type,m.key,m.props,null,k.mode,n),m),n.return=k,k=n}return j(k);case eM:f:{for(r=m.key;null!==l;){if(l.key===r)if(4===l.tag&&l.stateNode.containerInfo===m.containerInfo&&l.stateNode.implementation===m.implementation){e(k,l.sibling),(n=g(l,m.children||[])).return=k,k=n;break f}else{e(k,l);break}c(k,l),l=l.sibling}(n=eA(m,k.mode,n)).return=k,k=n}return j(k);case eW:return b(k,l,m=ay(m),n)}if(e3(m))return function(b,d,g,h){for(var j=null,k=null,l=d,m=d=0,n=null;null!==l&&m<g.length;m++){l.index>m?(n=l,l=null):n=l.sibling;var r=p(b,l,g[m],h);if(null===r){null===l&&(l=n);break}a&&l&&null===r.alternate&&c(b,l),d=i(r,d,m),null===k?j=r:k.sibling=r,k=r,l=n}if(m===g.length)return e(b,l),h2&&H(b,m),j;if(null===l){for(;m<g.length;m++)null!==(l=o(b,g[m],h))&&(d=i(l,d,m),null===k?j=l:k.sibling=l,k=l);return h2&&H(b,m),j}for(l=f(l);m<g.length;m++)null!==(n=q(l,b,m,g[m],h))&&(a&&null!==(r=n.alternate)&&l.delete(null===r.key?m:r.key),d=i(n,d,m),null===k?j=n:k.sibling=n,k=n);return a&&l.forEach(function(a){return c(b,a)}),h2&&H(b,m),j}(k,l,m,n);if(h(m)){if("function"!=typeof(r=h(m)))throw Error(d(150));return function(b,g,h,j){if(null==h)throw Error(d(151));for(var k=null,l=null,m=g,n=g=0,r=null,s=h.next();null!==m&&!s.done;n++,s=h.next()){m.index>n?(r=m,m=null):r=m.sibling;var t=p(b,m,s.value,j);if(null===t){null===m&&(m=r);break}a&&m&&null===t.alternate&&c(b,m),g=i(t,g,n),null===l?k=t:l.sibling=t,l=t,m=r}if(s.done)return e(b,m),h2&&H(b,n),k;if(null===m){for(;!s.done;n++,s=h.next())null!==(s=o(b,s.value,j))&&(g=i(s,g,n),null===l?k=s:l.sibling=s,l=s);return h2&&H(b,n),k}for(m=f(m);!s.done;n++,s=h.next())null!==(s=q(m,b,n,s.value,j))&&(a&&null!==(r=s.alternate)&&m.delete(null===r.key?n:r.key),g=i(s,g,n),null===l?k=s:l.sibling=s,l=s);return a&&m.forEach(function(a){return c(b,a)}),h2&&H(b,n),k}(k,l,m=r.call(m),n)}if("function"==typeof m.then)return b(k,l,aB(m),n);if(m.$$typeof===eR)return b(k,l,ad(k,m),n);aD(k,m)}return"string"==typeof m&&""!==m||"number"==typeof m||"bigint"==typeof m?(m=""+m,null!==l&&6===l.tag?(e(k,l.sibling),(n=g(l,m)).return=k):(e(k,l),(n=ey(m,k.mode,n)).return=k),j(k=n)):e(k,l)}(k,l,m,n);return ix=null,r}catch(a){if(a===is||a===iu)throw a;var s=b(29,a,null,k.mode);return s.lanes=n,s.return=k,s}finally{}}}function aF(){for(var a=iC,b=iD=iC=0;b<a;){var c=iB[b];iB[b++]=null;var d=iB[b];iB[b++]=null;var e=iB[b];iB[b++]=null;var f=iB[b];if(iB[b++]=null,null!==d&&null!==e){var g=d.pending;null===g?e.next=e:(e.next=g.next,g.next=e),d.pending=e}0!==f&&aJ(c,e,f)}}function aG(a,b,c,d){iB[iC++]=a,iB[iC++]=b,iB[iC++]=c,iB[iC++]=d,iD|=d,a.lanes|=d,null!==(a=a.alternate)&&(a.lanes|=d)}function aH(a,b,c,d){return aG(a,b,c,d),aK(a)}function aI(a,b){return aG(a,null,null,b),aK(a)}function aJ(a,b,c){a.lanes|=c;var d=a.alternate;null!==d&&(d.lanes|=c);for(var e=!1,f=a.return;null!==f;)f.childLanes|=c,null!==(d=f.alternate)&&(d.childLanes|=c),22===f.tag&&(null===(a=f.stateNode)||1&a._visibility||(e=!0)),a=f,f=f.return;return 3===a.tag?(f=a.stateNode,e&&null!==b&&(e=31-hq(c),null===(d=(a=f.hiddenUpdates)[e])?a[e]=[b]:d.push(b),b.lane=0x20000000|c),f):null}function aK(a){if(50<j_)throw j_=0,j0=null,Error(d(185));for(var b=a.return;null!==b;)b=(a=b).return;return 3===a.tag?a.stateNode:null}function aL(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function aM(a,b){a=a.updateQueue,b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function aN(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function aO(a,b,c){var d=a.updateQueue;if(null===d)return null;if(d=d.shared,(2&jt)!=0){var e=d.pending;return null===e?b.next=b:(b.next=e.next,e.next=b),d.pending=b,b=aK(a),aJ(a,null,c),b}return aG(a,d,b,c),aK(a)}function aP(a,b,c){if(null!==(b=b.updateQueue)&&(b=b.shared,(4194048&c)!=0)){var d=b.lanes;d&=a.pendingLanes,c|=d,b.lanes=c,u(a,c)}}function aQ(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&c===(d=d.updateQueue)){var e=null,f=null;if(null!==(c=c.firstBaseUpdate)){do{var g={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};null===f?e=f=g:f=f.next=g,c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,callbacks:d.callbacks},a.updateQueue=c;return}null===(a=c.lastBaseUpdate)?c.firstBaseUpdate=b:a.next=b,c.lastBaseUpdate=b}function aR(){if(iF){var a=ip;if(null!==a)throw a}}function aS(a,b,c,d){iF=!1;var e=a.updateQueue;iE=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var i=h,j=i.next;i.next=null,null===g?f=j:g.next=j,g=i;var k=a.alternate;null!==k&&(h=(k=k.updateQueue).lastBaseUpdate)!==g&&(null===h?k.firstBaseUpdate=j:h.next=j,k.lastBaseUpdate=i)}if(null!==f){var l=e.baseState;for(g=0,k=j=i=null,h=f;;){var m=-0x20000001&h.lane,n=m!==h.lane;if(n?(jw&m)===m:(d&m)===m){0!==m&&m===io&&(iF=!0),null!==k&&(k=k.next={lane:0,tag:h.tag,payload:h.payload,callback:null,next:null});f:{var o=a,p=h;switch(m=b,p.tag){case 1:if("function"==typeof(o=p.payload)){l=o.call(c,l,m);break f}l=o;break f;case 3:o.flags=-65537&o.flags|128;case 0:if(null==(m="function"==typeof(o=p.payload)?o.call(c,l,m):o))break f;l=eJ({},l,m);break f;case 2:iE=!0}}null!==(m=h.callback)&&(a.flags|=64,n&&(a.flags|=8192),null===(n=e.callbacks)?e.callbacks=[m]:n.push(m))}else n={lane:m,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===k?(j=k=n,i=l):k=k.next=n,g|=m;if(null===(h=h.next)){if(null===(h=e.shared.pending))break;h=(n=h).next,n.next=null,e.lastBaseUpdate=n,e.shared.pending=null}}null===k&&(i=l),e.baseState=i,e.firstBaseUpdate=j,e.lastBaseUpdate=k,null===f&&(e.shared.lanes=0),jE|=g,a.lanes=g,a.memoizedState=l}}function aT(a,b){if("function"!=typeof a)throw Error(d(191,a));a.call(b)}function aU(a,b){var c=a.callbacks;if(null!==c)for(a.callbacks=null,a=0;a<c.length;a++)aT(c[a],b)}function aV(a,b){l(iH,a=jC),l(iG,b),jC=a|b.baseLanes}function aW(){l(iH,jC),l(iG,iG.current)}function aX(){jC=iH.current,k(iG),k(iH)}function aY(a){var b=a.alternate;l(iK,1&iK.current),l(iI,a),null===iJ&&(null===b||null!==iG.current||null!==b.memoizedState)&&(iJ=a)}function aZ(a){l(iK,iK.current),l(iI,a),null===iJ&&(iJ=a)}function a$(a){22===a.tag?(l(iK,iK.current),l(iI,a),null===iJ&&(iJ=a)):a_()}function a_(){l(iK,iK.current),l(iI,iI.current)}function a0(a){k(iI),iJ===a&&(iJ=null),k(iK)}function a1(a,b){l(iI,iI.current),l(iK,b)}function a2(a){k(iK),k(iI),iJ===a&&(iJ=null)}function a3(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(null===(c=c.dehydrated)||gt(c)||gu(c)))return b}else if(19===b.tag&&"independent"!==b.memoizedProps.revealOrder){if((128&b.flags)!=0)return b}else if(null!==b.child){b.child.return=b,b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return,b=b.sibling}return null}function a4(){throw Error(d(321))}function a5(a,b){if(null===b)return!1;for(var c=0;c<b.length&&c<a.length;c++)if(!hK(a[c],b[c]))return!1;return!0}function a6(a,b,c,d,e,f){return iL=f,iM=b,b.memoizedState=null,b.updateQueue=null,b.lanes=0,e4.H=null===a||null===a.memoizedState?iX:iY,iR=!1,f=c(d,e),iR=!1,iQ&&(f=a8(b,c,d,e)),a7(a),f}function a7(a){e4.H=iW;var b=null!==iN&&null!==iN.next;if(iL=0,iO=iN=iM=null,iP=!1,iT=0,iU=null,b)throw Error(d(300));null===a||i0||null!==(a=a.dependencies)&&aa(a)&&(i0=!0)}function a8(a,b,c,e){iM=a;var f=0;do{if(iQ&&(iU=null),iT=0,iQ=!1,25<=f)throw Error(d(301));if(f+=1,iO=iN=null,null!=a.updateQueue){var g=a.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,null!=g.memoCache&&(g.memoCache.index=0)}e4.H=iZ,g=b(c,e)}while(iQ);return g}function a9(){var a=e4.H,b=a.useState()[0];return b="function"==typeof b.then?bg(b):b,a=a.useState()[0],(null!==iN?iN.memoizedState:null)!==a&&(iM.flags|=1024),b}function ba(){var a=0!==iS;return iS=0,a}function bb(a,b,c){b.updateQueue=a.updateQueue,b.flags&=-2053,a.lanes&=~c}function bc(a){if(iP){for(a=a.memoizedState;null!==a;){var b=a.queue;null!==b&&(b.pending=null),a=a.next}iP=!1}iL=0,iO=iN=iM=null,iQ=!1,iT=iS=0,iU=null}function bd(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===iO?iM.memoizedState=iO=a:iO=iO.next=a,iO}function be(){if(null===iN){var a=iM.alternate;a=null!==a?a.memoizedState:null}else a=iN.next;var b=null===iO?iM.memoizedState:iO.next;if(null!==b)iO=b,iN=a;else{if(null===a)throw null===iM.alternate?Error(d(467)):Error(d(310));a={memoizedState:(iN=a).memoizedState,baseState:iN.baseState,baseQueue:iN.baseQueue,queue:iN.queue,next:null},null===iO?iM.memoizedState=iO=a:iO=iO.next=a}return iO}function bf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bg(a){var b=iT;return iT+=1,null===iU&&(iU=[]),a=ax(iU,a,b),b=iM,(null===iO?b.memoizedState:iO.next)===null&&(e4.H=null===(b=b.alternate)||null===b.memoizedState?iX:iY),a}function bh(a){if(null!==a&&"object"==typeof a){if("function"==typeof a.then)return bg(a);if(a.$$typeof===e_)return;if(a.$$typeof===eR)return ac(a)}throw Error(d(438,String(a)))}function bi(a){var b=null,c=iM.updateQueue;if(null!==c&&(b=c.memoCache),null==b){var d=iM.alternate;null!==d&&null!==(d=d.updateQueue)&&null!=(d=d.memoCache)&&(b={data:d.data.map(function(a){return a.slice()}),index:0})}if(null==b&&(b={data:[],index:0}),null===c&&(c=bf(),iM.updateQueue=c),c.memoCache=b,void 0===(c=b.data[b.index]))for(c=b.data[b.index]=Array(a),d=0;d<a;d++)c[d]=eZ;return b.index++,c}function bj(a,b){return"function"==typeof b?b(a):b}function bk(a){return bl(be(),iN,a)}function bl(a,b,c){var e=a.queue;if(null===e)throw Error(d(311));e.lastRenderedReducer=c;var f=a.baseQueue,g=e.pending;if(null!==g){if(null!==f){var h=f.next;f.next=g.next,g.next=h}b.baseQueue=f=g,e.pending=null}if(g=a.baseState,null===f)a.memoizedState=g;else{b=f.next;var i=h=null,j=null,k=b,l=!1;do{var m=-0x20000001&k.lane;if(m!==k.lane?(jw&m)===m:(iL&m)===m){var n=k.revertLane;if(0===n)null!==j&&(j=j.next={lane:0,revertLane:0,gesture:null,action:k.action,hasEagerState:k.hasEagerState,eagerState:k.eagerState,next:null}),m===io&&(l=!0);else if((iL&n)===n){k=k.next,n===io&&(l=!0);continue}else m={lane:0,revertLane:k.revertLane,gesture:null,action:k.action,hasEagerState:k.hasEagerState,eagerState:k.eagerState,next:null},null===j?(i=j=m,h=g):j=j.next=m,iM.lanes|=n,jE|=n;m=k.action,iR&&c(g,m),g=k.hasEagerState?k.eagerState:c(g,m)}else n={lane:m,revertLane:k.revertLane,gesture:k.gesture,action:k.action,hasEagerState:k.hasEagerState,eagerState:k.eagerState,next:null},null===j?(i=j=n,h=g):j=j.next=n,iM.lanes|=m,jE|=m;k=k.next}while(null!==k&&k!==b);if(null===j?h=g:j.next=i,!hK(g,a.memoizedState)&&(i0=!0,l&&null!==(c=ip)))throw c;a.memoizedState=g,a.baseState=h,a.baseQueue=j,e.lastRenderedState=g}return null===f&&(e.lanes=0),[a.memoizedState,e.dispatch]}function bm(a){var b=be(),c=b.queue;if(null===c)throw Error(d(311));c.lastRenderedReducer=a;var e=c.dispatch,f=c.pending,g=b.memoizedState;if(null!==f){c.pending=null;var h=f=f.next;do g=a(g,h.action),h=h.next;while(h!==f);hK(g,b.memoizedState)||(i0=!0),b.memoizedState=g,null===b.baseQueue&&(b.baseState=g),c.lastRenderedState=g}return[g,e]}function bn(a,b,c){var e=iM,f=be(),g=h2;if(g){if(void 0===c)throw Error(d(407));c=c()}else c=b();var h=!hK((iN||f).memoizedState,c);if(h&&(f.memoizedState=c,i0=!0),f=f.queue,bM(bq.bind(null,e,f,a),[a]),bH((a=f.getSnapshot!==b||h||null!==iO&&(1&iO.memoizedState.tag)!=0)?9:8,{destroy:void 0},bp.bind(null,e,f,c,b),null),a){if(e.flags|=2048,null===ju)throw Error(d(349));g||(127&iL)!=0||bo(e,b,c)}return c}function bo(a,b,c){a.flags|=16384,a={getSnapshot:b,value:c},null===(b=iM.updateQueue)?(b=bf(),iM.updateQueue=b,b.stores=[a]):null===(c=b.stores)?b.stores=[a]:c.push(a)}function bp(a,b,c,d){b.value=c,b.getSnapshot=d,br(b)&&bs(a)}function bq(a,b,c){return c(function(){br(b)&&bs(a)})}function br(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!hK(a,c)}catch{return!0}}function bs(a){var b=aI(a,2);null!==b&&dW(b,a,2)}function bt(a){var b=bd();if("function"==typeof a){var c=a;if(a=c(),iR){y(!0);try{c()}finally{y(!1)}}}return b.memoizedState=b.baseState=a,b.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bj,lastRenderedState:a},b}function bu(a,b,c,d){return a.baseState=c,bl(a,iN,"function"==typeof d?d:bj)}function bv(a,b,c,e,f){if(b5(a))throw Error(d(485));if(null!==(a=b.action)){var g={payload:f,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(a){g.listeners.push(a)}};null!==e4.T?c(!0):g.isTransition=!1,e(g),null===(c=b.pending)?(g.next=b.pending=g,bw(b,g)):(g.next=c.next,b.pending=c.next=g)}}function bw(a,b){var c=b.action,d=b.payload,e=a.state;if(b.isTransition){var f=e4.T,g={};g.types=null!==f?f.types:null,e4.T=g;try{var h=c(e,d),i=e4.S;null!==i&&i(g,h),bx(a,b,h)}catch(c){bz(a,b,c)}finally{null!==f&&null!==g.types&&(f.types=g.types),e4.T=f}}else try{f=c(e,d),bx(a,b,f)}catch(c){bz(a,b,c)}}function bx(a,b,c){null!==c&&"object"==typeof c&&"function"==typeof c.then?c.then(function(c){by(a,b,c)},function(c){return bz(a,b,c)}):by(a,b,c)}function by(a,b,c){b.status="fulfilled",b.value=c,bA(b),a.state=c,null!==(b=a.pending)&&((c=b.next)===b?a.pending=null:(c=c.next,b.next=c,bw(a,c)))}function bz(a,b,c){var d=a.pending;if(a.pending=null,null!==d){d=d.next;do b.status="rejected",b.reason=c,bA(b),b=b.next;while(b!==d)}a.action=null}function bA(a){a=a.listeners;for(var b=0;b<a.length;b++)(0,a[b])()}function bB(a,b){return b}function bC(a,b){if(h2){var c=ju.formState;if(null!==c){f:{var d=iM;if(h2){if(h1){var e=gx(h1,h4);if(e){h1=gz(e),d=gy(e);break f}}Q(d)}d=!1}d&&(b=c[0])}}(c=bd()).memoizedState=c.baseState=b,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bB,lastRenderedState:b},c.queue=d,c=b2.bind(null,iM,d),d.dispatch=c,d=bt(!1);var f=b4.bind(null,iM,!1,d.queue);return d=bd(),e={state:b,dispatch:null,action:a,pending:null},d.queue=e,c=bv.bind(null,iM,e,f,c),e.dispatch=c,d.memoizedState=a,[b,c,!1]}function bD(a){return bE(be(),iN,a)}function bE(a,b,c){if(b=bl(a,b,bB)[0],a=bk(bj)[0],"object"==typeof b&&null!==b&&"function"==typeof b.then)try{var d=bg(b)}catch(a){throw a===is?iu:a}else d=b;var e=(b=be()).queue,f=e.dispatch;return c!==b.memoizedState&&(iM.flags|=2048,bH(9,{destroy:void 0},bF.bind(null,e,c),null)),[d,f,a]}function bF(a,b){a.action=b}function bG(a){var b=be(),c=iN;if(null!==c)return bE(b,c,a);be(),b=b.memoizedState;var d=(c=be()).queue.dispatch;return c.memoizedState=a,[b,d,!1]}function bH(a,b,c,d){return a={tag:a,create:c,deps:d,inst:b,next:null},null===(b=iM.updateQueue)&&(b=bf(),iM.updateQueue=b),null===(c=b.lastEffect)?b.lastEffect=a.next=a:(d=c.next,c.next=a,a.next=d,b.lastEffect=a),a}function bI(){return be().memoizedState}function bJ(a,b,c,d){var e=bd();iM.flags|=a,e.memoizedState=bH(1|b,{destroy:void 0},c,void 0===d?null:d)}function bK(a,b,c,d){var e=be();d=void 0===d?null:d;var f=e.memoizedState.inst;null!==iN&&null!==d&&a5(d,iN.memoizedState.deps)?e.memoizedState=bH(b,f,c,d):(iM.flags|=a,e.memoizedState=bH(1|b,f,c,d))}function bL(a,b){bJ(8390656,8,a,b)}function bM(a,b){bK(2048,8,a,b)}function bN(a){var b=be().memoizedState;return function(a){iM.flags|=4;var b=iM.updateQueue;if(null===b)b=bf(),iM.updateQueue=b,b.events=[a];else{var c=b.events;null===c?b.events=[a]:c.push(a)}}({ref:b,nextImpl:a}),function(){if((2&jt)!=0)throw Error(d(440));return b.impl.apply(void 0,arguments)}}function bO(a,b){return bK(4,2,a,b)}function bP(a,b){return bK(4,4,a,b)}function bQ(a,b){if("function"==typeof b){var c=b(a=a());return function(){"function"==typeof c?c():b(null)}}if(null!=b)return b.current=a=a(),function(){b.current=null}}function bR(a,b,c){c=null!=c?c.concat([a]):null,bK(4,4,bQ.bind(null,b,a),c)}function bS(){}function bT(a,b){var c=be();b=void 0===b?null:b;var d=c.memoizedState;return null!==b&&a5(b,d[1])?d[0]:(c.memoizedState=[a,b],a)}function bU(a,b){var c=be();b=void 0===b?null:b;var d=c.memoizedState;if(null!==b&&a5(b,d[1]))return d[0];if(d=a(),iR){y(!0);try{a()}finally{y(!1)}}return c.memoizedState=[d,b],d}function bV(a,b,c){return void 0===c||(0x40000000&iL)!=0&&(261930&jw)==0?a.memoizedState=b:(a.memoizedState=c,a=dU(),iM.lanes|=a,jE|=a,c)}function bW(a,b,c,d){return hK(c,b)?c:null!==iG.current?(hK(a=bV(a,c,d),b)||(i0=!0),a):(106&iL)==0||(0x40000000&iL)!=0&&(261930&jw)==0?(i0=!0,a.memoizedState=c):(a=dU(),iM.lanes|=a,jE|=a,b)}function bX(a,b,c,d,e){var f=fs();fr(0!==f&&8>f?f:8);var g=e4.T,h={};h.types=null!==g?g.types:null,e4.T=h,b4(a,!1,b,c);try{var i=e(),j=e4.S;if(null!==j&&j(h,i),null!==i&&"object"==typeof i&&"function"==typeof i.then){var k,l,m=(k=[],l={status:"pending",value:null,reason:null,then:function(a){k.push(a)}},i.then(function(){l.status="fulfilled",l.value=d;for(var a=0;a<k.length;a++)(0,k[a])(d)},function(a){for(l.status="rejected",l.reason=a,a=0;a<k.length;a++)(0,k[a])(void 0)}),l);b3(a,b,m,dT(a))}else b3(a,b,d,dT(a))}catch(c){b3(a,b,{then:function(){},status:"rejected",reason:c},dT())}finally{fr(f),null!==g&&null!==h.types&&(g.types=h.types),e4.T=g}}function bY(a){var b=a.memoizedState;if(null!==b)return b;var c={};return(b={memoizedState:fE,baseState:fE,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bj,lastRenderedState:fE},next:null}).next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bj,lastRenderedState:c},next:null},a.memoizedState=b,null!==(a=a.alternate)&&(a.memoizedState=b),b}function bZ(){return ac(fF)}function b$(){return be().memoizedState}function b_(){return be().memoizedState}function b0(a){for(var b=a.return;null!==b;){switch(b.tag){case 24:case 3:var c=dT(),d=aO(b,a=aN(c),c);null!==d&&(dW(d,b,c),aP(d,b,c)),b={cache:af()},a.payload=b;return}b=b.return}}function b1(a,b,c){var d=dT();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},b5(a)?b6(b,c):null!==(c=aH(a,b,c,d))&&(dW(c,a,d),b7(c,b,d))}function b2(a,b,c){b3(a,b,c,dT())}function b3(a,b,c,d){var e={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(b5(a))b6(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&null!==(f=b.lastRenderedReducer))try{var g=b.lastRenderedState,h=f(g,c);if(e.hasEagerState=!0,e.eagerState=h,hK(h,g))return aG(a,b,e,0),null===ju&&aF(),!1}catch{}finally{}if(null!==(c=aH(a,b,e,d)))return dW(c,a,d),b7(c,b,d),!0}return!1}function b4(a,b,c,e){if(e={lane:2,revertLane:aq(),gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},b5(a)){if(b)throw Error(d(479))}else null!==(b=aH(a,c,e,2))&&dW(b,a,2)}function b5(a){var b=a.alternate;return a===iM||null!==b&&b===iM}function b6(a,b){iQ=iP=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b),a.pending=b}function b7(a,b,c){if((4194048&c)!=0){var d=b.lanes;d&=a.pendingLanes,b.lanes=c|=d,u(a,c)}}function b8(a,b,c,d){c=null==(c=c(d,b=a.memoizedState))?b:eJ({},b,c),a.memoizedState=c,0===a.lanes&&(a.updateQueue.baseState=c)}function b9(a,b,c,d,e,f,g){return"function"==typeof(a=a.stateNode).shouldComponentUpdate?a.shouldComponentUpdate(d,f,g):!b.prototype||!b.prototype.isPureReactComponent||!av(c,d)||!av(e,f)}function ca(a,b,c,d){a=b.state,"function"==typeof b.componentWillReceiveProps&&b.componentWillReceiveProps(c,d),"function"==typeof b.UNSAFE_componentWillReceiveProps&&b.UNSAFE_componentWillReceiveProps(c,d),b.state!==a&&i$.enqueueReplaceState(b,b.state,null)}function cb(a,b){var c=b;if("ref"in b)for(var d in c={},b)"ref"!==d&&(c[d]=b[d]);if(a=a.defaultProps)for(var e in c===b&&(c=eJ({},c)),a)void 0===c[e]&&(c[e]=a[e]);return c}function cc(a,b){try{(0,a.onUncaughtError)(b.value,{componentStack:b.stack})}catch(a){setTimeout(function(){throw a})}}function cd(a,b,c){try{(0,a.onCaughtError)(c.value,{componentStack:c.stack,errorBoundary:1===b.tag?b.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function ce(a,b,c){return(c=aN(c)).tag=3,c.payload={element:null},c.callback=function(){cc(a,b)},c}function cf(a){return(a=aN(a)).tag=3,a}function cg(a,b,c,d){var e=c.type.getDerivedStateFromError;if("function"==typeof e){var f=d.value;a.payload=function(){return e(f)},a.callback=function(){cd(b,c,d)}}var g=c.stateNode;null!==g&&"function"==typeof g.componentDidCatch&&(a.callback=function(){cd(b,c,d),"function"!=typeof e&&(null===jQ?jQ=new Set([this]):jQ.add(this));var a=d.stack;this.componentDidCatch(d.value,{componentStack:null!==a?a:""})})}function ch(a,b,c,d){b.child=null===a?iA(b,null,c,d):iz(b,a.child,c,d)}function ci(a,b,c,d,e){c=c.render;var f=b.ref;if("ref"in d){var g={};for(var h in d)"ref"!==h&&(g[h]=d[h])}else g=d;return ab(b),d=a6(a,b,c,g,f,e),h=ba(),null===a||i0?(h2&&h&&J(b),b.flags|=1,ch(a,b,d,e),b.child):(bb(a,b,e),cH(a,b,e))}function cj(a,b,c,d,e){if(null===a){var f=c.type;return"function"!=typeof f||et(f)||void 0!==f.defaultProps||null!==c.compare?((a=ew(c.type,null,d,b,b.mode,e)).ref=b.ref,a.return=b,b.child=a):(b.tag=15,b.type=f,ck(a,b,f,d,e))}if(f=a.child,!cI(a,e)){var g=f.memoizedProps;if((c=null!==(c=c.compare)?c:av)(g,d)&&a.ref===b.ref)return cH(a,b,e)}return b.flags|=1,(a=eu(f,d)).ref=b.ref,a.return=b,b.child=a}function ck(a,b,c,d,e){if(null!==a){var f=a.memoizedProps;if(av(f,d)&&a.ref===b.ref)if(i0=!1,b.pendingProps=d=f,!cI(a,e))return b.lanes=a.lanes,cH(a,b,e);else(131072&a.flags)!=0&&(i0=!0)}return cr(a,b,c,d,e)}function cl(a,b,c,d){var e=d.children,f=null!==a?a.memoizedState:null;if(null===a&&null===b.stateNode&&(b.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===d.mode){if((128&b.flags)!=0){if(f=null!==f?f.baseLanes|c:c,null!==a){for(d=b.child=a.child,e=0;null!==d;)e=e|d.lanes|d.childLanes,d=d.sibling;d=e&~f}else d=0,b.child=null;return cn(a,b,f,c,d)}if((0x20000000&c)==0)return d=b.lanes=0x20000000,cn(a,b,null!==f?f.baseLanes|c:c,c,d);b.memoizedState={baseLanes:0,cachePool:null},null!==a&&at(b,null!==f?f.cachePool:null),null!==f?aV(b,f):aW(),a$(b)}else null!==f?(at(b,f.cachePool),aV(b,f),a_(),b.memoizedState=null):(null!==a&&at(b,null),aW(),a_());return ch(a,b,e,c),b.child}function cm(a,b){return null!==a&&22===a.tag||null!==b.stateNode||(b.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.sibling}function cn(a,b,c,d,e){var f=as();return b.memoizedState={baseLanes:c,cachePool:f=null===f?null:{parent:fl?ic._currentValue:ic._currentValue2,pool:f}},null!==a&&at(b,null),aW(),a$(b),null!==a&&_(a,b,d,!0),b.childLanes=e,null}function co(a,b){return(b=cz({mode:b.mode,children:b.children},a.mode)).ref=a.ref,a.child=b,b.return=a,b}function cp(a,b,c){return iz(b,a.child,null,c),a=co(b,b.pendingProps),a.flags|=2,a0(b),b.memoizedState=null,a}function cq(a,b){var c=b.ref;if(null===c)null!==a&&null!==a.ref&&(b.flags|=4194816);else{if("function"!=typeof c&&"object"!=typeof c)throw Error(d(284));(null===a||a.ref!==c)&&(b.flags|=4194816)}}function cr(a,b,c,d,e){return ab(b),c=a6(a,b,c,d,void 0,e),d=ba(),null===a||i0?(h2&&d&&J(b),b.flags|=1,ch(a,b,c,e),b.child):(bb(a,b,e),cH(a,b,e))}function cs(a,b,c,d,e,f){return ab(b),b.updateQueue=null,c=a8(b,d,c,e),a7(a),d=ba(),null===a||i0?(h2&&d&&J(b),b.flags|=1,ch(a,b,c,f),b.child):(bb(a,b,f),cH(a,b,f))}function ct(a,b,c,d,e){if(ab(b),null===b.stateNode){var f=hp,g=c.contextType;"object"==typeof g&&null!==g&&(f=ac(g)),b.memoizedState=null!==(f=new c(d,f)).state&&void 0!==f.state?f.state:null,f.updater=i$,b.stateNode=f,f._reactInternals=b,(f=b.stateNode).props=d,f.state=b.memoizedState,f.refs={},aL(b),g=c.contextType,f.context="object"==typeof g&&null!==g?ac(g):hp,f.state=b.memoizedState,"function"==typeof(g=c.getDerivedStateFromProps)&&(b8(b,c,g,d),f.state=b.memoizedState),"function"==typeof c.getDerivedStateFromProps||"function"==typeof f.getSnapshotBeforeUpdate||"function"!=typeof f.UNSAFE_componentWillMount&&"function"!=typeof f.componentWillMount||(g=f.state,"function"==typeof f.componentWillMount&&f.componentWillMount(),"function"==typeof f.UNSAFE_componentWillMount&&f.UNSAFE_componentWillMount(),g!==f.state&&i$.enqueueReplaceState(f,f.state,null),aS(b,d,f,e),aR(),f.state=b.memoizedState),"function"==typeof f.componentDidMount&&(b.flags|=4194308),d=!0}else if(null===a){f=b.stateNode;var h=b.memoizedProps,i=cb(c,h);f.props=i;var j=f.context,k=c.contextType;g=hp,"object"==typeof k&&null!==k&&(g=ac(k));var l=c.getDerivedStateFromProps;k="function"==typeof l||"function"==typeof f.getSnapshotBeforeUpdate,h=b.pendingProps!==h,k||"function"!=typeof f.UNSAFE_componentWillReceiveProps&&"function"!=typeof f.componentWillReceiveProps||(h||j!==g)&&ca(b,f,d,g),iE=!1;var m=b.memoizedState;f.state=m,aS(b,d,f,e),aR(),j=b.memoizedState,h||m!==j||iE?("function"==typeof l&&(b8(b,c,l,d),j=b.memoizedState),(i=iE||b9(b,c,i,d,m,j,g))?(k||"function"!=typeof f.UNSAFE_componentWillMount&&"function"!=typeof f.componentWillMount||("function"==typeof f.componentWillMount&&f.componentWillMount(),"function"==typeof f.UNSAFE_componentWillMount&&f.UNSAFE_componentWillMount()),"function"==typeof f.componentDidMount&&(b.flags|=4194308)):("function"==typeof f.componentDidMount&&(b.flags|=4194308),b.memoizedProps=d,b.memoizedState=j),f.props=d,f.state=j,f.context=g,d=i):("function"==typeof f.componentDidMount&&(b.flags|=4194308),d=!1)}else{f=b.stateNode,aM(a,b),k=cb(c,g=b.memoizedProps),f.props=k,l=b.pendingProps,m=f.context,j=c.contextType,i=hp,"object"==typeof j&&null!==j&&(i=ac(j)),(j="function"==typeof(h=c.getDerivedStateFromProps)||"function"==typeof f.getSnapshotBeforeUpdate)||"function"!=typeof f.UNSAFE_componentWillReceiveProps&&"function"!=typeof f.componentWillReceiveProps||(g!==l||m!==i)&&ca(b,f,d,i),iE=!1,m=b.memoizedState,f.state=m,aS(b,d,f,e),aR();var n=b.memoizedState;g!==l||m!==n||iE||null!==a&&null!==a.dependencies&&aa(a.dependencies)?("function"==typeof h&&(b8(b,c,h,d),n=b.memoizedState),(k=iE||b9(b,c,k,d,m,n,i)||null!==a&&null!==a.dependencies&&aa(a.dependencies))?(j||"function"!=typeof f.UNSAFE_componentWillUpdate&&"function"!=typeof f.componentWillUpdate||("function"==typeof f.componentWillUpdate&&f.componentWillUpdate(d,n,i),"function"==typeof f.UNSAFE_componentWillUpdate&&f.UNSAFE_componentWillUpdate(d,n,i)),"function"==typeof f.componentDidUpdate&&(b.flags|=4),"function"==typeof f.getSnapshotBeforeUpdate&&(b.flags|=1024)):("function"!=typeof f.componentDidUpdate||g===a.memoizedProps&&m===a.memoizedState||(b.flags|=4),"function"!=typeof f.getSnapshotBeforeUpdate||g===a.memoizedProps&&m===a.memoizedState||(b.flags|=1024),b.memoizedProps=d,b.memoizedState=n),f.props=d,f.state=n,f.context=i,d=k):("function"!=typeof f.componentDidUpdate||g===a.memoizedProps&&m===a.memoizedState||(b.flags|=4),"function"!=typeof f.getSnapshotBeforeUpdate||g===a.memoizedProps&&m===a.memoizedState||(b.flags|=1024),d=!1)}return f=d,cq(a,b),d=(128&b.flags)!=0,f||d?(f=b.stateNode,c=d&&"function"!=typeof c.getDerivedStateFromError?null:f.render(),b.flags|=1,null!==a&&d?(b.child=iz(b,a.child,null,e),b.child=iz(b,null,c,e)):ch(a,b,c,e),b.memoizedState=f.state,a=b.child):a=cH(a,b,e),a}function cu(a,b,c,d){return U(),b.flags|=256,ch(a,b,c,d),b.child}function cv(a){return{baseLanes:a,cachePool:au()}}function cw(a,b,c){return a=null!==a?a.childLanes&~c:0,b&&(a|=jH),a}function cx(a,b,c){var e,f=b.pendingProps,g=!1,h=(128&b.flags)!=0;if((e=h)||(e=(null===a||null!==a.memoizedState)&&(2&iK.current)!=0),e&&(g=!0,b.flags&=-129),e=(32&b.flags)!=0,b.flags&=-33,null===a){if(h2){if(g?aY(b):a_(),(a=h1)?null!==(a=gJ(a,h4))&&(b.memoizedState={dehydrated:a,treeContext:null!==hV?{id:hW,overflow:hX}:null,retryLane:0x20000000,hydrationErrors:null},(c=ez(a)).return=b,b.child=c,h0=b,h1=null):a=null,null===a)throw Q(b);return gu(a)?b.lanes=32:b.lanes=0x20000000,null}return h=f.children,f=f.fallback,g?(a_(),h=cz({mode:"hidden",children:h},g=b.mode),f=ex(f,g,c,null),h.return=b,f.return=b,h.sibling=f,b.child=h,(f=b.child).memoizedState=cv(c),f.childLanes=cw(a,e,c),b.memoizedState=i1,cm(null,f)):(aY(b),cy(b,h))}var i=a.memoizedState;if(null!==i){var j=i.dehydrated;if(null!==j){var k=a,l=b,m=h,n=e,o=f,p=j,q=i,r=c;if(m)return 256&l.flags?(aY(l),l.flags&=-257,cA(k,l,r)):null!==l.memoizedState?(a_(),l.child=k.child,l.flags|=128,null):(a_(),p=o.fallback,q=l.mode,o=cz({mode:"visible",children:o.children},q),p=ex(p,q,r,null),p.flags|=2,o.return=l,p.return=l,o.sibling=p,l.child=o,iz(l,k.child,null,r),(o=l.child).memoizedState=cv(r),o.childLanes=cw(k,n,r),l.memoizedState=i1,cm(null,o));if(aY(l),gu(p))return""!==(n=gv(p).digest)&&((o=Error(d(419))).stack="",o.digest=n,W({value:o,source:null,stack:null})),cA(k,l,r);if(i0||_(k,l,r,!1),n=(r&k.childLanes)!=0,i0||n){if(null!==iG.current)return cA(k,l,r);if(null!==(n=ju)&&0!==(o=v(n,r))&&o!==q.retryLane)throw q.retryLane=o,aI(k,o),dW(n,k,o),i_;return gt(p)||d5(),cA(k,l,r)}return gt(p)?(l.flags|=192,l.child=k.child,null):(k=q.treeContext,fo&&(h1=gE(p),h0=l,h2=!0,h3=null,h4=!1,null!==k&&L(l,k)),l=cy(l,o.children),l.flags|=0x8001000,l)}}return g?(a_(),g=f.fallback,h=b.mode,j=(i=a.child).sibling,(f=eu(i,{mode:"hidden",children:f.children})).subtreeFlags=0x47f00000&i.subtreeFlags,null!==j?g=eu(j,g):(g=ex(g,h,c,null),g.flags|=2),g.return=b,f.return=b,f.sibling=g,b.child=f,cm(null,f),f=b.child,null===(g=a.child.memoizedState)?g=cv(c):(null!==(h=g.cachePool)?(i=fl?ic._currentValue:ic._currentValue2,h=h.parent!==i?{parent:i,pool:i}:h):h=au(),g={baseLanes:g.baseLanes|c,cachePool:h}),f.memoizedState=g,f.childLanes=cw(a,e,c),b.memoizedState=i1,cm(a.child,f)):(aY(b),a=(c=a.child).sibling,(c=eu(c,{mode:"visible",children:f.children})).return=b,c.sibling=null,null!==a&&(null===(e=b.deletions)?(b.deletions=[a],b.flags|=16):e.push(a)),b.child=c,b.memoizedState=null,c)}function cy(a,b){return(b=cz({mode:"visible",children:b},a.mode)).return=a,a.child=b}function cz(a,c){return(a=b(22,a,null,c)).lanes=0,a}function cA(a,b,c){return iz(b,a.child,null,c),a=cy(b,b.pendingProps.children),a.flags|=2,b.memoizedState=null,a}function cB(a,b,c){a.lanes|=b;var d=a.alternate;null!==d&&(d.lanes|=b),Z(a.return,b,c)}function cC(a){for(var b=null;null!==a;){var c=a.alternate;null!==c&&null===a3(c)&&(b=a),a=a.sibling}return b}function cD(a,b,c,d,e,f){var g=a.memoizedState;null===g?a.memoizedState={isBackwards:b,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:e,treeForkCount:f}:(g.isBackwards=b,g.rendering=null,g.renderingStartTime=0,g.last=d,g.tail=c,g.tailMode=e,g.treeForkCount=f)}function cE(a){var b=a.child;for(a.child=null;null!==b;){var c=b.sibling;b.sibling=a.child,a.child=b,b=c}}function cF(a,b,c){var d=b.pendingProps,e=d.revealOrder,f=d.tail;d=d.children;var g=iK.current;if(128&b.flags)return a1(b,g),null;var h=(2&g)!=0;if(h?(g=1&g|2,b.flags|=128):g&=1,a1(b,g),"backwards"===e&&null!==a?(cE(a),ch(a,b,d,c),cE(a)):ch(a,b,d,c),d=h2?hS:0,!h&&null!==a&&(128&a.flags)!=0)f:for(a=b.child;null!==a;){if(13===a.tag)null!==a.memoizedState&&cB(a,c,b);else if(19===a.tag)cB(a,c,b);else if(null!==a.child){a.child.return=a,a=a.child;continue}if(a===b)break;for(;null===a.sibling;){if(null===a.return||a.return===b)break f;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(e){case"backwards":null===(c=cC(b.child))?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null,cE(b)),cD(b,!0,e,null,f,d);break;case"unstable_legacy-backwards":for(c=null,e=b.child,b.child=null;null!==e;){if(null!==(a=e.alternate)&&null===a3(a)){b.child=e;break}a=e.sibling,e.sibling=c,c=e,e=a}cD(b,!0,c,null,f,d);break;case"together":cD(b,!1,null,null,void 0,d);break;case"independent":b.memoizedState=null;break;default:null===(c=cC(b.child))?(e=b.child,b.child=null):(e=c.sibling,c.sibling=null),cD(b,!1,e,c,f,d)}return b.child}function cG(a,b,c){var d=b.pendingProps;return X(b,b.type,d.value),ch(a,b,d.children,c),b.child}function cH(a,b,c){if(null!==a&&(b.dependencies=a.dependencies),jE|=b.lanes,(c&b.childLanes)==0){if(null===a)return null;else if(_(a,b,c,!1),(c&b.childLanes)==0)return null}if(null!==a&&b.child!==a.child)throw Error(d(153));if(null!==b.child){for(c=eu(a=b.child,a.pendingProps),b.child=c,c.return=b;null!==a.sibling;)a=a.sibling,(c=c.sibling=eu(a,a.pendingProps)).return=b;c.sibling=null}return b.child}function cI(a,b){return(a.lanes&b)!=0||!!(null!==(a=a.dependencies)&&aa(a))}function cJ(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps)i0=!0;else{if(!cI(a,c)&&(128&b.flags)==0)return i0=!1,function(a,b,c){switch(b.tag){case 3:M(b,b.stateNode.containerInfo),X(b,ic,a.memoizedState.cache),U();break;case 27:case 5:O(b);break;case 4:M(b,b.stateNode.containerInfo);break;case 10:X(b,b.type,b.memoizedProps.value);break;case 31:if(null!==b.memoizedState)return b.flags|=128,aZ(b),null;break;case 13:var d=b.memoizedState;if(null!==d){if(null!==d.dehydrated)return aY(b),b.flags|=128,null;d=_(a,b,c,!1);var e=b.child.childLanes;return d||(c&e)!=0?cx(a,b,c):(aY(b),null!==(a=cH(a,b,c))?a.sibling:null)}aY(b);break;case 19:if(128&b.flags)return cF(a,b,c);if(e=(128&a.flags)!=0,(d=(c&b.childLanes)!=0)||(_(a,b,c,!1),d=(c&b.childLanes)!=0),e){if(d)return cF(a,b,c);b.flags|=128}if(null!==(e=b.memoizedState)&&(e.rendering=null,e.tail=null,e.lastEffect=null),a1(b,iK.current),d)break;return null;case 22:return b.lanes=0,cl(a,b,c,b.pendingProps);case 24:X(b,ic,a.memoizedState.cache)}return cH(a,b,c)}(a,b,c);i0=(131072&a.flags)!=0}else i0=!1,h2&&(1048576&b.flags)!=0&&I(b,hS,b.index);switch(b.lanes=0,b.tag){case 16:f:{var e=b.pendingProps;if(a=ay(b.elementType),b.type=a,"function"==typeof a)et(a)?(e=cb(a,e),b.tag=1,b=ct(null,b,a,e,c)):(b.tag=0,b=cr(null,b,a,e,c));else{if(null!=a){var f=a.$$typeof;if(f===eS){b.tag=11,b=ci(null,b,a,e,c);break f}if(f===eV){b.tag=14,b=cj(null,b,a,e,c);break f}if(f===eR){b.tag=10,b.type=a,b=cG(null,b,c);break f}}throw Error(d(306,b=i(a)||a,""))}}return b;case 0:return cr(a,b,b.type,b.pendingProps,c);case 1:return f=cb(e=b.type,b.pendingProps),ct(a,b,e,f,c);case 3:f:{if(M(b,b.stateNode.containerInfo),null===a)throw Error(d(387));var g=b.pendingProps;e=(f=b.memoizedState).element,aM(a,b),aS(b,g,null,c);var h=b.memoizedState;if(X(b,ic,g=h.cache),g!==f.cache&&$(b,[ic],c,!0),aR(),g=h.element,fo&&f.isDehydrated)if(f={element:g,isDehydrated:!1,cache:h.cache},b.updateQueue.baseState=f,b.memoizedState=f,256&b.flags){b=cu(a,b,g,c);break f}else if(g!==e){W(e=G(Error(d(424)),b)),b=cu(a,b,g,c);break f}else for(fo&&(h1=gC(b.stateNode.containerInfo),h0=b,h2=!0,h3=null,h4=!0),c=iA(b,null,g,c),b.child=c;c;)c.flags=-3&c.flags|0x8001000,c=c.sibling;else{if(U(),g===e){b=cH(a,b,c);break f}ch(a,b,g,c)}b=b.child}return b;case 26:if(g3)return cq(a,b),null===a?(c=g6(b.type,null,b.pendingProps,null))?b.memoizedState=c:h2||(b.stateNode=hc(b.type,b.pendingProps,h$.current,b)):b.memoizedState=g6(b.type,a.memoizedProps,b.pendingProps,a.memoizedState),null;case 27:if(hh)return O(b),null===a&&hh&&h2&&(e=b.stateNode=hi(b.type,b.pendingProps,h$.current,hY.current,!1),h0=b,h4=!0,h1=gF(b.type,e,h1)),ch(a,b,b.pendingProps.children,c),cq(a,b),null===a&&(b.flags|=4194304),b.child;case 5:return null===a&&h2&&(g1(b.type,b.pendingProps,hY.current),(f=e=h1)&&(null!==(e=gG(e,b.type,b.pendingProps,h4))?(b.stateNode=e,h0=b,h1=gB(e),h4=!1,f=!0):f=!1),f||Q(b)),O(b),f=b.type,g=b.pendingProps,h=null!==a?a.memoizedProps:null,e=g.children,fg(f,g)?e=null:null!==h&&fg(f,h)&&(b.flags|=32),null!==b.memoizedState&&(f=a6(a,b,a9,null,null,c),fl?fF._currentValue=f:fF._currentValue2=f),cq(a,b),ch(a,b,e,c),b.child;case 6:return null===a&&h2&&(g2(b.pendingProps,hY.current),(a=c=h1)&&(null!==(c=gH(c,b.pendingProps,h4))?(b.stateNode=c,h0=b,h1=null,a=!0):a=!1),a||Q(b)),null;case 13:return cx(a,b,c);case 4:return M(b,b.stateNode.containerInfo),e=b.pendingProps,null===a?b.child=iz(b,null,e,c):ch(a,b,e,c),b.child;case 11:return ci(a,b,b.type,b.pendingProps,c);case 7:return e=b.pendingProps,cq(a,b),ch(a,b,e,c),b.child;case 8:case 12:return ch(a,b,b.pendingProps.children,c),b.child;case 10:return cG(a,b,c);case 9:return f=b.type._context,e=b.pendingProps.children,ab(b),e=e(f=ac(f)),b.flags|=1,ch(a,b,e,c),b.child;case 14:return cj(a,b,b.type,b.pendingProps,c);case 15:return ck(a,b,b.type,b.pendingProps,c);case 19:return cF(a,b,c);case 31:var j=a,k=b,l=c,m=k.pendingProps,n=(128&k.flags)!=0;if(k.flags&=-129,null===j){if(h2){if("hidden"===m.mode)return j=co(k,m),k.lanes=0x20000000,j.memoizedState={baseLanes:0,cachePool:null},cm(null,j);if(aZ(k),(j=h1)?null!==(j=gI(j,h4))&&(k.memoizedState={dehydrated:j,treeContext:null!==hV?{id:hW,overflow:hX}:null,retryLane:0x20000000,hydrationErrors:null},(l=ez(j)).return=k,k.child=l,h0=k,h1=null):j=null,null===j)throw Q(k);return k.lanes=0x20000000,null}return co(k,m)}var o=j.memoizedState;if(null!==o){var p=o.dehydrated;if(aZ(k),n)if(256&k.flags)k.flags&=-257,k=cp(j,k,l);else if(null!==k.memoizedState)k.child=j.child,k.flags|=128,k=null;else throw Error(d(558));else if(i0||_(j,k,l,!1),n=(l&j.childLanes)!=0,i0||n){if(null===iG.current){if(null!==(m=ju)&&0!==(p=v(m,l))&&p!==o.retryLane)throw o.retryLane=p,aI(j,p),dW(m,j,p),i_;d5()}k=cp(j,k,l)}else j=o.treeContext,fo&&(h1=gD(p),h0=k,h2=!0,h3=null,h4=!1,null!==j&&L(k,j)),k=co(k,m),k.flags|=0x8001000;return k}return(j=eu(j.child,{mode:m.mode,children:m.children})).ref=k.ref,k.child=j,j.return=k,j;case 22:return cl(a,b,c,b.pendingProps);case 24:return ab(b),e=ac(ic),null===a?(null===(f=as())&&(f=ju,g=af(),f.pooledCache=g,g.refCount++,null!==g&&(f.pooledCacheLanes|=c),f=g),b.memoizedState={parent:e,cache:f},aL(b),X(b,ic,f)):((a.lanes&c)!=0&&(aM(a,b),aS(b,null,null,c),aR()),f=a.memoizedState,g=b.memoizedState,f.parent!==e?(f={parent:e,cache:e},b.memoizedState=f,0===b.lanes&&(b.memoizedState=b.updateQueue.baseState=f),X(b,ic,e)):(X(b,ic,e=g.cache),e!==f.cache&&$(b,[ic],c,!0))),ch(a,b,b.pendingProps.children,c),b.child;case 30:return null===b.stateNode&&(b.stateNode={autoName:null,paired:null,clones:null,ref:null}),null!=(e=b.pendingProps).name&&"auto"!==e.name?b.flags|=null===a?0x1202000:0x1200000:h2&&J(b),null!==a&&a.memoizedProps.name!==e.name?b.flags|=4194816:cq(a,b),ch(a,b,e.children,c),b.child;case 29:throw b.pendingProps}throw Error(d(156,b.tag))}function cK(a){a.flags|=4}function cL(a){fn&&(a.flags|=8)}function cM(a,b){if(null!==a&&a.child===b.child)return!1;if((16&b.flags)!=0)return!0;for(a=b.child;null!==a;){if((8218&a.flags)!=0||(8218&a.subtreeFlags)!=0)return!0;a=a.sibling}return!1}function cN(a,b,c,d){if(fm)for(c=b.child;null!==c;){if(5===c.tag||6===c.tag)fe(a,c.stateNode);else if(!(4===c.tag||hh&&27===c.tag)&&null!==c.child){c.child.return=c,c=c.child;continue}if(c===b)break;for(;null===c.sibling;){if(null===c.return||c.return===b)return;c=c.return}c.sibling.return=c.return,c=c.sibling}else if(fn)for(var e=b.child;null!==e;){if(5===e.tag){var f=e.stateNode;c&&d&&(f=gr(f,e.type,e.memoizedProps)),fe(a,f)}else if(6===e.tag)f=e.stateNode,c&&d&&(f=gs(f,e.memoizedProps)),fe(a,f);else if(4!==e.tag){if(22===e.tag&&null!==e.memoizedState)null!==(f=e.child)&&(f.return=e),cN(a,e,!0,!0);else if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===b)break;for(;null===e.sibling;){if(null===e.return||e.return===b)return;e=e.return}e.sibling.return=e.return,e=e.sibling}}function cO(a,b){if(fn&&cM(a,b)){var c=(a=b.stateNode).containerInfo,d=gn();(function a(b,c,d,e){var f=!1;if(fn)for(var g=c.child;null!==g;){if(5===g.tag){var h=g.stateNode;d&&e&&(h=gr(h,g.type,g.memoizedProps)),go(b,h)}else if(6===g.tag)h=g.stateNode,d&&e&&(h=gs(h,g.memoizedProps)),go(b,h);else if(4!==g.tag){if(22===g.tag&&null!==g.memoizedState)null!==(f=g.child)&&(f.return=g),a(b,g,!0,!0),f=!0;else if(null!==g.child){g.child.return=g,g=g.child;continue}}if(g===c)break;for(;null===g.sibling;){if(null===g.return||g.return===c)return f;g=g.return}g.sibling.return=g.return,g=g.sibling}return f})(d,b,!1,!1),a.pendingChildren=d,cK(b),gp(c,d)}}function cP(a,b,c,d){if(fm)a.memoizedProps!==d&&cK(b);else if(fn){var e=a.stateNode,f=a.memoizedProps;if((a=cM(a,b))||f!==d){var g=hY.current;(f=gm(e,c,f,d,!a,null))===e?b.stateNode=e:(cL(b),ff(f,c,d,g)&&cK(b),b.stateNode=f,a&&cN(f,b,!1,!1))}else b.stateNode=e}}function cQ(a,b,c,d,e){if((32&a.mode)!=0&&(null===c?fw(b,d):fx(b,c,d))){if(a.flags|=0x1000000,(0x13ffff40&e)===e||fy(b,d))if(fz(a.stateNode,b,d))a.flags|=8192;else if(d2())a.flags|=8192;else throw iw=iv,it}else a.flags&=-0x1000001}function cR(a,b){if(he(b)){if(a.flags|=0x1000000,!hf(b))if(d2())a.flags|=8192;else throw iw=iv,it}else a.flags&=-0x1000001}function cS(a,b){null!==b&&(a.flags|=4),16384&a.flags&&(b=22!==a.tag?q():0x20000000,a.lanes|=b,jI|=b)}function cT(a,b){if(!h2)switch(a.tailMode){case"visible":break;case"collapsed":for(var c=a.tail,d=null;null!==c;)null!==c.alternate&&(d=c),c=c.sibling;null===d?b||null===a.tail?a.tail=null:a.tail.sibling=null:d.sibling=null;break;default:for(b=a.tail,c=null;null!==b;)null!==b.alternate&&(c=b),b=b.sibling;null===c?a.tail=null:c.sibling=null}}function cU(a){var b=null!==a.alternate&&a.alternate.child===a.child,c=0,d=0;if(b)for(var e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=0x47f00000&e.subtreeFlags,d|=0x47f00000&e.flags,e.return=a,e=e.sibling;else for(e=a.child;null!==e;)c|=e.lanes|e.childLanes,d|=e.subtreeFlags,d|=e.flags,e.return=a,e=e.sibling;return a.subtreeFlags|=d,a.childLanes=c,b}function cV(a,b){switch(K(b),b.tag){case 3:Y(ic),N();break;case 26:case 27:case 5:P(b);break;case 4:N();break;case 31:null!==b.memoizedState&&a0(b);break;case 13:a0(b);break;case 19:a2(b);break;case 10:Y(b.type);break;case 22:case 23:a0(b),aX(),null!==a&&k(ir);break;case 24:Y(ic)}}function cW(a,b){try{var c=b.updateQueue,d=null!==c?c.lastEffect:null;if(null!==d){var e=d.next;c=e;do{if((c.tag&a)===a){d=void 0;var f=c.create;c.inst.destroy=d=f()}c=c.next}while(c!==e)}}catch(a){em(b,b.return,a)}}function cX(a,b,c){try{var d=b.updateQueue,e=null!==d?d.lastEffect:null;if(null!==e){var f=e.next;d=f;do{if((d.tag&a)===a){var g=d.inst,h=g.destroy;if(void 0!==h){g.destroy=void 0,e=b;try{h()}catch(a){em(e,c,a)}}}d=d.next}while(d!==f)}}catch(a){em(b,b.return,a)}}function cY(a){var b=a.updateQueue;if(null!==b){var c=a.stateNode;try{aU(b,c)}catch(b){em(a,a.return,b)}}}function cZ(a,b,c){c.props=cb(a.type,a.memoizedProps),c.state=a.memoizedState;try{c.componentWillUnmount()}catch(c){em(a,b,c)}}function c$(a,b){try{var c=a.ref;if(null!==c){switch(a.tag){case 26:case 27:case 5:var d=e8(a.stateNode);break;case 30:var e=a.stateNode,f=z(a.memoizedProps,e);(null===e.ref||e.ref.name!==f)&&(e.ref=gg(f)),d=e.ref;break;case 7:null===a.stateNode&&(a.stateNode=gi(a)),d=a.stateNode;break;default:d=a.stateNode}"function"==typeof c?a.refCleanup=c(d):c.current=d}}catch(c){em(a,b,c)}}function c_(a,b){var c=a.ref,d=a.refCleanup;if(null!==c)if("function"==typeof d)try{d()}catch(c){em(a,b,c)}finally{a.refCleanup=null,null!=(a=a.alternate)&&(a.refCleanup=null)}else if("function"==typeof c)try{c(null)}catch(c){em(a,b,c)}else c.current=null}function c0(){var a=i2;return i2=!1,a}function c1(a,b){if((5===a.tag||27===a.tag||6===a.tag)&&null===a.alternate&&null!==b)for(var c=0;c<b.length;c++)gk(a.stateNode,b[c])}function c2(a){for(var b=a.return;null!==b&&(c5(b)&&gk(a.stateNode,b.stateNode),!c4(b));)b=b.return}function c3(a){for(var b=a.return;null!==b&&(c5(b)&&gl(a.stateNode,b.stateNode),!c4(b));)b=b.return}function c4(a){return 5===a.tag||3===a.tag||!!hh&&27===a.tag}function c5(a){return a&&7===a.tag&&null!==a.stateNode}function c6(a){var b=a.type,c=a.memoizedProps,d=a.stateNode;try{fU(d,b,c,a)}catch(b){em(a,a.return,b)}}function c7(a,b,c){try{fV(a.stateNode,a.type,c,b,a)}catch(b){em(a,a.return,b)}}function c8(a){return 5===a.tag||3===a.tag||!!g3&&26===a.tag||!!hh&&27===a.tag&&hm(a.type)||4===a.tag}function c9(a){f:for(;;){for(;null===a.sibling;){if(null===a.return||c8(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(hh&&27===a.tag&&hm(a.type)||2&a.flags||null===a.child||4===a.tag)continue f;a.child.return=a,a=a.child}if(!(2&a.flags))return a.stateNode}}function da(a,b,c,d){var e=a.tag;if(5===e||6===e)e=a.stateNode,b?fW(c,e,b):fR(c,e),c1(a,d),i2=!0;else if(4!==e&&(hh&&27===e&&(c1(a,d),d=null,hm(a.type)&&(c=a.stateNode)),null!==(a=a.child)))for(da(a,b,c,d),a=a.sibling;null!==a;)da(a,b,c,d),a=a.sibling}function db(a,b,c){a=a.containerInfo;try{gq(a,c)}catch(a){em(b,b.return,a)}}function dc(a){var b=a.stateNode,c=a.memoizedProps;try{hj(a.type,c,b,a)}catch(b){em(a,a.return,b)}}function dd(a){(30===a.tag||(0x2000000&a.subtreeFlags)!=0)&&(i3=!0)}function de(){var a=i5;return i5=null,a}function df(a,b,c,d,e){return i6=0,function a(b,c,d,e,f){if(!fm)return!1;for(var g=!1;null!==b;){if(5===b.tag){var h=b.stateNode;if(null!==e){var i=f8(h);e.push(i),ga(i)&&(g=!0)}else g||ga(f8(h))&&(g=!0);i3=!0,f3(h,0===i6?c:c+"_"+i6,d),i6++}else(22!==b.tag||null===b.memoizedState)&&(30===b.tag&&f||a(b.child,c,d,e,f)&&(g=!0));b=b.sibling}return g}(a.child,b,c,d,e)}function dg(a,b){if(fm)for(;null!==a;)5===a.tag?f4(a.stateNode,a.memoizedProps):(22!==a.tag||null===a.memoizedState)&&(30===a.tag&&b||dg(a.child,b)),a=a.sibling}function dh(a){if((0x1200000&a.subtreeFlags)!=0)for(a=a.child;null!==a;){if((22!==a.tag||null===a.memoizedState)&&(dh(a),30===a.tag&&(0x1200000&a.flags)!=0&&a.stateNode.paired)){var b=a.memoizedProps;if(null==b.name||"auto"===b.name)throw Error(d(544));var c=b.name;"none"!==(b=B(b.default,b.share))&&(df(a,c,b,null,!1)||dg(a.child,!1))}a=a.sibling}}function di(a,b){if(30===a.tag){var c=a.stateNode,d=a.memoizedProps,e=z(d,c),f=B(d.default,c.paired?d.share:d.enter);"none"!==f?df(a,e,f,null,!1)?(dh(a),c.paired||b||dV(a,d.onEnter)):dg(a.child,!1):dh(a)}else if((0x2000000&a.subtreeFlags)!=0)for(a=a.child;null!==a;)di(a,b),a=a.sibling;else dh(a)}function dj(a){if(null!==i4&&0!==i4.size){var b=i4;if((0x1200000&a.subtreeFlags)!=0)for(a=a.child;null!==a;){if(22!==a.tag||null===a.memoizedState){if(30===a.tag&&(0x1200000&a.flags)!=0){var c=a.memoizedProps,d=c.name;if(null!=d&&"auto"!==d){var e=b.get(d);if(void 0!==e){var f=B(c.default,c.share);if("none"!==f&&(df(a,d,f,null,!1)?(e.paired=f=a.stateNode,f.paired=e,dV(a,c.onShare)):dg(a.child,!1)),b.delete(d),0===b.size)break}}}dj(a)}a=a.sibling}}}function dk(a){if(30===a.tag){var b=a.memoizedProps,c=z(b,a.stateNode),d=null!==i4?i4.get(c):void 0,e=B(b.default,void 0!==d?b.share:b.exit);"none"!==e&&(df(a,c,e,null,!1)?void 0!==d?(d.paired=e=a.stateNode,e.paired=d,i4.delete(c),dV(a,b.onShare)):dV(a,b.onExit):dg(a.child,!1)),null!==i4&&dj(a)}else if((0x2000000&a.subtreeFlags)!=0)for(a=a.child;null!==a;)dk(a),a=a.sibling;else null!==i4&&dj(a)}function dl(a){if((0x1200000&a.subtreeFlags)!=0)for(a=a.child;null!==a;){if(22!==a.tag||null===a.memoizedState){if(30===a.tag&&(0x1200000&a.flags)!=0){var b=a.stateNode;null!==b.paired&&(b.paired=null,dg(a.child,!1))}dl(a)}a=a.sibling}}function dm(a){if(30===a.tag)a.stateNode.paired=null,dg(a.child,!1),dl(a);else if((0x2000000&a.subtreeFlags)!=0)for(a=a.child;null!==a;)dm(a),a=a.sibling;else dl(a)}function dn(a,b,c,d,e,f,g){if(!fm)return!1;for(var h=!1;null!==b;){if(5===b.tag){var i=b.stateNode;if(null!==f&&i6<f.length){var j=f[i6],k=f8(i);(ga(j)||ga(k))&&(h=!0),(4&a.flags)==0&&gb(j,k)&&(a.flags|=4),gc(j,k)&&(a.flags|=32)}else a.flags|=32;(4&a.flags)!=0&&f3(i,0===i6?c:c+"_"+i6,e),h&&(4&a.flags)!=0||(null===i5&&(i5=[]),i5.push(i,0===i6?d:d+"_"+i6,b.memoizedProps)),i6++}else(22!==b.tag||null===b.memoizedState)&&(30===b.tag&&g?a.flags|=32&b.flags:dn(a,b.child,c,d,e,f,g)&&(h=!0));b=b.sibling}return h}function dp(a){for(;null!==jc;){var b=jc,c=a,e=b.alternate,f=b.flags;switch(b.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if((1024&f)!=0&&null!==e){c=void 0,f=e.memoizedProps,e=e.memoizedState;var g=b.stateNode;try{var h=cb(b.type,f);c=g.getSnapshotBeforeUpdate(h,e),g.__reactInternalSnapshotBeforeUpdate=c}catch(a){em(b,b.return,a)}}break;case 3:(1024&f)!=0&&fm&&gh(b.stateNode.containerInfo);break;case 30:c&&null!==e&&(c=z(e.memoizedProps,e.stateNode),"none"!==(f=B((f=b.memoizedProps).default,f.update))&&df(e,c,f,e.memoizedState=[],!0));break;default:if((1024&f)!=0)throw Error(d(163))}if(null!==(e=b.sibling)){e.return=b.return,jc=e;break}jc=b.return}}function dq(a,b,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:dC(a,c),4&d&&cW(5,c);break;case 1:if(dC(a,c),4&d)if(a=c.stateNode,null===b)try{a.componentDidMount()}catch(a){em(c,c.return,a)}else{var e=cb(c.type,b.memoizedProps);b=b.memoizedState;try{a.componentDidUpdate(e,b,a.__reactInternalSnapshotBeforeUpdate)}catch(a){em(c,c.return,a)}}64&d&&cY(c),512&d&&c$(c,c.return);break;case 3:if(dC(a,c),64&d&&null!==(d=c.updateQueue)){if(a=null,null!==c.child)switch(c.child.tag){case 27:case 5:a=e8(c.child.stateNode);break;case 1:a=c.child.stateNode}try{aU(d,a)}catch(a){em(c,c.return,a)}}break;case 27:hh&&null===b&&4&d&&dc(c);case 26:case 5:if(dC(a,c),null===b){if(4&d)c6(c);else if(64&d){a=c.type,b=c.memoizedProps,e=c.stateNode;try{gQ(e,a,b,c)}catch(a){em(c,c.return,a)}}}512&d&&c$(c,c.return);break;case 12:dC(a,c);break;case 31:dC(a,c),4&d&&du(a,c);break;case 13:dC(a,c),4&d&&dv(a,c),64&d&&null!==(d=c.memoizedState)&&null!==(d=d.dehydrated)&&gw(d,c=eq.bind(null,c));break;case 22:if(!(d=null!==c.memoizedState||i7)){var f=null!==b&&null!==b.memoizedState||i8;b=i7,e=i8,i7=d,(i8=f)&&!e?(d=2*!!hh,(8772&c.subtreeFlags)!=0&&(d|=1),function a(b,c,d){for(d=(8772&c.subtreeFlags)!=0?d:-2&d,c=c.child;null!==c;){var e=c.alternate,f=b,g=c,h=g.flags,i=(1&d)!=0;switch(g.tag){case 0:case 11:case 15:a(f,g,d),cW(4,g);break;case 1:if(a(f,g,d),"function"==typeof(f=(e=g).stateNode).componentDidMount)try{f.componentDidMount()}catch(a){em(e,e.return,a)}if(null!==(f=(e=g).updateQueue)){var j=e.stateNode;try{var k=f.shared.hiddenCallbacks;if(null!==k)for(f.shared.hiddenCallbacks=null,f=0;f<k.length;f++)aT(k[f],j)}catch(a){em(e,e.return,a)}}i&&64&h&&cY(g),c$(g,g.return);break;case 27:hh&&(2&d)!=0&&dc(g);case 5:5!==g.tag&&27!==g.tag||c2(g),a(f,g,d),i&&null===e&&4&h&&c6(g),c$(g,g.return);break;case 6:c2(g);break;case 26:g3&&(j=g.stateNode,null!==g.memoizedState||null===j||i7||ha(g5(j.ownerDocument),g.type,j)),a(f,g,d),i&&null===e&&4&h&&c6(g),c$(g,g.return);break;case 12:a(f,g,d);break;case 31:a(f,g,d),i&&4&h&&du(f,g);break;case 13:a(f,g,d),i&&4&h&&dv(f,g);break;case 22:null===g.memoizedState&&a(f,g,d),c$(g,g.return);break;case 30:a(f,g,d),c$(g,g.return);break;case 7:c$(g,g.return);default:a(f,g,d)}c=c.sibling}}(a,c,d)):dC(a,c),i7=b,i8=e}break;case 30:dC(a,c),512&d&&c$(c,c.return);break;case 7:512&d&&c$(c,c.return);default:dC(a,c)}}function dr(a,b){if(fm)for(a=a.child;null!==a;)(function a(b,c){if(fm)switch(b.tag){case 5:case 26:try{var d=b.stateNode;c?f_(d):f1(b.stateNode,b.memoizedProps)}catch(a){em(b,b.return,a)}!function b(c,d){if(fm&&0x4000000&c.subtreeFlags)for(c=c.child;null!==c;){var e=c;if(fm)switch(e.tag){case 4:a(e,d);break;case 22:null===e.memoizedState&&b(e,d);break;default:b(e,d)}c=c.sibling}}(b,c);break;case 6:try{var e=b.stateNode;c?f0(e):f2(e,b.memoizedProps),i2=!0}catch(a){em(b,b.return,a)}break;case 18:try{var f=b.stateNode;c?gY(f):gZ(b.stateNode)}catch(a){em(b,b.return,a)}break;case 22:case 23:null===b.memoizedState&&dr(b,c);break;default:dr(b,c)}})(a,b),a=a.sibling}function ds(a,b,c){for(c=c.child;null!==c;)dt(a,b,c),c=c.sibling}function dt(a,b,c){if(hI&&"function"==typeof hI.onCommitFiberUnmount)try{hI.onCommitFiberUnmount(hH,c)}catch{}switch(c.tag){case 26:if(g3){i8||c_(c,b),ds(a,b,c),c.memoizedState?g8(c.memoizedState):c.stateNode&&(i8||hb(c.stateNode));break}case 27:if(hh){i8||c_(c,b),c3(c);var d=jh,e=ji;hm(c.type)&&(jh=c.stateNode,ji=!1),ds(a,b,c),hk(c.stateNode,c.type,c.memoizedProps),jh=d,ji=e;break}case 5:i8||c_(c,b),c3(c);case 6:if(6===c.tag&&c3(c),fm){if(d=jh,e=ji,jh=null,ds(a,b,c),jh=d,ji=e,null!==jh)if(ji)try{fZ(jh,c.stateNode),i2=!0}catch(a){em(c,b,a)}else try{fY(jh,c.stateNode),i2=!0}catch(a){em(c,b,a)}}else ds(a,b,c);break;case 18:fm&&null!==jh&&(ji?gX(jh,c.stateNode):gW(jh,c.stateNode));break;case 4:fm?(d=jh,e=ji,jh=c.stateNode.containerInfo,ji=!0,ds(a,b,c),jh=d,ji=e):(fn&&db(c.stateNode,c,gn()),ds(a,b,c));break;case 0:case 11:case 14:case 15:cX(2,c,b),i8||cX(4,c,b),ds(a,b,c);break;case 1:i8||(c_(c,b),"function"==typeof(d=c.stateNode).componentWillUnmount&&cZ(c,b,d)),ds(a,b,c);break;case 21:default:ds(a,b,c);break;case 22:i8=(d=i8)||null!==c.memoizedState,ds(a,b,c),i8=d;break;case 30:c_(c,b),ds(a,b,c);break;case 7:i8||c_(c,b),ds(a,b,c)}}function du(a,b){if(fo&&null===b.memoizedState&&null!==(a=b.alternate)&&null!==(a=a.memoizedState)){a=a.dehydrated;try{gS(a)}catch(a){em(b,b.return,a)}}}function dv(a,b){if(fo&&null===b.memoizedState&&null!==(a=b.alternate)&&null!==(a=a.memoizedState)&&null!==(a=a.dehydrated))try{gT(a)}catch(a){em(b,b.return,a)}}function dw(a,b){var c=function(a){switch(a.tag){case 31:case 13:case 19:var b=a.stateNode;return null===b&&(b=a.stateNode=new jb),b;case 22:return null===(b=(a=a.stateNode)._retryCache)&&(b=a._retryCache=new jb),b;default:throw Error(d(435,a.tag))}}(a);b.forEach(function(b){if(!c.has(b)){c.add(b);var d=er.bind(null,a,b);b.then(d,d)}})}function dx(a,b,c){var e=b.deletions;if(null!==e)for(var f=0;f<e.length;f++){var g=e[f],h=a,i=b;if(fm){var j=i;f:for(;null!==j;){switch(j.tag){case 27:if(hh){if(hm(j.type)){jh=j.stateNode,ji=!1;break f}break}case 5:jh=j.stateNode,ji=!1;break f;case 3:case 4:jh=j.stateNode.containerInfo,ji=!0;break f}j=j.return}if(null===jh)throw Error(d(160));dt(h,i,g),jh=null,ji=!1}else dt(h,i,g);null!==(h=g.alternate)&&(h.return=null),g.return=null}if(13886&b.subtreeFlags)for(b=b.child;null!==b;)dy(b,a,c),b=b.sibling}function dy(a,b,c){var e=a.alternate,f=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(4&f&&null!==(e=null!==(e=a.updateQueue)?e.events:null))for(var g=0;g<e.length;g++){var h=e[g];h.ref.impl=h.nextImpl}dx(b,a,c),dz(a),4&f&&(cX(3,a,a.return),cW(3,a),cX(5,a,a.return));break;case 1:dx(b,a,c),dz(a),512&f&&(i8||null===e||c_(e,e.return)),64&f&&i7&&null!==(a=a.updateQueue)&&null!==(b=a.callbacks)&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=null===f?b:f.concat(b));break;case 26:if(g3){g=jj,dx(b,a,c),dz(a),512&f&&(i8||null===e||c_(e,e.return)),4&f&&(c=null!==e?e.memoizedState:null,f=a.memoizedState,null===e?null===f?null===a.stateNode?a.stateNode=i7?hc(a.type,a.memoizedProps,b.containerInfo,a):g9(g,a.type,a.memoizedProps,a):i7||ha(g,a.type,a.stateNode):a.stateNode=g7(g,f,a.memoizedProps):c!==f?(null===c?null===(b=e.stateNode)||i8||hb(b):g8(c),null===f?i7||ha(g,a.type,a.stateNode):g7(g,f,a.memoizedProps)):null===f&&null!==a.stateNode&&c7(a,a.memoizedProps,e.memoizedProps));break}case 27:if(hh){dx(b,a,c),dz(a),512&f&&(i8||null===e||c_(e,e.return)),null!==e&&4&f&&c7(a,a.memoizedProps,e.memoizedProps);break}case 5:if(g=i9,i9=!1,dx(b,a,c),i9=g,dz(a),512&f&&(i8||null===e||c_(e,e.return)),fm){if(32&a.flags){b=a.stateNode;try{f$(b),i2=!0}catch(b){em(a,a.return,b)}}4&f&&null!=a.stateNode&&(b=a.memoizedProps,c7(a,b,null!==e?e.memoizedProps:b)),1024&f&&(ja=!0)}else fn&&null!==a.alternate&&(a.alternate.stateNode=a.stateNode);break;case 6:if(dx(b,a,c),dz(a),4&f&&fm){if(null===a.stateNode)throw Error(d(162));b=a.memoizedProps,f=null!==e?e.memoizedProps:b,c=a.stateNode;try{fT(c,f,b),i2=!0}catch(b){em(a,a.return,b)}}break;case 3:if(i2=!1,g3?(hd(),g=jj,jj=g5(b.containerInfo),dx(b,a,c),jj=g):dx(b,a,c),dz(a),4&f){if(fm&&fo&&null!==e&&e.memoizedState.isDehydrated)try{gR(b.containerInfo)}catch(b){em(a,a.return,b)}if(fn){f=b.containerInfo,b=b.pendingChildren;try{gq(f,b),i2=!0}catch(b){em(a,a.return,b)}}}ja&&(ja=!1,function a(b){if(1024&b.subtreeFlags)for(b=b.child;null!==b;){var c=b;a(c),5===c.tag&&1024&c.flags&&fG(c.stateNode),b=b.sibling}}(a)),i2=!1;break;case 4:e=i9,i9=i7,g=c0(),g3?(h=jj,jj=g5(a.stateNode.containerInfo),dx(b,a,c),dz(a),jj=h):(dx(b,a,c),dz(a)),i2&&je&&(jf=!0),i2=g,i9=e,4&f&&fn&&db(a.stateNode,a,a.stateNode.pendingChildren);break;case 12:dx(b,a,c),dz(a);break;case 31:case 19:dx(b,a,c),dz(a),4&f&&null!==(b=a.updateQueue)&&(a.updateQueue=null,dw(a,b));break;case 13:dx(b,a,c),dz(a),8192&a.child.flags&&null!==a.memoizedState!=(null!==e&&null!==e.memoizedState)&&(jM=hA()),4&f&&null!==(b=a.updateQueue)&&(a.updateQueue=null,dw(a,b));break;case 22:g=null!==a.memoizedState,h=null!==e&&null!==e.memoizedState;var i=i7,j=i8,k=i9;i7=i||g,i9=k||g,i8=j||h,dx(b,a,c),i8=j,i9=k,i7=i,dz(a),8192&f&&((b=a.stateNode)._visibility=g?-2&b._visibility:1|b._visibility,!g||null===e||h||i7||i8||(b=2*!!hh,c=h||i8,e=i7,h=i8,i7=g||i7,i8=c,function a(b,c){for(b=b.child;null!==b;){var d=b;switch(d.tag){case 0:case 11:case 14:case 15:cX(4,d,d.return),a(d,c);break;case 1:c_(d,d.return);var e=d.stateNode;"function"==typeof e.componentWillUnmount&&cZ(d,d.return,e),a(d,c);break;case 27:hh&&(2&c)!=0&&hk(d.stateNode,d.type,d.memoizedProps);case 5:c_(d,d.return),5!==d.tag&&27!==d.tag||c3(d),a(d,c);break;case 6:c3(d);break;case 26:c_(d,d.return),g3&&(e=d.stateNode,null!==d.memoizedState||null===e||i8||hb(e)),a(d,c);break;case 22:null===d.memoizedState&&a(d,c);break;case 30:c_(d,d.return),a(d,c);break;case 7:c_(d,d.return);default:a(d,c)}b=b.sibling}}(a,b),i7=e,i8=h),fm&&(g||!i9)&&dr(a,g)),4&f&&null!==(b=a.updateQueue)&&null!==(f=b.retryQueue)&&(b.retryQueue=null,dw(a,f));break;case 30:512&f&&(i8||null===e||c_(e,e.return)),f=c0(),g=je,h=(0x13ffff00&c)===c,i=a.memoizedProps,je=h&&"none"!==B(i.default,i.update),dx(b,a,c),dz(a),h&&null!==e&&i2&&(a.flags|=4),je=g,i2=f;break;case 21:break;case 7:512&f&&(i8||null===e||c_(e,e.return)),e&&null!==e.stateNode&&gj(a,e.stateNode);default:dx(b,a,c),dz(a)}}function dz(a){var b=a.flags;if(2&b){try{for(var c,e=a.return;null!==e;){if(c8(e)){c=e;break}e=e.return}e=null;for(var f=a.return;null!==f;){if(c5(f)){var g=f.stateNode;null===e?e=[g]:e.push(g)}if(c4(f))break;f=f.return}var h=e;if(fm){if(null==c)throw Error(d(160));switch(c.tag){case 27:if(hh){var i=c.stateNode,j=c9(a);da(a,j,i,h);break}case 5:var k=c.stateNode;32&c.flags&&(f$(k),c.flags&=-33);var l=c9(a);da(a,l,k,h);break;case 3:case 4:var m=c.stateNode.containerInfo,n=c9(a);!function a(b,c,d,e){var f=b.tag;if(5===f||6===f)f=b.stateNode,c?fX(d,f,c):fS(d,f),c1(b,e),i2=!0;else if(4!==f&&(hh&&27===f&&(c1(b,e),e=null,hm(b.type)&&(d=b.stateNode,c=null)),null!==(b=b.child)))for(a(b,c,d,e),b=b.sibling;null!==b;)a(b,c,d,e),b=b.sibling}(a,n,m,h);break;default:throw Error(d(161))}}else!function a(b,c){if(5===b.tag||hh&&27===b.tag)c1(b,c);else if(4!==b.tag&&null!==(b=b.child))for(a(b,c),b=b.sibling;null!==b;)a(b,c),b=b.sibling}(a,h)}catch(b){em(a,a.return,b)}a.flags&=-3}4096&b&&(a.flags&=-4097)}function dA(a,b){if(9270&b.subtreeFlags)for(b=b.child;null!==b;)dB(b,a),b=b.sibling;else!function a(b,c){for(b=b.child;null!==b;){if(30===b.tag){var d=b.memoizedProps,e=b.stateNode,f=z(d,e),g=B(d.default,d.update);if(c)var h=null===(e=e.clones)?null:e.map(f9);else h=b.memoizedState,b.memoizedState=null;e=b;var i=b.child;i6=0,f=dn(e,i,f,f,g,h,!1),(4&b.flags)!=0&&f&&(c||dV(b,d.onUpdate))}else(0x2000000&b.subtreeFlags)!=0&&a(b,c);b=b.sibling}}(b,!1)}function dB(a,b){var c=a.alternate;if(null===c)di(a,!1);else switch(a.tag){case 3:if(jg=jd=!1,de(),dA(b,a),!jd&&!jf){if(null!==(a=i5))for(var d=0;d<a.length;d+=3)f5(a[d],a[d+1],a[d+2]);f6(b.containerInfo),jg=!0}i5=null;break;case 5:default:dA(b,a);break;case 4:d=jd,jd=!1,dA(b,a),jd&&(jf=!0),jd=d;break;case 22:null===a.memoizedState&&(null!==c.memoizedState?di(a,!1):dA(b,a));break;case 30:d=jd;var e=de();jd=!1,dA(b,a),jd&&(a.flags|=4);var f=a.memoizedProps,g=a.stateNode;b=z(f,g),g=z(c.memoizedProps,g);var h=B(f.default,f.update);"none"===h?c=!1:(f=c.memoizedState,c.memoizedState=null,c=a.child,i6=0,c=dn(a,c,b,g,h,f,!0),i6!==(null===f?0:f.length)&&(a.flags|=32)),(4&a.flags)!=0&&c?(dV(a,a.memoizedProps.onUpdate),i5=e):null!==e&&(e.push.apply(e,i5),i5=e),jd=(32&a.flags)!=0||d}}function dC(a,b){if(8772&b.subtreeFlags)for(b=b.child;null!==b;)dq(a,b.alternate,b),b=b.sibling}function dD(a,b){var c=null;null!==a&&null!==a.memoizedState&&null!==a.memoizedState.cachePool&&(c=a.memoizedState.cachePool.pool),a=null,null!==b.memoizedState&&null!==b.memoizedState.cachePool&&(a=b.memoizedState.cachePool.pool),a!==c&&(null!=a&&a.refCount++,null!=c&&ag(c))}function dE(a,b){a=null,null!==b.alternate&&(a=b.alternate.memoizedState.cache),(b=b.memoizedState.cache)!==a&&(b.refCount++,null!=a&&ag(a))}function dF(a,b,c,d){var e=(0x13ffff00&c)===c;if(b.subtreeFlags&(e?10262:10256))for(b=b.child;null!==b;)dG(a,b,c,d),b=b.sibling;else e&&function a(b){for(b=b.child;null!==b;)30===b.tag?dg(b.child,!1):(0x2000000&b.subtreeFlags)!=0&&a(b),b=b.sibling}(b)}function dG(a,b,c,d){var e=(0x13ffff00&c)===c;e&&null===b.alternate&&null!==b.return&&null!==b.return.alternate&&dm(b);var f=b.flags;switch(b.tag){case 0:case 11:case 15:dF(a,b,c,d),2048&f&&cW(9,b);break;case 1:case 31:case 13:default:dF(a,b,c,d);break;case 3:dF(a,b,c,d),e&&fm&&jg&&f7(a.containerInfo),2048&f&&(a=null,null!==b.alternate&&(a=b.alternate.memoizedState.cache),(b=b.memoizedState.cache)!==a&&(b.refCount++,null!=a&&ag(a)));break;case 12:if(2048&f){dF(a,b,c,d),a=b.stateNode;try{var g=b.memoizedProps,h=g.id,i=g.onPostCommit;"function"==typeof i&&i(h,null===b.alternate?"mount":"update",a.passiveEffectDuration,-0)}catch(a){em(b,b.return,a)}}else dF(a,b,c,d);break;case 23:break;case 22:g=b.stateNode,h=b.alternate,null!==b.memoizedState?(e&&null!==h&&null===h.memoizedState&&dm(h),2&g._visibility?dF(a,b,c,d):dH(a,b)):(e&&null!==h&&null!==h.memoizedState&&dm(b),2&g._visibility?dF(a,b,c,d):(g._visibility|=2,function a(b,c,d,e,f){for(f=f&&(10256&c.subtreeFlags)!=0,c=c.child;null!==c;){var g=c,h=g.flags;switch(g.tag){case 0:case 11:case 15:a(b,g,d,e,f),cW(8,g);break;case 23:break;case 22:var i=g.stateNode;null!==g.memoizedState?2&i._visibility?a(b,g,d,e,f):dH(b,g):(i._visibility|=2,a(b,g,d,e,f)),f&&2048&h&&dD(g.alternate,g);break;case 24:a(b,g,d,e,f),f&&2048&h&&dE(g.alternate,g);break;default:a(b,g,d,e,f)}c=c.sibling}}(a,b,c,d,(10256&b.subtreeFlags)!=0))),2048&f&&dD(h,b);break;case 24:dF(a,b,c,d),2048&f&&dE(b.alternate,b);break;case 30:e&&null!==(e=b.alternate)&&(dg(e.child,!0),dg(b.child,!0)),dF(a,b,c,d)}}function dH(a,b){if(10256&b.subtreeFlags)for(b=b.child;null!==b;){var c=b,d=c.flags;switch(c.tag){case 22:dH(a,c),2048&d&&dD(c.alternate,c);break;case 24:dH(a,c),2048&d&&dE(c.alternate,c);break;default:dH(a,c)}b=b.sibling}}function dI(a,b,c){if(a.subtreeFlags&jk)for(a=a.child;null!==a;)dJ(a,b,c),a=a.sibling}function dJ(a,b,c){switch(a.tag){case 26:if(dI(a,b,c),a.flags&jk)if(null!==a.memoizedState)hg(c,jj,a.memoizedState,a.memoizedProps);else{var d=a.stateNode,e=a.type;a=a.memoizedProps,((0x13ffff40&b)===b||fy(e,a))&&fB(c,d,e,a)}break;case 5:dI(a,b,c),a.flags&jk&&(d=a.stateNode,e=a.type,a=a.memoizedProps,((0x13ffff40&b)===b||fy(e,a))&&fB(c,d,e,a));break;case 3:case 4:g3?(d=jj,jj=g5(a.stateNode.containerInfo),dI(a,b,c),jj=d):dI(a,b,c);break;case 22:null===a.memoizedState&&(null!==(d=a.alternate)&&null!==d.memoizedState?(d=jk,jk=0x1000000,dI(a,b,c),jk=d):dI(a,b,c));break;case 30:(a.flags&jk)!=0&&null!=(d=a.memoizedProps.name)&&"auto"!==d&&((e=a.stateNode).paired=null,null===i4&&(i4=new Map),i4.set(d,e)),dI(a,b,c);break;default:dI(a,b,c)}}function dK(a){var b=a.alternate;if(null!==b&&null!==(a=b.child)){b.child=null;do b=a.sibling,a.sibling=null,a=b;while(null!==a)}}function dL(a){var b=a.deletions;if((16&a.flags)!=0){if(null!==b)for(var c=0;c<b.length;c++){var d=b[c];jc=d,dN(d,a)}dK(a)}if(10256&a.subtreeFlags)for(a=a.child;null!==a;)dM(a),a=a.sibling}function dM(a){switch(a.tag){case 0:case 11:case 15:dL(a),2048&a.flags&&cX(9,a,a.return);break;case 3:case 12:default:dL(a);break;case 22:var b=a.stateNode;null!==a.memoizedState&&2&b._visibility&&(null===a.return||13!==a.return.tag)?(b._visibility&=-3,function a(b){var c=b.deletions;if((16&b.flags)!=0){if(null!==c)for(var d=0;d<c.length;d++){var e=c[d];jc=e,dN(e,b)}dK(b)}for(b=b.child;null!==b;){switch((c=b).tag){case 0:case 11:case 15:cX(8,c,c.return),a(c);break;case 22:2&(d=c.stateNode)._visibility&&(d._visibility&=-3,a(c));break;default:a(c)}b=b.sibling}}(a)):dL(a)}}function dN(a,b){for(;null!==jc;){var c=jc;switch(c.tag){case 0:case 11:case 15:cX(8,c,b);break;case 23:case 22:if(null!==c.memoizedState&&null!==c.memoizedState.cachePool){var d=c.memoizedState.cachePool.pool;null!=d&&d.refCount++}break;case 24:ag(c.memoizedState.cache)}if(null!==(d=c.child))d.return=c,jc=d;else for(c=a;null!==jc;){var e=(d=jc).sibling,f=d.return;if(function a(b){var c=b.alternate;null!==c&&(b.alternate=null,a(c)),b.child=null,b.deletions=null,b.sibling=null,5===b.tag&&null!==(c=b.stateNode)&&fv(c),b.stateNode=null,b.return=null,b.dependencies=null,b.memoizedProps=null,b.memoizedState=null,b.pendingProps=null,b.stateNode=null,b.updateQueue=null}(d),d===c){jc=null;break}if(null!==e){e.return=f,jc=e;break}jc=f}}}function dO(a){var b=fp(a);if(null!=b){if("string"!=typeof b.memoizedProps["data-testname"])throw Error(d(364));return b}if(null===(a=fK(a)))throw Error(d(362));return a.stateNode.current}function dP(a,b){var c=a.tag;switch(b.$$typeof){case jm:if(a.type===b.value)return!0;break;case jn:f:{for(b=b.value,a=[a,0],c=0;c<a.length;){var e=a[c++],f=e.tag,g=a[c++],h=b[g];if(5!==f&&26!==f&&27!==f||!fN(e)){for(;null!=h&&dP(e,h);)h=b[++g];if(g===b.length){b=!0;break f}for(e=e.child;null!==e;)a.push(e,g),e=e.sibling}}b=!1}return b;case jo:if((5===c||26===c||27===c)&&fO(a.stateNode,b.value))return!0;break;case jq:if((5===c||6===c||26===c||27===c)&&null!==(a=fM(a))&&0<=a.indexOf(b.value))return!0;break;case jp:if((5===c||26===c||27===c)&&"string"==typeof(a=a.memoizedProps["data-testname"])&&a.toLowerCase()===b.value.toLowerCase())return!0;break;default:throw Error(d(365))}return!1}function dQ(a){switch(a.$$typeof){case jm:return"<"+(i(a.value)||"Unknown")+">";case jn:return":has("+(dQ(a)||"")+")";case jo:return'[role="'+a.value+'"]';case jq:return'"'+a.value+'"';case jp:return'[data-testname="'+a.value+'"]';default:throw Error(d(365))}}function dR(a,b){var c=[];a=[a,0];for(var d=0;d<a.length;){var e=a[d++],f=e.tag,g=a[d++],h=b[g];if(5!==f&&26!==f&&27!==f||!fN(e)){for(;null!=h&&dP(e,h);)h=b[++g];if(g===b.length)c.push(e);else for(e=e.child;null!==e;)a.push(e,g),e=e.sibling}}return c}function dS(a,b){if(!fJ)throw Error(d(363));a=dR(a=dO(a),b),b=[],a=Array.from(a);for(var c=0;c<a.length;){var e=a[c++],f=e.tag;if(5===f||26===f||27===f)fN(e)||b.push(e.stateNode);else for(e=e.child;null!==e;)a.push(e),e=e.sibling}return b}function dT(){return(2&jt)!=0&&0!==jw?jw&-jw:null!==e4.T?aq():ft()}function dU(){if(0===jH)if((0x20000000&jw)==0||h2){var a=hu;(3932160&(hu<<=1))==0&&(hu=262144),jH=a}else jH=0x20000000;return null!==(a=iI.current)&&(a.flags|=32),jH}function dV(a,b){if(null!=b){var c=a.stateNode,d=c.ref;null===d&&(d=c.ref=gg(z(a.memoizedProps,c))),null===jZ&&(jZ=[]),jZ.push(b.bind(null,d))}}function dW(a,b,c){(a===ju&&(2===jx||9===jx)||null!==a.cancelPendingCommit)&&(d0(a,0),dZ(a,jw,jH,!1)),s(a,c),((2&jt)==0||a!==ju)&&(a===ju&&((2&jt)==0&&(jF|=c),4===jD&&dZ(a,jw,jH,!1)),aj(a))}function dX(a,b,c){if((6&jt)!=0)throw Error(d(327));for(var e=!c&&(127&b)==0&&(b&a.expiredLanes)==0||o(a,b),f=e?function(a,b){var c=jt;jt|=2;var e=d3(),f=d4();ju!==a||jw!==b?(jP=null,jO=hA()+500,d0(a,b)):jA=o(a,b);f:for(;;)try{if(0!==jx&&null!==jv){b=jv;var g=jy;g:switch(jx){case 1:jx=0,jy=null,d9(a,b,g,1);break;case 2:case 9:if(aw(g)){jx=0,jy=null,d8(b);break}b=function(){2!==jx&&9!==jx||ju!==a||(jx=7),aj(a)},g.then(b,b);break f;case 3:jx=7;break f;case 4:jx=5;break f;case 7:aw(g)?(jx=0,jy=null,d8(b)):(jx=0,jy=null,d9(a,b,g,7));break;case 5:var h=null;switch(jv.tag){case 26:h=jv.memoizedState;case 5:case 27:var i=jv,j=i.type,k=i.pendingProps;if(h?hf(h):fz(i.stateNode,j,k)){jx=0,jy=null;var l=i.sibling;if(null!==l)jv=l;else{var m=i.return;null!==m?(jv=m,ea(m)):jv=null}break g}}jx=0,jy=null,d9(a,b,g,5);break;case 6:jx=0,jy=null,d9(a,b,g,6);break;case 8:d_(),jD=6;break f;default:throw Error(d(462))}}for(;null!==jv&&!hy();)d7(jv);break}catch(b){d1(a,b)}return h8=h7=null,e4.H=e,e4.A=f,jt=c,null!==jv?0:(ju=null,jw=0,aF(),jD)}(a,b):d6(a,b,!0),g=e;;){if(0===f)jA&&!e&&dZ(a,b,0,!1);else{if(c=a.current.alternate,g&&!function(a){for(var b=a;;){var c=b.tag;if((0===c||11===c||15===c)&&16384&b.flags&&null!==(c=b.updateQueue)&&null!==(c=c.stores))for(var d=0;d<c.length;d++){var e=c[d],f=e.getSnapshot;e=e.value;try{if(!hK(f(),e))return!1}catch{return!1}}if(c=b.child,16384&b.subtreeFlags&&null!==c)c.return=b,b=c;else{if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return!0;b=b.return}b.sibling.return=b.return,b=b.sibling}}return!0}(c)){f=d6(a,b,!1),g=!1;continue}if(2===f){if(g=b,a.errorRecoveryDisabledLanes&g)var h=0;else h=0!=(h=-0x20000001&a.pendingLanes)?h:0x20000000&h?0x20000000:0;if(0!==h){b=h;f:{f=jJ;var i=fo&&a.current.memoizedState.isDehydrated;if(i&&(d0(a,h).flags|=256),2!==(h=d6(a,h,!1))&&6!==h){if(jB&&!i){a.errorRecoveryDisabledLanes|=g,jF|=g,f=4;break f}g=jK,jK=f,null!==g&&(null===jK?jK=g:jK.push.apply(jK,g))}f=h}if(g=!1,2!==f)continue}}if(1===f){d0(a,0),dZ(a,b,0,!0);break}f:{switch(e=a,g=f){case 0:case 1:throw Error(d(345));case 4:if((4194048&b)!==b&&(0x3c00000&b)!==b)break;case 6:dZ(e,b,jH,!jz);break f;case 2:jK=null;break;case 3:case 5:break;default:throw Error(d(329))}if((0x3c00000&b)===b&&10<(f=jM+300-hA())){if(dZ(e,b,jH,!jz),0!==n(e,0,!0))break f;jU=b,e.timeoutHandle=fi(dY.bind(null,e,c,jK,jP,jL,b,jH,jF,jI,jz,g,"Throttled",-0,0),f);break f}dY(e,c,jK,jP,jL,b,jH,jF,jI,jz,g,null,-0,0)}}break}aj(a)}function dY(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.timeoutHandle=fk;var o=b.subtreeFlags,p=(0x13ffff00&f)===f;if(l=null,(p||8192&o||(0x1002000&o)==0x1002000)&&(l=fA(),i4=null,dJ(b,f,l),p&&fC(l,a.containerInfo),null!==(o=fD(l,o=(0x3c00000&f)===f?jM-hA():(4194048&f)===f?jN-hA():0)))){jU=f,a.cancelPendingCommit=o(ec.bind(null,a,b,f,c,d,e,g,h,i,j,k,l,null,m,n)),dZ(a,f,g,!j);return}ec(a,b,f,c,d,e,g,h,i,j,k,l)}function dZ(a,b,c,d){b=p(a,b)&~jG&~jF,a.suspendedLanes|=b,a.pingedLanes&=~b,d&&(a.warmLanes|=b),d=a.expirationTimes;for(var e=b;0<e;){var f=31-hq(e),g=1<<f;d[f]=-1,e&=~g}0!==c&&t(a,c,b)}function d$(){return(6&jt)!=0||(ak(0,!1),!1)}function d_(){if(null!==jv){if(0===jx)var a=jv.return;else a=jv,h8=h7=null,bc(a),ix=null,iy=0,a=jv;for(;null!==a;)cV(a.alternate,a),a=a.return;jv=null}}function d0(a,b){var c=a.timeoutHandle;return c!==fk&&(a.timeoutHandle=fk,fj(c)),null!==(c=a.cancelPendingCommit)&&(a.cancelPendingCommit=null,c()),jU=0,d_(),ju=a,jv=c=eu(a.current,null),jw=b,jx=0,jy=null,jz=!1,jA=o(a,b),jB=!1,jI=jH=jG=jF=jE=jD=0,jK=jJ=null,jL=!1,jC=p(a,b),aF(),c}function d1(a,b){iM=null,e4.H=iW,b===is||b===iu?(b=az(),jx=3):b===it?(b=az(),jx=4):jx=b===i_?8:null!==b&&"object"==typeof b&&"function"==typeof b.then?6:1,jy=b,null===jv&&(jD=1,cc(a,G(b,a.current)))}function d2(){var a=iI.current;return null===a||((4194048&jw)===jw?null===iJ:((0x3c00000&jw)===jw||(0x20000000&jw)!=0)&&a===iJ)}function d3(){var a=e4.H;return e4.H=iW,null===a?iW:a}function d4(){var a=e4.A;return e4.A=jl,a}function d5(){jD=4,jz||(4194048&jw)!==jw&&null!==iI.current||(jA=!0),(0x7ffffff&jE)==0&&(0x7ffffff&jF)==0||null===ju||dZ(ju,jw,jH,!1)}function d6(a,b,c){var d=jt;jt|=2;var e=d3(),f=d4();(ju!==a||jw!==b)&&(jP=null,d0(a,b)),b=!1;var g=jD;f:for(;;)try{if(0!==jx&&null!==jv){var h=jv,i=jy;switch(jx){case 8:d_(),g=6;break f;case 3:case 2:case 9:case 6:null===iI.current&&(b=!0);var j=jx;if(jx=0,jy=null,d9(a,h,i,j),c&&jA){g=0;break f}break;default:j=jx,jx=0,jy=null,d9(a,h,i,j)}}(function(){for(;null!==jv;)d7(jv)})(),g=jD;break}catch(b){d1(a,b)}return b&&a.shellSuspendCounter++,h8=h7=null,jt=d,e4.H=e,e4.A=f,null===jv&&(ju=null,jw=0,aF()),g}function d7(a){var b=cJ(a.alternate,a,jC);a.memoizedProps=a.pendingProps,null===b?ea(a):jv=b}function d8(a){var b=a,c=b.alternate;switch(b.tag){case 15:case 0:b=cs(c,b,b.pendingProps,b.type,void 0,jw);break;case 11:b=cs(c,b,b.pendingProps,b.type.render,b.ref,jw);break;case 5:bc(b);var d=b;fo&&d===h0&&(h2?(S(d),5===d.tag&&null!=d.stateNode&&(h1=d.stateNode)):(S(d),h2=!0));default:cV(c,b),b=cJ(c,b=jv=ev(b,jC),jC)}a.memoizedProps=a.pendingProps,null===b?ea(a):jv=b}function d9(a,b,c,e){h8=h7=null,bc(b),ix=null,iy=0;var f=b.return;try{if(function(a,b,c,e,f){if(c.flags|=32768,null!==e&&"object"==typeof e&&"function"==typeof e.then){if(null!==(b=c.alternate)&&_(b,c,f,!0),null!==(c=iI.current)){switch(c.tag){case 31:case 13:case 19:return null===iJ?d5():null===c.alternate&&0===jD&&(jD=3),c.flags&=-257,c.flags|=65536,c.lanes=f,e===iv?c.flags|=16384:(null===(b=c.updateQueue)?c.updateQueue=new Set([e]):b.add(e),en(a,e,f)),!1;case 22:return c.flags|=65536,e===iv?c.flags|=16384:(null===(b=c.updateQueue)?(b={transitions:null,markerInstances:null,retryQueue:new Set([e])},c.updateQueue=b):null===(c=b.retryQueue)?b.retryQueue=new Set([e]):c.add(e),en(a,e,f)),!1}throw Error(d(435,c.tag))}return en(a,e,f),d5(),!1}if(h2)return null!==(b=iI.current)?((65536&b.flags)==0&&(b.flags|=256),b.flags|=65536,b.lanes=f,e!==h5&&W(G(a=Error(d(422),{cause:e}),c))):(e!==h5&&W(G(b=Error(d(423),{cause:e}),c)),a=a.current.alternate,a.flags|=65536,f&=-f,a.lanes|=f,e=G(e,c),f=ce(a.stateNode,e,f),aQ(a,f),4!==jD&&(jD=2)),!1;var g=Error(d(520),{cause:e});if(g=G(g,c),null===jJ?jJ=[g]:jJ.push(g),4!==jD&&(jD=2),null===b)return!0;e=G(e,c),c=b;do{switch(c.tag){case 3:return c.flags|=65536,a=f&-f,c.lanes|=a,a=ce(c.stateNode,e,a),aQ(c,a),!1;case 1:if(b=c.type,g=c.stateNode,(128&c.flags)==0&&("function"==typeof b.getDerivedStateFromError||null!==g&&"function"==typeof g.componentDidCatch&&(null===jQ||!jQ.has(g))))return c.flags|=65536,f&=-f,c.lanes|=f,cg(f=cf(f),a,c,e),aQ(c,f),!1;break;case 22:if(null!==c.memoizedState)return c.flags|=65536,!1}c=c.return}while(null!==c);return!1}(a,f,b,c,jw)){jD=1,cc(a,G(c,a.current)),jv=null;return}}catch(b){if(null!==f)throw jv=f,b;jD=1,cc(a,G(c,a.current)),jv=null;return}32768&b.flags?(h2||1===e?a=!0:jA||(0x20000000&jw)!=0?a=!1:(jz=a=!0,(2===e||9===e||3===e||6===e)&&null!==(e=iI.current)&&13===e.tag&&(e.flags|=16384)),eb(b,a)):ea(b)}function ea(a){var b=a;do{if((32768&b.flags)!=0)return void eb(b,jz);a=b.return;var c=function(a,b,c){var e=b.pendingProps;switch(K(b),b.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return cU(b),null;case 3:return c=b.stateNode,e=null,null!==a&&(e=a.memoizedState.cache),b.memoizedState.cache!==e&&(b.flags|=2048),Y(ic),N(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(null===a||null===a.child)&&(T(b)?cK(b):null===a||a.memoizedState.isDehydrated&&(256&b.flags)==0||(b.flags|=1024,V())),cO(a,b),cU(b),null;case 26:if(g3){var f=b.type,g=b.memoizedState;return null===a?(cK(b),null!==g?(cU(b),cR(b,g)):(cU(b),cQ(b,f,null,e,c))):g?g!==a.memoizedState?(cK(b),cU(b),cR(b,g)):(cU(b),b.flags&=-0x1000001):(g=a.memoizedProps,fm?g!==e&&cK(b):cP(a,b,f,e),cU(b),cQ(b,f,g,e,c)),null}case 27:if(hh){if(P(b),c=h$.current,f=b.type,null!==a&&null!=b.stateNode)fm?a.memoizedProps!==e&&cK(b):cP(a,b,f,e);else{if(!e){if(null===b.stateNode)throw Error(d(166));return cU(b),b.subtreeFlags&=-0x2000001,null}a=hY.current,T(b)?R(b,a):(b.stateNode=a=hi(f,e,c,a,!0),cK(b))}return cU(b),b.subtreeFlags&=-0x2000001,null}case 5:if(P(b),f=b.type,null!==a&&null!=b.stateNode)cP(a,b,f,e);else{if(!e){if(null===b.stateNode)throw Error(d(166));return cU(b),b.subtreeFlags&=-0x2000001,null}if(g=hY.current,T(b))R(b,g),gU(b.stateNode,f,e,g)&&(b.flags|=64);else{var h=fd(f,e,h$.current,g,b);cL(b),cN(h,b,!1,!1),b.stateNode=h,ff(h,f,e,g)&&cK(b)}}return cU(b),b.subtreeFlags&=-0x2000001,cQ(b,b.type,null===a?null:a.memoizedProps,b.pendingProps,c),null;case 6:if(a&&null!=b.stateNode)c=a.memoizedProps,fm?c!==e&&cK(b):fn&&(c!==e?(a=h$.current,c=hY.current,cL(b),b.stateNode=fh(e,a,c,b)):b.stateNode=a.stateNode);else{if("string"!=typeof e&&null===b.stateNode)throw Error(d(166));if(a=h$.current,c=hY.current,T(b)){if(!fo)throw Error(d(176));if(a=b.stateNode,c=b.memoizedProps,e=null,null!==(f=h0))switch(f.tag){case 27:case 5:e=f.memoizedProps}gL(a,c,b,e)||Q(b,!0)}else cL(b),b.stateNode=fh(e,a,c,b)}return cU(b),null;case 31:if(c=b.memoizedState,null===a||null!==a.memoizedState){if(e=T(b),null!==c){if(null===a){if(!e)throw Error(d(318));if(!fo)throw Error(d(556));if(!(a=null!==(a=b.memoizedState)?a.dehydrated:null))throw Error(d(557));gM(a,b)}else U(),(128&b.flags)==0&&(b.memoizedState=null),b.flags|=4;cU(b),a=!1}else c=V(),null!==a&&null!==a.memoizedState&&(a.memoizedState.hydrationErrors=c),a=!0;if(!a)return 256&b.flags?(a0(b),b):(a0(b),null);if((128&b.flags)!=0)throw Error(d(558))}return cU(b),null;case 13:if(e=b.memoizedState,null===a||null!==a.memoizedState&&null!==a.memoizedState.dehydrated){if(f=T(b),null!==e&&null!==e.dehydrated){if(null===a){if(!f)throw Error(d(318));if(!fo)throw Error(d(344));if(!(f=null!==(f=b.memoizedState)?f.dehydrated:null))throw Error(d(317));gN(f,b)}else U(),(128&b.flags)==0&&(b.memoizedState=null),b.flags|=4;cU(b),f=!1}else f=V(),null!==a&&null!==a.memoizedState&&(a.memoizedState.hydrationErrors=f),f=!0;if(!f)return 256&b.flags?(a0(b),b):(a0(b),null)}return a0(b),(128&b.flags)!=0?(b.lanes=c,b):(c=null!==e,a=null!==a&&null!==a.memoizedState,c&&(e=b.child,f=null,null!==e.alternate&&null!==e.alternate.memoizedState&&null!==e.alternate.memoizedState.cachePool&&(f=e.alternate.memoizedState.cachePool.pool),g=null,null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(g=e.memoizedState.cachePool.pool),g!==f&&(e.flags|=2048)),c!==a&&c&&(b.child.flags|=8192),cS(b,b.updateQueue),cU(b),null);case 4:return N(),cO(a,b),null===a&&fq(b.stateNode.containerInfo),b.flags|=0x4000000,cU(b),null;case 10:return Y(b.type),cU(b),null;case 19:if(a2(b),null===(e=b.memoizedState))return cU(b),null;if(f=(128&b.flags)!=0,null===(g=e.rendering))if(f)cT(e,!1);else{if(0!==jD||null!==a&&(128&a.flags)!=0)for(a=b.child;null!==a;){if(null!==(g=a3(a))){for(b.flags|=128,cT(e,!1),b.updateQueue=a=g.updateQueue,cS(b,a),b.subtreeFlags=0,a=c,c=b.child;null!==c;)ev(c,a),c=c.sibling;return a1(b,1&iK.current|2),h2&&H(b,e.treeForkCount),b.child}a=a.sibling}null!==e.tail&&hA()>jO&&(b.flags|=128,f=!0,cT(e,!1),b.lanes=4194304)}else{if(!f)if(null!==(a=a3(g))){if(b.flags|=128,f=!0,b.updateQueue=a=a.updateQueue,cS(b,a),cT(e,!0),null===e.tail&&"collapsed"!==e.tailMode&&"visible"!==e.tailMode&&!g.alternate&&!h2)return cU(b),null}else 2*hA()-e.renderingStartTime>jO&&0x20000000!==c&&(b.flags|=128,f=!0,cT(e,!1),b.lanes=4194304);e.isBackwards?(g.sibling=b.child,b.child=g):(null!==(a=e.last)?a.sibling=g:b.child=g,e.last=g)}if(null!==e.tail){a=e.tail;f:{for(c=a;null!==c;){if(null!==c.alternate){c=!1;break f}c=c.sibling}c=!0}return e.rendering=a,e.tail=a.sibling,e.renderingStartTime=hA(),a.sibling=null,g=iK.current,g=f?1&g|2:1&g,"visible"===e.tailMode||"collapsed"===e.tailMode||!c||h2?a1(b,g):(c=g,l(iI,b),l(iK,c),null===iJ&&(iJ=b)),h2&&H(b,e.treeForkCount),a}return cU(b),null;case 22:case 23:return a0(b),aX(),e=null!==b.memoizedState,null!==a?null!==a.memoizedState!==e&&(b.flags|=8192):e&&(b.flags|=8192),e?(0x20000000&c)!=0&&(128&b.flags)==0&&(cU(b),6&b.subtreeFlags&&(b.flags|=8192)):cU(b),null!==(c=b.updateQueue)&&cS(b,c.retryQueue),c=null,null!==a&&null!==a.memoizedState&&null!==a.memoizedState.cachePool&&(c=a.memoizedState.cachePool.pool),e=null,null!==b.memoizedState&&null!==b.memoizedState.cachePool&&(e=b.memoizedState.cachePool.pool),e!==c&&(b.flags|=2048),null!==a&&k(ir),null;case 24:return c=null,null!==a&&(c=a.memoizedState.cache),b.memoizedState.cache!==c&&(b.flags|=2048),Y(ic),cU(b),null;case 25:return null;case 30:return b.flags|=0x2000000,cU(b),null}throw Error(d(156,b.tag))}(b.alternate,b,jC);if(null!==c){jv=c;return}if(null!==(b=b.sibling)){jv=b;return}jv=b=a}while(null!==b);0===jD&&(jD=5)}function eb(a,b){do{var c=function(a,b){switch(K(b),b.tag){case 1:return 65536&(a=b.flags)?(b.flags=-65537&a|128,b):null;case 3:return Y(ic),N(),(65536&(a=b.flags))!=0&&(128&a)==0?(b.flags=-65537&a|128,b):null;case 26:case 27:case 5:return P(b),null;case 31:if(null!==b.memoizedState){if(a0(b),null===b.alternate)throw Error(d(340));U()}return 65536&(a=b.flags)?(b.flags=-65537&a|128,b):null;case 13:if(a0(b),null!==(a=b.memoizedState)&&null!==a.dehydrated){if(null===b.alternate)throw Error(d(340));U()}return 65536&(a=b.flags)?(b.flags=-65537&a|128,b):null;case 19:return a2(b),65536&(a=b.flags)?(b.flags=-65537&a|128,null!==(a=b.memoizedState)&&(a.rendering=null,a.tail=null),b.flags|=4,b):null;case 4:return N(),null;case 10:return Y(b.type),null;case 22:case 23:return a0(b),aX(),null!==a&&k(ir),65536&(a=b.flags)?(b.flags=-65537&a|128,b):null;case 24:return Y(ic),null;default:return null}}(a.alternate,a);if(null!==c){c.flags&=32767,jv=c;return}if(null!==(c=a.return)&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!b&&null!==(a=a.sibling)){jv=a;return}jv=a=c}while(null!==a);jD=6,jv=null}function ec(a,b,c,e,f,g,h,i,j,k,l,m){a.cancelPendingCommit=null;do ej();while(0!==jR);if((6&jt)!=0)throw Error(d(327));if(null!==b){if(b===a.current)throw Error(d(177));a===ju&&(jv=ju=null,jw=0),jT=b,jS=a,jU=c,jW=f,jX=e,function(a,b,c,d,e,f,g){var h,i=b.lanes|b.childLanes;if(jV=i,function(a,b,c,d,e,f){var g=a.pendingLanes;a.pendingLanes=c,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=c,a.entangledLanes&=c,a.errorRecoveryDisabledLanes&=c,a.shellSuspendCounter=0;var h=a.entanglements,i=a.expirationTimes,j=a.hiddenUpdates;for(c=g&~c;0<c;){var k=31-hq(c),l=1<<k;h[k]=0,i[k]=-1;var m=j[k];if(null!==m)for(j[k]=null,k=0;k<m.length;k++){var n=m[k];null!==n&&(n.lane&=-0x20000001)}c&=~l}0!==d&&t(a,d,0),0!==f&&0===e&&0!==a.tag&&(a.suspendedLanes|=f&~(g&~b))}(a,c,i|=iD,d,e,f),jZ=null,(0x13ffff00&c)===c?(h=a.transitionTypes,a.transitionTypes=null,j$=h,d=10262):(j$=null,d=10256),(b.subtreeFlags&d)!=0||(b.flags&d)!=0?(a.callbackNode=null,a.callbackPriority=0,hw(hD,function(){return ek(),null})):(a.callbackNode=null,a.callbackPriority=0),i3=!1,d=(13878&b.flags)!=0,(13878&b.subtreeFlags)!=0||d){d=e4.T,e4.T=null,e=fs(),fr(2),f=jt,jt|=4;try{var j=a,k=b,l=c;for(fb(j.containerInfo),j=(0x13ffff00&l)===l,jc=k,k=j?9270:1024;null!==jc;){if(l=jc,j){var m=l.deletions;if(null!==m)for(var n=0;n<m.length;n++)j&&dk(m[n])}if(null===l.alternate&&(2&l.flags)!=0)j&&dd(l),dp(j);else{if(22===l.tag){if(m=l.alternate,null!==l.memoizedState){null!==m&&null===m.memoizedState&&j&&dk(m),dp(j);continue}else if(null!==m&&null!==m.memoizedState){j&&dd(l),dp(j);continue}}m=l.child,(l.subtreeFlags&k)!=0&&null!==m?(m.return=l,jc=m):(j&&function a(b){for(b=b.child;null!==b;){if(30===b.tag){var c=b.memoizedProps,d=z(c,b.stateNode);c=B(c.default,c.update),b.flags&=-5,"none"!==c&&df(b,d,c,b.memoizedState=[],!1)}else(0x2000000&b.subtreeFlags)!=0&&a(b);b=b.sibling}}(l),dp(j))}}i4=null}finally{jt=f,fr(e),e4.T=d}}jR=1,i3?jY=gd(g,a.containerInfo,j$,ef,eg,ee,eh,ek,ed,null,null):(ef(),eg(),eh())}(a,b,c,h,i,j,m)}}function ed(a){0!==jR&&(0,jS.onRecoverableError)(a,{componentStack:null})}function ee(){3===jR&&(jR=0,dB(jT,jS),jR=4)}function ef(){if(1===jR){jR=0;var a=jS,b=jT,c=jU,d=(13878&b.flags)!=0;if((13878&b.subtreeFlags)!=0||d){d=e4.T,e4.T=null;var e=fs();fr(2);var f=jt;jt|=4;try{je=jf=!1,dy(b,a,c),fc(a.containerInfo)}finally{jt=f,fr(e),e4.T=d}}a.current=b,jR=2}}function eg(){if(2===jR){jR=0;var a=jS,b=jT,c=(8772&b.flags)!=0;if((8772&b.subtreeFlags)!=0||c){c=e4.T,e4.T=null;var d=fs();fr(2);var e=jt;jt|=4;try{dq(a,b.alternate,b)}finally{jt=e,fr(d),e4.T=c}}jR=3}}function eh(){if(4===jR||3===jR){jR=0;var a=jY;jY=null,hz();var b=jS,c=jT,d=jU,e=jX,f=(0x13ffff00&d)===d?10262:10256;if((c.subtreeFlags&f)!=0||(c.flags&f)!=0?jR=5:(jR=0,jT=jS=null,ei(b,b.pendingLanes)),0===(f=b.pendingLanes)&&(jQ=null),x(d),c=c.stateNode,hI&&"function"==typeof hI.onCommitFiberRoot)try{hI.onCommitFiberRoot(hH,c,void 0,(128&c.current.flags)==128)}catch{}if(null!==e){c=e4.T,f=fs(),fr(2),e4.T=null;try{for(var g=b.onRecoverableError,h=0;h<e.length;h++){var i=e[h];g(i.value,{componentStack:i.stack})}}finally{e4.T=c,fr(f)}}if(e=jZ,g=j$,j$=null,null!==e&&(jZ=null,null===g&&(g=[]),null!==a))for(i=0;i<e.length;i++)void 0!==(c=(0,e[i])(g))&&gf(a,c);(3&jU)!=0&&ej(),aj(b),f=b.pendingLanes,(261930&d)!=0&&(42&f)!=0?b===j0?j_++:(j_=0,j0=b):(j_=0,j0=null),fo&&gV(),ak(0,!1)}}function ei(a,b){0==(a.pooledCacheLanes&=b)&&null!=(b=a.pooledCache)&&(a.pooledCache=null,ag(b))}function ej(){return null!==jY&&(ge(jY),jY=null),ef(),eg(),eh(),ek()}function ek(){if(5!==jR)return!1;var a=jS,b=jV;jV=0;var c=x(jU),e=32>c?32:c;c=e4.T;var f=fs();try{fr(e),e4.T=null,e=jW,jW=null;var g=jS,h=jU;if(jR=0,jT=jS=null,jU=0,(6&jt)!=0)throw Error(d(331));var i=jt;if(jt|=4,dM(g.current),dG(g,g.current,h,e),jt=i,ak(0,!1),hI&&"function"==typeof hI.onPostCommitFiberRoot)try{hI.onPostCommitFiberRoot(hH,g)}catch{}return!0}finally{fr(f),e4.T=c,ei(a,b)}}function el(a,b,c){b=G(c,b),b=ce(a.stateNode,b,2),null!==(a=aO(a,b,2))&&(s(a,2),aj(a))}function em(a,b,c){if(3===a.tag)el(a,a,c);else for(;null!==b;){if(3===b.tag){el(b,a,c);break}if(1===b.tag){var d=b.stateNode;if("function"==typeof b.type.getDerivedStateFromError||"function"==typeof d.componentDidCatch&&(null===jQ||!jQ.has(d))){a=G(c,a),null!==(d=aO(b,c=cf(2),2))&&(cg(c,d,b,a),s(d,2),aj(d));break}}b=b.return}}function en(a,b,c){var d=a.pingCache;if(null===d){d=a.pingCache=new js;var e=new Set;d.set(b,e)}else void 0===(e=d.get(b))&&(e=new Set,d.set(b,e));e.has(c)||(jB=!0,e.add(c),a=eo.bind(null,a,b,c),b.then(a,a))}function eo(a,b,c){var d=a.pingCache;null!==d&&d.delete(b),a.pingedLanes|=a.suspendedLanes&c,a.warmLanes&=~c,ju===a&&(jw&c)===c&&((4===jD||3===jD&&(0x3c00000&jw)===jw&&300>hA()-jM)&&(2&jt)==0?d0(a,0):jG|=c,jI===jw&&(jI=0)),aj(a)}function ep(a,b){0===b&&(b=q()),null!==(a=aI(a,b))&&(s(a,b),aj(a))}function eq(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane),ep(a,c)}function er(a,b){var c=0;switch(a.tag){case 31:case 13:var e=a.stateNode,f=a.memoizedState;null!==f&&(c=f.retryLane);break;case 19:e=a.stateNode;break;case 22:e=a.stateNode._retryCache;break;default:throw Error(d(314))}null!==e&&e.delete(b),ep(a,c)}function es(a,b,c,d){this.tag=a,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=b,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function et(a){return!(!(a=a.prototype)||!a.isReactComponent)}function eu(a,c){var d=a.alternate;return null===d?((d=b(a.tag,c,a.key,a.mode)).elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=c,d.type=a.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=0x47f00000&a.flags,d.childLanes=a.childLanes,d.lanes=a.lanes,d.child=a.child,d.memoizedProps=a.memoizedProps,d.memoizedState=a.memoizedState,d.updateQueue=a.updateQueue,c=a.dependencies,d.dependencies=null===c?null:{lanes:c.lanes,firstContext:c.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d.refCleanup=a.refCleanup,d}function ev(a,b){a.flags&=0x47f00002;var c=a.alternate;return null===c?(a.childLanes=0,a.lanes=b,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=c.childLanes,a.lanes=c.lanes,a.child=c.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=c.memoizedProps,a.memoizedState=c.memoizedState,a.updateQueue=c.updateQueue,a.type=c.type,a.dependencies=null===(b=c.dependencies)?null:{lanes:b.lanes,firstContext:b.firstContext}),a}function ew(a,c,e,f,g,h){var i=0;if("function"==typeof(f=a))et(f)&&(i=1);else if("string"==typeof f)i=g3&&hh?g4(a,e,hY.current)?26:hl(a)?27:5:g3?g4(a,e,hY.current)?26:5:hh&&hl(a)?27:5;else f:switch(f){case eX:return(a=b(31,e,c,g)).elementType=eX,a.lanes=h,a;case eN:return ex(e.children,g,h,c);case eO:i=8,g|=24;break;case eP:return(a=b(12,e,c,2|g)).elementType=eP,a.lanes=h,a;case eT:return(a=b(13,e,c,g)).elementType=eT,a.lanes=h,a;case eU:return(a=b(19,e,c,g)).elementType=eU,a.lanes=h,a;case eY:case e$:return(a=b(30,e,c,a=32|g)).elementType=e$,a.lanes=h,a.stateNode={autoName:null,paired:null,clones:null,ref:null},a;default:if("object"==typeof f&&null!==f)switch(f.$$typeof){case eR:i=10;break f;case eQ:i=9;break f;case eS:i=11;break f;case eV:i=14;break f;case eW:i=16,f=null;break f}i=29,e=Error(d(130,null===a?"null":typeof a,"")),f=null}return(c=b(i,e,c,g)).elementType=a,c.type=f,c.lanes=h,c}function ex(a,c,d,e){return(a=b(7,a,e,c)).lanes=d,a}function ey(a,c,d){return(a=b(6,a,null,c)).lanes=d,a}function ez(a){var c=b(18,null,null,0);return c.stateNode=a,c}function eA(a,c,d){return(c=b(4,null!==a.children?a.children:[],a.key,c)).lanes=d,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}function eB(a,b,c,d,e,f,g,h,i){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=fk,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=r(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=r(0),this.hiddenUpdates=r(null),this.identifierPrefix=d,this.onUncaughtError=e,this.onCaughtError=f,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=i,this.transitionTypes=null,this.incompleteTransitions=new Map}function eC(a,c,d,e,f,g,h,i,j,k,l,m){return a=new eB(a,c,d,h,j,k,l,m,i),c=1,!0===g&&(c|=24),g=b(3,null,null,c),a.current=g,g.stateNode=a,c=af(),c.refCount++,a.pooledCache=c,c.refCount++,g.memoizedState={element:e,isDehydrated:d,cache:c},aL(g),a}function eD(a){var b=a._reactInternals;if(void 0===b)throw"function"==typeof a.render?Error(d(188)):Error(d(268,a=Object.keys(a).join(",")));return null===(a=null!==(a=g(b))?function a(b){var c=b.tag;if(5===c||26===c||27===c||6===c)return b;for(b=b.child;null!==b;){if(null!==(c=a(b)))return c;b=b.sibling}return null}(a):null)?null:e8(a.stateNode)}function eE(a,b,c,d,e,f){e=hp,null===d.context?d.context=e:d.pendingContext=e,(d=aN(b)).payload={element:c},null!==(f=void 0===f?null:f)&&(d.callback=f),null!==(c=aO(a,d,b))&&(dW(c,a,b),aP(c,a,b))}function eF(a,b){if(null!==(a=a.memoizedState)&&null!==a.dehydrated){var c=a.retryLane;a.retryLane=0!==c&&c<b?c:b}}function eG(a,b){eF(a,b),(a=a.alternate)&&eF(a,b)}var eH={},eI=C(),eJ=Object.assign,eK=Symbol.for("react.element"),eL=Symbol.for("react.transitional.element"),eM=Symbol.for("react.portal"),eN=Symbol.for("react.fragment"),eO=Symbol.for("react.strict_mode"),eP=Symbol.for("react.profiler"),eQ=Symbol.for("react.consumer"),eR=Symbol.for("react.context"),eS=Symbol.for("react.forward_ref"),eT=Symbol.for("react.suspense"),eU=Symbol.for("react.suspense_list"),eV=Symbol.for("react.memo"),eW=Symbol.for("react.lazy"),eX=Symbol.for("react.activity"),eY=Symbol.for("react.legacy_hidden"),eZ=Symbol.for("react.memo_cache_sentinel"),e$=Symbol.for("react.view_transition"),e_=Symbol.for("react.recoverable"),e0=Symbol.iterator,e1=Symbol.for("react.optimistic_key"),e2=Symbol.for("react.client.reference"),e3=Array.isArray,e4=eI.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,e5=a.rendererVersion,e6=a.rendererPackageName,e7=a.extraDevToolsConfig,e8=a.getPublicInstance,e9=a.getRootHostContext,fa=a.getChildHostContext,fb=a.prepareForCommit,fc=a.resetAfterCommit,fd=a.createInstance;a.cloneMutableInstance;var fe=a.appendInitialChild,ff=a.finalizeInitialChildren,fg=a.shouldSetTextContent,fh=a.createTextInstance;a.cloneMutableTextInstance;var fi=a.scheduleTimeout,fj=a.cancelTimeout,fk=a.noTimeout,fl=a.isPrimaryRenderer;a.warnsIfNotActing;var fm=a.supportsMutation,fn=a.supportsPersistence,fo=a.supportsHydration,fp=a.getInstanceFromNode;a.beforeActiveInstanceBlur;var fq=a.preparePortalMount;a.prepareScopeUpdate,a.getInstanceFromScope;var fr=a.setCurrentUpdatePriority,fs=a.getCurrentUpdatePriority,ft=a.resolveUpdatePriority;a.trackSchedulerEvent,a.resolveEventType,a.resolveEventTimeStamp;var fu=a.shouldAttemptEagerTransition,fv=a.detachDeletedInstance;a.requestPostPaintCallback;var fw=a.maySuspendCommit,fx=a.maySuspendCommitOnUpdate,fy=a.maySuspendCommitInSyncRender,fz=a.preloadInstance,fA=a.startSuspendingCommit,fB=a.suspendInstance,fC=a.suspendOnActiveViewTransition,fD=a.waitForCommitToBeReady;a.getSuspendedCommitReason;var fE=a.NotPendingTransition,fF=a.HostTransitionContext,fG=a.resetFormInstance;a.bindToConsole;var fH=a.supportsMicrotasks,fI=a.scheduleMicrotask,fJ=a.supportsTestSelectors,fK=a.findFiberRoot,fL=a.getBoundingRect,fM=a.getTextContent,fN=a.isHiddenSubtree,fO=a.matchAccessibilityRole,fP=a.setFocusIfFocusable,fQ=a.setupIntersectionObserver,fR=a.appendChild,fS=a.appendChildToContainer,fT=a.commitTextUpdate,fU=a.commitMount,fV=a.commitUpdate,fW=a.insertBefore,fX=a.insertInContainerBefore,fY=a.removeChild,fZ=a.removeChildFromContainer,f$=a.resetTextContent,f_=a.hideInstance,f0=a.hideTextInstance,f1=a.unhideInstance,f2=a.unhideTextInstance,f3=a.applyViewTransitionName,f4=a.restoreViewTransitionName,f5=a.cancelViewTransitionName,f6=a.cancelRootViewTransitionName,f7=a.restoreRootViewTransitionName;a.cloneRootViewTransitionContainer,a.removeRootViewTransitionClone;var f8=a.measureInstance,f9=a.measureClonedInstance,ga=a.wasInstanceInViewport,gb=a.hasInstanceChanged,gc=a.hasInstanceAffectedParent,gd=a.startViewTransition;a.startGestureTransition;var ge=a.stopViewTransition,gf=a.addViewTransitionFinishedListener;a.getCurrentGestureOffset;var gg=a.createViewTransitionInstance,gh=a.clearContainer,gi=a.createFragmentInstance,gj=a.updateFragmentInstanceFiber,gk=a.commitNewChildToFragmentInstance,gl=a.deleteChildFromFragmentInstance,gm=a.cloneInstance,gn=a.createContainerChildSet,go=a.appendChildToContainerChildSet,gp=a.finalizeContainerChildren,gq=a.replaceContainerChildren,gr=a.cloneHiddenInstance,gs=a.cloneHiddenTextInstance,gt=a.isSuspenseInstancePending,gu=a.isSuspenseInstanceFallback,gv=a.getSuspenseInstanceFallbackErrorDetails,gw=a.registerSuspenseInstanceRetry,gx=a.canHydrateFormStateMarker,gy=a.isFormStateMarkerMatching,gz=a.getNextHydratableSibling,gA=a.getNextHydratableSiblingAfterSingleton,gB=a.getFirstHydratableChild,gC=a.getFirstHydratableChildWithinContainer,gD=a.getFirstHydratableChildWithinActivityInstance,gE=a.getFirstHydratableChildWithinSuspenseInstance,gF=a.getFirstHydratableChildWithinSingleton,gG=a.canHydrateInstance,gH=a.canHydrateTextInstance,gI=a.canHydrateActivityInstance,gJ=a.canHydrateSuspenseInstance,gK=a.hydrateInstance,gL=a.hydrateTextInstance,gM=a.hydrateActivityInstance,gN=a.hydrateSuspenseInstance,gO=a.getNextHydratableInstanceAfterActivityInstance,gP=a.getNextHydratableInstanceAfterSuspenseInstance,gQ=a.commitHydratedInstance,gR=a.commitHydratedContainer,gS=a.commitHydratedActivityInstance,gT=a.commitHydratedSuspenseInstance,gU=a.finalizeHydratedChildren,gV=a.flushHydrationEvents;a.clearActivityBoundary;var gW=a.clearSuspenseBoundary;a.clearActivityBoundaryFromContainer;var gX=a.clearSuspenseBoundaryFromContainer,gY=a.hideDehydratedBoundary,gZ=a.unhideDehydratedBoundary,g$=a.shouldDeleteUnhydratedTailInstances;a.diffHydratedPropsForDevWarnings,a.diffHydratedTextForDevWarnings,a.describeHydratableInstanceForDevWarnings;var g_,g0,g1=a.validateHydratableInstance,g2=a.validateHydratableTextInstance,g3=a.supportsResources,g4=a.isHostHoistableType,g5=a.getHoistableRoot,g6=a.getResource,g7=a.acquireResource,g8=a.releaseResource,g9=a.hydrateHoistable,ha=a.mountHoistable,hb=a.unmountHoistable,hc=a.createHoistableInstance,hd=a.prepareToCommitHoistables,he=a.mayResourceSuspendCommit,hf=a.preloadResource,hg=a.suspendResource,hh=a.supportsSingletons,hi=a.resolveSingletonInstance,hj=a.acquireSingletonInstance,hk=a.releaseSingletonInstance,hl=a.isHostSingletonType,hm=a.isSingletonScope,hn=[],ho=-1,hp={},hq=Math.clz32?Math.clz32:function(a){return 0==(a>>>=0)?32:31-(hr(a)/hs|0)|0},hr=Math.log,hs=Math.LN2,ht=256,hu=262144,hv=4194304,hw=n$.unstable_scheduleCallback,hx=n$.unstable_cancelCallback,hy=n$.unstable_shouldYield,hz=n$.unstable_requestPaint,hA=n$.unstable_now,hB=n$.unstable_ImmediatePriority,hC=n$.unstable_UserBlockingPriority,hD=n$.unstable_NormalPriority,hE=n$.unstable_IdlePriority,hF=n$.log,hG=n$.unstable_setDisableYieldValue,hH=null,hI=null,hJ=0,hK="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},hL="function"==typeof reportError?reportError:function(a){"object"==typeof process&&"function"==typeof process.emit?process.emit("uncaughtException",a):console.error(a)},hM=Object.prototype.hasOwnProperty,hN=!1,hO=new WeakMap,hP=[],hQ=0,hR=null,hS=0,hT=[],hU=0,hV=null,hW=1,hX="",hY=j(null),hZ=j(null),h$=j(null),h_=j(null),h0=null,h1=null,h2=!1,h3=null,h4=!1,h5=Error(d(519)),h6=j(null),h7=null,h8=null,h9="u">typeof AbortController?AbortController:function(){var a=[],b=this.signal={aborted:!1,addEventListener:function(b,c){a.push(c)}};this.abort=function(){b.aborted=!0,a.forEach(function(a){return a()})}},ia=n$.unstable_scheduleCallback,ib=n$.unstable_NormalPriority,ic={$$typeof:eR,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},id=null,ie=null,ig=null,ih=!1,ii=!1,ij=!1,ik=0,il=null,im=0,io=0,ip=null,iq=e4.S;e4.S=function(a,b){if(jN=hA(),"object"==typeof b&&null!==b&&"function"==typeof b.then&&function(a){if(null===il){var b=il=[];im=0,io=aq(),ip={status:"pending",value:void 0,then:function(a){b.push(a)}}}im++,a.then(ar,ar)}(b),null!==id)for(var c=ie;null!==c;)ah(c,id),c=c.next;if(null!=(c=a.types)){for(var d=ie;null!==d;)ah(d,c),d=d.next;if(0!==io){null===(d=id)&&(d=id=[]);for(var e=0;e<c.length;e++){var f=c[e];-1===d.indexOf(f)&&d.push(f)}}}null!==iq&&iq(a,b)};var ir=j(null),is=Error(d(460)),it=Error(d(474)),iu=Error(d(542)),iv={then:function(){}},iw=null,ix=null,iy=0,iz=aE(!0),iA=aE(!1),iB=[],iC=0,iD=0,iE=!1,iF=!1,iG=j(null),iH=j(0),iI=j(null),iJ=null,iK=j(0),iL=0,iM=null,iN=null,iO=null,iP=!1,iQ=!1,iR=!1,iS=0,iT=0,iU=null,iV=0,iW={readContext:ac,use:bh,useCallback:a4,useContext:a4,useEffect:a4,useImperativeHandle:a4,useLayoutEffect:a4,useInsertionEffect:a4,useMemo:a4,useReducer:a4,useRef:a4,useState:a4,useDebugValue:a4,useDeferredValue:a4,useTransition:a4,useSyncExternalStore:a4,useId:a4,useHostTransitionStatus:a4,useFormState:a4,useActionState:a4,useOptimistic:a4,useMemoCache:a4,useCacheRefresh:a4,useEffectEvent:a4},iX={readContext:ac,use:bh,useCallback:function(a,b){return bd().memoizedState=[a,void 0===b?null:b],a},useContext:ac,useEffect:bL,useImperativeHandle:function(a,b,c){c=null!=c?c.concat([a]):null,bJ(4194308,4,bQ.bind(null,b,a),c)},useLayoutEffect:function(a,b){return bJ(4194308,4,a,b)},useInsertionEffect:function(a,b){bJ(4,2,a,b)},useMemo:function(a,b){var c=bd();b=void 0===b?null:b;var d=a();if(iR){y(!0);try{a()}finally{y(!1)}}return c.memoizedState=[d,b],d},useReducer:function(a,b,c){var d=bd();if(void 0!==c){var e=c(b);if(iR){y(!0);try{c(b)}finally{y(!1)}}}else e=b;return d.memoizedState=d.baseState=e,d.queue=a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:e},a=a.dispatch=b1.bind(null,iM,a),[d.memoizedState,a]},useRef:function(a){return bd().memoizedState={current:a}},useState:function(a){var b=(a=bt(a)).queue,c=b2.bind(null,iM,b);return b.dispatch=c,[a.memoizedState,c]},useDebugValue:bS,useDeferredValue:function(a,b){return bV(bd(),a,b)},useTransition:function(){var a=bt(!1);return a=bX.bind(null,iM,a.queue,!0,!1),bd().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,b,c){var e=iM,f=bd();if(h2){if(void 0===c)throw Error(d(407));c=c()}else{if(c=b(),null===ju)throw Error(d(349));(127&jw)!=0||bo(e,b,c)}f.memoizedState=c;var g={value:c,getSnapshot:b};return f.queue=g,bL(bq.bind(null,e,g,a),[a]),e.flags|=2048,bH(9,{destroy:void 0},bp.bind(null,e,g,c,b),null),c},useId:function(){var a=bd(),b=ju.identifierPrefix;if(h2){var c=hX,d=hW;b="_"+b+"R_"+(c=(d&~(1<<32-hq(d)-1)).toString(32)+c),0<(c=iS++)&&(b+="H"+c.toString(32)),b+="_"}else b="_"+b+"r_"+(c=iV++).toString(32)+"_";return a.memoizedState=b},useHostTransitionStatus:bZ,useFormState:bC,useActionState:bC,useOptimistic:function(a){var b=bd();b.memoizedState=b.baseState=a;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return b.queue=c,b=b4.bind(null,iM,!0,c),c.dispatch=b,[a,b]},useMemoCache:bi,useCacheRefresh:function(){return bd().memoizedState=b0.bind(null,iM)},useEffectEvent:function(a){var b=bd(),c={impl:a};return b.memoizedState=c,function(){if((2&jt)!=0)throw Error(d(440));return c.impl.apply(void 0,arguments)}}},iY={readContext:ac,use:bh,useCallback:bT,useContext:ac,useEffect:bM,useImperativeHandle:bR,useInsertionEffect:bO,useLayoutEffect:bP,useMemo:bU,useReducer:bk,useRef:bI,useState:function(){return bk(bj)},useDebugValue:bS,useDeferredValue:function(a,b){return bW(be(),iN.memoizedState,a,b)},useTransition:function(){var a=bk(bj)[0],b=be().memoizedState;return["boolean"==typeof a?a:bg(a),b]},useSyncExternalStore:bn,useId:b$,useHostTransitionStatus:bZ,useFormState:bD,useActionState:bD,useOptimistic:function(a,b){return bu(be(),iN,a,b)},useMemoCache:bi,useCacheRefresh:b_,useEffectEvent:bN},iZ={readContext:ac,use:bh,useCallback:bT,useContext:ac,useEffect:bM,useImperativeHandle:bR,useInsertionEffect:bO,useLayoutEffect:bP,useMemo:bU,useReducer:bm,useRef:bI,useState:function(){return bm(bj)},useDebugValue:bS,useDeferredValue:function(a,b){var c=be();return null===iN?bV(c,a,b):bW(c,iN.memoizedState,a,b)},useTransition:function(){var a=bm(bj)[0],b=be().memoizedState;return["boolean"==typeof a?a:bg(a),b]},useSyncExternalStore:bn,useId:b$,useHostTransitionStatus:bZ,useFormState:bG,useActionState:bG,useOptimistic:function(a,b){var c=be();return null!==iN?bu(c,iN,a,b):(c.baseState=a,[a,c.queue.dispatch])},useMemoCache:bi,useCacheRefresh:b_,useEffectEvent:bN},i$={enqueueSetState:function(a,b,c){a=a._reactInternals;var d=dT(),e=aN(d);e.payload=b,null!=c&&(e.callback=c),null!==(b=aO(a,e,d))&&(dW(b,a,d),aP(b,a,d))},enqueueReplaceState:function(a,b,c){a=a._reactInternals;var d=dT(),e=aN(d);e.tag=1,e.payload=b,null!=c&&(e.callback=c),null!==(b=aO(a,e,d))&&(dW(b,a,d),aP(b,a,d))},enqueueForceUpdate:function(a,b){a=a._reactInternals;var c=dT(),d=aN(c);d.tag=2,null!=b&&(d.callback=b),null!==(b=aO(a,d,c))&&(dW(b,a,c),aP(b,a,c))}},i_=Error(d(461)),i0=!1,i1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},i2=!1,i3=!1,i4=null,i5=null,i6=0,i7=!1,i8=!1,i9=!1,ja=!1,jb="function"==typeof WeakSet?WeakSet:Set,jc=null,jd=!1,je=!1,jf=!1,jg=!1,jh=null,ji=!1,jj=null,jk=8192,jl={getCacheForType:function(a){var b=ac(ic),c=b.data.get(a);return void 0===c&&(c=a(),b.data.set(a,c)),c},cacheSignal:function(){return ac(ic).controller.signal}},jm=0,jn=1,jo=2,jp=3,jq=4;if("function"==typeof Symbol&&Symbol.for){var jr=Symbol.for;jm=jr("selector.component"),jn=jr("selector.has_pseudo_class"),jo=jr("selector.role"),jp=jr("selector.test_id"),jq=jr("selector.text")}var js="function"==typeof WeakMap?WeakMap:Map,jt=0,ju=null,jv=null,jw=0,jx=0,jy=null,jz=!1,jA=!1,jB=!1,jC=0,jD=0,jE=0,jF=0,jG=0,jH=0,jI=0,jJ=null,jK=null,jL=!1,jM=0,jN=0,jO=1/0,jP=null,jQ=null,jR=0,jS=null,jT=null,jU=0,jV=0,jW=null,jX=null,jY=null,jZ=null,j$=null,j_=0,j0=null;return eH.attemptContinuousHydration=function(a){if(13===a.tag||31===a.tag){var b=aI(a,0x4000000);null!==b&&dW(b,a,0x4000000),eG(a,0x4000000)}},eH.attemptHydrationAtCurrentPriority=function(a){if(13===a.tag||31===a.tag){var b=dT(),c=aI(a,b=w(b));null!==c&&dW(c,a,b),eG(a,b)}},eH.attemptSynchronousHydration=function(a){switch(a.tag){case 3:if((a=a.stateNode).current.memoizedState.isDehydrated){var b=m(a.pendingLanes);if(0!==b){for(a.pendingLanes|=2,a.entangledLanes|=2;b;){var c=1<<31-hq(b);a.entanglements[1]|=c,b&=~c}aj(a),(6&jt)==0&&(jO=hA()+500,ak(0,!1))}}break;case 31:case 13:null!==(b=aI(a,2))&&dW(b,a,2),d$(),eG(a,2)}},eH.batchedUpdates=function(a,b){return a(b)},eH.createComponentSelector=function(a){return{$$typeof:jm,value:a}},eH.createContainer=function(a,b,c,d,e,f,g,h,i,j){return eC(a,b,!1,null,c,d,f,null,g,h,i,j)},eH.createHasPseudoClassSelector=function(a){return{$$typeof:jn,value:a}},eH.createHydrationContainer=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o;return(a=eC(c,d,!0,a,e,f,h,n,i,j,k,l)).context=hp,c=a.current,(e=aN(d=w(d=dT()))).callback=null!=(o=b)?o:null,aO(c,e,d),b=d,a.current.lanes=b,s(a,b),aj(a),a},eH.createPortal=function(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:eM,key:null==d?null:d===e1?e1:""+d,children:a,containerInfo:b,implementation:c}},eH.createRoleSelector=function(a){return{$$typeof:jo,value:a}},eH.createTestNameSelector=function(a){return{$$typeof:jp,value:a}},eH.createTextSelector=function(a){return{$$typeof:jq,value:a}},eH.defaultOnCaughtError=function(a){console.error(a)},eH.defaultOnRecoverableError=function(a){hL(a)},eH.defaultOnUncaughtError=function(a){hL(a)},eH.deferredUpdates=function(a){var b=e4.T,c=fs();try{return fr(32),e4.T=null,a()}finally{fr(c),e4.T=b}},eH.discreteUpdates=function(a,b,c,d,e){var f=e4.T,g=fs();try{return fr(2),e4.T=null,a(b,c,d,e)}finally{fr(g),e4.T=f,0===jt&&(jO=hA()+500)}},eH.findAllNodes=dS,eH.findBoundingRects=function(a,b){if(!fJ)throw Error(d(363));b=dS(a,b),a=[];for(var c=0;c<b.length;c++)a.push(fL(b[c]));for(b=a.length-1;0<b;b--){c=a[b];for(var e=c.x,f=e+c.width,g=c.y,h=g+c.height,i=b-1;0<=i;i--)if(b!==i){var j=a[i],k=j.x,l=k+j.width,m=j.y,n=m+j.height;if(e>=k&&g>=m&&f<=l&&h<=n){a.splice(b,1);break}if(e!==k||c.width!==j.width||n<g||m>h){if(!(g!==m||c.height!==j.height||l<e||k>f)){k>e&&(j.width+=k-e,j.x=e),l<f&&(j.width=f-k),a.splice(b,1);break}}else{m>g&&(j.height+=m-g,j.y=g),n<h&&(j.height=h-m),a.splice(b,1);break}}}return a},eH.findHostInstance=eD,eH.findHostInstanceWithNoPortals=function(a){return null===(a=null!==(a=g(a))?function a(b){var c=b.tag;if(5===c||26===c||27===c||6===c)return b;for(b=b.child;null!==b;){if(4!==b.tag&&null!==(c=a(b)))return c;b=b.sibling}return null}(a):null)?null:e8(a.stateNode)},eH.findHostInstanceWithWarning=function(a){return eD(a)},eH.flushPassiveEffects=ej,eH.flushSyncFromReconciler=function(a){var b=jt;jt|=1;var c=e4.T,d=fs();try{if(fr(2),e4.T=null,a)return a()}finally{fr(d),e4.T=c,(6&(jt=b))==0&&ak(0,!1)}},eH.flushSyncWork=d$,eH.focusWithin=function(a,b){if(!fJ)throw Error(d(363));for(b=Array.from(b=dR(a=dO(a),b)),a=0;a<b.length;){var c=b[a++],e=c.tag;if(!fN(c)){if((5===e||26===e||27===e)&&fP(c.stateNode))return!0;for(c=c.child;null!==c;)b.push(c),c=c.sibling}}return!1},eH.getFindAllNodesFailureDescription=function(a,b){if(!fJ)throw Error(d(363));var c=0,e=[];a=[dO(a),0];for(var f=0;f<a.length;){var g=a[f++],h=g.tag,i=a[f++],j=b[i];if((5!==h&&26!==h&&27!==h||!fN(g))&&(dP(g,j)&&(e.push(dQ(j)),++i>c&&(c=i)),i<b.length))for(g=g.child;null!==g;)a.push(g,i),g=g.sibling}if(c<b.length){for(a=[];c<b.length;c++)a.push(dQ(b[c]));return`findAllNodes was able to match part of the selector:
350
+ `+e.join(" > ")+`
351
+
352
+ No matching component was found for:
353
+ `+a.join(" > ")}return null},eH.getPublicRootInstance=function(a){if(!(a=a.current).child)return null;switch(a.child.tag){case 27:case 5:return e8(a.child.stateNode);default:return a.child.stateNode}},eH.injectIntoDevTools=function(){var a={bundleType:0,version:e5,rendererPackageName:e6,currentDispatcherRef:e4,reconcilerVersion:"19.3.0"};if(null!==e7&&(a.rendererConfig=e7),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var b=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(b.isDisabled||!b.supportsFiber)a=!0;else{try{hH=b.inject(a),hI=b}catch{}a=!!b.checkDCE}}return a},eH.isAlreadyRendering=function(){return(6&jt)!=0},eH.observeVisibleRects=function(a,b,c,e){if(!fJ)throw Error(d(363));var f=fQ(a=dS(a,b),c,e).disconnect;return{disconnect:function(){f()}}},eH.shouldError=function(){return null},eH.shouldSuspend=function(){return!1},eH.startHostTransition=function(a,b,e,f){if(5!==a.tag)throw Error(d(476));var g=bY(a).queue;bX(a,g,b,fE,null===e?c:function(){var b=bY(a);return null===b.next&&(b=a.alternate.memoizedState),b3(a,b.next.queue,{},dT()),e(f)})},eH.updateContainer=function(a,b,c,d){var e=b.current,f=dT();return eE(e,f,a,b,c,d),f},eH.updateContainerSync=function(a,b,c,d){return eE(b.current,2,a,b,c,d),2},eH},oJ.exports.default=oJ.exports,Object.defineProperty(oJ.exports,"__esModule",{value:!0})),oI.exports=oJ.exports),(v=oI.exports)&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default"))?v.default:v,oL={},oM=/^three(?=[A-Z])/,oN=a=>`${a[0].toUpperCase()}${a.slice(1)}`,oO=0;function oP(a,b){let c=oN(a),d=oL[c];if("primitive"!==a&&!d)throw Error(`R3F: ${c} 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"===a&&!b.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==b.args&&!Array.isArray(b.args))throw Error("R3F: The args prop must be an array!")}function oQ(a){if(a.isHidden){var b,c;a.props.attach&&null!=(b=a.parent)&&b.object?on(a.parent,a):ov(a.object)&&(a.object.visible=null==(c=a.previousVisible)||c),a.previousVisible=void 0,a.isHidden=!1,ou(a)}}function oR(a,b,c){let d=b.root.getState();if(a.parent||a.object===d.scene){if(!b.object){var e,f;let a=oL[oN(b.type)];b.object=null!=(e=b.props.object)?e:new a(...null!=(f=b.props.args)?f:[]),b.object.__r3f=b}if(ot(b.object,b.props),b.props.attach)on(a,b);else if(ov(b.object)&&ov(a.object)){let d=a.object.children.indexOf(null==c?void 0:c.object);if(c&&-1!==d){let c=a.object.children.indexOf(b.object);-1!==c?(a.object.children.splice(c,1),a.object.children.splice(c<d?d-1:d,0,b.object)):(b.object.parent=a.object,a.object.children.splice(d,0,b.object),b.object.dispatchEvent({type:"added"}),a.object.dispatchEvent({type:"childadded",child:b.object}))}else a.object.add(b.object)}for(let a of b.children)oR(b,a);ou(b)}}function oS(a,b){if(b){if(b.parent===a){let c=a.children.indexOf(b);-1!==c&&a.children.splice(c,1)}b.parent=a,a.children.push(b),oR(a,b)}}function oT(a,b,c){if(!b||!c)return;if(b.parent===a){let c=a.children.indexOf(b);-1!==c&&a.children.splice(c,1)}b.parent=a;let d=a.children.indexOf(c);-1!==d?a.children.splice(d,0,b):a.children.push(b),oR(a,b,c)}function oU(a){if("function"==typeof a.dispose){let b=()=>{try{a.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?b():(0,n$.unstable_scheduleCallback)(n$.unstable_IdlePriority,b)}}function oV(a,b,c){if(!b)return;b.parent=null;let d=a.children.indexOf(b);-1!==d&&a.children.splice(d,1),b.props.attach?oo(a,b):ov(b.object)&&ov(a.object)&&(a.object.remove(b.object),function(a,b){let{internal:c}=a.getState();c.interaction=c.interaction.filter(a=>a!==b),c.initialHits=c.initialHits.filter(a=>a!==b),c.hovered.forEach((a,d)=>{(a.eventObject===b||a.object===b)&&c.hovered.delete(d)}),c.capturedMap.forEach((a,d)=>{ox(c.capturedMap,b,a,d)})}(n6(b),b.object));let e=null!==b.props.dispose&&!1!==c;for(let a=b.children.length-1;a>=0;a--){let c=b.children[a];oV(b,c,e)}b.children.length=0,delete b.object.__r3f,e&&"primitive"!==b.type&&"Scene"!==b.object.type&&oU(b.object),void 0===c&&ou(b)}let oW=[],oX=()=>{},oY={},oZ=0,o$=(w={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(a,b,c){var d;return oP(a=oN(a)in oL?a:a.replace(oM,""),b),"primitive"===a&&null!=(d=b.object)&&d.__r3f&&delete b.object.__r3f,ok(b.object,c,a,b)},removeChild:oV,appendChild:oS,appendInitialChild:oS,insertBefore:oT,appendChildToContainer(a,b){let c=a.getState().scene.__r3f;b&&c&&oS(c,b)},removeChildFromContainer(a,b){let c=a.getState().scene.__r3f;b&&c&&oV(c,b)},insertInContainerBefore(a,b,c){let d=a.getState().scene.__r3f;b&&c&&d&&oT(d,b,c)},getRootHostContext:()=>oY,getChildHostContext:()=>oY,commitUpdate(a,b,c,d,e){var f,g,h;oP(b,d);let i=!1;if("primitive"===a.type&&c.object!==d.object||(null==(f=d.args)?void 0:f.length)!==(null==(g=c.args)?void 0:g.length)?i=!0:null!=(h=d.args)&&h.some((a,b)=>{var d;return a!==(null==(d=c.args)?void 0:d[b])})&&(i=!0),i)oW.push([a,oj(d),e]);else{let b=function(a,b){let c={};for(let d in b)if(!op.includes(d)&&!oh.equ(b[d],a.props[d]))for(let a in c[d]=b[d],b)a.startsWith(`${d}-`)&&(c[a]=b[a]);for(let d in a.props){if(op.includes(d)||b.hasOwnProperty(d))continue;let{root:e,key:f}=ol(a.object,d);if(e.constructor&&0===e.constructor.length){let a=function(a){let b=oq.get(a.constructor);try{b||(b=new a.constructor,oq.set(a.constructor,b))}catch(a){}return b}(e);oh.und(a)||(c[d]=a[f])}else c[d]=0}return c}(a,d),c=a.props.attach;a.props=oj(d),void 0!==c?a.props.attach=c:delete a.props.attach,Object.keys(b).length&&ot(a.object,b)}},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:a=>null==a?void 0:a.object,prepareForCommit:()=>null,preparePortalMount:a=>ok(a.getState().scene,a,"",{}),resetAfterCommit:function(){if(0!==oW.length)try{!function(){for(let[a]of oW){let b=a.parent;if(b)for(let c of(a.props.attach?oo(b,a):ov(a.object)&&ov(b.object)&&b.object.remove(a.object),a.children))c.props.attach?oo(a,c):ov(c.object)&&ov(a.object)&&a.object.remove(c.object);a.isHidden&&oQ(a),a.object.__r3f&&delete a.object.__r3f,"primitive"!==a.type&&oU(a.object)}for(let[d,e,f]of oW){d.props=e;let g=d.parent;if(g){let e=oL[oN(d.type)],h=d.object;d.object=null!=(a=d.props.object)?a:new e(...null!=(b=d.props.args)?b:[]),d.object.__r3f=d;var a,b,c=d.object;for(let a of[f,f.alternate])if(null!==a)if("function"==typeof a.ref){null==a.refCleanup||a.refCleanup();let b=a.ref(c);"function"==typeof b&&(a.refCleanup=b)}else a.ref&&(a.ref.current=c);for(let a of(!function(a,b,c){let{internal:d}=a.getState();for(let a=0;a<d.interaction.length;a++)d.interaction[a]===b&&(d.interaction[a]=c);for(let a=0;a<d.initialHits.length;a++)d.initialHits[a]===b&&(d.initialHits[a]=c);d.hovered.forEach((a,e)=>{if(a.eventObject===b||a.object===b){d.hovered.delete(e);let f={...a,eventObject:a.eventObject===b?c:a.eventObject,object:a.object===b?c:a.object};d.hovered.set(ow(f),f)}}),d.capturedMap.forEach(a=>{let d=a.get(b);d&&(a.delete(b),a.set(c,d))})}(n6(d),h,d.object),ot(d.object,d.props),d.props.attach?on(g,d):ov(d.object)&&ov(g.object)&&g.object.add(d.object),d.children))a.props.attach?on(d,a):ov(a.object)&&ov(d.object)&&d.object.add(a.object);ou(d)}}}()}finally{oW.length=0}},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(a){if(!a.isHidden){var b;a.props.attach&&null!=(b=a.parent)&&b.object?oo(a.parent,a):ov(a.object)&&(a.previousVisible=a.object.visible,a.object.visible=!1),a.isHidden=!0,ou(a)}},unhideInstance:oQ,createTextInstance:oX,hideTextInstance:oX,unhideTextInstance:oX,supportsMicrotasks:!0,scheduleMicrotask:function(a){"function"==typeof queueMicrotask?queueMicrotask(a):"u">typeof Promise?Promise.resolve().then(a).catch(a=>{setTimeout(()=>{throw a})}):setTimeout(a)},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:B.createContext(null),setCurrentUpdatePriority(a){oZ=a},getCurrentUpdatePriority:()=>oZ,resolveUpdatePriority(){let a;if(0!==oZ)return oZ;if(void 0===a)return 32;switch(a){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,n$.unstable_getCurrentPriorityLevel)()){case n$.unstable_ImmediatePriority:return 2;case n$.unstable_UserBlockingPriority:return 8;case n$.unstable_NormalPriority:case n$.unstable_LowPriority:return 32;case n$.unstable_IdlePriority:return 0x10000000;default:return 32}default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.8.1",applyViewTransitionName(a,b,c){},restoreViewTransitionName(a,b){},cancelViewTransitionName(a,b,c){},cancelRootViewTransitionName(a){},restoreRootViewTransitionName(a){},InstanceMeasurement:null,measureInstance:a=>null,wasInstanceInViewport:a=>!0,hasInstanceChanged:(a,b)=>!1,hasInstanceAffectedParent:(a,b)=>!1,suspendOnActiveViewTransition(a,b){},startViewTransition:(a,b,c,d,e,f,g,h,i,j,k)=>(d(),e(),null==k||k(),g(),null),startGestureTransition:(a,b,c,d,e,f,g,h,i,j)=>(g(),h(),null==j||j(),null),stopViewTransition(a){},addViewTransitionFinishedListener(a,b){b()},createViewTransitionInstance:a=>null,getCurrentGestureOffset(a){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(a,b)=>a,cloneMutableTextInstance:a=>a,cloneRootViewTransitionContainer(a){throw Error("Not implemented.")},removeRootViewTransitionClone(a,b){throw Error("Not implemented.")},createFragmentInstance:a=>null,updateFragmentInstanceFiber(a,b){},commitNewChildToFragmentInstance(a,b){},deleteChildFromFragmentInstance(a,b){},measureClonedInstance:a=>null,maySuspendCommitOnUpdate:(a,b,c)=>!1,maySuspendCommitInSyncRender:(a,b)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(a,b)=>null},(s=oK(w)).injectIntoDevTools(),s),o_=new Map;function o0(a,b){let c=a.state;switch(b.type){case"use":if("disposed"===c.status)return!1;return a.state={status:"open"},!0;case"unmount":if("disposed"===c.status)return!1;return a.state={status:"closing",token:b.token},!0;case"dispose":if("closing"!==c.status||c.token!==b.token)return!1;return a.state={status:"disposed"},!0}}function o1({store:a,children:b,onCreated:c,rootElement:d}){return n8(()=>{let b=a.getState();b.set(a=>({internal:{...a.internal,active:!0}})),c&&c(b),a.getState().events.connected||null==b.events.connect||b.events.connect(d)},[]),(0,A.jsx)(oz.Provider,{value:a,children:b})}function o2(a){try{return a()}catch(a){console.warn("[R3F] Error while unmounting root; teardown may be incomplete:",a)}}let o3=new Set,o4=new Set,o5=new Set;function o6(a,b){if(a.size)for(let{callback:c}of a.values())c(b)}function o7(a,b){switch(a){case"before":return o6(o3,b);case"after":return o6(o4,b);case"tail":return o6(o5,b)}}function o8(a,b,c){let d=b.clock.getDelta();"never"===b.frameloop&&"number"==typeof a&&(d=a-b.clock.elapsedTime,b.clock.oldTime=b.clock.elapsedTime,b.clock.elapsedTime=a),i=b.internal.subscribers;for(let a=0;a<i.length;a++)(j=i[a]).ref.current(j.store.getState(),d,c);return!b.internal.priority&&b.gl.render&&b.gl.render(b.scene,b.camera),b.internal.frames=Math.max(0,b.internal.frames-1),"always"===b.frameloop?1:b.internal.frames}let o9=!1,pa=!1;function pb(a){for(let c of(l=requestAnimationFrame(pb),o9=!0,k=0,o7("before",a),pa=!0,o_.values())){var b;(m=c.store.getState()).internal.active&&("always"===m.frameloop||m.internal.frames>0)&&!(null!=(b=m.gl.xr)&&b.isPresenting)&&(k+=o8(a,m))}if(pa=!1,o7("after",a),0===k)return o7("tail",a),o9=!1,cancelAnimationFrame(l)}function pc(a,b=1){var c;if(!a)return o_.forEach(a=>pc(a.store.getState(),b));(null==(c=a.gl.xr)||!c.isPresenting)&&a.internal.active&&"never"!==a.frameloop&&(b>1?a.internal.frames=Math.min(60,a.internal.frames+b):pa?a.internal.frames=2:a.internal.frames=1,o9||(o9=!0,requestAnimationFrame(pb)))}function pd(a,b=!0,c,d){if(b&&o7("before",a),c)o8(a,c,d);else for(let b of o_.values())o8(a,b.store.getState());b&&o7("after",a)}let pe={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 pf(a){let{handlePointer:b}=function(a){function b(a){return a.filter(a=>["Move","Over","Enter","Out","Leave"].some(b=>{var c;return null==(c=a.__r3f)?void 0:c.handlers["onPointer"+b]}))}function c(b){let{internal:c}=a.getState();for(let a of c.hovered.values())if(!b.length||!b.find(b=>b.object===a.object&&b.index===a.index&&b.instanceId===a.instanceId)){let d=a.eventObject.__r3f;if(c.hovered.delete(ow(a)),null!=d&&d.eventCount){let c=d.handlers,e={...a,intersections:b};null==c.onPointerOut||c.onPointerOut(e),null==c.onPointerLeave||c.onPointerLeave(e)}}}function d(a,b){for(let c=0;c<b.length;c++){let d=b[c].__r3f;null==d||null==d.handlers.onPointerMissed||d.handlers.onPointerMissed(a)}}return{handlePointer:function(e){switch(e){case"onPointerLeave":case"onPointerCancel":return()=>c([]);case"onLostPointerCapture":return b=>{let{internal:d}=a.getState();"pointerId"in b&&d.capturedMap.has(b.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(b.pointerId)&&(d.capturedMap.delete(b.pointerId),c([]))})}}return function(f){let{onPointerMissed:g,internal:h}=a.getState();h.lastEvent.current=f;let i="onPointerMove"===e,j="onClick"===e||"onContextMenu"===e||"onDoubleClick"===e,k=function(b,c){let d=a.getState(),e=new Set,f=[],g=c?c(d.internal.interaction):d.internal.interaction;for(let a=0;a<g.length;a++){let b=og(g[a]);b&&(b.raycaster.camera=void 0)}d.previousRoot||null==d.events.compute||d.events.compute(b,d);let h=g.flatMap(function(a){let c=og(a);if(!c||!c.events.enabled||null===c.raycaster.camera)return[];if(void 0===c.raycaster.camera){var d;null==c.events.compute||c.events.compute(b,c,null==(d=c.previousRoot)?void 0:d.getState()),void 0===c.raycaster.camera&&(c.raycaster.camera=null)}return c.raycaster.camera?c.raycaster.intersectObject(a,!0):[]}).sort((a,b)=>{let c=og(a.object),d=og(b.object);return c&&d&&d.events.priority-c.events.priority||a.distance-b.distance}).filter(a=>{let b=ow(a);return!e.has(b)&&(e.add(b),!0)});for(let a of(d.events.filter&&(h=d.events.filter(h,d)),h)){let b=a.object;for(;b;){var i;null!=(i=b.__r3f)&&i.eventCount&&f.push({...a,eventObject:b}),b=b.parent}}if("pointerId"in b&&d.internal.capturedMap.has(b.pointerId))for(let a of d.internal.capturedMap.get(b.pointerId).values())e.has(ow(a.intersection))||f.push(a.intersection);return f}(f,i?b:void 0),l=j?function(b){let{internal:c}=a.getState(),d=b.offsetX-c.initialClick[0],e=b.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+e*e))}(f):0;"onPointerDown"===e&&(h.initialClick=[f.offsetX,f.offsetY],h.initialHits=k.map(a=>a.eventObject)),j&&!k.length&&l<=2&&(d(f,h.interaction),g&&g(f)),i&&c(k),!function(a,b,d,e){if(a.length){let f={stopped:!1};for(let g of a){let h=og(g.object);if(h||g.object.traverseAncestors(a=>{let b=og(a);if(b)return h=b,!1}),h){let{raycaster:i,pointer:j,camera:k,internal:l}=h,m=new dz(j.x,j.y,0).unproject(k),n=a=>{var b,c;return null!=(b=null==(c=l.capturedMap.get(a))?void 0:c.has(g.eventObject))&&b},o=a=>{let c={intersection:g,target:b.target};l.capturedMap.has(a)?l.capturedMap.get(a).set(g.eventObject,c):l.capturedMap.set(a,new Map([[g.eventObject,c]])),b.target.setPointerCapture(a)},p=a=>{let b=l.capturedMap.get(a);b&&ox(l.capturedMap,g.eventObject,b,a)},q={};for(let a in b){let c=b[a];"function"!=typeof c&&(q[a]=c)}let r={...g,...q,pointer:j,intersections:a,stopped:f.stopped,delta:d,unprojectedPoint:m,ray:i.ray,camera:k,stopPropagation(){let d="pointerId"in b&&l.capturedMap.get(b.pointerId);(!d||d.has(g.eventObject))&&(r.stopped=f.stopped=!0,l.hovered.size&&Array.from(l.hovered.values()).find(a=>a.eventObject===g.eventObject)&&c([...a.slice(0,a.indexOf(g)),g]))},target:{hasPointerCapture:n,setPointerCapture:o,releasePointerCapture:p},currentTarget:{hasPointerCapture:n,setPointerCapture:o,releasePointerCapture:p},nativeEvent:b};if(e(r),!0===f.stopped)break}}}}(k,f,l,function(a){let b=a.eventObject,c=b.__r3f;if(!(null!=c&&c.eventCount))return;let g=c.handlers;if(i){if(g.onPointerOver||g.onPointerEnter||g.onPointerOut||g.onPointerLeave){let b=ow(a),c=h.hovered.get(b);c?c.stopped&&a.stopPropagation():(h.hovered.set(b,a),null==g.onPointerOver||g.onPointerOver(a),null==g.onPointerEnter||g.onPointerEnter(a))}null==g.onPointerMove||g.onPointerMove(a)}else{let c=g[e];c?(!j||h.initialHits.includes(b))&&(d(f,h.interaction.filter(a=>!h.initialHits.includes(a))),c(a)):j&&h.initialHits.includes(b)&&d(f,h.interaction.filter(a=>!h.initialHits.includes(a)))}})}}}}(a);return{priority:1,enabled:!0,compute(a,b,c){b.pointer.set(a.offsetX/b.size.width*2-1,-(2*(a.offsetY/b.size.height))+1),b.raycaster.setFromCamera(b.pointer,b.camera)},connected:void 0,handlers:Object.keys(pe).reduce((a,c)=>({...a,[c]:b(c)}),{}),update:()=>{var b;let{events:c,internal:d}=a.getState();null!=(b=d.lastEvent)&&b.current&&c.handlers&&c.handlers.onPointerMove(d.lastEvent.current)},connect:b=>{let{set:c,events:d}=a.getState();if(null==d.disconnect||d.disconnect(),c(a=>({events:{...a.events,connected:b}})),d.handlers)for(let a in d.handlers){let c=d.handlers[a],[e,f]=pe[a];b.addEventListener(e,c,{passive:f})}},disconnect:()=>{let{set:b,events:c}=a.getState();if(c.connected){if(c.handlers)for(let a in c.handlers){let b=c.handlers[a],[d]=pe[a];c.connected.removeEventListener(d,b)}b(a=>({events:{...a.events,connected:void 0}}))}}}}function pg(a,b){let c;return(...d)=>{window.clearTimeout(c),c=window.setTimeout(()=>a(...d),b)}}let ph=["x","y","top","bottom","left","right","width","height"];function pi({ref:a,children:b,fallback:c,resize:d,style:e,gl:f,events:g=pf,eventSource:h,eventPrefix:i,shadows:j,linear:k,flat:l,legacy:m,orthographic:n,frameloop:o,dpr:p,performance:q,raycaster:r,camera:s,scene:t,onPointerMissed:u,onCreated:v,...w}){let x,y,C,D;B.useMemo(()=>(function(a){if("function"==typeof a){let b=`${oO++}`;return oL[b]=a,b}Object.assign(oL,a)})(z),[]);let E=(x=n3(),y=function(){let a=n3(),[b]=B.useState(()=>new Map);b.clear();let c=a;for(;c;){let a=c.type;n5(a)&&a!==n1&&!b.has(a)&&b.set(a,B.use(n0(a))),c=c.return}return b}(),C=B.useMemo(()=>Array.from(y.keys()).reduce((a,b)=>c=>B.createElement(a,null,B.createElement(b.Provider,{...c,value:y.get(b)})),a=>B.createElement(n2,{...a})),[y]),D=oc(),B.useMemo(()=>({children:a})=>{let b=n_(x,!0,a=>a.type===B.StrictMode)?B.StrictMode:B.Fragment;return(0,A.jsx)(b,{children:(0,A.jsx)(D,{children:(0,A.jsx)(C,{children:a})})})},[x,C,D])),[F,G]=function({debounce:a,scroll:b,polyfill:c,offsetSize:d}={debounce:0,scroll:!1,offsetSize:!1}){var e,f,g;let h=c||("u"<typeof window?class{}:window.ResizeObserver);if(!h)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[i,j]=(0,B.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),k=(0,B.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:i,orientationHandler:null}),l=a?"number"==typeof a?a:a.scroll:null,m=a?"number"==typeof a?a:a.resize:null,n=(0,B.useRef)(!1);(0,B.useEffect)(()=>(n.current=!0,()=>void(n.current=!1)));let[o,p,q]=(0,B.useMemo)(()=>{let a=()=>{let a,b;if(!k.current.element)return;let{left:c,top:e,width:f,height:g,bottom:h,right:i,x:l,y:m}=k.current.element.getBoundingClientRect(),o={left:c,top:e,width:f,height:g,bottom:h,right:i,x:l,y:m};k.current.element instanceof HTMLElement&&d&&(o.height=k.current.element.offsetHeight,o.width=k.current.element.offsetWidth),Object.freeze(o),n.current&&(a=k.current.lastBounds,b=o,!ph.every(c=>a[c]===b[c]))&&j(k.current.lastBounds=o)};return[a,m?pg(a,m):a,l?pg(a,l):a]},[j,d,l,m]);function r(){k.current.scrollContainers&&(k.current.scrollContainers.forEach(a=>a.removeEventListener("scroll",q,!0)),k.current.scrollContainers=null),k.current.resizeObserver&&(k.current.resizeObserver.disconnect(),k.current.resizeObserver=null),k.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",k.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",k.current.orientationHandler))}function s(){k.current.element&&(k.current.resizeObserver=new h(q),k.current.resizeObserver.observe(k.current.element),b&&k.current.scrollContainers&&k.current.scrollContainers.forEach(a=>a.addEventListener("scroll",q,{capture:!0,passive:!0})),k.current.orientationHandler=()=>{q()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",k.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",k.current.orientationHandler))}return e=q,f=!!b,(0,B.useEffect)(()=>{if(f)return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",e,!0)},[e,f]),g=p,(0,B.useEffect)(()=>(window.addEventListener("resize",g),()=>void window.removeEventListener("resize",g)),[g]),(0,B.useEffect)(()=>{r(),s()},[b,q,p]),(0,B.useEffect)(()=>r,[]),[a=>{a&&a!==k.current.element&&(r(),k.current.element=a,k.current.scrollContainers=function a(b){let c=[];if(!b||b===document.body)return c;let{overflow:d,overflowX:e,overflowY:f}=window.getComputedStyle(b);return[d,e,f].some(a=>"auto"===a||"scroll"===a)&&c.push(b),[...c,...a(b.parentElement)]}(a),s())},i,o]}({scroll:!0,debounce:{scroll:50,resize:0},...d}),H=B.useRef(null),I=B.useRef(null);B.useImperativeHandle(a,()=>H.current);let J=n9(u),O=B.useCallback(a=>null==J.current?void 0:J.current(a),[J]),[P,Q]=B.useState(!1),[R,S]=B.useState(!1);if(P)throw P;if(R)throw R;let T=B.useRef(null),[U,V]=function(){let[a,b]=B.useState(null),c=B.useCallback(()=>b(null),[]),d=B.useCallback(a=>b(b=>null!=b?b:Promise.resolve(a).then(oa,oa)),[]);return[a?(0,A.jsx)(B.Suspense,{fallback:null,children:(0,A.jsx)(ob,{promise:a,onSettled:c})}):null,d]}(),W=B.useRef(null),X=()=>h?h&&h.hasOwnProperty("current")?h.current:h:I.current;B.useInsertionEffect(()=>()=>{let a=T.current;T.current=null,null==a||a.unmount()},[]),n8(()=>{let a=H.current;if(G.width>0&&G.height>0&&a){let c,d,e,h,u,w,x,y,z,C,D,F,H,J,P,R;T.current||(d=null==(c=o_.get(a))?void 0:c.fiber,e=null==c?void 0:c.store,c&&console.warn("R3F.createRoot should only be called once!"),h="function"==typeof reportError?reportError:console.error,F=e||(z=(y=(x=(u=(a,b)=>{let c,d=new dz,e=new dz,f=new dz;function g(a=b().camera,c=e,h=b().size){let{width:i,height:j,top:k,left:l}=h,m=i/j;c.isVector3?f.copy(c):f.set(...c);let n=a.getWorldPosition(d).distanceTo(f);if(a&&a.isOrthographicCamera)return{width:i/a.zoom,height:j/a.zoom,top:k,left:l,factor:1,distance:n,aspect:m};{let b=2*Math.tan(a.fov*Math.PI/180/2)*n,c=i/j*b;return{width:c,height:b,top:k,left:l,factor:i/c,distance:n,aspect:m}}}let h=b=>a(a=>({performance:{...a.performance,current:b}})),i=new dx;return{set:a,get:b,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(a=1)=>pc(b(),a),advance:(a,c)=>pd(a,c,b()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new kN,pointer:i,mouse:i,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let a=b();c&&clearTimeout(c),a.performance.current!==a.performance.min&&h(a.performance.min),c=setTimeout(()=>h(b().performance.max),a.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:g},setEvents:b=>a(a=>({...a,events:{...a.events,...b}})),setSize:(c,d,f=0,h=0)=>{let i=b().camera,j={width:c,height:d,top:f,left:h};a(a=>({size:j,viewport:{...a.viewport,...g(i,e,j)}}))},setDpr:b=>a(a=>{let c=of(b);return{viewport:{...a.viewport,dpr:c,initialDpr:a.viewport.initialDpr||c}}}),setFrameloop:(c="always")=>{let d=b().clock;d.stop(),d.elapsedTime=0,"never"!==c&&(d.start(),d.elapsedTime=0),a(()=>({frameloop:c}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:B.createRef(),active:!1,frames:0,priority:0,subscribe:(a,c,d)=>{let e=b().internal;return e.priority=e.priority+ +(c>0),e.subscribers.push({ref:a,priority:c,store:d}),e.subscribers=e.subscribers.sort((a,b)=>a.priority-b.priority),()=>{let d=b().internal;null!=d&&d.subscribers&&(d.priority=d.priority-(c>0),d.subscribers=d.subscribers.filter(b=>b.ref!==a))}}}}})?nW(u,w):nW).getState()).size,C=y.viewport.dpr,D=y.camera,x.subscribe(()=>{let{camera:a,size:b,viewport:c,gl:d,set:e}=x.getState();if(b.width!==z.width||b.height!==z.height||c.dpr!==C){z=b,C=c.dpr;!a.manual&&(a&&a.isOrthographicCamera?(a.left=-(b.width/2),a.right=b.width/2,a.top=b.height/2,a.bottom=-(b.height/2)):a.aspect=b.width/b.height,a.updateProjectionMatrix());c.dpr>0&&d.setPixelRatio(c.dpr);let e="u">typeof HTMLCanvasElement&&d.domElement instanceof HTMLCanvasElement;d.setSize(b.width,b.height,e)}a!==D&&(D=a,e(b=>({viewport:{...b.viewport,...b.viewport.getCurrentViewport(a)}})))}),x.subscribe(a=>pc(a)),x),H=d||o$.createContainer(F,1,null,!1,null,"",h,h,h,null),P=c||{fiber:H,store:F,state:{status:"open"},ready:Object.assign(Promise.resolve(J=void 0),{status:"fulfilled",value:J}),configuration:{},ownsRenderer:!1},c||o_.set(a,P),R=!1,T.current={get ready(){return P.ready},configure(b={}){let c,d,e;if(!o0(P,{type:"use"})){var f;let a;return(a=Promise.reject(f=Error("R3F: Cannot configure a root after disposal has started."))).catch(()=>{}),Object.assign(a,{status:"rejected",reason:f})}let g=P.ready,{promise:h,resolve:i,reject:j}=((e=new Promise((a,b)=>{c=b=>{Object.assign(e,{status:"fulfilled",value:b}),a(b)},d=a=>{Object.assign(e,{status:"rejected",reason:a}),b(a)}})).status="pending",e.catch(()=>{}),{promise:e,resolve:c,reject:d});P.ready=h;let k=c=>{let d=F.getState();d.gl||(P.ownsRenderer=!oy(b.gl),d.set({gl:c})),function({store:a,configuration:b},c,d){var e,f,g;let{gl:h,scene:i,camera:j,shadows:k=!1,linear:l=!1,flat:m=!1,legacy:n=!1,frameloop:o="always",dpr:p=[1,2],performance:q,onPointerMissed:r}=d,s=function(a,b){if(!b&&"u">typeof HTMLCanvasElement&&a instanceof HTMLCanvasElement&&a.parentElement){let{width:b,height:c,top:d,left:e}=a.parentElement.getBoundingClientRect();return{width:b,height:c,top:d,left:e}}return!b&&"u">typeof OffscreenCanvas&&a instanceof OffscreenCanvas?{width:a.width,height:a.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...b}}(c,d.size),t={...d,shadows:k,linear:l,flat:m,legacy:n,frameloop:o,size:s},u=a.getState(),v=u.gl,w=b.previous,x=a=>!w||!oh.equ(t[a],w[a],oG);b.previous=void 0;let y=u.raycaster;if(y||u.set({raycaster:y=new kK}),x("raycaster")){let{params:a,...b}=null!=(e=d.raycaster)?e:{};ot(y,{...b,params:{...y.params,...a}})}if(!u.camera||u.camera===b.camera&&x("camera")){b.camera=j;let a=null==j?void 0:j.isCamera,c=a?j:d.orthographic?new jM(0,0,0,0,.1,1e3):new jH(75,0,.1,1e3);!a&&(c.position.z=5,j&&(ot(c,j),!c.manual&&("aspect"in j||"left"in j||"right"in j||"bottom"in j||"top"in j)&&(c.manual=!0,c.updateProjectionMatrix())),u.camera||null!=j&&j.rotation||c.lookAt(0,0,0)),u.set({camera:c}),y.camera=c}if(!u.scene){let b;null!=i&&i.isScene?ok(b=i,a,"",{}):(ok(b=new ez,a,"",{}),i&&ot(b,i)),u.set({scene:b})}if(d.events&&!u.events.handlers&&u.set({events:d.events(a)}),x("size")&&u.setSize(s.width,s.height,s.top,s.left),u.viewport.dpr!==of(p)&&u.setDpr(p),x("frameloop")&&u.setFrameloop(o),x("onPointerMissed")&&u.set({onPointerMissed:r}),q&&x("performance")&&u.set(a=>({performance:{...a.performance,...q}})),!u.xr){let b=(b,c)=>{let d=a.getState();"never"!==d.frameloop&&pd(b,!0,d,c)},c=()=>{let c=a.getState();c.gl.xr.enabled=c.gl.xr.isPresenting,c.gl.xr.setAnimationLoop(c.gl.xr.isPresenting?b:null),c.gl.xr.isPresenting||pc(c)},d={connect(){let b=a.getState().gl;b.xr.addEventListener("sessionstart",c),b.xr.addEventListener("sessionend",c)},disconnect(){let b=a.getState().gl;b.xr.removeEventListener("sessionstart",c),b.xr.removeEventListener("sessionend",c)}};"function"==typeof(null==(f=v.xr)?void 0:f.addEventListener)&&d.connect(),u.set({xr:d})}if(v.shadowMap&&x("shadows")){let a=v.shadowMap.enabled,b=v.shadowMap.type;v.shadowMap.enabled=!!k,oh.boo(k)?v.shadowMap.type=M:oh.str(k)?v.shadowMap.type=null!=(g=({basic:K,percentage:L,soft:M,variance:N})[k])?g:M:oh.obj(k)&&Object.assign(v.shadowMap,k),(a!==v.shadowMap.enabled||b!==v.shadowMap.type)&&(v.shadowMap.needsUpdate=!0)}let z=!h||oh.fun(h)||oy(h)?void 0:h;x("legacy")&&(dG.enabled=!n,u.set({legacy:n})),x("linear")&&((null==z?void 0:z.outputColorSpace)===void 0&&(v.outputColorSpace=l?cl:ck),u.set({linear:l})),x("flat")&&((null==z?void 0:z.toneMapping)===void 0&&(v.toneMapping=m?aB:aF),u.set({flat:m})),z&&x("gl")&&ot(v,z),b.previous=t}(P,a,b),i(this)},l=()=>{try{var c,d;let e,f=null!=(c=F.getState().gl)?c:(d=b.gl,e={canvas:a,powerPreference:"high-performance",antialias:!0,alpha:!0},"function"==typeof d?d(e):oy(d)?d:new nS({...e,...d}));oH(f)?Promise.resolve(f).then(k).catch(j):k(f)}catch(a){j(a)}};return"pending"===g.status?g.then(l,j):l(),h},render(b){if(!o0(P,{type:"use"}))return F;if(F.getState().gl||"fulfilled"!==P.ready.status||this.configure(),"rejected"===P.ready.status)throw P.ready.reason;let c=()=>{var d;if("open"!==P.state.status||"rejected"===P.ready.status)return;if("pending"===P.ready.status)return void P.ready.then(c,h);let e=null==(d=P.configuration.previous)?void 0:d.onCreated,f=(0,A.jsx)(o1,{store:F,children:b,onCreated:e,rootElement:a});R?o$.updateContainer(f,H,null,oa):(R=!0,o$.updateContainerSync(f,H,null,oa),o$.flushSyncWork())};return c(),F},unmount(){o_.get(a)===P&&function(a){let b=o_.get(a),c=Symbol("unmount");if(!b||!o0(b,{type:"unmount",token:c}))return;let d=()=>{var e;let f;if("pending"===b.ready.status)return void b.ready.then(d,d);if(!o0(b,{type:"dispose",token:c}))return;o_.delete(a);let g=b.store.getState();g.internal.active=!1,o2(()=>null==g.events.disconnect?void 0:g.events.disconnect()),null!=(e=g.gl)&&e.xr&&o2(()=>g.xr.disconnect()),g.scene&&o2(()=>(function(a){for(let b in"Scene"!==a.type&&(null==a.dispose||a.dispose()),a){let c=a[b];(null==c?void 0:c.type)!=="Scene"&&(null==c||null==c.dispose||c.dispose())}})(g.scene));let h=g.gl;h&&b.ownsRenderer?f=o2(()=>(function(a){if((null==a.hasInitialized?void 0:a.hasInitialized())===!1)return;let b=o2(()=>{var b;return a.dispose?a.dispose():null==(b=a.renderLists)||null==b.dispose?void 0:b.dispose()});if(oH(b))return Promise.resolve(b).catch(a=>console.warn("[R3F] Error disposing renderer",a)).then(()=>o2(()=>null==a.forceContextLoss?void 0:a.forceContextLoss()));o2(()=>null==a.forceContextLoss?void 0:a.forceContextLoss())})(h)):h&&(o2(()=>{var a;return null==(a=h.renderLists)||null==a.dispose?void 0:a.dispose()}),o2(()=>null==h.forceContextLoss?void 0:h.forceContextLoss())),oH(f)&&f.then(()=>void 0)};o$.updateContainer(null,b.fiber,null,()=>{"closing"===b.state.status&&b.state.token===c&&o$.updateContainer(null,b.fiber,null,d)})}(a)}}),T.current.configure({gl:f,scene:t,events:g,shadows:j,linear:k,flat:l,legacy:m,orthographic:n,frameloop:o,dpr:p,performance:q,raycaster:r,camera:s,size:G,onPointerMissed:O,onCreated:a=>{var b;W.current=a,null==a.events.connect||a.events.connect(null!=(b=X())?b:I.current),i&&a.setEvents({compute:(a,b)=>{let c=a[i+"X"],d=a[i+"Y"];b.pointer.set(c/b.size.width*2-1,-(2*(d/b.size.height))+1),b.raycaster.setFromCamera(b.pointer,b.camera)}}),null==v||v(a)}}).catch(S),"fulfilled"===T.current.ready.status?T.current.render((0,A.jsx)(E,{children:(0,A.jsx)(oe,{set:S,children:(0,A.jsx)(B.Suspense,{fallback:(0,A.jsx)(od,{set:Q}),children:null!=b?b:null})})})):"pending"===T.current.ready.status&&V(T.current.ready)}}),B.useEffect(()=>{var a;let b=null==(a=W.current)?void 0:a.get(),c=X();b&&c&&b.events.connected!==c&&(null==b.events.connect||b.events.connect(c))}),B.useEffect(()=>{let a=H.current;return()=>{var b;a.isConnected||null==(b=T.current)||b.unmount()}},[]);let Y=h?"none":"auto";return(0,A.jsxs)("div",{ref:I,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Y,...e},...w,children:[(0,A.jsx)("div",{ref:F,style:{width:"100%",height:"100%"},children:(0,A.jsx)("canvas",{ref:H,style:{display:"block"},children:c})}),U]})}function pj(a){return(0,A.jsx)(n2,{children:(0,A.jsx)(pi,{...a})})}var pk=c(7616);function pl(a){let b,c,d,e=-1,f=0;for(let g=0;g<a.length;++g){let h=a[g];if(void 0===b&&(b=h.array.constructor),b!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===c&&(c=h.itemSize),c!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===d&&(d=h.normalized),d!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===e&&(e=h.gpuType),e!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;f+=h.count*c}let g=new b(f),h=new e8(g,c,d),i=0;for(let b=0;b<a.length;++b){let d=a[b];if(d.isInterleavedBufferAttribute){let a=i/c;for(let b=0,e=d.count;b<e;b++)for(let e=0;e<c;e++){let c=d.getComponent(b,e);h.setComponent(b+a,e,c)}}else g.set(d.array,i);i+=d.count*c}return void 0!==e&&(h.gpuType=e),h}let pm=[{hair:"#1d1719",length:"long",bangs:"curtain",eyes:"#c97828",eyeShape:"sharp",skin:"#f6d5c3",outfit:"#1c1a1f",inner:"#2e282d",accent:"#d4a853",skirt:"#151417",legs:"#1a171b",accessories:[{kind:"bow",color:"#a82e37",x:-.16,y:.1,z:-.12,size:1.35,tails:!0},{kind:"pendant",color:"#d6a84c"}]},{hair:"#b08261",length:"bob",bangs:"wispy",eyes:"#3b9b52",eyeShape:"round",skin:"#ffe8d6",outfit:"#2d292b",inner:"#e6e1dc",accent:"#c0b8b2",hood:!0,skirt:"#3b3a40",legs:"#2c2b30",accessories:[{kind:"pendant",color:"#cba052"}]},{hair:"#c8d3e6",length:"short",bangs:"swept",ahoge:!0,eyes:"#2d76c9",eyeShape:"round",skin:"#fce6d6",outfit:"#222b38",inner:"#15171b",accent:"#29c4d8",stripe:"#d97026",skirt:"#2a3545",legs:"#262b34",accessories:[{kind:"goggles",frame:"#b88636",lens:"#d98a2c"},{kind:"pendant",color:"#b88b46"}]},{hair:"#f48cb6",length:"bob",bangs:"choppy",ahoge:!0,ponytail:{x:1,high:!0},eyes:"#7638b5",eyeShape:"sharp",skin:"#fde8e1",outfit:"#1b1822",inner:"#2e2a36",accent:"#8a5cf6",skirt:"#15131c",legs:"#1b1820",accessories:[{kind:"bow",color:"#18151d",x:.215,y:.17,z:-.02,size:1.1},{kind:"choker",color:"#18151d"}]},{hair:"#162650",streak:"#3d9be9",length:"long",bangs:"choppy",ahoge:!0,ponytail:{x:-1,high:!0},eyes:"#2c8ef8",eyeShape:"round",skin:"#fde8de",outfit:"#141720",inner:"#1f2433",accent:"#68b2f8",hood:!0,skirt:"#1f2433",legs:"#14161f",accessories:[{kind:"clip",color:"#b8dcff",x:-1,shape:"whale"},{kind:"choker",color:"#4ee2ec"}]},{hair:"#11161b",streak:"#00c9b4",length:"bob",bangs:"swept",ahoge:!0,braid:{x:1,color:"#00a896"},eyes:"#00d6bc",eyeShape:"sharp",skin:"#fcece5",outfit:"#1d1f24",inner:"#141416",accent:"#e0e5eb",skirt:"#151517",legs:"#18191c",accessories:[{kind:"clip",color:"#00f0ff",x:1,shape:"x"},{kind:"glasses",color:"#d8dfe5"}]},{hair:"#9c5430",length:"bob",bangs:"curtain",braid:{x:1},eyes:"#c88225",eyeShape:"round",skin:"#f6d3b6",outfit:"#d8bc94",inner:"#efeae0",accent:"#2e2a27",skirt:"#5a4636",legs:"#3f3732",accessories:[{kind:"clip",color:"#a8a49d",x:1,shape:"camera"},{kind:"pendant",color:"#2e2a27"}]}],pn={hair:"#9aa0a8",length:"short",bangs:"choppy",eyes:"#4b5058",eyeShape:"round",skin:"#c9ccd2",outfit:"#7d838d",inner:"#9aa0a8",accent:"#b6bbc3",legs:"#5d626b",accessories:[]},po=.36+.31+.19+.2+.02,pp=.36+.31+.19+.2+.02+.12;function pq(a,b,c,d,e,f,g=[0,0,0],h="XYZ"){let i=new ga(c,"string"==typeof d?a.material(d):d);return i.position.set(...e),i.scale.set(...f),i.rotation.set(g[0],g[1],g[2],h),b.add(i),i}function pr(a,b){let c=new eo;return c.position.set(...b),a.add(c),c}function ps(a,b,c,{angle:d,rootY:e,length:f,width:g,tilt:h=.32,roll:i=0,depth:j=.035,lift:k=.012}){pq(a,b,a.geometry.cone,c,function(a,b,c=0){let d=.2*Math.sqrt(Math.max(0,1-(a/.194)**2))+c;return[Math.sin(b)*d,.19+a,Math.cos(b)*d*.95]}(e-.45*f,d,k),[g,f,j],[Math.PI-h,d,i],"YXZ")}let pt={choppy:[{angle:-.95,length:.15,width:.055},{angle:-.55,length:.125,width:.06},{angle:-.18,length:.11,width:.06},{angle:.2,length:.13,width:.06},{angle:.58,length:.115,width:.06},{angle:.95,length:.15,width:.055}],curtain:[{angle:-1,length:.19,width:.055,roll:.12},{angle:-.62,length:.15,width:.06,roll:.22},{angle:-.26,length:.1,width:.055,roll:.35},{angle:.26,length:.1,width:.055,roll:-.35},{angle:.62,length:.15,width:.06,roll:-.22},{angle:1,length:.19,width:.055,roll:-.12}],swept:[{angle:-.95,length:.16,width:.06,roll:-.25},{angle:-.55,length:.14,width:.065,roll:-.4},{angle:-.15,length:.125,width:.065,roll:-.45},{angle:.25,length:.11,width:.065,roll:-.45},{angle:.62,length:.1,width:.06,roll:-.35},{angle:.98,length:.13,width:.055,roll:-.2}],wispy:[{angle:-.95,length:.16,width:.05},{angle:-.5,length:.12,width:.042,roll:.15},{angle:-.12,length:.105,width:.04},{angle:.3,length:.12,width:.042,roll:-.15},{angle:.95,length:.16,width:.05}]},pu={short:.22,bob:.27,long:.44},pv=new dz(-.15,.35,.2),pw=new dz(1.2,4.9,8.2);function px(a,b){return Math.atan2(Math.sin(b-a),Math.cos(b-a))}function py(){return oB(a=>a.camera),oB(a=>a.size.width/Math.max(a.size.height,1)),oB(a=>a.invalidate),null}function pz(a,b,c){return c<b?(b+c)/2:Math.min(c,Math.max(b,a))}function pA(a,b,c,d,e,f,g){let h=c;for(let c=0;c<=b.length;c+=1){a.top=h-e,a.bottom=h;let c=b.find(b=>a.left<b.right&&b.left<a.right&&a.top<b.bottom&&b.top<a.bottom);if(!c)return h;if((h=d?c.top-4:c.bottom+4+e)<f||h>g)break}return null}function pB({shared:a,bubbles:b,reserved:c,onReady:d}){let e=oB(a=>a.camera),f=oB(a=>a.size);oB(a=>a.invalidate);let g=(0,B.useMemo)(()=>({point:new dz,written:new Map,sizes:new Map,observer:null,items:[],placed:[],blocked:[],ready:!1}),[]);return oC(()=>{let h=g.blocked;for(let a of(h.length=0,c.values())){let b=a.offsetLeft,c=a.offsetTop;h.push({left:b,top:c,right:b+a.offsetWidth,bottom:c+a.offsetHeight})}let i=g.items;for(let[c,d]of(i.length=0,a.heads)){let a=b.get(c);if(!a)continue;let h=g.sizes.get(a);h||(h={width:a.offsetWidth,height:a.offsetHeight},g.sizes.set(a,h),g.observer?.observe(a)),d.head.getWorldPosition(g.point),g.point.y+=pp-po+.22+.42*d.lift,g.point.project(e),i.push({key:c,element:a,x:(g.point.x+1)/2*f.width,y:(1-g.point.y)/2*f.height,depth:g.point.z,width:h.width,height:h.height,rest:d.rest})}i.sort((a,b)=>a.rest===b.rest?a.rest?b.y-a.y:0:a.rest?1:-1);let j=g.placed;for(let a of(j.length=0,i)){let b=6*!a.rest,c=a.width/2,d=pz(a.x,c+4,f.width-c-4),e=a.height+4;for(let b of h)d-c<b.right&&b.left<d+c&&(e=Math.max(e,b.bottom+4+a.height));let i=f.height-4-b,k=pz(a.y,e,i),l={left:d-c,right:d+c,top:k-a.height,bottom:k+b};a.rest&&(k=pA(l,j,k,!0,a.height,e,i)??pA(l,j,k,!1,a.height,e,i)??k,l.top=k-a.height,l.bottom=k),j.push(l);let m=`translate(${Math.round(d)}px, ${Math.round(k)}px) translate(-50%, -100%)`;g.written.get(a.key)!==m&&(g.written.set(a.key,m),a.element.style.transform=m,a.element.style.zIndex=String(Math.round((1-a.depth)*1e4)),a.element.dataset.placed="true")}g.ready||(g.ready=!0,d())}),null}function pC({x:a,z:b,width:c,cushion:d,chairs:e,lit:f}){let g=c/2-.05,h=e.length>0?e:[{x:a,z:b-.3,key:""}];return(0,A.jsxs)("group",{children:[(0,A.jsxs)("mesh",{position:[a,.42,b],children:[(0,A.jsx)("boxGeometry",{args:[c,.04,.5]}),(0,A.jsx)("meshStandardMaterial",{color:"#b48a62",roughness:.7})]}),[[-g,-.2],[g,-.2],[-g,.2],[g,.2]].map(([c,d])=>(0,A.jsxs)("mesh",{position:[a+c,.21,b+d],children:[(0,A.jsx)("boxGeometry",{args:[.04,.42,.04]}),(0,A.jsx)("meshStandardMaterial",{color:"#5b4a3b"})]},`${c}:${d}`)),h.map(a=>{let b=!!a.key&&!0===f.get(a.key),c=""!==a.key;return(0,A.jsxs)("group",{children:[(0,A.jsxs)("group",{position:[a.x,.445,a.z+.3],children:[(0,A.jsxs)("mesh",{children:[(0,A.jsx)("boxGeometry",{args:[.3,.012,.2]}),(0,A.jsx)("meshStandardMaterial",{color:"#3a3e45"})]}),c?(0,A.jsxs)("group",{position:[0,.005,.1],"rotation-x":-.25,children:[(0,A.jsxs)("mesh",{position:[0,.1,0],children:[(0,A.jsx)("boxGeometry",{args:[.3,.2,.012]}),(0,A.jsx)("meshStandardMaterial",{color:"#3a3e45"})]}),(0,A.jsxs)("mesh",{position:[0,.1,-.007],"rotation-y":Math.PI,children:[(0,A.jsx)("planeGeometry",{args:[.27,.17]}),(0,A.jsx)("meshStandardMaterial",{color:b?"#a8d8ff":"#1f2329",emissive:b?"#5fb2ff":"#000000",emissiveIntensity:.9*!!b})]}),(0,A.jsxs)("mesh",{position:[0,.11,.007],children:[(0,A.jsx)("circleGeometry",{args:[.025,16]}),(0,A.jsx)("meshStandardMaterial",{color:b?"#cfe9ff":"#565b63",emissive:b?"#7cc4ff":"#000000",emissiveIntensity:1.2*!!b})]})]}):(0,A.jsxs)("mesh",{position:[0,.012,0],children:[(0,A.jsx)("boxGeometry",{args:[.3,.012,.2]}),(0,A.jsx)("meshStandardMaterial",{color:"#4a4f57"})]})]}),(0,A.jsxs)("group",{position:[a.x,0,a.z-.06*!!c],children:[(0,A.jsxs)("mesh",{position:[0,.2,0],children:[(0,A.jsx)("boxGeometry",{args:[.36,.05,.34]}),(0,A.jsx)("meshStandardMaterial",{color:d,roughness:.85})]}),(0,A.jsxs)("mesh",{position:[0,.25+.17,-.18],children:[(0,A.jsx)("boxGeometry",{args:[.36,.38,.04]}),(0,A.jsx)("meshStandardMaterial",{color:d,roughness:.85})]}),(0,A.jsxs)("mesh",{position:[0,.1,0],children:[(0,A.jsx)("cylinderGeometry",{args:[.025,.025,.2,8]}),(0,A.jsx)("meshStandardMaterial",{color:"#2f3236"})]})]})]},a.key||"tucked")})]})}function pD({layout:a,lit:b}){let c=(0,B.useMemo)(()=>a.desks.map((b,c)=>a.stations.filter(a=>a.deskIndex===c).map(a=>({x:a.desk.point.x,z:a.desk.point.z,key:a.key}))),[a]);return(0,A.jsxs)("group",{children:[(0,A.jsxs)("mesh",{"rotation-x":-Math.PI/2,position:[0,0,.15],children:[(0,A.jsx)("planeGeometry",{args:[8.4,5.9]}),(0,A.jsx)("meshStandardMaterial",{color:"#ddd6ca",roughness:.95})]}),(0,A.jsxs)("mesh",{position:[0,1.2,-2.85],children:[(0,A.jsx)("boxGeometry",{args:[8.4,2.4,.1]}),(0,A.jsx)("meshStandardMaterial",{color:"#ece7dd",roughness:1})]}),(0,A.jsxs)("mesh",{position:[-4.25,1.2,.15],children:[(0,A.jsx)("boxGeometry",{args:[.1,2.4,6]}),(0,A.jsx)("meshStandardMaterial",{color:"#e3ddd1",roughness:1})]}),(0,A.jsxs)("mesh",{position:[-4.195,.95,pk.kn.z],"rotation-y":Math.PI/2,children:[(0,A.jsx)("planeGeometry",{args:[.9,1.9]}),(0,A.jsx)("meshStandardMaterial",{color:"#8a7a66",roughness:.8})]}),(0,A.jsxs)("mesh",{"rotation-x":-Math.PI/2,position:[.3,.004,1.85],children:[(0,A.jsx)("circleGeometry",{args:[1.25,48]}),(0,A.jsx)("meshStandardMaterial",{color:"#c3ccbd",roughness:1})]}),(0,A.jsxs)("mesh",{"rotation-x":-Math.PI/2,position:[-2.95,.004,2],children:[(0,A.jsx)("planeGeometry",{args:[2.3,2.1]}),(0,A.jsx)("meshStandardMaterial",{color:"#e8d9c2",roughness:1})]}),(0,A.jsxs)("group",{position:[pk.JE.center.x,0,pk.JE.center.z],children:[(0,A.jsxs)("mesh",{position:[0,.18,.12],children:[(0,A.jsx)("boxGeometry",{args:[pk.JE.width,.14,.42]}),(0,A.jsx)("meshStandardMaterial",{color:"#8c9a8a",roughness:.9})]}),(0,A.jsxs)("mesh",{position:[0,.37,-.12],children:[(0,A.jsx)("boxGeometry",{args:[pk.JE.width,.42,.12]}),(0,A.jsx)("meshStandardMaterial",{color:"#7d8b7b",roughness:.9})]}),[-1,1].map(a=>(0,A.jsxs)("mesh",{position:[a*(pk.JE.width/2+.05),.25,.06],children:[(0,A.jsx)("boxGeometry",{args:[.1,.3,.5]}),(0,A.jsx)("meshStandardMaterial",{color:"#7d8b7b",roughness:.9})]},a))]}),(0,A.jsxs)("group",{position:[-1.95,0,1.15],children:[(0,A.jsxs)("mesh",{position:[0,.15,0],children:[(0,A.jsx)("cylinderGeometry",{args:[.13,.1,.3,14]}),(0,A.jsx)("meshStandardMaterial",{color:"#b0704a"})]}),(0,A.jsxs)("mesh",{position:[0,.48,0],children:[(0,A.jsx)("sphereGeometry",{args:[.24,14,10]}),(0,A.jsx)("meshStandardMaterial",{color:"#6f9a62",roughness:.9})]})]}),a.desks.map((a,d)=>(0,A.jsx)(pC,{x:a.center.x,z:a.center.z,width:a.width,cushion:null===a.seat?"#9aa0a8":pm[a.seat%pm.length].hair,chairs:c[d],lit:b},`${a.seat??"guest"}:${d}`))]})}function pE({actorKey:a,seat:b,shared:c,target:d,selected:e,onSelect:f,onHover:g,onMotionChange:h}){let i=oB(a=>a.gl);oB(a=>a.invalidate);let j=(0,B.useMemo)(()=>{let a=null===b?pn:pm[b%pm.length];return function(a,b,c=!1){let{sphere:d,cylinder:e,torso:f,box:g}=a.geometry,h=new eo,i=pr(h,[0,0,0]),j=pr(i,[.062,.36,0]),k=pr(i,[-.062,.36,0]);for(let c of[j,k])pq(a,c,e,b.legs,[0,-.15,0],[.048,.3,.048]),pq(a,c,g,"#2b2a2e",[0,-.322,.022],[.08,.045,.13]);let l=pr(i,[0,.36,0]);pq(a,l,f,b.outfit,[0,.15,0],[.15,.3,.122]),pq(a,l,g,b.inner,[0,.17,.106],[.075,.2,.02],[-.13,0,0]),pq(a,l,a.geometry.ring,b.accent,[0,.3,0],[.08,.08,.065],[Math.PI/2,0,0]),pq(a,l,e,b.skin,[0,.31,0],[.04,.06,.04]),b.hood&&pq(a,l,d,b.outfit,[0,.29,-.1],[.13,.065,.07],[.3,0,0]),b.skirt&&pq(a,l,f,b.skirt,[0,-.045,0],[.19,.13,.17]);let m=pr(l,[.14,.27,0]),n=pr(l,[-.14,.27,0]);for(let c of[m,n])pq(a,c,e,b.outfit,[0,-.12,0],[.042,.24,.042]),b.stripe&&pq(a,c,e,b.stripe,[0,-.108,0],[.045,.03,.045]),pq(a,c,e,b.accent,[0,-.24+.015,0],[.046,.03,.046]),pq(a,c,d,b.skin,[0,-.266,0],[.04,.042,.04]);let o=pr(l,[0,.33,0]);if(pq(a,o,d,b.skin,[0,.19,0],[.2,.194,.19]),c)for(let c of[-1,1])pq(a,o,d,b.eyes,[.072*c,.17,.178],[.034,.046,.02]);else{let c=`#${new ev(b.eyes).multiplyScalar(.32).getHexString()}`;for(let e of[-1,1])!function(a,b,c,d,e){let{sphere:f}=a.geometry,g="sharp"===c.eyeShape,h=g?.05:.058,i=.078*d,j=.38*d;pq(a,b,f,a.flat(c.eyes),[i,.155,.168],[.043,h,.02],[0,j,0]),pq(a,b,f,a.flat(e),[i-.003*d,.149,.184],[.023,.55*h,.008],[0,j,0]),pq(a,b,f,a.flat("#2a1d22"),[i,.155+.1*h,.167],[.049,1.1*h,.016],[0,j,0]),g&&pq(a,b,f,a.flat("#2a1d22"),[i+.046*d,.155+.92*h,.17],[.018,.007,.008],[0,j,.5*d]),pq(a,b,f,a.flat("#ffffff"),[i+.013*d,.155+.3*h,.19],[.014,.017,.006],[0,j,0]),pq(a,b,f,a.flat("#ffffff"),[i-.014*d,.155-.5*h,.188],[.007,.007,.004],[0,j,0])}(a,o,b,e,c),pq(a,o,d,"#f6aaa6",[.105*e,.085,.122],[.03,.012,.01],[0,.6*e,0])}pq(a,o,d,"#b85a5c",[0,.065,.143],[.018,.007,.006]),c||function(a,b,c){let{sphere:d,dome:e,box:f,cone:g}=a.geometry,h=c.hair;for(let d of(pq(a,b,e,h,[0,.19+.014,-.01],[.22400000000000003,.22400000000000003,.22799999999999998],[-.36,0,0]),pt[c.bangs]))ps(a,b,h,{angle:d.angle,rootY:.145,length:d.length,width:d.width,roll:d.roll??0});c.streak&&ps(a,b,c.streak,{angle:.4,rootY:.13,length:.1,width:.026,roll:-.3,lift:.022});let i=pu[c.length];for(let d of[-1,1])pq(a,b,g,h,[.19*d,.22-.5*i,.055],[.05,i,.045],[Math.PI,0,.1*d]),c.streak&&pq(a,b,g,c.streak,[.168*d,.2-.42*i,.075],[.022,.7*i,.02],[Math.PI,0,.06*d]);if("short"===c.length)for(let c of(pq(a,b,d,h,[0,.2,-.065],[.212,.205,.175]),[-.1,0,.1]))pq(a,b,g,h,[c,.19-.14,-.1],[.05,.11,.045],[Math.PI+.45,0,2.5*c]);else if(pq(a,b,d,h,[0,.155,-.085],[.232,.24,.188]),"bob"===c.length)for(let c of[-1,1])pq(a,b,d,h,[.175*c,.19-.2,-.05],[.075,.055,.09],[0,0,-.5*c]);else for(let c of(pq(a,b,d,h,[0,.19-.3,-.13],[.215,.33,.09],[-.16,0,0]),[-.12,0,.12]))pq(a,b,g,h,[c,-.44,-.17],[.075,.13,.055],[Math.PI-.1,0,1.5*c]);if(c.ahoge&&pq(a,b,g,h,[.02,.45,.03],[.02,.13,.015],[.45,0,-.55]),c.ponytail){let e=c.ponytail.x,f=c.ponytail.high?.32:.21;pq(a,b,d,h,[.18*e,f,-.07],[.055,.055,.055]),pq(a,b,d,h,[.25*e,f-.06,-.09],[.075,.08,.075],[0,0,.3*e]),pq(a,b,d,h,[.29*e,f-.18,-.1],[.062,.11,.064],[0,0,.2*e]),pq(a,b,g,h,[.3*e,f-.33,-.1],[.05,.13,.05],[Math.PI,0,-.15*e])}if(c.braid){let e=c.braid.x,g=c.braid.color??h;for(let c=0;c<5;c+=1){let f=.048-.004*c;pq(a,b,d,g,[e*(.17-.008*c),.09-.068*c,.06+.022*c],[f,1.15*f,f])}pq(a,b,f,"#2b2b2b",[.135*e,-.26,.16],[.045,.02,.045])}}(a,o,b),function(a,b,c,d){let{sphere:e,box:f,ring:g,cone:h}=a.geometry;for(let i of d.accessories)switch(i.kind){case"bow":{let c=i.size,d=[i.x,.19+i.y,i.z];for(let f of[-1,1])pq(a,b,e,i.color,[d[0]+.058*f*c,d[1],d[2]],[.064*c,.042*c,.026*c],[0,0,.35*f]),i.tails&&pq(a,b,h,i.color,[d[0]+.03*f*c,d[1]-.09*c,d[2]-.01],[.024*c,.13*c,.01],[Math.PI,0,-.25*f]);pq(a,b,e,i.color,d,[.026*c,.026*c,.026*c]);break}case"goggles":for(let c of[-1,1])pq(a,b,g,i.frame,[.066*c,.36,.12],[.047,.047,.047],[-.95,0,0]),pq(a,b,e,i.lens,[.066*c,.363,.122],[.04,.012,.04],[-.95+Math.PI/2,0,0]);break;case"clip":{let c=i.x,d=[.15*c,.19+.1,.125];switch(i.shape??"bar"){case"x":for(let e of[.78,-.78])pq(a,b,f,i.color,d,[.06,.016,.016],[0,.5*c,e]);break;case"whale":pq(a,b,e,i.color,d,[.04,.027,.02],[0,.5*c,0]),pq(a,b,h,i.color,[d[0]+.045*c,d[1]+.012,d[2]-.012],[.018,.035,.008],[0,.5*c,.9*c]);break;case"camera":pq(a,b,f,i.color,d,[.055,.036,.022],[0,.5*c,0]),pq(a,b,e,"#2b2b2b",[d[0]-.005*c,d[1],d[2]+.012],[.012,.012,.008]);break;default:pq(a,b,f,i.color,d,[.055,.022,.02],[0,0,-.5*c])}break}case"glasses":for(let c of[-1,1])pq(a,b,g,i.color,[.078*c,.155,.198],[.056,.056,.03],[0,.3*c,0]);pq(a,b,f,i.color,[0,.165,.205],[.04,.007,.007]);break;case"pendant":pq(a,c,e,i.color,[0,.235,.1],[.022,.022,.012]);break;case"choker":pq(a,c,g,i.color,[0,.305,0],[.05,.05,.07],[Math.PI/2,0,0]),pq(a,c,e,i.color,[0,.28,.052],[.014,.016,.01])}}(a,o,l,b);let p=[];for(let a of[j,k,l,m,n,o])!function(a,b){let c=new Map;for(let b of a.children.filter(a=>a instanceof ga)){b.updateMatrix();let d=b.geometry.clone().applyMatrix4(b.matrix),e=b.material,f=c.get(e)??[];f.push(d),c.set(e,f),a.remove(b)}for(let[d,e]of c){let c=1===e.length?e[0]:function(a,b=!1){let c=null!==a[0].index,d=new Set(Object.keys(a[0].attributes)),e=new Set(Object.keys(a[0].morphAttributes)),f={},g={},h=a[0].morphTargetsRelative,i=new ft,j=0;for(let k=0;k<a.length;++k){let l=a[k],m=0;if(c!==(null!==l.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let a in l.attributes){if(!d.has(a))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+'. All geometries must have compatible attributes; make sure "'+a+'" attribute exists among all geometries, or in none of them.'),null;void 0===f[a]&&(f[a]=[]),f[a].push(l.attributes[a]),m++}if(m!==d.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+". Make sure all geometries have the same number of attributes."),null;if(h!==l.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let a in l.morphAttributes){if(!e.has(a))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+". .morphAttributes must be consistent throughout all geometries."),null;void 0===g[a]&&(g[a]=[]),g[a].push(l.morphAttributes[a])}if(b){let a;if(c)a=l.index.count;else{if(void 0===l.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+k+". The geometry must have either an index or a position attribute"),null;a=l.attributes.position.count}i.addGroup(j,a,k),j+=a}}if(c){let b=0,c=[];for(let d=0;d<a.length;++d){let e=a[d].index;for(let a=0;a<e.count;++a)c.push(e.getX(a)+b);b+=a[d].attributes.position.count}i.setIndex(c)}for(let a in f){let b=pl(f[a]);if(!b)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+a+" attribute."),null;i.setAttribute(a,b)}for(let a in g){let b=g[a][0].length;if(0!==b){i.morphAttributes=i.morphAttributes||{},i.morphAttributes[a]=[];for(let c=0;c<b;++c){let b=[];for(let d=0;d<g[a].length;++d)b.push(g[a][d][c]);let d=pl(b);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+a+" morphAttribute."),null;i.morphAttributes[a].push(d)}}}return i}(e,!1);if(e.length>1)for(let a of e)a.dispose();c&&(b.push(c),a.add(new ga(c,d)))}}(a,p);return{root:h,body:i,torso:l,head:o,armLeft:m,armRight:n,legLeft:j,legRight:k,baked:p}}(c.kit,a,null===b)},[b,c.kit]),k=(0,B.useRef)(null),l=(0,B.useRef)(d),m="rest"===d.kind?d.place.point:pk.kn,n=(0,B.useRef)({point:{...m},heading:0,phase:"rest"===d.kind?"pose":"walk",sit:0,walkPhase:0,blend:{walk:0,type:0,wave:0,slump:0},paceLeg:0,paceWait:(b??0)%3*2.6/3,motion:null,time:(b??7)*1.37});return"participant"===d.kind&&d.station.bubbleLift,d.kind,oC((a,b)=>{var d,e,f,g,i,m,o,p;let q,r,s,t,u,v,w,x,y,z,A=Math.min(b,.1),B=c.reducedMotion.current,C=n.current;C.time+=A;let D=l.current;if("participant"===D.kind)y="desk"===D.plan.spot?D.station.desk:D.station.lounge,z=D.plan.pose;else{let a=D.place;z=a.pose,y={point:a.to&&1===C.paceLeg&&!B?a.to:a.point,facing:a.facing}}let E="work"===z||"sofa"===z,F=B?1:A/.45,G=!1;if("sitDown"===C.phase||"seated"===C.phase)E?"sitDown"===C.phase?(C.sit=Math.min(1,C.sit+F),C.sit>=1&&(C.phase="seated")):G=!0:C.phase="standUp";else if("standUp"===C.phase)C.sit=Math.max(0,C.sit-F),C.sit<=0&&(C.phase="walk");else{let a=(0,pk.yA)(C.point,y.point,B?1/0:1.15*A);if(a.arrived){C.point=a.point;let b=px(C.heading,y.facing);Math.abs(b)>.12&&!B?(C.heading+=b*Math.min(1,7*A),C.phase="turn"):(C.heading=y.facing,E?C.phase="sitDown":(C.phase="pose","pace"!==z||B?G=!0:(C.paceWait-=A,C.paceWait<=0&&(C.paceWait=2.6,C.paceLeg=+(1!==C.paceLeg)))))}else{let b=Math.atan2(a.point.x-C.point.x,a.point.z-C.point.z);C.heading+=px(C.heading,b)*Math.min(1,7*A),C.point=a.point,C.phase="walk",C.walkPhase+=9*A}}let H=B?1:Math.min(1,8*A),I=C.blend;if(I.walk+=(("walk"===C.phase)-I.walk)*H,I.type+=(("seated"===C.phase&&"work"===z)-I.type)*H,I.wave+=(("pose"===C.phase&&"wave"===z)-I.wave)*H,I.slump+=(("pose"===C.phase&&"slump"===z)-I.slump)*H,d=j,e={walkPhase:C.walkPhase,walk:I.walk,sit:C.sit,type:I.type,wave:I.wave,slump:I.slump,breathe:+!B},f=C.time,q=.6*Math.sin(e.walkPhase)*e.walk,r=-Math.PI/2*e.sit,d.legLeft.rotation.x=r+q,d.legRight.rotation.x=r-q,s=Math.sin(2.1*f)*e.breathe,t=.025*Math.abs(Math.sin(e.walkPhase))*e.walk,d.body.position.y=-(.36-.25)*e.sit+t+.004*s,d.torso.scale.y=1+.012*s,u=a=>.07*Math.sin(9*f+1.7*a)*e.breathe,v=(g=-(.8*q))+(-1.15+u(1)-g)*e.type,w=(i=.8*q)+(-1.15+u(-1)-i)*e.type,x=.12*e.slump,d.armLeft.rotation.set(v+x,0,.1+-.08*e.slump),d.armRight.rotation.set(w+x,0,-.1+.08*e.slump),e.wave>0&&(d.armRight.rotation.z=-.1+(-2.55+.35*Math.sin(7*f)*e.breathe- -.1)*e.wave,d.armRight.rotation.x=(m=d.armRight.rotation.x)+(0-m)*e.wave),d.head.rotation.x=.05*e.type+.3*e.slump+.02*s,d.head.rotation.y=.06*Math.sin(.6*f)*e.breathe*(1-e.type),d.torso.rotation.x=.1*e.slump,k.current&&(k.current.position.set(C.point.x,0,C.point.z),k.current.rotation.y=C.heading),"participant"===D.kind&&h){let a=(o=C.phase,p=D.plan,"walk"===o?"desk"===p.spot?"toDesk":"toLounge":"sitDown"===o||"seated"===o?"work":"standUp"===o?"desk"===p.spot?"atDesk":"toLounge":"desk"===p.spot?"slump"===p.pose?"slump":"atDesk":"wave"===p.pose?"wave":"idle");a!==C.motion&&(C.motion=a,h(a))}B&&!G&&a.invalidate()}),(0,A.jsxs)("group",{ref:k,children:[(0,A.jsx)("primitive",{object:j.root}),(0,A.jsxs)("mesh",{"rotation-x":-Math.PI/2,position:[0,.01,0],children:[(0,A.jsx)("circleGeometry",{args:[.26,28]}),(0,A.jsx)("meshBasicMaterial",{color:"#000000",transparent:!0,opacity:"rest"===d.kind?.1:.16,depthWrite:!1})]}),e&&(0,A.jsxs)("mesh",{"rotation-x":-Math.PI/2,position:[0,.015,0],children:[(0,A.jsx)("ringGeometry",{args:[.3,.37,48]}),(0,A.jsx)("meshBasicMaterial",{color:"#ff6f0f",depthWrite:!1})]}),(0,A.jsxs)("mesh",{position:[0,po/2,0],onClick:a=>{a.stopPropagation(),f?.()},onPointerOver:b=>{b.stopPropagation(),i.domElement.style.cursor=f?"pointer":"help",g(a)},onPointerOut:()=>{i.domElement.style.cursor="",g(null)},children:[(0,A.jsx)("boxGeometry",{args:[.5,po,.45]}),(0,A.jsx)("meshBasicMaterial",{transparent:!0,opacity:0,depthWrite:!1})]})]})}function pF({onContextLost:a}){return oB(a=>a.gl.domElement),null}function pG({layout:a,participants:b,bubbles:c,reserved:d,onSelect:e,onHover:f,onReady:g,onMotionChange:h}){let i=(0,B.useMemo)(()=>{let a,b,c;return{kit:(a={sphere:new iv(1,20,14),dome:new iv(1,22,12,0,2*Math.PI,0,.56*Math.PI),cylinder:new hw(1,1,1,12),torso:new hw(.76,1,1,16),box:new ht(1,1,1),ring:new ix(1,.16,8,24),cone:new hx(1,1,10)},b=new Map,c=new Map,{geometry:a,material:a=>{let c=b.get(a);return c||(c=new iL({color:a,roughness:.78,metalness:0}),b.set(a,c)),c},flat:a=>{let b=c.get(a);return b||(b=new f$({color:a}),c.set(a,b)),b},dispose:()=>{for(let b of Object.values(a))b.dispose();for(let a of b.values())a.dispose();for(let a of c.values())a.dispose();b.clear(),c.clear()}}),heads:new Map,departed:new Map,reducedMotion:{current:!1}}},[]);oB(a=>a.invalidate);let j=(0,B.useMemo)(()=>new Map(a.stations.map(a=>[a.key,a])),[a]),k=(0,B.useMemo)(()=>new Map(b.map(a=>[a.key,"desk"===a.plan.spot&&"work"===a.plan.pose])),[b]),l=(0,B.useRef)(new Map),m=(0,B.useRef)({onSelect:e,onMotionChange:h});return m.current={onSelect:e,onMotionChange:h},(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(py,{}),(0,A.jsx)("hemisphereLight",{args:["#ffffff","#b5a993",1.7]}),(0,A.jsx)("directionalLight",{position:[3,6,5],intensity:1.5}),(0,A.jsx)(pD,{layout:a,lit:k}),b.map(a=>{var b;let c,d=j.get(a.key);if(!d)return null;let e=(b=a.key,(c=l.current.get(b))||(c={select:()=>m.current.onSelect(b),motion:a=>m.current.onMotionChange(b,a)},l.current.set(b,c)),c);return(0,A.jsx)(pH,{participant:a,station:d,shared:i,onSelect:e.select,onHover:f,onMotionChange:e.motion},a.key)}),a.rest.map(a=>(0,A.jsx)(pI,{place:a,shared:i,onHover:f},(0,pk.wC)(a.seat))),(0,A.jsx)(pB,{shared:i,bubbles:c,reserved:d,onReady:g})]})}function pH({participant:a,station:b,shared:c,onSelect:d,onHover:e,onMotionChange:f}){let{plan:g}=a,h=(0,B.useMemo)(()=>({kind:"participant",station:b,plan:g}),[b,g.spot,g.pose]);return(0,A.jsx)(pE,{actorKey:a.key,seat:a.seat,shared:c,target:h,selected:a.selected,onSelect:d,onHover:e,onMotionChange:f})}function pI({place:a,shared:b,onHover:c}){let d=(0,B.useMemo)(()=>({kind:"rest",place:a}),[a]);return(0,A.jsx)(pE,{actorKey:(0,pk.wC)(a.seat),seat:a.seat,shared:b,target:d,selected:!1,onHover:c})}function pJ({onContextLost:a,...b}){return(0,A.jsxs)(pj,{dpr:[1,1.75],frameloop:"always",camera:{fov:36,near:.1,far:60,position:pw.clone().add(pv).toArray()},gl:{antialias:!0,alpha:!0,powerPreference:"low-power"},children:[(0,A.jsx)(pF,{onContextLost:a}),(0,A.jsx)(pG,{...b})]})}[-3.95,3.4].flatMap(a=>[0,1.15].flatMap(b=>[-2,3].map(c=>new dz(a,b,c))))},20999:(a,b,c)=>{a.exports=c(41421)},33584:(a,b)=>{function c(a,b){var c=a.length;for(a.push(b);0<c;){var d=c-1>>>1,e=a[d];if(0<f(e,b))a[d]=b,a[c]=e,c=d;else break}}function d(a){return 0===a.length?null:a[0]}function e(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;for(var d=0,e=a.length,g=e>>>1;d<g;){var h=2*(d+1)-1,i=a[h],j=h+1,k=a[j];if(0>f(i,c))j<e&&0>f(k,i)?(a[d]=k,a[j]=c,d=j):(a[d]=i,a[h]=c,d=h);else if(j<e&&0>f(k,c))a[d]=k,a[j]=c,d=j;else break}}return b}function f(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(b.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var g,h=performance;b.unstable_now=function(){return h.now()}}else{var i=Date,j=i.now();b.unstable_now=function(){return i.now()-j}}var k=[],l=[],m=1,n=null,o=3,p=!1,q=!1,r=!1,s=!1,t="function"==typeof setTimeout?setTimeout:null,u="function"==typeof clearTimeout?clearTimeout:null,v="u">typeof setImmediate?setImmediate:null;function w(a){for(var b=d(l);null!==b;){if(null===b.callback)e(l);else if(b.startTime<=a)e(l),b.sortIndex=b.expirationTime,c(k,b);else break;b=d(l)}}function x(a){if(r=!1,w(a),!q)if(null!==d(k))q=!0,y||(y=!0,g());else{var b=d(l);null!==b&&G(x,b.startTime-a)}}var y=!1,z=-1,A=5,B=-1;function C(){return!!s||!(b.unstable_now()-B<A)}function D(){if(s=!1,y){var a=b.unstable_now();B=a;var c=!0;try{h:{q=!1,r&&(r=!1,u(z),z=-1),p=!0;var f=o;try{i:{for(w(a),n=d(k);null!==n&&!(n.expirationTime>a&&C());){var h=n.callback;if("function"==typeof h){n.callback=null,o=n.priorityLevel;var i=h(n.expirationTime<=a);if(a=b.unstable_now(),"function"==typeof i){n.callback=i,w(a),c=!0;break i}n===d(k)&&e(k),w(a)}else e(k);n=d(k)}if(null!==n)c=!0;else{var j=d(l);null!==j&&G(x,j.startTime-a),c=!1}}break h}finally{n=null,o=f,p=!1}}}finally{c?g():y=!1}}}if("function"==typeof v)g=function(){v(D)};else if("u">typeof MessageChannel){var E=new MessageChannel,F=E.port2;E.port1.onmessage=D,g=function(){F.postMessage(null)}}else g=function(){t(D,0)};function G(a,c){z=t(function(){a(b.unstable_now())},c)}b.unstable_IdlePriority=5,b.unstable_ImmediatePriority=1,b.unstable_LowPriority=4,b.unstable_NormalPriority=3,b.unstable_Profiling=null,b.unstable_UserBlockingPriority=2,b.unstable_cancelCallback=function(a){a.callback=null},b.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<a?Math.floor(1e3/a):5},b.unstable_getCurrentPriorityLevel=function(){return o},b.unstable_next=function(a){switch(o){case 1:case 2:case 3:var b=3;break;default:b=o}var c=o;o=b;try{return a()}finally{o=c}},b.unstable_requestPaint=function(){s=!0},b.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=o;o=a;try{return b()}finally{o=c}},b.unstable_scheduleCallback=function(a,e,f){var h=b.unstable_now();switch(f="object"==typeof f&&null!==f&&"number"==typeof(f=f.delay)&&0<f?h+f:h,a){case 1:var i=-1;break;case 2:i=250;break;case 5:i=0x3fffffff;break;case 4:i=1e4;break;default:i=5e3}return i=f+i,a={id:m++,callback:e,priorityLevel:a,startTime:f,expirationTime:i,sortIndex:-1},f>h?(a.sortIndex=f,c(l,a),null===d(k)&&a===d(l)&&(r?(u(z),z=-1):r=!0,G(x,f-h))):(a.sortIndex=i,c(k,a),q||p||(q=!0,y||(y=!0,g()))),a},b.unstable_shouldYield=C,b.unstable_wrapCallback=function(a){var b=o;return function(){var c=o;o=b;try{return a.apply(this,arguments)}finally{o=c}}}},41421:(a,b,c)=>{var d=c(67484),e=c(42237),f="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},g=e.useSyncExternalStore,h=d.useRef,i=d.useEffect,j=d.useMemo,k=d.useDebugValue;b.useSyncExternalStoreWithSelector=function(a,b,c,d,e){var l=h(null);if(null===l.current){var m={hasValue:!1,value:null};l.current=m}else m=l.current;var n=g(a,(l=j(function(){function a(a){if(!i){if(i=!0,g=a,a=d(a),void 0!==e&&m.hasValue){var b=m.value;if(e(b,a))return h=b}return h=a}if(b=h,f(g,a))return b;var c=d(a);return void 0!==e&&e(b,c)?(g=a,b):(g=a,h=c)}var g,h,i=!1,j=void 0===c?null:c;return[function(){return a(b())},null===j?void 0:function(){return a(j())}]},[b,c,d,e]))[0],l[1]);return i(function(){m.hasValue=!0,m.value=n},[n]),k(n),n}},42237:(a,b,c)=>{a.exports=c(96862)},79277:(a,b,c)=>{a.exports=c(33584)},96862:(a,b,c)=>{var d=c(67484),e="function"==typeof Object.is?Object.is:function(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},f=d.useState,g=d.useEffect,h=d.useLayoutEffect,i=d.useDebugValue;function j(a){var b=a.getSnapshot;a=a.value;try{var c=b();return!e(a,c)}catch(a){return!0}}var k="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(a,b){return b()}:function(a,b){var c=b(),d=f({inst:{value:c,getSnapshot:b}}),e=d[0].inst,k=d[1];return h(function(){e.value=c,e.getSnapshot=b,j(e)&&k({inst:e})},[a,c,b]),g(function(){return j(e)&&k({inst:e}),a(function(){j(e)&&k({inst:e})})},[a]),i(c),c};b.useSyncExternalStore=void 0!==d.useSyncExternalStore?d.useSyncExternalStore:k}};